Conversation
cdata
commented
Mar 3, 2020
| moveChildren(gltf.scene, this.modelContainer); | ||
| } | ||
|
|
||
| this.modelContainer.traverse(obj => { |
Contributor
Author
There was a problem hiding this comment.
This was duplicate work, and now consolidated in ModelViewerGLTFInstance implementation.
cdata
commented
Mar 3, 2020
| this[$currentScene]![$releaseFromCache](); | ||
| this[$currentScene] = null; | ||
| if (gltf != null) { | ||
| moveChildren(this.modelContainer, gltf.scene); |
Contributor
Author
There was a problem hiding this comment.
Moving children around like this is probably not necessary; Three.js allows a Scene to be a child of another Object3D, so we could probably just take advantage of that and insert the gltf.scene directly into the graph. Punting for the future, though.
Merged
elalish
previously approved these changes
Mar 3, 2020
Contributor
elalish
left a comment
There was a problem hiding this comment.
Awesome! Great to have all the Three.js cloning tweaks in one place!
| suite('preparing the GLTF', () => { | ||
| test('creates a prepared GLTF', () => { | ||
| const rawGLTF = createFakeGLTF(); | ||
| const preparedGLTF = GLTFInstance.prepare(rawGLTF); |
Contributor
There was a problem hiding this comment.
This looks like it could be part of the suite above, since it uses the same setup.
|
|
||
| test('disables frustum culling on meshes', () => { | ||
| (preparedGLTF.scene.children as [Mesh, Mesh, Mesh]) | ||
| .forEach(mesh => expect(mesh.frustumCulled).to.be.false); |
added 7 commits
March 3, 2020 18:41
ab3a62b to
c25ae6c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This started out as a fix for the problem where 3DOM scene graphs expressed a unique material for every location in the scene graph where a material occurred. It turned out that this was an implementation problem caused in
CachingGLTFLoaderand related to how models are cloned. So, to address the issue I made a light refactor of the related code (which was overdue anyway). Some highlights from the change:CachingGLTFLoaderandcloneGltfGLTFInstance, a conveniently clone-able, dispose-able, API-compatible alternative toGLTFCachingGLTFLoadernow loads a full GLTF-like, rather than just a sceneRoughnessMipmapperis created once, rather than per-instance ofCachingGLTFLoaderDepends on #1063
Fixes #1061