Fix incorrect light updates for wielditem and item visuals (#9540)
authorDanila Shutov <dcbrwn2@gmail.com>
Mon, 23 Mar 2020 20:57:44 +0000 (23:57 +0300)
committerGitHub <noreply@github.com>
Mon, 23 Mar 2020 20:57:44 +0000 (21:57 +0100)
An alternative to #9537

src/client/content_cao.cpp

index 49463c3d384efcb1d20d952ce49e486bb4e6f5cb..30b1b82122ec5cbe69dc32ce574b57de0d116495 100644 (file)
@@ -826,7 +826,11 @@ void GenericCAO::setNodeLight(u8 light)
 {
        video::SColor color(255, light, light, light);
 
-       if (m_enable_shaders) {
+       if (m_prop.visual == "wielditem" || m_prop.visual == "item") {
+               // Since these types of visuals are using their own shader
+               // they should be handled separately
+               m_wield_meshnode->setColor(color);
+       } else if (m_enable_shaders) {
                scene::ISceneNode *node = getSceneNode();
 
                if (node == nullptr)
@@ -850,8 +854,6 @@ void GenericCAO::setNodeLight(u8 light)
                        setMeshColor(m_meshnode->getMesh(), color);
                } else if (m_animated_meshnode) {
                        setAnimatedMeshColor(m_animated_meshnode, color);
-               } else if (m_wield_meshnode) {
-                       m_wield_meshnode->setColor(color);
                } else if (m_spritenode) {
                        m_spritenode->setColor(color);
                }