1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Refactor the way you set material properties

Instead of using SMaterial::setFlag, you now set them directly on SMaterial or SMaterialLayer.
This commit is contained in:
Gregor Parzefall 2023-06-23 11:33:23 +02:00 committed by sfan5
parent 128d22e6ee
commit 307e380f30
15 changed files with 202 additions and 171 deletions

View file

@ -36,13 +36,16 @@ public:
infostream<<"SmokePuffCSO: constructing"<<std::endl;
m_spritenode = smgr->addBillboardSceneNode(
NULL, v2f(1,1), pos, -1);
m_spritenode->setMaterialTexture(0,
env->getGameDef()->tsrc()->getTextureForMesh("smoke_puff.png"));
m_spritenode->setMaterialFlag(video::EMF_LIGHTING, false);
m_spritenode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
//m_spritenode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
m_spritenode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
m_spritenode->setMaterialFlag(video::EMF_FOG_ENABLE, true);
video::ITexture *tex = env->getGameDef()->tsrc()->getTextureForMesh("smoke_puff.png");
m_spritenode->forEachMaterial([tex] (video::SMaterial &mat) {
mat.setTexture(0, tex);
mat.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
mat.Lighting = false;
mat.FogEnable = true;
mat.forEachTexture([] (video::SMaterialLayer &tex) {
tex.BilinearFilter = false;
});
});
m_spritenode->setColor(video::SColor(255,0,0,0));
m_spritenode->setVisible(true);
m_spritenode->setSize(size);