Add some fallback
This commit is contained in:
parent
e1c7efd68c
commit
a06d9e858b
@ -262,24 +262,36 @@ Material::Material(const XMLNode *node, bool deprecated)
|
||||
bool b = false;
|
||||
node->get("additive", &b);
|
||||
if (b)
|
||||
{
|
||||
m_shader_name = "alphablend";
|
||||
m_shader_type = SHADERTYPE_ADDITIVE;
|
||||
}
|
||||
|
||||
b = false;
|
||||
node->get("transparency", &b);
|
||||
if (b)
|
||||
{
|
||||
m_shader_name = "alphatest";
|
||||
m_shader_type = SHADERTYPE_ALPHA_TEST;
|
||||
}
|
||||
|
||||
//node->get("lightmap", &m_lightmap);
|
||||
|
||||
b = false;
|
||||
node->get("alpha", &b);
|
||||
if (b)
|
||||
{
|
||||
m_shader_name = "alphablend";
|
||||
m_shader_type = SHADERTYPE_ALPHA_BLEND;
|
||||
}
|
||||
|
||||
b = true;
|
||||
node->get("light", &b);
|
||||
if (!b)
|
||||
{
|
||||
m_shader_name = "unlit";
|
||||
m_shader_type = SHADERTYPE_SOLID_UNLIT;
|
||||
}
|
||||
|
||||
b = false;
|
||||
node->get("smooth-reflection", &b);
|
||||
@ -289,10 +301,26 @@ Material::Material(const XMLNode *node, bool deprecated)
|
||||
|
||||
if (node->get("compositing", &s))
|
||||
{
|
||||
if (s == "blend") m_shader_type = SHADERTYPE_ALPHA_BLEND;
|
||||
else if (s == "test") m_shader_type = SHADERTYPE_ALPHA_TEST;
|
||||
else if (s == "additive") m_shader_type = SHADERTYPE_ADDITIVE;
|
||||
else if (s == "coverage") m_shader_type = SHADERTYPE_ALPHA_TEST;
|
||||
if (s == "blend")
|
||||
{
|
||||
m_shader_name = "alphablend";
|
||||
m_shader_type = SHADERTYPE_ALPHA_BLEND;
|
||||
}
|
||||
else if (s == "test")
|
||||
{
|
||||
m_shader_name = "alphatest";
|
||||
m_shader_type = SHADERTYPE_ALPHA_TEST;
|
||||
}
|
||||
else if (s == "additive")
|
||||
{
|
||||
m_shader_name = "additive";
|
||||
m_shader_type = SHADERTYPE_ADDITIVE;
|
||||
}
|
||||
else if (s == "coverage")
|
||||
{
|
||||
m_shader_name = "alphatest";
|
||||
m_shader_type = SHADERTYPE_ALPHA_TEST;
|
||||
}
|
||||
else if (s != "none")
|
||||
Log::warn("material", "Unknown compositing mode '%s'", s.c_str());
|
||||
}
|
||||
@ -380,7 +408,10 @@ Material::Material(const XMLNode *node, bool deprecated)
|
||||
// ---- End backwards compatibility
|
||||
}
|
||||
|
||||
m_shader_name = s.empty() ? "solid" : s;
|
||||
if (m_shader_name == "solid" && !s.empty())
|
||||
{
|
||||
m_shader_name = s;
|
||||
}
|
||||
if (m_shader_name == "solid")
|
||||
{
|
||||
if (!normal_map_tex.empty())
|
||||
|
@ -49,19 +49,15 @@ public:
|
||||
enum ShaderType
|
||||
{
|
||||
SHADERTYPE_SOLID = 0,
|
||||
SHADERTYPE_SOLID_SKINNED_MESH,
|
||||
SHADERTYPE_ALPHA_TEST,
|
||||
SHADERTYPE_ALPHA_TEST_SKINNED_MESH,
|
||||
SHADERTYPE_ALPHA_BLEND,
|
||||
SHADERTYPE_ADDITIVE,
|
||||
SHADERTYPE_SOLID_UNLIT,
|
||||
SHADERTYPE_SOLID_UNLIT_SKINNED_MESH,
|
||||
/** Effect that makes grass wave as in the wind */
|
||||
SHADERTYPE_VEGETATION,
|
||||
SHADERTYPE_WATER,
|
||||
SHADERTYPE_SPHERE_MAP,
|
||||
SHADERTYPE_NORMAL_MAP,
|
||||
SHADERTYPE_NORMAL_MAP_SKINNED_MESH,
|
||||
SHADERTYPE_DETAIL_MAP,
|
||||
SHADERTYPE_SPLATTING,
|
||||
SHADERTYPE_COUNT,
|
||||
|
Loading…
Reference in New Issue
Block a user