-
-
Save Zeno-/61a7ec602dc6860b57a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 1866530429b4f824619509aa5dbe7ce309fa3b78 Mon Sep 17 00:00:00 2001 | |
From: Craig Robbins <kde.psych@gmail.com> | |
Date: Tue, 10 Feb 2015 16:20:54 +1000 | |
Subject: [PATCH] Allow creation of MapBlockMesh with shaders forced off | |
--- | |
src/itemdef.cpp | 11 ++++++----- | |
src/mapblock_mesh.cpp | 6 ++++-- | |
src/mapblock_mesh.h | 2 +- | |
3 files changed, 11 insertions(+), 8 deletions(-) | |
diff --git a/src/itemdef.cpp b/src/itemdef.cpp | |
index ac67c5b..e5089e3 100644 | |
--- a/src/itemdef.cpp | |
+++ b/src/itemdef.cpp | |
@@ -372,17 +372,18 @@ class CItemDefManager: public IWritableItemDefManager | |
/* | |
Make a mesh from the node | |
*/ | |
- if (g_settings->getBool("enable_shaders")) { | |
- reenable_shaders = true; | |
- g_settings->setBool("enable_shaders", 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; | |
MapNode mesh_make_node(id, param1, param2); | |
mesh_make_data.fillSingleNode(&mesh_make_node); | |
- MapBlockMesh mapblock_mesh(&mesh_make_data, v3s16(0, 0, 0)); | |
+ // Create mapblock_mesh with shaders forced off | |
+ MapBlockMesh mapblock_mesh(&mesh_make_data, v3s16(0, 0, 0), true); | |
node_mesh = mapblock_mesh.getMesh(); | |
node_mesh->grab(); | |
video::SColor c(255, 255, 255, 255); | |
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp | |
index cf311ac..e7f8a7f 100644 | |
--- a/src/mapblock_mesh.cpp | |
+++ b/src/mapblock_mesh.cpp | |
@@ -1018,7 +1018,7 @@ static void updateAllFastFaceRows(MeshMakeData *data, | |
MapBlockMesh | |
*/ | |
-MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset): | |
+MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset, bool force_disable_shaders): | |
m_mesh(new scene::SMesh()), | |
m_gamedef(data->m_gamedef), | |
m_animation_force_timer(0), // force initial animation | |
@@ -1028,7 +1028,9 @@ static void updateAllFastFaceRows(MeshMakeData *data, | |
m_last_daynight_ratio((u32) -1), | |
m_daynight_diffs() | |
{ | |
- m_enable_shaders = g_settings->getBool("enable_shaders"); | |
+ m_enable_shaders = force_disable_shaders ? false | |
+ : g_settings->getBool("enable_shaders"); | |
+ | |
m_enable_highlighting = g_settings->getBool("enable_node_highlighting"); | |
// 4-21ms for MAP_BLOCKSIZE=16 (NOTE: probably outdated) | |
diff --git a/src/mapblock_mesh.h b/src/mapblock_mesh.h | |
index be56d4c..090045b 100644 | |
--- a/src/mapblock_mesh.h | |
+++ b/src/mapblock_mesh.h | |
@@ -90,7 +90,7 @@ class MapBlockMesh | |
{ | |
public: | |
// Builds the mesh given | |
- MapBlockMesh(MeshMakeData *data, v3s16 camera_offset); | |
+ MapBlockMesh(MeshMakeData *data, v3s16 camera_offset, bool force_disable_shaders = false); | |
~MapBlockMesh(); | |
// Main animation function, parameters: | |
-- | |
1.9.3 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment