diff options
author | Wuzzy <wuzzy2@mail.ru> | 2021-10-20 19:50:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-20 21:50:16 +0200 |
commit | 86b44ecd8280d8304aa26a600fc004d40a970020 (patch) | |
tree | c355bd74f3dd0321094bc03b80b2c010386d916a /src/client | |
parent | c82ec8b210f613fcd5bb386a14f0a8f88591253a (diff) | |
download | minetest-86b44ecd8280d8304aa26a600fc004d40a970020.tar.gz minetest-86b44ecd8280d8304aa26a600fc004d40a970020.tar.bz2 minetest-86b44ecd8280d8304aa26a600fc004d40a970020.zip |
Add no_texture.png as fallback for unspecified textures
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/content_cao.cpp | 10 | ||||
-rw-r--r-- | src/client/game.cpp | 5 | ||||
-rw-r--r-- | src/client/hud.cpp | 25 | ||||
-rw-r--r-- | src/client/wieldmesh.cpp | 11 |
4 files changed, 33 insertions, 18 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp index da78cae7c..1e79d00c9 100644 --- a/src/client/content_cao.cpp +++ b/src/client/content_cao.cpp @@ -647,7 +647,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr) m_matrixnode, v2f(1, 1), v3f(0,0,0), -1); m_spritenode->grab(); m_spritenode->setMaterialTexture(0, - tsrc->getTextureForMesh("unknown_node.png")); + tsrc->getTextureForMesh("no_texture.png")); setSceneNodeMaterial(m_spritenode); @@ -1288,7 +1288,7 @@ void GenericCAO::updateTextures(std::string mod) if (m_spritenode) { if (m_prop.visual == "sprite") { - std::string texturestring = "unknown_node.png"; + std::string texturestring = "no_texture.png"; if (!m_prop.textures.empty()) texturestring = m_prop.textures[0]; texturestring += mod; @@ -1367,7 +1367,7 @@ void GenericCAO::updateTextures(std::string mod) { for (u32 i = 0; i < 6; ++i) { - std::string texturestring = "unknown_node.png"; + std::string texturestring = "no_texture.png"; if(m_prop.textures.size() > i) texturestring = m_prop.textures[i]; texturestring += mod; @@ -1400,7 +1400,7 @@ void GenericCAO::updateTextures(std::string mod) } else if (m_prop.visual == "upright_sprite") { scene::IMesh *mesh = m_meshnode->getMesh(); { - std::string tname = "unknown_object.png"; + std::string tname = "no_texture.png"; if (!m_prop.textures.empty()) tname = m_prop.textures[0]; tname += mod; @@ -1422,7 +1422,7 @@ void GenericCAO::updateTextures(std::string mod) buf->getMaterial().setFlag(video::EMF_ANISOTROPIC_FILTER, use_anisotropic_filter); } { - std::string tname = "unknown_object.png"; + std::string tname = "no_texture.png"; if (m_prop.textures.size() >= 2) tname = m_prop.textures[1]; else if (!m_prop.textures.empty()) diff --git a/src/client/game.cpp b/src/client/game.cpp index a6448f40d..57951dc95 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -3331,9 +3331,8 @@ void Game::handlePointingAtNode(const PointedThing &pointed, } else { MapNode n = map.getNode(nodepos); - if (nodedef_manager->get(n).tiledef[0].name == "unknown_node.png") { - m_game_ui->setInfoText(L"Unknown node: " + - utf8_to_wide(nodedef_manager->get(n).name)); + if (nodedef_manager->get(n).name == "unknown") { + m_game_ui->setInfoText(L"Unknown node"); } } diff --git a/src/client/hud.cpp b/src/client/hud.cpp index 0620759da..e08d2ef02 100644 --- a/src/client/hud.cpp +++ b/src/client/hud.cpp @@ -1007,11 +1007,15 @@ void drawItemStack( bool draw_overlay = false; + bool has_mesh = false; + ItemMesh *imesh; + // Render as mesh if animated or no inventory image if ((enable_animations && rotation_kind < IT_ROT_NONE) || def.inventory_image.empty()) { - ItemMesh *imesh = client->idef()->getWieldMesh(def.name, client); - if (!imesh || !imesh->mesh) - return; + imesh = client->idef()->getWieldMesh(def.name, client); + has_mesh = imesh && imesh->mesh; + } + if (has_mesh) { scene::IMesh *mesh = imesh->mesh; driver->clearBuffers(video::ECBF_DEPTH); s32 delta = 0; @@ -1103,10 +1107,17 @@ void drawItemStack( draw_overlay = def.type == ITEM_NODE && def.inventory_image.empty(); } else { // Otherwise just draw as 2D video::ITexture *texture = client->idef()->getInventoryTexture(def.name, client); - if (!texture) - return; - video::SColor color = - client->idef()->getItemstackColor(item, client); + video::SColor color; + if (texture) { + color = client->idef()->getItemstackColor(item, client); + } else { + color = video::SColor(255, 255, 255, 255); + ITextureSource *tsrc = client->getTextureSource(); + texture = tsrc->getTexture("no_texture.png"); + if (!texture) + return; + } + const video::SColor colors[] = { color, color, color, color }; draw2DImageFilterScaled(driver, texture, rect, diff --git a/src/client/wieldmesh.cpp b/src/client/wieldmesh.cpp index 6beed3f3a..0a4cb3b86 100644 --- a/src/client/wieldmesh.cpp +++ b/src/client/wieldmesh.cpp @@ -458,9 +458,14 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che material.setFlag(video::EMF_TRILINEAR_FILTER, m_trilinear_filter); } return; - } else if (!def.inventory_image.empty()) { - setExtruded(def.inventory_image, def.inventory_overlay, def.wield_scale, - tsrc, 1); + } else { + if (!def.inventory_image.empty()) { + setExtruded(def.inventory_image, def.inventory_overlay, def.wield_scale, + tsrc, 1); + } else { + setExtruded("no_texture.png", "", def.wield_scale, tsrc, 1); + } + m_colors.emplace_back(); // overlay is white, if present m_colors.emplace_back(true, video::SColor(0xFFFFFFFF)); |