mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
parent
ca646487f2
commit
5c1b72544a
@ -621,8 +621,6 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
|
|||||||
|
|
||||||
setSceneNodeMaterial(m_spritenode);
|
setSceneNodeMaterial(m_spritenode);
|
||||||
|
|
||||||
u8 li = m_last_light;
|
|
||||||
m_spritenode->setColor(video::SColor(255,li,li,li));
|
|
||||||
m_spritenode->setSize(v2f(m_prop.visual_size.X,
|
m_spritenode->setSize(v2f(m_prop.visual_size.X,
|
||||||
m_prop.visual_size.Y) * BS);
|
m_prop.visual_size.Y) * BS);
|
||||||
{
|
{
|
||||||
@ -636,8 +634,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
|
|||||||
scene::SMesh *mesh = new scene::SMesh();
|
scene::SMesh *mesh = new scene::SMesh();
|
||||||
double dx = BS * m_prop.visual_size.X / 2;
|
double dx = BS * m_prop.visual_size.X / 2;
|
||||||
double dy = BS * m_prop.visual_size.Y / 2;
|
double dy = BS * m_prop.visual_size.Y / 2;
|
||||||
u8 li = m_last_light;
|
video::SColor c(0xFFFFFFFF);
|
||||||
video::SColor c(255, li, li, li);
|
|
||||||
|
|
||||||
{ // Front
|
{ // Front
|
||||||
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
||||||
@ -717,8 +714,6 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
|
|||||||
mesh->drop();
|
mesh->drop();
|
||||||
|
|
||||||
m_meshnode->setScale(m_prop.visual_size);
|
m_meshnode->setScale(m_prop.visual_size);
|
||||||
u8 li = m_last_light;
|
|
||||||
setMeshColor(m_meshnode->getMesh(), video::SColor(255,li,li,li));
|
|
||||||
|
|
||||||
setSceneNodeMaterial(m_meshnode);
|
setSceneNodeMaterial(m_meshnode);
|
||||||
} else if (m_prop.visual == "mesh") {
|
} else if (m_prop.visual == "mesh") {
|
||||||
@ -731,12 +726,11 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
|
|||||||
mesh->drop(); // The scene node took hold of it
|
mesh->drop(); // The scene node took hold of it
|
||||||
m_animated_meshnode->animateJoints(); // Needed for some animations
|
m_animated_meshnode->animateJoints(); // Needed for some animations
|
||||||
m_animated_meshnode->setScale(m_prop.visual_size);
|
m_animated_meshnode->setScale(m_prop.visual_size);
|
||||||
u8 li = m_last_light;
|
|
||||||
|
|
||||||
// set vertex colors to ensure alpha is set
|
// set vertex colors to ensure alpha is set
|
||||||
setMeshColor(m_animated_meshnode->getMesh(), video::SColor(255,li,li,li));
|
setMeshColor(m_animated_meshnode->getMesh(), video::SColor(0xFFFFFFFF));
|
||||||
|
|
||||||
setAnimatedMeshColor(m_animated_meshnode, video::SColor(255,li,li,li));
|
setAnimatedMeshColor(m_animated_meshnode, video::SColor(0xFFFFFFFF));
|
||||||
|
|
||||||
setSceneNodeMaterial(m_animated_meshnode);
|
setSceneNodeMaterial(m_animated_meshnode);
|
||||||
|
|
||||||
@ -766,8 +760,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
|
|||||||
(m_prop.visual == "wielditem"));
|
(m_prop.visual == "wielditem"));
|
||||||
|
|
||||||
m_wield_meshnode->setScale(m_prop.visual_size / 2.0f);
|
m_wield_meshnode->setScale(m_prop.visual_size / 2.0f);
|
||||||
u8 li = m_last_light;
|
m_wield_meshnode->setColor(video::SColor(0xFFFFFFFF));
|
||||||
m_wield_meshnode->setColor(video::SColor(255, li, li, li));
|
|
||||||
} else {
|
} else {
|
||||||
infostream<<"GenericCAO::addToScene(): \""<<m_prop.visual
|
infostream<<"GenericCAO::addToScene(): \""<<m_prop.visual
|
||||||
<<"\" not supported"<<std::endl;
|
<<"\" not supported"<<std::endl;
|
||||||
@ -795,6 +788,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
|
|||||||
updateAnimation();
|
updateAnimation();
|
||||||
updateBonePosition();
|
updateBonePosition();
|
||||||
updateAttachments();
|
updateAttachments();
|
||||||
|
setNodeLight(m_last_light);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericCAO::updateLight(u8 light_at_pos)
|
void GenericCAO::updateLight(u8 light_at_pos)
|
||||||
@ -824,14 +818,19 @@ void GenericCAO::updateLightNoCheck(u8 light_at_pos)
|
|||||||
|
|
||||||
if (li != m_last_light) {
|
if (li != m_last_light) {
|
||||||
m_last_light = li;
|
m_last_light = li;
|
||||||
video::SColor color(255,li,li,li);
|
setNodeLight(li);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GenericCAO::setNodeLight(u8 light)
|
||||||
|
{
|
||||||
|
video::SColor color(255, light, light, light);
|
||||||
|
|
||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
scene::ISceneNode *node = getSceneNode();
|
scene::ISceneNode *node = getSceneNode();
|
||||||
|
|
||||||
if (node == nullptr) {
|
if (node == nullptr)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (m_prop.visual == "upright_sprite") {
|
if (m_prop.visual == "upright_sprite") {
|
||||||
scene::IMesh *mesh = m_meshnode->getMesh();
|
scene::IMesh *mesh = m_meshnode->getMesh();
|
||||||
@ -858,7 +857,6 @@ void GenericCAO::updateLightNoCheck(u8 light_at_pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
v3s16 GenericCAO::getLightPosition()
|
v3s16 GenericCAO::getLightPosition()
|
||||||
{
|
{
|
||||||
|
@ -238,6 +238,8 @@ public:
|
|||||||
|
|
||||||
void updateLightNoCheck(u8 light_at_pos);
|
void updateLightNoCheck(u8 light_at_pos);
|
||||||
|
|
||||||
|
void setNodeLight(u8 light);
|
||||||
|
|
||||||
v3s16 getLightPosition();
|
v3s16 getLightPosition();
|
||||||
|
|
||||||
void updateNodePos();
|
void updateNodePos();
|
||||||
|
Loading…
Reference in New Issue
Block a user