From 6c9be39db0d8ae2759cc8d6d5c4b952d13cf4f64 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 29 Mar 2021 22:27:46 +0000 Subject: Fix wield image of plantlike_rooted (#11067) --- src/client/wieldmesh.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/client/wieldmesh.cpp') diff --git a/src/client/wieldmesh.cpp b/src/client/wieldmesh.cpp index 387eb17c3..9806644df 100644 --- a/src/client/wieldmesh.cpp +++ b/src/client/wieldmesh.cpp @@ -395,7 +395,6 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che case NDT_TORCHLIKE: case NDT_RAILLIKE: case NDT_PLANTLIKE: - case NDT_PLANTLIKE_ROOTED: case NDT_FLOWINGLIQUID: { v3f wscale = def.wield_scale; if (f.drawtype == NDT_FLOWINGLIQUID) @@ -411,6 +410,15 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che m_colors.emplace_back(l1.has_color, l1.color); break; } + case NDT_PLANTLIKE_ROOTED: { + setExtruded(tsrc->getTextureName(f.special_tiles[0].layers[0].texture_id), + "", def.wield_scale, tsrc, + f.special_tiles[0].layers[0].animation_frame_count); + // Add color + const TileLayer &l0 = f.special_tiles[0].layers[0]; + m_colors.emplace_back(l0.has_color, l0.color); + break; + } case NDT_NORMAL: case NDT_ALLFACES: case NDT_LIQUID: -- cgit v1.2.3 From 1e4913cd76f5d31456d04a5ce23e66d5c60060de Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 31 Mar 2021 13:15:47 +0200 Subject: Irrlicht support code maintenance --- src/client/clientlauncher.cpp | 2 -- src/client/content_cao.cpp | 3 --- src/client/game.cpp | 23 ----------------------- src/client/keycode.cpp | 2 -- src/client/mesh.cpp | 8 -------- src/client/wieldmesh.cpp | 2 -- src/irrlicht_changes/CGUITTFont.cpp | 8 -------- src/irrlicht_changes/CGUITTFont.h | 2 +- src/irrlicht_changes/static_text.cpp | 4 ---- src/irrlicht_changes/static_text.h | 4 ---- src/irrlichttypes.h | 26 ++++---------------------- 11 files changed, 5 insertions(+), 79 deletions(-) (limited to 'src/client/wieldmesh.cpp') diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index 2bb0bc385..b1b801947 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -178,11 +178,9 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args) g_fontengine = new FontEngine(guienv); FATAL_ERROR_IF(g_fontengine == NULL, "Font engine creation failed."); -#if (IRRLICHT_VERSION_MAJOR >= 1 && IRRLICHT_VERSION_MINOR >= 8) || IRRLICHT_VERSION_MAJOR >= 2 // Irrlicht 1.8 input colours skin->setColor(gui::EGDC_EDITABLE, video::SColor(255, 128, 128, 128)); skin->setColor(gui::EGDC_FOCUSED_EDITABLE, video::SColor(255, 96, 134, 49)); -#endif // Create the menu clouds if (!g_menucloudsmgr) diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp index 97ae9afc4..63b8821f4 100644 --- a/src/client/content_cao.cpp +++ b/src/client/content_cao.cpp @@ -1473,11 +1473,8 @@ void GenericCAO::updateAnimation() if (m_animated_meshnode->getAnimationSpeed() != m_animation_speed) m_animated_meshnode->setAnimationSpeed(m_animation_speed); m_animated_meshnode->setTransitionTime(m_animation_blend); -// Requires Irrlicht 1.8 or greater -#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR >= 8) || IRRLICHT_VERSION_MAJOR > 1 if (m_animated_meshnode->getLoopMode() != m_animation_loop) m_animated_meshnode->setLoopMode(m_animation_loop); -#endif } void GenericCAO::updateAnimationSpeed() diff --git a/src/client/game.cpp b/src/client/game.cpp index 334f1da67..22b7ee875 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -400,12 +400,7 @@ public: }; -// before 1.8 there isn't a "integer interface", only float -#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8) -typedef f32 SamplerLayer_t; -#else typedef s32 SamplerLayer_t; -#endif class GameGlobalShaderConstantSetter : public IShaderConstantSetter @@ -513,38 +508,20 @@ public: float eye_position_array[3]; v3f epos = m_client->getEnv().getLocalPlayer()->getEyePosition(); -#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8) - eye_position_array[0] = epos.X; - eye_position_array[1] = epos.Y; - eye_position_array[2] = epos.Z; -#else epos.getAs3Values(eye_position_array); -#endif m_eye_position_pixel.set(eye_position_array, services); m_eye_position_vertex.set(eye_position_array, services); if (m_client->getMinimap()) { float minimap_yaw_array[3]; v3f minimap_yaw = m_client->getMinimap()->getYawVec(); -#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8) - minimap_yaw_array[0] = minimap_yaw.X; - minimap_yaw_array[1] = minimap_yaw.Y; - minimap_yaw_array[2] = minimap_yaw.Z; -#else minimap_yaw.getAs3Values(minimap_yaw_array); -#endif m_minimap_yaw.set(minimap_yaw_array, services); } float camera_offset_array[3]; v3f offset = intToFloat(m_client->getCamera()->getOffset(), BS); -#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8) - camera_offset_array[0] = offset.X; - camera_offset_array[1] = offset.Y; - camera_offset_array[2] = offset.Z; -#else offset.getAs3Values(camera_offset_array); -#endif m_camera_offset_pixel.set(camera_offset_array, services); m_camera_offset_vertex.set(camera_offset_array, services); diff --git a/src/client/keycode.cpp b/src/client/keycode.cpp index ce5214f54..fac077f0f 100644 --- a/src/client/keycode.cpp +++ b/src/client/keycode.cpp @@ -197,7 +197,6 @@ static const struct table_key table[] = { DEFINEKEY1(KEY_MODECHANGE, N_("IME Mode Change")) DEFINEKEY1(KEY_APPS, N_("Apps")) DEFINEKEY1(KEY_SLEEP, N_("Sleep")) -#if !(IRRLICHT_VERSION_MAJOR <= 1 && IRRLICHT_VERSION_MINOR <= 7 && IRRLICHT_VERSION_REVISION < 3) DEFINEKEY1(KEY_OEM_1, "OEM 1") // KEY_OEM_[0-9] and KEY_OEM_102 are assigned to multiple DEFINEKEY1(KEY_OEM_2, "OEM 2") // different chars (on different platforms too) and thus w/o char DEFINEKEY1(KEY_OEM_3, "OEM 3") @@ -208,7 +207,6 @@ static const struct table_key table[] = { DEFINEKEY1(KEY_OEM_8, "OEM 8") DEFINEKEY1(KEY_OEM_AX, "OEM AX") DEFINEKEY1(KEY_OEM_102, "OEM 102") -#endif DEFINEKEY1(KEY_ATTN, "Attn") DEFINEKEY1(KEY_CRSEL, "CrSel") DEFINEKEY1(KEY_EXSEL, "ExSel") diff --git a/src/client/mesh.cpp b/src/client/mesh.cpp index 2400a374c..e43139218 100644 --- a/src/client/mesh.cpp +++ b/src/client/mesh.cpp @@ -27,14 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -// In Irrlicht 1.8 the signature of ITexture::lock was changed from -// (bool, u32) to (E_TEXTURE_LOCK_MODE, u32). -#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 7 -#define MY_ETLM_READ_ONLY true -#else -#define MY_ETLM_READ_ONLY video::ETLM_READ_ONLY -#endif - inline static void applyShadeFactor(video::SColor& color, float factor) { color.setRed(core::clamp(core::round32(color.getRed()*factor), 0, 255)); diff --git a/src/client/wieldmesh.cpp b/src/client/wieldmesh.cpp index 9806644df..e76bbfa9e 100644 --- a/src/client/wieldmesh.cpp +++ b/src/client/wieldmesh.cpp @@ -294,9 +294,7 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename, } material.setFlag(video::EMF_ANISOTROPIC_FILTER, m_anisotropic_filter); // mipmaps cause "thin black line" artifacts -#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR >= 8) || IRRLICHT_VERSION_MAJOR >= 2 material.setFlag(video::EMF_USE_MIP_MAPS, false); -#endif if (m_enable_shaders) { material.setTexture(2, tsrc->getShaderFlagsTexture(false)); } diff --git a/src/irrlicht_changes/CGUITTFont.cpp b/src/irrlicht_changes/CGUITTFont.cpp index 8b01e88ae..05a1ae43e 100644 --- a/src/irrlicht_changes/CGUITTFont.cpp +++ b/src/irrlicht_changes/CGUITTFont.cpp @@ -1021,11 +1021,7 @@ video::IImage* CGUITTFont::createTextureFromChar(const uchar32_t& ch) video::ITexture* tex = page->texture; // Acquire a read-only lock of the corresponding page texture. - #if IRRLICHT_VERSION_MAJOR==1 && IRRLICHT_VERSION_MINOR>=8 void* ptr = tex->lock(video::ETLM_READ_ONLY); - #else - void* ptr = tex->lock(true); - #endif video::ECOLOR_FORMAT format = tex->getColorFormat(); core::dimension2du tex_size = tex->getOriginalSize(); @@ -1182,11 +1178,7 @@ core::array CGUITTFont::addTextSceneNode(const wchar_t* text // Now we copy planes corresponding to the letter size. IMeshManipulator* mani = smgr->getMeshManipulator(); IMesh* meshcopy = mani->createMeshCopy(shared_plane_ptr_); - #if IRRLICHT_VERSION_MAJOR==1 && IRRLICHT_VERSION_MINOR>=8 mani->scale(meshcopy, vector3df((f32)letter_size.Width, (f32)letter_size.Height, 1)); - #else - mani->scaleMesh(meshcopy, vector3df((f32)letter_size.Width, (f32)letter_size.Height, 1)); - #endif ISceneNode* current_node = smgr->addMeshSceneNode(meshcopy, parent, -1, current_pos); meshcopy->drop(); diff --git a/src/irrlicht_changes/CGUITTFont.h b/src/irrlicht_changes/CGUITTFont.h index a26a1db76..141ea3931 100644 --- a/src/irrlicht_changes/CGUITTFont.h +++ b/src/irrlicht_changes/CGUITTFont.h @@ -34,7 +34,7 @@ #include #include #include -#include "irrUString.h" +#include #include "util/enriched_string.h" #include FT_FREETYPE_H diff --git a/src/irrlicht_changes/static_text.cpp b/src/irrlicht_changes/static_text.cpp index a8cc33352..b20707bbd 100644 --- a/src/irrlicht_changes/static_text.cpp +++ b/src/irrlicht_changes/static_text.cpp @@ -246,11 +246,7 @@ void StaticText::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vert } -#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 7 -const video::SColor& StaticText::getOverrideColor() const -#else video::SColor StaticText::getOverrideColor() const -#endif { return ColoredText.getDefaultColor(); } diff --git a/src/irrlicht_changes/static_text.h b/src/irrlicht_changes/static_text.h index 786129d57..83bbf4c3d 100644 --- a/src/irrlicht_changes/static_text.h +++ b/src/irrlicht_changes/static_text.h @@ -134,11 +134,7 @@ namespace gui virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical); //! Gets the override color - #if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 7 - virtual const video::SColor& getOverrideColor() const; - #else virtual video::SColor getOverrideColor() const; - #endif #if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8 //! Gets the currently used text color diff --git a/src/irrlichttypes.h b/src/irrlichttypes.h index 794776b26..93c2d105b 100644 --- a/src/irrlichttypes.h +++ b/src/irrlichttypes.h @@ -19,16 +19,11 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once -/* Ensure that is included before , unless building on - * MSVC, to address an irrlicht issue: https://sourceforge.net/p/irrlicht/bugs/433/ - * - * TODO: Decide whether or not we support non-compliant C++ compilers like old - * versions of MSCV. If we do not then can always be included - * regardless of the compiler. +/* + * IrrlichtMt already includes stdint.h in irrTypes.h. This works everywhere + * we need it to (including recent MSVC), so should be fine here too. */ -#ifndef _MSC_VER -# include -#endif +#include #include @@ -36,19 +31,6 @@ using namespace irr; namespace irr { -// Irrlicht 1.8+ defines 64bit unsigned symbol in irrTypes.h -#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8) -#ifdef _MSC_VER - // Windows - typedef long long s64; - typedef unsigned long long u64; -#else - // Posix - typedef int64_t s64; - typedef uint64_t u64; -#endif -#endif - #if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR >= 9) namespace core { template -- cgit v1.2.3 From 90a7bd6a0afb6509e96bcb373f95b448ee7f3b1d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 20 Apr 2021 17:50:03 +0000 Subject: Put torch/signlike node on floor if no paramtype2 (#11074) --- builtin/game/falling.lua | 15 ++++++--------- doc/lua_api.txt | 16 +++++++++++----- games/devtest/mods/testnodes/drawtypes.lua | 24 ++++++++++++++++-------- src/client/wieldmesh.cpp | 10 ++++++---- src/mapnode.cpp | 5 ++++- 5 files changed, 43 insertions(+), 27 deletions(-) (limited to 'src/client/wieldmesh.cpp') diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index 5450542ff..1f0a63993 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -84,9 +84,6 @@ core.register_entity(":__builtin:falling_node", { local textures if def.tiles and def.tiles[1] then local tile = def.tiles[1] - if def.drawtype == "torchlike" and def.paramtype2 ~= "wallmounted" then - tile = def.tiles[2] or def.tiles[1] - end if type(tile) == "table" then tile = tile.name end @@ -147,11 +144,7 @@ core.register_entity(":__builtin:falling_node", { -- Rotate entity if def.drawtype == "torchlike" then - if def.paramtype2 == "wallmounted" then - self.object:set_yaw(math.pi*0.25) - else - self.object:set_yaw(-math.pi*0.25) - end + self.object:set_yaw(math.pi*0.25) elseif ((node.param2 ~= 0 or def.drawtype == "nodebox" or def.drawtype == "mesh") and (def.wield_image == "" or def.wield_image == nil)) or def.drawtype == "signlike" @@ -165,8 +158,12 @@ core.register_entity(":__builtin:falling_node", { if euler then self.object:set_rotation(euler) end - elseif (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted") then + elseif (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted" or def.drawtype == "signlike") then local rot = node.param2 % 8 + if (def.drawtype == "signlike" and def.paramtype2 ~= "wallmounted" and def.paramtype2 ~= "colorwallmounted") then + -- Change rotation to "floor" by default for non-wallmounted paramtype2 + rot = 1 + end local pitch, yaw, roll = 0, 0, 0 if def.drawtype == "nodebox" or def.drawtype == "mesh" then if rot == 0 then diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 4c963465a..5f72b8b2b 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1140,14 +1140,20 @@ Look for examples in `games/devtest` or `games/minetest_game`. used to compensate for how `glasslike` reduces visual thickness. * `torchlike` * A single vertical texture. - * If placed on top of a node, uses the first texture specified in `tiles`. - * If placed against the underside of a node, uses the second texture - specified in `tiles`. - * If placed on the side of a node, uses the third texture specified in - `tiles` and is perpendicular to that node. + * If `paramtype2="[color]wallmounted": + * If placed on top of a node, uses the first texture specified in `tiles`. + * If placed against the underside of a node, uses the second texture + specified in `tiles`. + * If placed on the side of a node, uses the third texture specified in + `tiles` and is perpendicular to that node. + * If `paramtype2="none"`: + * Will be rendered as if placed on top of a node (see + above) and only the first texture is used. * `signlike` * A single texture parallel to, and mounted against, the top, underside or side of a node. + * If `paramtype2="[color]wallmounted", it rotates according to `param2` + * If `paramtype2="none"`, it will always be on the floor. * `plantlike` * Two vertical and diagonal textures at right-angles to each other. * See `paramtype2 = "meshoptions"` above for other options. diff --git a/games/devtest/mods/testnodes/drawtypes.lua b/games/devtest/mods/testnodes/drawtypes.lua index f6d48b06f..881ba75aa 100644 --- a/games/devtest/mods/testnodes/drawtypes.lua +++ b/games/devtest/mods/testnodes/drawtypes.lua @@ -129,14 +129,10 @@ minetest.register_node("testnodes:fencelike", { }) minetest.register_node("testnodes:torchlike", { - description = S("Torchlike Drawtype Test Node"), + description = S("Floor Torchlike Drawtype Test Node"), drawtype = "torchlike", paramtype = "light", - tiles = { - "testnodes_torchlike_floor.png", - "testnodes_torchlike_ceiling.png", - "testnodes_torchlike_wall.png", - }, + tiles = { "testnodes_torchlike_floor.png^[colorize:#FF0000:64" }, walkable = false, @@ -161,9 +157,21 @@ minetest.register_node("testnodes:torchlike_wallmounted", { groups = { dig_immediate = 3 }, }) +minetest.register_node("testnodes:signlike", { + description = S("Floor Signlike Drawtype Test Node"), + drawtype = "signlike", + paramtype = "light", + tiles = { "testnodes_signlike.png^[colorize:#FF0000:64" }, -minetest.register_node("testnodes:signlike", { + walkable = false, + groups = { dig_immediate = 3 }, + sunlight_propagates = true, + inventory_image = fallback_image("testnodes_signlike.png"), +}) + + +minetest.register_node("testnodes:signlike_wallmounted", { description = S("Wallmounted Signlike Drawtype Test Node"), drawtype = "signlike", paramtype = "light", @@ -583,7 +591,7 @@ scale("plantlike", scale("torchlike_wallmounted", S("Double-sized Wallmounted Torchlike Drawtype Test Node"), S("Half-sized Wallmounted Torchlike Drawtype Test Node")) -scale("signlike", +scale("signlike_wallmounted", S("Double-sized Wallmounted Signlike Drawtype Test Node"), S("Half-sized Wallmounted Signlike Drawtype Test Node")) scale("firelike", diff --git a/src/client/wieldmesh.cpp b/src/client/wieldmesh.cpp index e76bbfa9e..d9d5e57cd 100644 --- a/src/client/wieldmesh.cpp +++ b/src/client/wieldmesh.cpp @@ -313,12 +313,14 @@ static scene::SMesh *createSpecialNodeMesh(Client *client, MapNode n, // keep it } else if (f.param_type_2 == CPT2_WALLMOUNTED || f.param_type_2 == CPT2_COLORED_WALLMOUNTED) { - if (f.drawtype == NDT_TORCHLIKE) - n.setParam2(1); - else if (f.drawtype == NDT_SIGNLIKE || + if (f.drawtype == NDT_TORCHLIKE || + f.drawtype == NDT_SIGNLIKE || f.drawtype == NDT_NODEBOX || - f.drawtype == NDT_MESH) + f.drawtype == NDT_MESH) { n.setParam2(4); + } + } else if (f.drawtype == NDT_SIGNLIKE || f.drawtype == NDT_TORCHLIKE) { + n.setParam2(1); } gen.renderSingle(n.getContent(), n.getParam2()); diff --git a/src/mapnode.cpp b/src/mapnode.cpp index 20980b238..c885bfe1d 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -159,8 +159,11 @@ u8 MapNode::getWallMounted(const NodeDefManager *nodemgr) const { const ContentFeatures &f = nodemgr->get(*this); if (f.param_type_2 == CPT2_WALLMOUNTED || - f.param_type_2 == CPT2_COLORED_WALLMOUNTED) + f.param_type_2 == CPT2_COLORED_WALLMOUNTED) { return getParam2() & 0x07; + } else if (f.drawtype == NDT_SIGNLIKE || f.drawtype == NDT_TORCHLIKE) { + return 1; + } return 0; } -- cgit v1.2.3 From 5a02c376ea5f2e7f1dd0a2bd4f08bf953ed4bfc8 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Thu, 29 Apr 2021 09:40:56 +0200 Subject: refacto: RenderingEngine::get_scene_manager() is now not callable from singleton This permits to make evidence that we have some bad object passing on various code parts. I fixed majority of them to reduce the scope of passed objects Unfortunately, for some edge cases i should have to expose ISceneManager from client, this should be fixed in the future when our POO will be cleaner client side (we have a mix of rendering and processing in majority of the client objects, it works but it's not clean) --- src/client/client.cpp | 5 +++++ src/client/client.h | 1 + src/client/clientenvironment.cpp | 2 +- src/client/content_mapblock.cpp | 16 +++++++--------- src/client/content_mapblock.h | 3 ++- src/client/mapblock_mesh.cpp | 4 ++-- src/client/particles.cpp | 4 ++-- src/client/renderingengine.h | 5 ++--- src/client/wieldmesh.cpp | 5 +++-- src/gui/guiFormSpecMenu.cpp | 2 +- src/nodedef.cpp | 4 ++-- 11 files changed, 28 insertions(+), 23 deletions(-) (limited to 'src/client/wieldmesh.cpp') 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 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(); -- cgit v1.2.3