Fix wielditem entity drawtype brightness control
This commit is contained in:
parent
ac628c9b0a
commit
c4f400acd0
@ -40,6 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "util/serialize.h"
|
#include "util/serialize.h"
|
||||||
#include "util/mathconstants.h"
|
#include "util/mathconstants.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
#include <IMeshManipulator.h>
|
||||||
|
|
||||||
class Settings;
|
class Settings;
|
||||||
struct ToolCapabilities;
|
struct ToolCapabilities;
|
||||||
@ -797,8 +798,15 @@ public:
|
|||||||
infostream<<"textures[0]: "<<m_prop.textures[0]<<std::endl;
|
infostream<<"textures[0]: "<<m_prop.textures[0]<<std::endl;
|
||||||
IItemDefManager *idef = m_gamedef->idef();
|
IItemDefManager *idef = m_gamedef->idef();
|
||||||
ItemStack item(m_prop.textures[0], 1, 0, "", idef);
|
ItemStack item(m_prop.textures[0], 1, 0, "", idef);
|
||||||
scene::IMesh *mesh = item.getDefinition(idef).wield_mesh;
|
scene::IMesh *item_mesh = item.getDefinition(idef).wield_mesh;
|
||||||
|
|
||||||
|
// Copy mesh to be able to set unique vertex colors
|
||||||
|
scene::IMeshManipulator *manip =
|
||||||
|
irr->getVideoDriver()->getMeshManipulator();
|
||||||
|
scene::IMesh *mesh = manip->createMeshUniquePrimitives(item_mesh);
|
||||||
|
|
||||||
m_meshnode = smgr->addMeshSceneNode(mesh, NULL);
|
m_meshnode = smgr->addMeshSceneNode(mesh, NULL);
|
||||||
|
mesh->drop();
|
||||||
|
|
||||||
m_meshnode->setScale(v3f(m_prop.visual_size.X/2,
|
m_meshnode->setScale(v3f(m_prop.visual_size.X/2,
|
||||||
m_prop.visual_size.Y/2,
|
m_prop.visual_size.Y/2,
|
||||||
@ -838,15 +846,17 @@ public:
|
|||||||
{
|
{
|
||||||
bool is_visible = (m_hp != 0);
|
bool is_visible = (m_hp != 0);
|
||||||
u8 li = decode_light(light_at_pos);
|
u8 li = decode_light(light_at_pos);
|
||||||
m_last_light = li;
|
if(li != m_last_light){
|
||||||
video::SColor color(255,li,li,li);
|
m_last_light = li;
|
||||||
if(m_meshnode){
|
video::SColor color(255,li,li,li);
|
||||||
setMeshColor(m_meshnode->getMesh(), color);
|
if(m_meshnode){
|
||||||
m_meshnode->setVisible(is_visible);
|
setMeshColor(m_meshnode->getMesh(), color);
|
||||||
}
|
m_meshnode->setVisible(is_visible);
|
||||||
if(m_spritenode){
|
}
|
||||||
m_spritenode->setColor(color);
|
if(m_spritenode){
|
||||||
m_spritenode->setVisible(is_visible);
|
m_spritenode->setColor(color);
|
||||||
|
m_spritenode->setVisible(is_visible);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2129,6 +2129,7 @@ void ClientEnvironment::step(float dtime)
|
|||||||
Step active objects and update lighting of them
|
Step active objects and update lighting of them
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
bool update_lighting = m_active_object_light_update_interval.step(dtime, 0.21);
|
||||||
for(core::map<u16, ClientActiveObject*>::Iterator
|
for(core::map<u16, ClientActiveObject*>::Iterator
|
||||||
i = m_active_objects.getIterator();
|
i = m_active_objects.getIterator();
|
||||||
i.atEnd()==false; i++)
|
i.atEnd()==false; i++)
|
||||||
@ -2137,7 +2138,7 @@ void ClientEnvironment::step(float dtime)
|
|||||||
// Step object
|
// Step object
|
||||||
obj->step(dtime, this);
|
obj->step(dtime, this);
|
||||||
|
|
||||||
if(m_active_object_light_update_interval.step(dtime, 0.21))
|
if(update_lighting)
|
||||||
{
|
{
|
||||||
// Update lighting
|
// Update lighting
|
||||||
u8 light = 0;
|
u8 light = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user