aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/client.cpp5
-rw-r--r--src/client/client.h1
-rw-r--r--src/client/clientenvironment.cpp2
-rw-r--r--src/client/content_mapblock.cpp16
-rw-r--r--src/client/content_mapblock.h3
-rw-r--r--src/client/mapblock_mesh.cpp4
-rw-r--r--src/client/particles.cpp4
-rw-r--r--src/client/renderingengine.h5
-rw-r--r--src/client/wieldmesh.cpp5
-rw-r--r--src/gui/guiFormSpecMenu.cpp2
-rw-r--r--src/nodedef.cpp4
11 files changed, 28 insertions, 23 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp
index d1c5cd948..2f4f2aac5 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -1475,6 +1475,11 @@ bool Client::updateWieldedItem()
return true;
}
+irr::scene::ISceneManager* Client::getSceneManager()
+{
+ return m_rendering_engine->get_scene_manager();
+}
+
Inventory* Client::getInventory(const InventoryLocation &loc)
{
switch(loc.type){
diff --git a/src/client/client.h b/src/client/client.h
index bcb7d6b09..be5970160 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -355,6 +355,7 @@ public:
void setCamera(Camera* camera) { m_camera = camera; }
Camera* getCamera () { return m_camera; }
+ irr::scene::ISceneManager *getSceneManager();
bool shouldShowMinimap() const;
diff --git a/src/client/clientenvironment.cpp b/src/client/clientenvironment.cpp
index 9c40484bf..7e3867537 100644
--- a/src/client/clientenvironment.cpp
+++ b/src/client/clientenvironment.cpp
@@ -352,7 +352,7 @@ u16 ClientEnvironment::addActiveObject(ClientActiveObject *object)
if (!m_ao_manager.registerObject(object))
return 0;
- object->addToScene(m_texturesource, RenderingEngine::get_scene_manager());
+ object->addToScene(m_texturesource, m_client->getSceneManager());
// Update lighting immediately
object->updateLight(getDayNightRatio());
diff --git a/src/client/content_mapblock.cpp b/src/client/content_mapblock.cpp
index ce7235bca..e530f3d7f 100644
--- a/src/client/content_mapblock.cpp
+++ b/src/client/content_mapblock.cpp
@@ -60,18 +60,16 @@ static constexpr u16 quad_indices[] = {0, 1, 2, 2, 3, 0};
const std::string MapblockMeshGenerator::raillike_groupname = "connect_to_raillike";
-MapblockMeshGenerator::MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output)
+MapblockMeshGenerator::MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output,
+ irr::scene::IMeshManipulator *mm):
+ data(input),
+ collector(output),
+ nodedef(data->m_client->ndef()),
+ meshmanip(mm),
+ blockpos_nodes(data->m_blockpos * MAP_BLOCKSIZE)
{
- data = input;
- collector = output;
-
- nodedef = data->m_client->ndef();
- meshmanip = RenderingEngine::get_scene_manager()->getMeshManipulator();
-
enable_mesh_cache = g_settings->getBool("enable_mesh_cache") &&
!data->m_smooth_lighting; // Mesh cache is not supported with smooth lighting
-
- blockpos_nodes = data->m_blockpos * MAP_BLOCKSIZE;
}
void MapblockMeshGenerator::useTile(int index, u8 set_flags, u8 reset_flags, bool special)
diff --git a/src/client/content_mapblock.h b/src/client/content_mapblock.h
index a6c450d1f..cbee49021 100644
--- a/src/client/content_mapblock.h
+++ b/src/client/content_mapblock.h
@@ -172,7 +172,8 @@ public:
void drawNode();
public:
- MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output);
+ MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output,
+ irr::scene::IMeshManipulator *mm);
void generate();
void renderSingle(content_t node, u8 param2 = 0x00);
};
diff --git a/src/client/mapblock_mesh.cpp b/src/client/mapblock_mesh.cpp
index 167e1e3ec..72e68fe97 100644
--- a/src/client/mapblock_mesh.cpp
+++ b/src/client/mapblock_mesh.cpp
@@ -1072,8 +1072,8 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
*/
{
- MapblockMeshGenerator generator(data, &collector);
- generator.generate();
+ MapblockMeshGenerator(data, &collector,
+ data->m_client->getSceneManager()->getMeshManipulator()).generate();
}
/*
diff --git a/src/client/particles.cpp b/src/client/particles.cpp
index 7acd996dc..288826a5f 100644
--- a/src/client/particles.cpp
+++ b/src/client/particles.cpp
@@ -64,8 +64,8 @@ Particle::Particle(
v2f texsize,
video::SColor color
):
- scene::ISceneNode(RenderingEngine::get_scene_manager()->getRootSceneNode(),
- RenderingEngine::get_scene_manager())
+ scene::ISceneNode(((Client *)gamedef)->getSceneManager()->getRootSceneNode(),
+ ((Client *)gamedef)->getSceneManager())
{
// Misc
m_gamedef = gamedef;
diff --git a/src/client/renderingengine.h b/src/client/renderingengine.h
index 5462aa667..4d06baa23 100644
--- a/src/client/renderingengine.h
+++ b/src/client/renderingengine.h
@@ -79,10 +79,9 @@ public:
return s_singleton->m_device->getVideoDriver();
}
- static scene::ISceneManager *get_scene_manager()
+ scene::ISceneManager *get_scene_manager()
{
- sanity_check(s_singleton && s_singleton->m_device);
- return s_singleton->m_device->getSceneManager();
+ return m_device->getSceneManager();
}
static irr::IrrlichtDevice *get_raw_device()
diff --git a/src/client/wieldmesh.cpp b/src/client/wieldmesh.cpp
index d9d5e57cd..08fd49fc0 100644
--- a/src/client/wieldmesh.cpp
+++ b/src/client/wieldmesh.cpp
@@ -307,7 +307,8 @@ static scene::SMesh *createSpecialNodeMesh(Client *client, MapNode n,
MeshMakeData mesh_make_data(client, false);
MeshCollector collector;
mesh_make_data.setSmoothLighting(false);
- MapblockMeshGenerator gen(&mesh_make_data, &collector);
+ MapblockMeshGenerator gen(&mesh_make_data, &collector,
+ client->getSceneManager()->getMeshManipulator());
if (n.getParam2()) {
// keep it
@@ -538,7 +539,7 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
content_t id = ndef->getId(def.name);
FATAL_ERROR_IF(!g_extrusion_mesh_cache, "Extrusion mesh cache is not yet initialized");
-
+
scene::SMesh *mesh = nullptr;
// Shading is on by default
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp
index fd35f2d84..fdcf27a0a 100644
--- a/src/gui/guiFormSpecMenu.cpp
+++ b/src/gui/guiFormSpecMenu.cpp
@@ -2794,7 +2794,7 @@ void GUIFormSpecMenu::parseModel(parserData *data, const std::string &element)
core::rect<s32> rect(pos, pos + geom);
- GUIScene *e = new GUIScene(Environment, RenderingEngine::get_scene_manager(),
+ GUIScene *e = new GUIScene(Environment, m_client->getSceneManager(),
data->current_parent, rect, spec.fid);
auto meshnode = e->setMesh(mesh);
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index dd862e606..65a76bcec 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -1446,8 +1446,8 @@ void NodeDefManager::updateTextures(IGameDef *gamedef,
Client *client = (Client *)gamedef;
ITextureSource *tsrc = client->tsrc();
IShaderSource *shdsrc = client->getShaderSource();
- scene::IMeshManipulator *meshmanip =
- RenderingEngine::get_scene_manager()->getMeshManipulator();
+ auto smgr = client->getSceneManager();
+ scene::IMeshManipulator *meshmanip = smgr->getMeshManipulator();
TextureSettings tsettings;
tsettings.readSettings();