summaryrefslogtreecommitdiff
path: root/src/mapblock_mesh.cpp
diff options
context:
space:
mode:
authorRealBadAngel <mk@realbadangel.pl>2013-12-09 13:25:43 +0100
committerRealBadAngel <mk@realbadangel.pl>2013-12-09 13:28:50 +0100
commitdae03382bf1e3abfcc33417c611b9194c7783b3f (patch)
treec74773f8136d4d9db008b9092a11d3d084182d08 /src/mapblock_mesh.cpp
parent50b0e9f7a4916044b1938d461c9c4029b30569da (diff)
downloadminetest-dae03382bf1e3abfcc33417c611b9194c7783b3f.tar.gz
minetest-dae03382bf1e3abfcc33417c611b9194c7783b3f.tar.bz2
minetest-dae03382bf1e3abfcc33417c611b9194c7783b3f.zip
Optimize shaders code. Add settings at compile time.
Diffstat (limited to 'src/mapblock_mesh.cpp')
-rw-r--r--src/mapblock_mesh.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp
index 81aac72d7..afea3dcce 100644
--- a/src/mapblock_mesh.cpp
+++ b/src/mapblock_mesh.cpp
@@ -1111,6 +1111,7 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data):
*/
bool enable_shaders = g_settings->getBool("enable_shaders");
bool enable_bumpmapping = g_settings->getBool("enable_bumpmapping");
+ bool enable_parallax_occlusion = g_settings->getBool("enable_parallax_occlusion");
video::E_MATERIAL_TYPE shadermat1, shadermat2, shadermat3,
shadermat4, shadermat5;
@@ -1210,7 +1211,7 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data):
if (enable_shaders) {
ITextureSource *tsrc = data->m_gamedef->tsrc();
material.setTexture(2, tsrc->getTexture("disable_img.png"));
- if (enable_bumpmapping) {
+ if (enable_bumpmapping || enable_parallax_occlusion) {
std::string fname_base = tsrc->getTextureName(p.tile.texture_id);
std::string normal_ext = "_normal.png";
size_t pos = fname_base.find(".");
@@ -1292,7 +1293,8 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack, u32 daynight_rat
{
bool enable_shaders = g_settings->getBool("enable_shaders");
bool enable_bumpmapping = g_settings->getBool("enable_bumpmapping");
-
+ bool enable_parallax_occlusion = g_settings->getBool("enable_parallax_occlusion");
+
if(!m_has_animation)
{
m_animation_force_timer = 100000;
@@ -1362,7 +1364,7 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack, u32 daynight_rat
// Set the texture
buf->getMaterial().setTexture(0, tsrc->getTexture(os.str()));
buf->getMaterial().setTexture(2, tsrc->getTexture("disable_img.png"));
- if (enable_shaders && enable_bumpmapping)
+ if (enable_shaders && (enable_bumpmapping || enable_parallax_occlusion))
{
std::string fname_base,fname_normal;
fname_base = tsrc->getTextureName(tile.texture_id);