Fix material detection
This commit is contained in:
parent
273a2bf022
commit
69896fdc6a
@ -784,7 +784,6 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
// Material and shaders
|
||||
m->MaterialType = irr_driver->getShader(ES_NORMAL_MAP);
|
||||
m->setTexture(1, glossytex);
|
||||
m_shader_type = SHADERTYPE_NORMAL_MAP;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -796,7 +795,6 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
m->setTexture(2, m->getTexture(1));
|
||||
if (!m->getTexture(2))
|
||||
m->setTexture(2, getUnicolorTexture(SColor(255, 255, 255, 255)));
|
||||
m_shader_type = SHADERTYPE_DETAIL_MAP;
|
||||
}
|
||||
m->setTexture(1, glossytex);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ void STKAnimatedMesh::updateGL()
|
||||
if (!rnd->isTransparent())
|
||||
{
|
||||
Material* material = material_manager->getMaterialFor(mb->getMaterial().getTexture(0), mb);
|
||||
Material::ShaderType MatType = material->getShaderType();// MaterialTypeToMeshMaterial(type, mb->getVertexType(), material);
|
||||
Material::ShaderType MatType = MaterialTypeToMeshMaterial(type, mb->getVertexType(), material);
|
||||
InitTextures(mesh, MatType);
|
||||
}
|
||||
|
||||
|
@ -10,30 +10,21 @@
|
||||
#include "graphics/camera.hpp"
|
||||
#include "modes/world.hpp"
|
||||
|
||||
/*
|
||||
MeshMaterial MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE MaterialType, video::E_VERTEX_TYPE tp, Material* material)
|
||||
|
||||
Material::ShaderType MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE MaterialType, video::E_VERTEX_TYPE tp, Material* material)
|
||||
{
|
||||
switch (material->getShaderType())
|
||||
{
|
||||
case Material::SHADERTYPE_SPHERE_MAP:
|
||||
return MAT_SPHEREMAP;
|
||||
case Material::SHADERTYPE_ALPHA_TEST:
|
||||
return MAT_ALPHA_REF;
|
||||
case Material::SHADERTYPE_VEGETATION:
|
||||
return MAT_GRASS;
|
||||
case Material::SHADERTYPE_SPLATTING:
|
||||
return MAT_SPLATTING;
|
||||
case Material::SHADERTYPE_SOLID_UNLIT:
|
||||
return MAT_UNLIT;
|
||||
default:
|
||||
return material->getShaderType();
|
||||
case Material::SHADERTYPE_SOLID:
|
||||
if (MaterialType == irr_driver->getShader(ES_NORMAL_MAP))
|
||||
return MAT_NORMAL_MAP;
|
||||
return Material::SHADERTYPE_NORMAL_MAP;
|
||||
else if (tp == video::EVT_2TCOORDS)
|
||||
return MAT_DETAIL;
|
||||
return MAT_DEFAULT;
|
||||
return Material::SHADERTYPE_DETAIL_MAP;
|
||||
return Material::SHADERTYPE_SOLID;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
TransparentMaterial MaterialTypeToTransparentMaterial(video::E_MATERIAL_TYPE type, f32 MaterialTypeParam, Material* material)
|
||||
{
|
||||
@ -287,7 +278,7 @@ SetTexture(GLMesh &mesh, unsigned i, bool isSrgb)
|
||||
{
|
||||
if (!mesh.textures[i])
|
||||
{
|
||||
Log::warn("STKMesh", "Missing texture");
|
||||
Log::fatal("STKMesh", "Missing texture");
|
||||
return;
|
||||
}
|
||||
compressTexture(mesh.textures[i], isSrgb);
|
||||
|
@ -174,6 +174,7 @@ class ListDisplacement : public MiscList<ListDisplacement, GLMesh *, core::matri
|
||||
class ListInstancedGlow : public Singleton<ListInstancedGlow>, public std::vector<GLMesh *>
|
||||
{};
|
||||
|
||||
Material::ShaderType MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE MaterialType, video::E_VERTEX_TYPE tp, Material* material);
|
||||
TransparentMaterial MaterialTypeToTransparentMaterial(video::E_MATERIAL_TYPE, f32 MaterialTypeParam, Material* material);
|
||||
|
||||
void InitTextures(GLMesh &mesh, Material::ShaderType);
|
||||
|
@ -143,7 +143,7 @@ void STKMeshSceneNode::updateNoGL()
|
||||
else
|
||||
{
|
||||
assert(!isDisplacement);
|
||||
Material::ShaderType MatType = material->getShaderType();// MaterialTypeToMeshMaterial(type, mb->getVertexType(), material);
|
||||
Material::ShaderType MatType = MaterialTypeToMeshMaterial(type, mb->getVertexType(), material);
|
||||
if (!immediate_draw)
|
||||
MeshSolidMaterial[MatType].push_back(&mesh);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user