Set VBO hints in more places

This commit is contained in:
sfan5 2024-02-19 15:10:18 +01:00
parent fbec378869
commit 5280863300
5 changed files with 19 additions and 1 deletions

@ -818,6 +818,18 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
<<"\" not supported"<<std::endl;
}
/* Set VBO hint */
// - if shaders are disabled we modify the mesh often
// - sprites are also modified often
// - the wieldmesh sets its own hint
// - bone transformations do not need to modify the vertex data
if (m_enable_shaders && (m_meshnode || m_animated_meshnode)) {
if (m_meshnode)
m_meshnode->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);

@ -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()

@ -571,6 +571,7 @@ scene::SMeshBuffer *Minimap::getMinimapMeshBuffer()
buf->Indices[4] = 3;
buf->Indices[5] = 0;
buf->setHardwareMappingHint(scene::EHM_STATIC);
return buf;
}

@ -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.

@ -462,11 +462,14 @@ public:
// Create new ClientCached
auto cc = std::make_unique<ClientCached>();
// 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);