Fix lighting of upright_sprite entities (#12336)

Use MeshNode materials to set the light since ReadOnlyMaterials is now false
This commit is contained in:
x2048 2022-05-20 22:35:03 +02:00 committed by GitHub
parent 604fb2b738
commit a4ef62f5b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -905,12 +905,8 @@ void GenericCAO::setNodeLight(const video::SColor &light_color)
if (m_prop.visual == "upright_sprite") {
if (!m_meshnode)
return;
scene::IMesh *mesh = m_meshnode->getMesh();
for (u32 i = 0; i < mesh->getMeshBufferCount(); ++i) {
scene::IMeshBuffer *buf = mesh->getMeshBuffer(i);
buf->getMaterial().EmissiveColor = light_color;
}
for (u32 i = 0; i < m_meshnode->getMaterialCount(); ++i)
m_meshnode->getMaterial(i).EmissiveColor = light_color;
} else {
scene::ISceneNode *node = getSceneNode();
if (!node)