From 5280863300e88c6e42c320115a53f0957e113589 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 19 Feb 2024 15:10:18 +0100 Subject: [PATCH] Set VBO hints in more places --- src/client/content_cao.cpp | 12 ++++++++++++ src/client/hud.cpp | 1 + src/client/minimap.cpp | 1 + src/irrlicht_changes/CGUITTFont.cpp | 1 + src/itemdef.cpp | 5 ++++- 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp index 7e8dfaeb2..330eebd95 100644 --- a/src/client/content_cao.cpp +++ b/src/client/content_cao.cpp @@ -818,6 +818,18 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr) <<"\" not supported"<getMesh()->setHardwareMappingHint(scene::EHM_STATIC); + if (m_animated_meshnode) + m_animated_meshnode->getMesh()->setHardwareMappingHint(scene::EHM_STATIC); + } + /* don't update while punch texture modifier is active */ if (m_reset_textures_timer < 0) updateTextures(m_current_texture_modifier); diff --git a/src/client/hud.cpp b/src/client/hud.cpp index 181dcb0e4..9439a4492 100644 --- a/src/client/hud.cpp +++ b/src/client/hud.cpp @@ -135,6 +135,7 @@ Hud::Hud(Client *client, LocalPlayer *player, m_rotation_mesh_buffer.getMaterial().Lighting = false; m_rotation_mesh_buffer.getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; + m_rotation_mesh_buffer.setHardwareMappingHint(scene::EHM_STATIC); } Hud::~Hud() diff --git a/src/client/minimap.cpp b/src/client/minimap.cpp index 1362dae68..852220d06 100644 --- a/src/client/minimap.cpp +++ b/src/client/minimap.cpp @@ -571,6 +571,7 @@ scene::SMeshBuffer *Minimap::getMinimapMeshBuffer() buf->Indices[4] = 3; buf->Indices[5] = 0; + buf->setHardwareMappingHint(scene::EHM_STATIC); return buf; } diff --git a/src/irrlicht_changes/CGUITTFont.cpp b/src/irrlicht_changes/CGUITTFont.cpp index 9274ee69f..40d2bb405 100644 --- a/src/irrlicht_changes/CGUITTFont.cpp +++ b/src/irrlicht_changes/CGUITTFont.cpp @@ -1046,6 +1046,7 @@ void CGUITTFont::createSharedPlane() buf->append(vertices, 4, indices, 6); shared_plane_.addMeshBuffer( buf ); + shared_plane_.setHardwareMappingHint(EHM_STATIC); shared_plane_ptr_ = &shared_plane_; buf->drop(); //the addMeshBuffer method will grab it, so we can drop this ptr. diff --git a/src/itemdef.cpp b/src/itemdef.cpp index 5c63270c0..bd08f1e2b 100644 --- a/src/itemdef.cpp +++ b/src/itemdef.cpp @@ -462,11 +462,14 @@ public: // Create new ClientCached auto cc = std::make_unique(); - // Create an inventory texture cc->inventory_texture = NULL; if (!inventory_image.empty()) cc->inventory_texture = tsrc->getTexture(inventory_image); getItemMesh(client, item, &(cc->wield_mesh)); + // note: vertices are modified frequently (see hud.cpp) so only indices + // can be mapped + if (auto mesh = cc->wield_mesh.mesh) + mesh->setHardwareMappingHint(scene::EHM_STATIC, scene::EBT_INDEX); cc->palette = tsrc->getPalette(def.palette_image);