From f824866686ddba471a7b0c3178eaf968883bb69e Mon Sep 17 00:00:00 2001 From: Craig Robbins Date: Wed, 11 Feb 2015 17:01:19 +1000 Subject: Revert "Remove workaround in itemdef.cpp to enable/disable/enable "enable_shaders" setting" This reverts commit d25ff8fd2592f457b91e8a61240694af3902d23f. --- src/client.cpp | 3 +-- src/client.h | 3 +-- src/itemdef.cpp | 11 ++++++++++- src/mapblock_mesh.cpp | 5 ++--- src/mapblock_mesh.h | 3 +-- src/wieldmesh.cpp | 4 +--- 6 files changed, 16 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index 107e16f14..b13631f95 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -283,7 +283,6 @@ Client::Client( } m_cache_smooth_lighting = g_settings->getBool("smooth_lighting"); - m_cache_enable_shaders = g_settings->getBool("enable_shaders"); } void Client::Stop() @@ -2682,7 +2681,7 @@ void Client::addUpdateMeshTask(v3s16 p, bool ack_to_server, bool urgent) Create a task to update the mesh of the block */ - MeshMakeData *data = new MeshMakeData(this, m_cache_enable_shaders); + MeshMakeData *data = new MeshMakeData(this); { //TimeTaker timer("data fill"); diff --git a/src/client.h b/src/client.h index 93143009e..fd43361b1 100644 --- a/src/client.h +++ b/src/client.h @@ -623,9 +623,8 @@ private: Database *localdb; Server *localserver; - // TODO: Add callback to update these when g_settings changes + // TODO: Add callback to update this when g_settings changes bool m_cache_smooth_lighting; - bool m_cache_enable_shaders; }; #endif // !CLIENT_HEADER diff --git a/src/itemdef.cpp b/src/itemdef.cpp index d356b96c5..ac67c5b27 100644 --- a/src/itemdef.cpp +++ b/src/itemdef.cpp @@ -362,6 +362,8 @@ public: scene::IMesh *node_mesh = NULL; + bool reenable_shaders = false; + if (need_rtt_mesh || need_wield_mesh) { u8 param1 = 0; if (f.param_type == CPT_LIGHT) @@ -370,7 +372,11 @@ public: /* Make a mesh from the node */ - MeshMakeData mesh_make_data(gamedef, false); + if (g_settings->getBool("enable_shaders")) { + reenable_shaders = true; + g_settings->setBool("enable_shaders", false); + } + MeshMakeData mesh_make_data(gamedef); u8 param2 = 0; if (f.param_type_2 == CPT2_WALLMOUNTED) param2 = 1; @@ -437,6 +443,9 @@ public: if (node_mesh) node_mesh->drop(); + + if (reenable_shaders) + g_settings->setBool("enable_shaders",true); } // Put in cache diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index 318be14d6..cf311acba 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -42,7 +42,7 @@ static void applyFacesShading(video::SColor& color, float factor) MeshMakeData */ -MeshMakeData::MeshMakeData(IGameDef *gamedef, bool use_shaders): +MeshMakeData::MeshMakeData(IGameDef *gamedef): m_vmanip(), m_blockpos(-1337,-1337,-1337), m_crack_pos_relative(-1337, -1337, -1337), @@ -50,8 +50,7 @@ MeshMakeData::MeshMakeData(IGameDef *gamedef, bool use_shaders): m_smooth_lighting(false), m_show_hud(false), m_highlight_mesh_color(255, 255, 255, 255), - m_gamedef(gamedef), - m_use_shaders(use_shaders) + m_gamedef(gamedef) {} void MeshMakeData::fill(MapBlock *block) diff --git a/src/mapblock_mesh.h b/src/mapblock_mesh.h index 98af92c74..be56d4c58 100644 --- a/src/mapblock_mesh.h +++ b/src/mapblock_mesh.h @@ -45,9 +45,8 @@ struct MeshMakeData video::SColor m_highlight_mesh_color; IGameDef *m_gamedef; - bool m_use_shaders; - MeshMakeData(IGameDef *gamedef, bool use_shaders); + MeshMakeData(IGameDef *gamedef); /* Copy central data directly from block, and other data from diff --git a/src/wieldmesh.cpp b/src/wieldmesh.cpp index 7c16bddcb..4ddae36d4 100644 --- a/src/wieldmesh.cpp +++ b/src/wieldmesh.cpp @@ -340,9 +340,7 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, IGameDef *gamedef) } else if (f.drawtype == NDT_NORMAL || f.drawtype == NDT_ALLFACES) { setCube(f.tiles, def.wield_scale, tsrc); } else { - //// TODO: Change false in the following constructor args to - //// appropriate value when shader is added for wield items (if applicable) - MeshMakeData mesh_make_data(gamedef, false); + MeshMakeData mesh_make_data(gamedef); MapNode mesh_make_node(id, 255, 0); mesh_make_data.fillSingleNode(&mesh_make_node); MapBlockMesh mapblock_mesh(&mesh_make_data, v3s16(0, 0, 0)); -- cgit v1.2.3