openframeworks/openFrameworks — pull request #1974 by julapy (2013-03-27 00:18:46+00:00)
Title: ofxAssimpModelLoader - optimised texture loading.

i found an issue when trying to load a model from a client with lots of meshes.
the model was using 2 texture atlases but each mesh was loading the texture from scratch,
there were something like 70 meshes and the app very quickly came to a crawl.

the solution is simply to load a texture once and if already loaded, reuse the loaded texture.

so ive created a ofxAssimpTexture class which stores a ofTexture pointer and path name used to load the texture. now when a mesh tries to load a texture, it checks if the path name matches any of the existing textures, if so it reuses the texture that is already loaded.

the ofxAssimpTexture/s are managed by the ofxAssimpModelLoader and are distributed amongst the meshes and when ofxAssimpModelLoader is deleted, it also deletes all the textures.

ive tested this thoroughly and all seems to be ok.
be good to get another pair of eyes across this before merging.

L.