forked from Mirrorlandia_minetest/minetest
Fix two bugs in content_cao
fixes #9889 (backface_culling with visual = "cube") fixes #9916 (crash with visual = "upright_sprite")
This commit is contained in:
parent
5430770b68
commit
f51cf7c68a
@ -713,6 +713,8 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
|
|||||||
mesh->drop();
|
mesh->drop();
|
||||||
|
|
||||||
m_meshnode->setScale(m_prop.visual_size);
|
m_meshnode->setScale(m_prop.visual_size);
|
||||||
|
m_meshnode->setMaterialFlag(video::EMF_BACK_FACE_CULLING,
|
||||||
|
m_prop.backface_culling);
|
||||||
|
|
||||||
setSceneNodeMaterial(m_meshnode);
|
setSceneNodeMaterial(m_meshnode);
|
||||||
} else if (m_prop.visual == "mesh") {
|
} else if (m_prop.visual == "mesh") {
|
||||||
@ -832,19 +834,20 @@ void GenericCAO::setNodeLight(u8 light)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
scene::ISceneNode *node = getSceneNode();
|
if (m_prop.visual == "upright_sprite") {
|
||||||
|
if (!m_meshnode)
|
||||||
if (node == nullptr)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_prop.visual == "upright_sprite") {
|
|
||||||
scene::IMesh *mesh = m_meshnode->getMesh();
|
scene::IMesh *mesh = m_meshnode->getMesh();
|
||||||
for (u32 i = 0; i < mesh->getMeshBufferCount(); ++i) {
|
for (u32 i = 0; i < mesh->getMeshBufferCount(); ++i) {
|
||||||
scene::IMeshBuffer *buf = mesh->getMeshBuffer(i);
|
scene::IMeshBuffer *buf = mesh->getMeshBuffer(i);
|
||||||
video::SMaterial &material = buf->getMaterial();
|
buf->getMaterial().EmissiveColor = color;
|
||||||
material.EmissiveColor = color;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
scene::ISceneNode *node = getSceneNode();
|
||||||
|
if (!node)
|
||||||
|
return;
|
||||||
|
|
||||||
for (u32 i = 0; i < node->getMaterialCount(); ++i) {
|
for (u32 i = 0; i < node->getMaterialCount(); ++i) {
|
||||||
video::SMaterial &material = node->getMaterial(i);
|
video::SMaterial &material = node->getMaterial(i);
|
||||||
material.EmissiveColor = color;
|
material.EmissiveColor = color;
|
||||||
|
Loading…
Reference in New Issue
Block a user