Skip to content
Permalink
Browse files
Asset library: Share materials instead of copying them
NOTE this is not necessarily safe! It's just intended as an illustration.

Load time: 1.88s -> 1.46s
Render scene med. time: 2.56ms -> 1.95ms
  • Loading branch information
rygorous committed Mar 4, 2013
1 parent 26aef84 commit 464503c
Showing 1 changed file with 6 additions and 0 deletions.
@@ -339,10 +339,16 @@ CPUTMaterial *CPUTAssetLibrary::GetMaterial(const cString &name, bool nameIsFull
// Not looking for an instance, so return what we found
return pMaterial;
}
#if 1
if ( !created )
pMaterial->AddRef();
return pMaterial;
#else
CPUTMaterial *pClone = pMaterial->CloneMaterial( absolutePathAndFilename, pModel, meshIndex);
if ( created )
pMaterial->Release(); // We don't want to hold a reference to the master.
return pClone;
#endif
}


0 comments on commit 464503c

Please sign in to comment.