Add base for detail map with splatting

This commit is contained in:
Sam 2017-03-20 20:49:54 +01:00
parent 2a64ce94c8
commit 16c0736f8b
5 changed files with 17 additions and 8 deletions

View File

@ -221,6 +221,7 @@ Material::Material(const XMLNode *node, bool deprecated)
else if (s == "splatting")
{
m_shader_type = SHADERTYPE_SPLATTING;
node->get("hf-texture", &m_hf_texture);
node->get("splatting-texture-1", &m_splatting_texture_1);
node->get("splatting-texture-2", &m_splatting_texture_2);
node->get("splatting-texture-3", &m_splatting_texture_3);
@ -864,14 +865,17 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
}
m->setTexture(5, tex);
TexConfig s4tc(false/*srgb*/, false/*premul_alpha*/,
true/*mesh_tex*/, false/*set_material*/);
if (m_splatting_texture_4.size() > 0)
{
TexConfig s4tc(false/*srgb*/, false/*premul_alpha*/,
true/*mesh_tex*/, false/*set_material*/);
tex = stm->getTexture(m_splatting_texture_4, &s4tc);
}
m->setTexture(6, tex);
m->setTexture(7, glossytex);
tex = stm->getTexture(m_hf_texture, &s4tc);
m->setTexture(8, tex);
// Material and shaders
m->MaterialType = Shaders::getShader(ES_SPLATTING);

View File

@ -248,6 +248,9 @@ private:
std::string m_colorization_mask;
/** If m_splatting is true, indicates the high frequery texture */
std::string m_hf_texture;
/** If m_splatting is true, indicates the first splatting texture */
std::string m_splatting_texture_1;

View File

@ -223,7 +223,8 @@ SplattingShader::SplattingShader()
4, "tex_detail0", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "tex_detail1", ST_TRILINEAR_ANISOTROPIC_FILTERED,
6, "tex_detail2", ST_TRILINEAR_ANISOTROPIC_FILTERED,
7, "tex_detail3", ST_TRILINEAR_ANISOTROPIC_FILTERED);
7, "tex_detail3", ST_TRILINEAR_ANISOTROPIC_FILTERED,
8, "tex_hf", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // SplattingShader
// ============================================================================
@ -839,10 +840,10 @@ const std::tuple<size_t> DetailMat::RSMTextures = std::tuple<size_t>(0);
// ----------------------------------------------------------------------------
const std::tuple<size_t> SplattingMat::FirstPassTextures
= std::tuple<size_t>(7);
const std::tuple<size_t, size_t, size_t, size_t, size_t>
= std::tuple<size_t>(8);
const std::tuple<size_t, size_t, size_t, size_t, size_t, size_t>
SplattingMat::SecondPassTextures
= std::tuple<size_t, size_t, size_t, size_t, size_t>(1, 3, 4, 5, 6);
= std::tuple<size_t, size_t, size_t, size_t, size_t, size_t>(1, 3, 4, 5, 6, 7);
std::tuple<> SplattingMat::ShadowTextures;
const std::tuple<size_t, size_t, size_t, size_t, size_t>
SplattingMat::RSMTextures

View File

@ -140,7 +140,7 @@ public:
}; // InstancedSphereMapShader
// ============================================================================
class SplattingShader : public TextureShader<SplattingShader, 8, core::matrix4>
class SplattingShader : public TextureShader<SplattingShader, 9, core::matrix4>
{
public:
SplattingShader();
@ -679,7 +679,7 @@ struct SplattingMat
static const enum Material::ShaderType MaterialType
= Material::SHADERTYPE_SPLATTING;
static const std::tuple<size_t> FirstPassTextures;
static const std::tuple<size_t, size_t, size_t, size_t, size_t>
static const std::tuple<size_t, size_t, size_t, size_t, size_t, size_t>
SecondPassTextures;
static std::tuple<> ShadowTextures;
static const std::tuple<size_t, size_t, size_t, size_t, size_t>

View File

@ -461,6 +461,7 @@ void initTextures(GLMesh &mesh, Material::ShaderType mat)
setTexture(mesh, 5, true, getShaderTypeName(mat));
setTexture(mesh, 6, false, getShaderTypeName(mat));
setTexture(mesh, 7, false, getShaderTypeName(mat));
setTexture(mesh, 8, false, getShaderTypeName(mat));
break;
}
} // initTextures