Texture caching question

I'm putting together the framework for a game, and I'm trying to figure out if two models had the same texture and both were loaded, would the texture be loaded twice? (Or if I loaded a texture for some other reason directly with the TextureManager).

It looks like the TextureManager class is setup to only load a texture once, am I right about that?

Also, is there a 'model manager' out there I should know about? I'm putting one together so i can just call something like ModelManager.loadModel(String), I haven't overlooked it somewhere have I?

TextureManager caches textures when you load them from an URL. So if you load the same URL twice, the resources are re-used. Nothing like that for models as far as I know, but they're easier to re-use by yourself (eg with SharedMesh/Node). We also had a cloning tool (to re-use only parts of a model) but that no longer works… there will likely be something like that in the future again.

Can a sharednode act indepedant of another shared copy of the same node? Like if I have two models will they both run the same animation at the same time? I had read a lot on this and I was under the impression a clone was better for animation purposes and shared was better for static data. Sometimes it's hard to know what information is right as some of the information in the forums is very old. It's funny you mention the clone stuff, I had just been looking all over for it (due to what I am hoping is my misconception on what sharednode is good for).

With SharedMesh the resources for creating another model are very small, but yes, you can only run animations in sync with each other.

For running seperate animations on models, there might be a few things you could still share (eg. vertex color buffer if you use that), and a good clone system could aid you with that… but right now there's only the cloning trick:


This, I think, will still share textures (due to the TextureManager, but don't pin me down on that one), but nothing else. You could manually set the things you want to share though, to save some memory.

Also be advised that I've discovered a bug or two in texture caching that will be checked in soon.  The bug can cause Texture objects to be reused from the cache, but still generate new texture ids in certain circumstances.