Skip to content

Commit

Permalink
Only set material flag on rendered meshes (#5023)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhofhansl authored and nerzhul committed Jan 14, 2017
1 parent f0c6fec commit c41352a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/clientmap.cpp
Expand Up @@ -371,10 +371,10 @@ struct MeshBufListList

void add(scene::IMeshBuffer *buf)
{
const video::SMaterial &m = buf->getMaterial();
for(std::vector<MeshBufList>::iterator i = lists.begin();
i != lists.end(); ++i){
MeshBufList &l = *i;
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
Expand All @@ -387,7 +387,7 @@ struct MeshBufListList
}
}
MeshBufList l;
l.m = buf->getMaterial();
l.m = m;
l.bufs.push_back(buf);
lists.push_back(l);
}
Expand Down Expand Up @@ -508,19 +508,20 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
{
scene::IMeshBuffer *buf = mesh->getMeshBuffer(i);

buf->getMaterial().setFlag(video::EMF_TRILINEAR_FILTER, m_cache_trilinear_filter);
buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, m_cache_bilinear_filter);
buf->getMaterial().setFlag(video::EMF_ANISOTROPIC_FILTER, m_cache_anistropic_filter);
buf->getMaterial().setFlag(video::EMF_WIREFRAME, m_control.show_wireframe);

const video::SMaterial& material = buf->getMaterial();
video::SMaterial& material = buf->getMaterial();
video::IMaterialRenderer* rnd =
driver->getMaterialRenderer(material.MaterialType);
bool transparent = (rnd && rnd->isTransparent());
if (transparent == is_transparent_pass) {
if (buf->getVertexCount() == 0)
errorstream << "Block [" << analyze_block(block)
<< "] contains an empty meshbuf" << std::endl;

material.setFlag(video::EMF_TRILINEAR_FILTER, m_cache_trilinear_filter);
material.setFlag(video::EMF_BILINEAR_FILTER, m_cache_bilinear_filter);
material.setFlag(video::EMF_ANISOTROPIC_FILTER, m_cache_anistropic_filter);
material.setFlag(video::EMF_WIREFRAME, m_control.show_wireframe);

drawbufs.add(buf);
}
}
Expand Down

0 comments on commit c41352a

Please sign in to comment.