Skip to content

GLTF loader with Draco extension#2

Open
fanzhanggoogle wants to merge 16 commits into
fanzhanggoogle:devfrom
donmccurdy:feat-gltf-draco-extension
Open

GLTF loader with Draco extension#2
fanzhanggoogle wants to merge 16 commits into
fanzhanggoogle:devfrom
donmccurdy:feat-gltf-draco-extension

Conversation

@fanzhanggoogle
Copy link
Copy Markdown
Owner

(DO NOT Merge. It's for discussion only)

Hi @donmccurdy,

Thank you so much for the great work. We can discuss here for the detail.

@ondys
@FrankGalligan

Comment thread examples/js/loaders/GLTF2Loader.js Outdated

return this._withDependencies( [

"accessors",
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In loadAccessors function, is it required to check if the accessor has bufferView before this line:
var arraybuffer = dependencies.bufferViews[ accessor.bufferView ];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense; done. We may eventually need to consider what should be returned, since the accessor cannot create a THREE.BufferAttribute in this case.

Comment thread examples/js/loaders/GLTF2Loader.js Outdated
return this._withDependencies( [

"accessors",
"bufferViews",
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding, bufferViews will be loaded when accessors are loaded. So the line is not necessary?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct – bufferViews are a dependency of accessors, so they're already loaded, but must also be listed explicitly here for them to be included in the dependencies parameter.

Comment thread examples/js/loaders/GLTF2Loader.js Outdated

GLTFDracoMeshCompressionExtension.prototype.decodePrimitive = function ( primitive, dependencies ) {

var bufferViewID = primitive.extensions[ this.name ].bufferView;
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the conformance, we need to use the version property to verify if the version of the encoded mesh and decoder are compatible, e.g. > 0.9.1.
@ondys
@FrankGalligan

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one problem is that our draco_decoder.js currently does not provide API to query its version. I'll try to add that today.

Another thing is that we should most likely not care about the revision version, only the major and minor versions should affect the bitstream .. i.e. we should probably mention in the spec that for conformance, the decoder needs to support the major.minor version of the encoded file, revision can be ignored (if we want to include it at all).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a short update on the version (mostly for @donmccurdy) .. I'll probably land the CL internally later today, but an updated draco_decoder.js is most likely going to be available no earlier than Monday)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ondys! Let me know when the version is available, and get that check added.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*and I'll get that check added.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@donmccurdy Thanks for the remainder! The version check should be available in our latest javascripts posted in our master branch. You can check whether the provided version is supported using function DracoModule.isVersionSupported(versionString)

The only problem is that the function needs to be called from and instance of DracoModule which is in your case automatically instantiated inside the class THREE.DRACOLoader and as far as I can tell, there is currently no easy way get the module out of the loader, so we may have to either add the version check functionality to THREE.DRACOLoader or we can make the DracoModule accessible to other classes. Alternatively, you can just create a new instance of DracoModule in your code, but that would be an overkill for a simple version check (it's actually quite costly to instantiate it).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Offhand I think exposing a isVersionSupported(version) method on THREE.DracoLoader, calling through to DracoModule, sounds like the way to go. I will try to look into that more this weekend. :)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just sent over a PR; avoiding making another DracoModule instance seems like a good call thanks.

@donmccurdy
Copy link
Copy Markdown

Any other issues we want to look into here? Once the version check is in, I think we could consider merging this to the three.js GLTF2Loader.

@donmccurdy donmccurdy force-pushed the feat-gltf-draco-extension branch from 031195e to 7f7b11b Compare March 29, 2017 01:31
@donmccurdy
Copy link
Copy Markdown

I've updated this branch with the isVersionSupported check, and rebased against three.js/dev. (clean diff)

@donmccurdy donmccurdy force-pushed the feat-gltf-draco-extension branch 2 times, most recently from 6ca99b7 to bad6b18 Compare July 12, 2017 00:00
@donmccurdy donmccurdy force-pushed the feat-gltf-draco-extension branch from bad6b18 to 0f8069b Compare July 12, 2017 00:01
fanzhanggoogle and others added 2 commits July 11, 2017 17:16
* Implement GLTFDracoMeshCompressionExtension.

* Add DracoBunny.gltf example.

* Clean up default material situation.

* Add extensionsRequired.

* Ignore accessors w/o bufferView.

* fix

* Updated gltf draco sample bunny

* Fix

* removed test files

* Remove bad merge

* Remove bad merge

* Fix

* Fix

* Fix

* Fix

* Fix
@donmccurdy donmccurdy force-pushed the feat-gltf-draco-extension branch 2 times, most recently from 913ff6f to 7e834ad Compare July 12, 2017 01:14
@donmccurdy donmccurdy force-pushed the feat-gltf-draco-extension branch from 7e834ad to 4113305 Compare July 12, 2017 01:59
FrankGalligan referenced this pull request in FrankGalligan/three.js Mar 3, 2018
* fix standing matrix application

* demonstrate setPoseTarget

* update build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants