-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
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
GLTFExporter: Texture cache #13417
Conversation
return cachedData.images[ map.uuid ]; | ||
|
||
} | ||
// @QUESTION Needs image cache for the case where two different textures share the same image? |
There was a problem hiding this comment.
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 );
}
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Thanks! |
This PR adds texture cache support to
GLTFExporter
and fixes #13415 (comment)