diff options
author | kwolekr <kwolekr@minetest.net> | 2013-11-17 02:46:05 -0500 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2013-11-17 02:46:05 -0500 |
commit | a92fc3563ccc34f1fb93170f5943c719d843fb35 (patch) | |
tree | d242b866b638cacd0f90d49a258b020f246dca95 /src | |
parent | 533785ec9a95de696c57d0dc2a17947acfb0dc46 (diff) | |
download | minetest-a92fc3563ccc34f1fb93170f5943c719d843fb35.tar.gz minetest-a92fc3563ccc34f1fb93170f5943c719d843fb35.tar.bz2 minetest-a92fc3563ccc34f1fb93170f5943c719d843fb35.zip |
Prevent shaders from being created when disabled
Diffstat (limited to 'src')
-rw-r--r-- | src/mapblock_mesh.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index 6cbc2c521..253703ddc 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -1109,18 +1109,22 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data): /* Convert MeshCollector to SMesh */ + bool enable_shaders = g_settings->getBool("enable_shaders"); bool enable_bumpmapping = g_settings->getBool("enable_bumpmapping"); - bool enable_shaders = g_settings->getBool("enable_shaders"); - video::E_MATERIAL_TYPE shadermat1 = m_gamedef->getShaderSource()-> - getShader("test_shader_1").material; - video::E_MATERIAL_TYPE shadermat2 = m_gamedef->getShaderSource()-> - getShader("test_shader_2").material; - video::E_MATERIAL_TYPE shadermat3 = m_gamedef->getShaderSource()-> - getShader("test_shader_3").material; - video::E_MATERIAL_TYPE bumpmaps1 = m_gamedef->getShaderSource()-> - getShader("bumpmaps_solids").material; - video::E_MATERIAL_TYPE bumpmaps2 = m_gamedef->getShaderSource()-> - getShader("bumpmaps_liquids").material; + + video::E_MATERIAL_TYPE shadermat1, shadermat2, shadermat3, bumpmaps1, bumpmaps2; + shadermat1 = shadermat2 = shadermat3 = bumpmaps1 = bumpmaps2 = video::EMT_SOLID; + + if (enable_shaders) { + IShaderSource *shdrsrc = m_gamedef->getShaderSource(); + shadermat1 = shdrsrc->getShader("test_shader_1").material; + shadermat2 = shdrsrc->getShader("test_shader_2").material; + shadermat3 = shdrsrc->getShader("test_shader_3").material; + if (enable_bumpmapping) { + bumpmaps1 = shdrsrc->getShader("bumpmaps_solids").material; + bumpmaps2 = shdrsrc->getShader("bumpmaps_liquids").material; + } + } for(u32 i = 0; i < collector.prebuffers.size(); i++) { |