void MipMapReplacer::EnumerateTexturesRecursive(Entity * entity, Set<Texture *> & textures) { if(!entity) return; int32 childrenCount = entity->GetChildrenCount(); for(int32 i = 0; i < childrenCount; i++) EnumerateTexturesRecursive(entity->GetChild(i), textures); RenderObject * ro = GetRenderObject(entity); if(ro) { int32 rbCount = ro->GetRenderBatchCount(); for(int32 i = 0; i < rbCount; i++) { RenderBatch * rb = ro->GetRenderBatch(i); if(rb) { Material * material = rb->GetMaterial(); if(material) { Texture * texture = material->GetTexture(Material::TEXTURE_DIFFUSE); if(texture) textures.insert(texture); } } } } }
void MipMapReplacer::EnumerateTexturesRecursive(Entity * entity, Set<Texture *> & textures) { if(!entity) return; int32 childrenCount = entity->GetChildrenCount(); for(int32 i = 0; i < childrenCount; i++) EnumerateTexturesRecursive(entity->GetChild(i), textures); RenderObject * ro = GetRenderObject(entity); if(ro) { int32 rbCount = ro->GetRenderBatchCount(); for(int32 i = 0; i < rbCount; i++) { RenderBatch * rb = ro->GetRenderBatch(i); if(rb) { DVASSERT(0 && "Vitaliy Borodovsky: Temporarly disabled. Need to rewrite for new materials"); NMaterial * material = rb->GetMaterial(); if(material) { Texture * texture = material->GetTexture(NMaterial::TEXTURE_ALBEDO); if(texture) textures.insert(texture); } } } } }
void MipMapReplacer::ReplaceMipMaps(Entity * node, int32 level) { Set<Texture *> textures; EnumerateTexturesRecursive(node, textures); Set<Texture *>::iterator endIt = textures.end(); for(Set<Texture *>::iterator it = textures.begin(); it != endIt; ++it) ReplaceMipMap((*it), level); }