1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Reuse object_shader for "wielditem" and "item" entity drawtypes (#9537)

This commit is contained in:
Danila Shutov 2020-04-19 19:47:13 +03:00 committed by GitHub
parent c87d52a5fa
commit cdbe3c5e57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 165 deletions

View file

@ -347,7 +347,7 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
scene::SMesh *mesh = nullptr;
if (m_enable_shaders) {
u32 shader_id = shdrsrc->getShader("wielded_shader", TILE_MATERIAL_BASIC, NDT_NORMAL);
u32 shader_id = shdrsrc->getShader("object_shader", TILE_MATERIAL_BASIC, NDT_NORMAL);
m_material_type = shdrsrc->getShaderInfo(shader_id).material;
}
@ -471,6 +471,21 @@ void WieldMeshSceneNode::setColor(video::SColor c)
}
}
void WieldMeshSceneNode::setNodeLightColor(video::SColor color)
{
if (!m_meshnode)
return;
if (m_enable_shaders) {
for (u32 i = 0; i < m_meshnode->getMaterialCount(); ++i) {
video::SMaterial &material = m_meshnode->getMaterial(i);
material.EmissiveColor = color;
}
} else {
setColor(color);
}
}
void WieldMeshSceneNode::render()
{
// note: if this method is changed to actually do something,