-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Model Resource Caching #2177
Model Resource Caching #2177
Conversation
Update fork with official cesium repo's master state
Thanks for this @Relfos! Can you please merge cesium's master branch into your branch so we'll be able to merge when this is ready: |
Do you think we need this? I envisioned this working without any changes to the user's code. |
Actually, I'm going to wait until you merge in master so I can look at a clean diff. |
@Relfos please add a comment to this pull request when it is ready since github does not automatically send an email when new commits are added to a branch. Thanks! |
Conflicts: CHANGES.md README.md Source/Scene/Model.js
Conflicts: Source/Core/objectToQuery.js Specs/Core/objectToQuerySpec.js
Hi Patrick, can you check this pull request soon? |
I'll try to look at this on Saturday. Please keep it up-to-date with master. |
Ok, I'll keep it updated until then! On Mon, Dec 8, 2014 at 3:08 PM, Patrick Cozzi notifications@github.com
|
Thanks again for the pull request @Relfos. I think this needs a few changes for robustness. Renderer resources should be cached per context to support the same model in two different Cesium viewers (which can't share resources), and cached items should automatically be deleted from the cache when they are not in use. We would also like to be able to cache using a user-defined key for the cases when the glTF was created procedurally and a URL is not available. I tried to support all of this in the model-cache branch. Try it and let me know if it works for you. The only other changes I would consider for this branch are:
Let me know if you need any of these changes or anything else in that branch. CC #927 |
Closing via #2340. |
This branch provides a modification the internals of the Model class.
Now there is a clear separation between a model and its resources used by the GPU (shaders, textures, vertex arrays, etc).
This means that it is now possible to load multiple instances of the same model without requiring reloading the whole model again, and without wasting gpu resources having multiple copies of the same things.
In order to preserve backwards compatitibility, the previous system will still work as usual. In order to make use of the new caching system, the programmer will have to create a ModelResourceCache and pass it inside the options when creating a new Model.
Currently models resources are cached by URLs (meaning Models loaded from the same URL will reuse the same assets if they are sharing a cache instance).