Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLTFExporter: Texture cache #13417

Merged
merged 4 commits into from
Feb 24, 2018
Merged

Conversation

takahirox
Copy link
Collaborator

This PR adds texture cache support to GLTFExporter and fixes #13415 (comment)

return cachedData.images[ map.uuid ];

}
// @QUESTION Needs image cache for the case where two different textures share the same image?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we keep this cache, maybe using a Map? They're supported in IE11+

if ( cachedData.images.has( map.image ) ) {

  return cachedData.images.get( map.image );

}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm thinking to switch from Object to WeakMap for cache like WebGLProperties does soon. How about recovering image cache when we'll do?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok sure. Would just call this @TODO instead of @QUESTION then. 👍 But I think Map/WeakMap should be no different for this use case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, it's still question for me. I'm really not sure if two or more textures share the same image tho Three.js allows so.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That would happen with texture atlas transforms, for example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, I've replaced because we'll have actual use case.

@mrdoob mrdoob added this to the r91 milestone Feb 23, 2018
@mrdoob mrdoob merged commit 0802907 into mrdoob:dev Feb 24, 2018
@mrdoob
Copy link
Owner

mrdoob commented Feb 24, 2018

Thanks!

@takahirox takahirox deleted the GLTFExporterTextureCache branch February 24, 2018 13:45
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.

3 participants