aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlhofhansl <lhofhansl@yahoo.com>2017-01-14 13:30:14 -0800
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-01-14 22:30:14 +0100
commitc41352a1c7a393299ea0dce0b4d075849f96dcd9 (patch)
treec46552637b6cd907cf6215f4f630cb4c039f7e00 /src
parentf0c6feca97ee412b26c96521724dcd63104185bd (diff)
downloadminetest-c41352a1c7a393299ea0dce0b4d075849f96dcd9.tar.gz
minetest-c41352a1c7a393299ea0dce0b4d075849f96dcd9.tar.bz2
minetest-c41352a1c7a393299ea0dce0b4d075849f96dcd9.zip
Only set material flag on rendered meshes (#5023)
Diffstat (limited to 'src')
-rw-r--r--src/clientmap.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/clientmap.cpp b/src/clientmap.cpp
index 7e688daad..fa326f0b4 100644
--- a/src/clientmap.cpp
+++ b/src/clientmap.cpp
@@ -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
@@ -387,7 +387,7 @@ struct MeshBufListList
}
}
MeshBufList l;
- l.m = buf->getMaterial();
+ l.m = m;
l.bufs.push_back(buf);
lists.push_back(l);
}
@@ -508,12 +508,7 @@ 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());
@@ -521,6 +516,12 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 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);
}
}