1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-11-21 08:55:21 +01:00

Introduce EMT_INVALID as safe placeholder

This commit is contained in:
sfan5
2025-11-07 13:30:26 +01:00
parent fad3a0fa6d
commit c3790dd7af
8 changed files with 16 additions and 23 deletions

View File

@@ -599,14 +599,14 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
m_material_type = shader_source->getShaderInfo(shader_id).material;
} else {
// Not used, so make sure it's not valid
m_material_type = EMT_INVALID;
m_material_type = video::EMT_INVALID;
}
m_matrixnode = m_smgr->addDummyTransformationSceneNode();
m_matrixnode->grab();
auto setMaterial = [this] (video::SMaterial &mat) {
if (m_material_type != EMT_INVALID)
if (m_material_type != video::EMT_INVALID)
mat.MaterialType = m_material_type;
mat.FogEnable = true;
mat.forEachTexture([] (auto &tex) {

View File

@@ -74,7 +74,6 @@ struct MeshAnimationInfo {
class GenericCAO : public ClientActiveObject
{
private:
static constexpr auto EMT_INVALID = video::EMT_FORCE_32BIT;
// Only set at initialization
std::string m_name = "";
@@ -101,7 +100,7 @@ private:
std::vector<MeshAnimationInfo> m_meshnode_animation;
// Material
video::E_MATERIAL_TYPE m_material_type = EMT_INVALID;
video::E_MATERIAL_TYPE m_material_type = video::EMT_INVALID;
// Movement
v3f m_position = v3f(0.0f, 10.0f * BS, 0);

View File

@@ -640,7 +640,7 @@ void ShaderSource::rebuildShaders()
for (ShaderInfo &i : m_shaderinfo_cache) {
if (!i.name.empty()) {
gpu->deleteShaderMaterial(i.material);
i.material = video::EMT_SOLID; // invalidate
i.material = video::EMT_INVALID;
}
}

View File

@@ -229,9 +229,9 @@ using CachedStructPixelShaderSetting = CachedStructShaderSetting<T, count, cache
struct ShaderInfo {
std::string name;
video::E_MATERIAL_TYPE base_material = video::EMT_SOLID;
video::E_MATERIAL_TYPE base_material = video::EMT_INVALID;
// Material ID the shader has received from Irrlicht
video::E_MATERIAL_TYPE material = video::EMT_SOLID;
video::E_MATERIAL_TYPE material = video::EMT_INVALID;
// Input constants
ShaderConstants input_constants;
// Extra uniform callback