ofxAssimpModelLoader - optimised texture loading. #1974

Merged
merged 2 commits into from Jun 18, 2013

3 participants

@julapy
openFrameworks member

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.

julapy added some commits Mar 27, 2013
@julapy julapy optimised texture loading for ofxAssimpModelLoader.
previously a texture was loaded for every mesh without checking if the texture already existed.
this approach saves on any unnecessary texture loading.
3fd4581
@julapy julapy textures now holds a vector of ofxAssimpTexture, this fixes a small b…
…ug that crept in.
36b9dbf
@julapy
openFrameworks member

has anyone had a chance to look at this?
ive used it in a couple live iphone apps and its been working fine.

@kylemcdonald

@elliotwoods as 3d leader could you check this out?

@vade, as the original author? any notes?

@vade

Ah, nice catch. It looks good here with just a browsing of the code. I'd say go for it.

@kylemcdonald

thanks anton! sounds good.

@kylemcdonald kylemcdonald merged commit ac80f9f into openframeworks:develop Jun 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment