Avoid doing a full material compare if not even first texture does match

master
sapier 2014-06-12 22:33:50 +02:00
parent 35ec3855f6
commit 334ec4bb1b
1 changed files with 37 additions and 30 deletions

View File

@ -394,7 +394,14 @@ struct MeshBufListList
for(std::list<MeshBufList>::iterator i = lists.begin();
i != lists.end(); ++i){
MeshBufList &l = *i;
if(l.m == buf->getMaterial()){
video::SMaterial &m = buf->getMaterial();
// comparing a full material is quite expensive so we don't do it if
// not even first texture is equal
if (l.m.TextureLayer[0].Texture != m.TextureLayer[0].Texture)
continue;
if (l.m == m) {
l.bufs.push_back(buf);
return;
}