Try to reduce the header size of materials.hpp

Plus header clean up
This commit is contained in:
Benau 2016-12-23 14:44:18 +08:00
parent d932451295
commit 31f2a720ca
19 changed files with 1688 additions and 1503 deletions

View File

@ -24,6 +24,7 @@
#include "graphics/lod_node.hpp"
#include "graphics/materials.hpp"
#include "graphics/shadow_matrices.hpp"
#include "graphics/shaders.hpp"
#include "graphics/stk_animated_mesh.hpp"
#include "graphics/stk_billboard.hpp"
#include "graphics/stk_mesh.hpp"

View File

@ -22,7 +22,6 @@
#include "config/user_config.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/particle_emitter.hpp"
#include "graphics/shaders.hpp"
#include "graphics/shared_gpu_objects.hpp"
#include "graphics/texture_manager.hpp"
#include "graphics/texture_shader.hpp"

View File

@ -312,15 +312,15 @@ public:
std::unique_ptr<RenderTarget> createRenderTarget(const irr::core::dimension2du &dimension,
const std::string &name);
#endif
// ------------------------------------------------------------------------
/** Returns the color to clear the back buffer. */
const irr::video::SColor& getClearColor() const { return m_clear_color; }
// ------------------------------------------------------------------------
/** Sets the color to use when clearing the back buffer. */
void setClearbackBufferColor(irr::video::SColor color)
{
m_clear_color = color;
} // setClearbackBufferColor
// ------------------------------------------------------------------------
/** Returns the color to clear the back buffer. */
const irr::video::SColor& getClearColor() const { return m_clear_color; }
// ------------------------------------------------------------------------
/** Sets the color to use when clearing the back buffer. */
void setClearbackBufferColor(irr::video::SColor color)
{
m_clear_color = color;
} // setClearbackBufferColor
// ------------------------------------------------------------------------
/** Convenience function that loads a texture with default parameters

File diff suppressed because it is too large Load Diff

View File

@ -16,9 +16,732 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "graphics/materials.hpp"
#include "graphics/vao_manager.hpp"
#ifndef SERVER_ONLY
// ============================================================================
// Solid Normal and depth pass shaders
ObjectPass1Shader::ObjectPass1Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
GL_FRAGMENT_SHADER, "object_pass1.frag");
assignUniforms("ModelMatrix", "InverseModelMatrix");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // ObjectPass1Shader
// ============================================================================
// Solid Lit pass shaders
ObjectPass2Shader::ObjectPass2Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
GL_FRAGMENT_SHADER, "object_pass2.frag");
assignUniforms("ModelMatrix", "texture_trans", "color_change");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "colorization_mask",
ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // ObjectPass2Shader
// ============================================================================
InstancedObjectPass1Shader::InstancedObjectPass1Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "instanced_object_pass1.frag");
assignUniforms();
assignSamplerNames(0, "glosstex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedObjectPass1Shader
// ============================================================================
InstancedObjectRefPass1Shader::InstancedObjectRefPass1Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "instanced_objectref_pass1.frag");
assignUniforms();
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED,
1, "glosstex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedObjectRefPass1Shader
// ============================================================================
ObjectRefPass2Shader::ObjectRefPass2Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
GL_FRAGMENT_SHADER, "objectref_pass2.frag");
assignUniforms("ModelMatrix", "texture_trans", "color_change");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "colorization_mask",
ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // ObjectRefPass2Shader
// ============================================================================
InstancedObjectPass2Shader::InstancedObjectPass2Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "instanced_object_pass2.frag");
assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "colorization_mask",
ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedObjectPass2Shader
// ============================================================================
InstancedObjectRefPass2Shader::InstancedObjectRefPass2Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "instanced_objectref_pass2.frag");
assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "colorization_mask",
ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedObjectRefPass2Shader
// ============================================================================
ShadowShader::ShadowShader()
{
#if !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150)
return;
if (CVS->isAMDVertexShaderLayerUsable())
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "shadow.vert",
GL_FRAGMENT_SHADER, "shadow.frag");
}
else
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "shadow.vert",
GL_GEOMETRY_SHADER, "shadow.geom",
GL_FRAGMENT_SHADER, "shadow.frag");
}
assignUniforms("ModelMatrix", "layer");
#endif
} // ShadowShader
// ============================================================================
InstancedShadowShader::InstancedShadowShader()
{
#if !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150)
return;
if (CVS->isAMDVertexShaderLayerUsable())
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_shadow.vert",
GL_FRAGMENT_SHADER, "shadow.frag");
}
else
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_shadow.vert",
GL_GEOMETRY_SHADER, "instanced_shadow.geom",
GL_FRAGMENT_SHADER, "shadow.frag");
}
assignUniforms("layer");
#endif
} // InstancedShadowShader
// ============================================================================
CRSMShader::CRSMShader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "rsm.vert",
GL_FRAGMENT_SHADER, "rsm.frag");
assignUniforms("ModelMatrix", "texture_trans", "RSMMatrix");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // CRSMShader
// ============================================================================
SplattingRSMShader::SplattingRSMShader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "rsm.vert",
GL_FRAGMENT_SHADER, "splatting_rsm.frag");
assignUniforms("ModelMatrix", "RSMMatrix");
assignSamplerNames(0, "tex_layout", ST_TRILINEAR_ANISOTROPIC_FILTERED,
1, "tex_detail0", ST_TRILINEAR_ANISOTROPIC_FILTERED,
2, "tex_detail1", ST_TRILINEAR_ANISOTROPIC_FILTERED,
3, "tex_detail2", ST_TRILINEAR_ANISOTROPIC_FILTERED,
4, "tex_detail3", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // SplattingRSMShader
// ============================================================================
CInstancedRSMShader::CInstancedRSMShader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_rsm.vert",
GL_FRAGMENT_SHADER, "instanced_rsm.frag");
assignUniforms("RSMMatrix");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // CInstancedRSMShader
// ============================================================================
SphereMapShader::SphereMapShader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
GL_FRAGMENT_SHADER, "objectpass_spheremap.frag");
assignUniforms("ModelMatrix", "InverseModelMatrix");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // SphereMapShader
// ============================================================================
InstancedSphereMapShader::InstancedSphereMapShader()
{
loadProgram(OBJECT,
GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "instanced_objectpass_spheremap.frag");
assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedSphereMapShader
// ============================================================================
SplattingShader::SplattingShader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
GL_FRAGMENT_SHADER, "splatting.frag");
assignUniforms("ModelMatrix");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "tex_layout", ST_TRILINEAR_ANISOTROPIC_FILTERED,
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);
} // SplattingShader
// ============================================================================
ObjectRefPass1Shader::ObjectRefPass1Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
GL_FRAGMENT_SHADER, "objectref_pass1.frag");
assignUniforms("ModelMatrix", "InverseModelMatrix", "texture_trans");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED,
1, "glosstex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // ObjectRefPass1Shader
// ============================================================================
NormalMapShader::NormalMapShader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
GL_FRAGMENT_SHADER, "normalmap.frag");
assignUniforms("ModelMatrix", "InverseModelMatrix");
assignSamplerNames(0, "normalMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
1, "glossMap", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // NormalMapShader
// ============================================================================
InstancedNormalMapShader::InstancedNormalMapShader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "instanced_normalmap.frag");
assignUniforms();
assignSamplerNames(0, "normalMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
1, "glossMap", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedNormalMapShader
// ============================================================================
ObjectUnlitShader::ObjectUnlitShader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
GL_FRAGMENT_SHADER, "object_unlit.frag");
assignUniforms("ModelMatrix", "texture_trans");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // ObjectUnlitShader
// ============================================================================
InstancedObjectUnlitShader::InstancedObjectUnlitShader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "instanced_object_unlit.frag");
assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedObjectUnlitShader
// ============================================================================
RefShadowShader::RefShadowShader()
{
#if !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150)
return;
if (CVS->isAMDVertexShaderLayerUsable())
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "shadow.vert",
GL_FRAGMENT_SHADER, "shadowref.frag");
}
else
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "shadow.vert",
GL_GEOMETRY_SHADER, "shadow.geom",
GL_FRAGMENT_SHADER, "shadowref.frag");
}
assignUniforms("ModelMatrix", "layer");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
#endif
} // RefShadowShader
// ============================================================================
InstancedRefShadowShader::InstancedRefShadowShader()
{
#if !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150)
return;
if (CVS->isAMDVertexShaderLayerUsable())
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_shadow.vert",
GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
}
else
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_shadow.vert",
GL_GEOMETRY_SHADER, "instanced_shadow.geom",
GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
}
assignUniforms("layer");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
#endif
} // InstancedRefShadowShader
// ============================================================================
DisplaceMaskShader::DisplaceMaskShader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "displace.vert",
GL_FRAGMENT_SHADER, "white.frag");
assignUniforms("ModelMatrix");
} // DisplaceMaskShader
// ============================================================================
DisplaceShader::DisplaceShader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "displace.vert",
GL_FRAGMENT_SHADER, "displace.frag");
assignUniforms("ModelMatrix", "dir", "dir2");
assignSamplerNames(0, "displacement_tex", ST_BILINEAR_FILTERED,
1, "color_tex", ST_BILINEAR_FILTERED,
2, "mask_tex", ST_BILINEAR_FILTERED,
3, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // DisplaceShader
// ============================================================================
NormalVisualizer::NormalVisualizer()
{
#if !defined(USE_GLES2)
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_GEOMETRY_SHADER, "normal_visualizer.geom",
GL_FRAGMENT_SHADER, "coloredquad.frag");
assignUniforms("color");
#endif
} // NormalVisualizer
// ============================================================================
GrassPass1Shader::GrassPass1Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "grass_pass.vert",
GL_FRAGMENT_SHADER, "objectref_pass1.frag");
assignUniforms("ModelMatrix", "InverseModelMatrix", "windDir");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED,
1, "glosstex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // GrassPass1Shader
// ============================================================================
InstancedGrassPass1Shader::InstancedGrassPass1Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_grass.vert",
GL_FRAGMENT_SHADER, "instanced_objectref_pass1.frag");
assignUniforms("windDir");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED,
1, "glosstex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedGrassPass1Shader
// ============================================================================
GrassShadowShader::GrassShadowShader()
{
#if !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150)
return;
if (CVS->isAMDVertexShaderLayerUsable())
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "shadow_grass.vert",
GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
}
else
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "shadow_grass.vert",
GL_GEOMETRY_SHADER, "shadow.geom",
GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
}
assignUniforms("ModelMatrix", "windDir", "layer");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
#endif
} // GrassShadowShader
// ============================================================================
InstancedGrassShadowShader::InstancedGrassShadowShader()
{
#if !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150)
return;
if (CVS->isAMDVertexShaderLayerUsable())
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_grassshadow.vert",
GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
}
else
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_grassshadow.vert",
GL_GEOMETRY_SHADER, "instanced_shadow.geom",
GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
}
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
assignUniforms("layer", "windDir");
#endif
} // InstancedGrassShadowShader
// ============================================================================
GrassPass2Shader::GrassPass2Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "grass_pass.vert",
GL_FRAGMENT_SHADER, "grass_pass2.frag");
assignUniforms("ModelMatrix", "windDir", "color_change");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "dtex", ST_NEAREST_FILTERED,
4, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
6, "colorization_mask",
ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // GrassPass2Shader
// ============================================================================
InstancedGrassPass2Shader::InstancedGrassPass2Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_grass.vert",
GL_FRAGMENT_SHADER, "instanced_grass_pass2.frag");
assignUniforms("windDir");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "dtex", ST_NEAREST_FILTERED,
4, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
6, "colorization_mask",
ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedGrassPass2Shader
// ============================================================================
DetailedObjectPass2Shader::DetailedObjectPass2Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
GL_FRAGMENT_SHADER, "detailed_object_pass2.frag");
assignUniforms("ModelMatrix");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
4, "Detail", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // DetailedObjectPass2Shader
// ============================================================================
InstancedDetailedObjectPass2Shader::InstancedDetailedObjectPass2Shader()
{
loadProgram(OBJECT,
GL_VERTEX_SHADER, "instanced_object_pass.vert",
GL_FRAGMENT_SHADER, "instanced_detailed_object_pass2.frag");
assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
4, "Detail", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedDetailedObjectPass2Shader
// ============================================================================
SkinnedPass1Shader::SkinnedPass1Shader()
{
if (!CVS->supportsHardwareSkinning()) return;
loadProgram(SKINNED_MESH, GL_VERTEX_SHADER, "skinning.vert",
GL_FRAGMENT_SHADER, "object_pass1.frag");
assignUniforms("ModelMatrix", "InverseModelMatrix", "skinning_offset");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // SkinnedPass1Shader
// ============================================================================
InstancedSkinnedPass1Shader::InstancedSkinnedPass1Shader()
{
if (!CVS->supportsHardwareSkinning()) return;
loadProgram(SKINNED_MESH,
GL_VERTEX_SHADER, "instanced_skinning.vert",
GL_FRAGMENT_SHADER, "instanced_object_pass1.frag");
assignUniforms();
assignSamplerNames(0, "glosstex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedSkinnedPass1Shader
// ============================================================================
SkinnedPass2Shader::SkinnedPass2Shader()
{
if (!CVS->supportsHardwareSkinning()) return;
loadProgram(SKINNED_MESH, GL_VERTEX_SHADER, "skinning.vert",
GL_FRAGMENT_SHADER, "object_pass2.frag");
assignUniforms("ModelMatrix", "texture_trans", "color_change",
"skinning_offset");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "colorization_mask",
ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // SkinnedPass2Shader
// ============================================================================
InstancedSkinnedPass2Shader::InstancedSkinnedPass2Shader()
{
if (!CVS->supportsHardwareSkinning()) return;
loadProgram(SKINNED_MESH,
GL_VERTEX_SHADER, "instanced_skinning.vert",
GL_FRAGMENT_SHADER, "instanced_object_pass2.frag");
assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "colorization_mask",
ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedSkinnedPass2Shader
// ============================================================================
SkinnedRefPass1Shader::SkinnedRefPass1Shader()
{
if (!CVS->supportsHardwareSkinning()) return;
loadProgram(SKINNED_MESH, GL_VERTEX_SHADER, "skinning.vert",
GL_FRAGMENT_SHADER, "objectref_pass1.frag");
assignUniforms("ModelMatrix", "InverseModelMatrix", "texture_trans",
"skinning_offset");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED,
1, "glosstex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // SkinnedRefPass1Shader
// ============================================================================
InstancedSkinnedRefPass1Shader::InstancedSkinnedRefPass1Shader()
{
if (!CVS->supportsHardwareSkinning()) return;
loadProgram(SKINNED_MESH,
GL_VERTEX_SHADER, "instanced_skinning.vert",
GL_FRAGMENT_SHADER, "instanced_objectref_pass1.frag");
assignUniforms();
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED,
1, "glosstex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedSkinnedRefPass1Shader
// ============================================================================
SkinnedRefPass2Shader::SkinnedRefPass2Shader()
{
if (!CVS->supportsHardwareSkinning()) return;
loadProgram(SKINNED_MESH, GL_VERTEX_SHADER, "skinning.vert",
GL_FRAGMENT_SHADER, "objectref_pass2.frag");
assignUniforms("ModelMatrix", "texture_trans", "color_change",
"skinning_offset");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "colorization_mask",
ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // SkinnedRefPass2Shader
// ============================================================================
InstancedSkinnedRefPass2Shader::InstancedSkinnedRefPass2Shader()
{
if (!CVS->supportsHardwareSkinning()) return;
loadProgram(SKINNED_MESH,
GL_VERTEX_SHADER, "instanced_skinning.vert",
GL_FRAGMENT_SHADER, "instanced_objectref_pass2.frag");
assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "colorization_mask",
ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedSkinnedRefPass2Shader
// ============================================================================
SkinnedUnlitShader::SkinnedUnlitShader()
{
if (!CVS->supportsHardwareSkinning()) return;
loadProgram(SKINNED_MESH, GL_VERTEX_SHADER, "skinning.vert",
GL_FRAGMENT_SHADER, "object_unlit.frag");
assignUniforms("ModelMatrix", "texture_trans", "skinning_offset");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // SkinnedUnlitShader
// ============================================================================
InstancedSkinnedUnlitShader::InstancedSkinnedUnlitShader()
{
if (!CVS->supportsHardwareSkinning()) return;
loadProgram(SKINNED_MESH,
GL_VERTEX_SHADER, "instanced_skinning.vert",
GL_FRAGMENT_SHADER, "instanced_object_unlit.frag");
assignUniforms();
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedSkinnedUnlitShader
// ============================================================================
SkinnedNormalMapShader::SkinnedNormalMapShader()
{
if (!CVS->supportsHardwareSkinning()) return;
loadProgram(SKINNED_MESH, GL_VERTEX_SHADER, "skinning.vert",
GL_FRAGMENT_SHADER, "normalmap.frag");
assignUniforms("ModelMatrix", "InverseModelMatrix", "skinning_offset");
assignSamplerNames(0, "normalMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
1, "glossMap", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // SkinnedNormalMapShader
// ============================================================================
InstancedSkinnedNormalMapShader::InstancedSkinnedNormalMapShader()
{
if (!CVS->supportsHardwareSkinning()) return;
loadProgram(SKINNED_MESH, GL_VERTEX_SHADER, "instanced_skinning.vert",
GL_FRAGMENT_SHADER, "instanced_normalmap.frag");
assignUniforms();
assignSamplerNames(0, "normalMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
1, "glossMap", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // InstancedSkinnedNormalMapShader
// ============================================================================
SkinnedShadowShader::SkinnedShadowShader()
{
#if !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150 || !CVS->supportsHardwareSkinning())
return;
if (CVS->isAMDVertexShaderLayerUsable())
{
loadProgram(SKINNED_MESH, GL_VERTEX_SHADER, "skinning_shadow.vert",
GL_FRAGMENT_SHADER, "shadow.frag");
}
else
{
loadProgram(SKINNED_MESH, GL_VERTEX_SHADER, "skinning_shadow.vert",
GL_GEOMETRY_SHADER, "shadow.geom",
GL_FRAGMENT_SHADER, "shadow.frag");
}
assignUniforms("ModelMatrix", "skinning_offset", "layer");
#endif
} // SkinnedShadowShader
// ============================================================================
InstancedSkinnedShadowShader::InstancedSkinnedShadowShader()
{
#if !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150 || !CVS->supportsHardwareSkinning())
return;
if (CVS->isAMDVertexShaderLayerUsable())
{
loadProgram(SKINNED_MESH,
GL_VERTEX_SHADER, "instanced_skinning_shadow.vert",
GL_FRAGMENT_SHADER, "shadow.frag");
}
else
{
loadProgram(SKINNED_MESH,
GL_VERTEX_SHADER, "instanced_skinning_shadow.vert",
GL_GEOMETRY_SHADER, "instanced_shadow.geom",
GL_FRAGMENT_SHADER, "shadow.frag");
}
assignUniforms("layer");
#endif
} // InstancedSkinnedShadowShader
// ============================================================================
SkinnedRefShadowShader::SkinnedRefShadowShader()
{
#if !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150 || !CVS->supportsHardwareSkinning())
return;
if (CVS->isAMDVertexShaderLayerUsable())
{
loadProgram(SKINNED_MESH, GL_VERTEX_SHADER, "skinning_shadow.vert",
GL_FRAGMENT_SHADER, "shadowref.frag");
}
else
{
loadProgram(SKINNED_MESH, GL_VERTEX_SHADER, "skinning_shadow.vert",
GL_GEOMETRY_SHADER, "shadow.geom",
GL_FRAGMENT_SHADER, "shadowref.frag");
}
assignUniforms("ModelMatrix", "skinning_offset", "layer");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
#endif
} // SkinnedRefShadowShader
// ============================================================================
InstancedSkinnedRefShadowShader::InstancedSkinnedRefShadowShader()
{
#if !defined(USE_GLES2)
// Geometry shader needed
if (CVS->getGLSLVersion() < 150 || !CVS->supportsHardwareSkinning())
return;
if (CVS->isAMDVertexShaderLayerUsable())
{
loadProgram(SKINNED_MESH,
GL_VERTEX_SHADER, "instanced_skinning_shadow.vert",
GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
}
else
{
loadProgram(SKINNED_MESH,
GL_VERTEX_SHADER, "instanced_skinning_shadow.vert",
GL_GEOMETRY_SHADER, "instanced_shadow.geom",
GL_FRAGMENT_SHADER, "instanced_shadowref.frag");
}
assignUniforms("layer");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
#endif
} // InstancedSkinnedRefShadowShader
// ============================================================================
const InstanceType SkinnedSolid::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t> SkinnedSolid::FirstPassTextures
= STK::Tuple<size_t>(1);
const STK::Tuple<size_t, size_t, size_t> SkinnedSolid::SecondPassTextures
@ -27,21 +750,27 @@ const STK::Tuple<> SkinnedSolid::ShadowTextures;
const STK::Tuple<size_t> SkinnedSolid::RSMTextures = STK::Tuple<size_t>(0);
// ----------------------------------------------------------------------------
const InstanceType SkinnedAlphaRef::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t, size_t> SkinnedAlphaRef::FirstPassTextures
= STK::Tuple<size_t, size_t>(0, 1);
const STK::Tuple<size_t, size_t, size_t> SkinnedAlphaRef::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t>(0, 1, 2);
const STK::Tuple<size_t> SkinnedAlphaRef::ShadowTextures = STK::Tuple<size_t>(0);
const STK::Tuple<size_t> SkinnedAlphaRef::ShadowTextures
= STK::Tuple<size_t>(0);
const STK::Tuple<size_t> SkinnedAlphaRef::RSMTextures = STK::Tuple<size_t>(0);
// ----------------------------------------------------------------------------
const InstanceType SkinnedUnlitMat::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t, size_t> SkinnedUnlitMat::FirstPassTextures
= STK::Tuple<size_t, size_t>(0, 1);
const STK::Tuple<size_t> SkinnedUnlitMat::SecondPassTextures = STK::Tuple<size_t>(0);
const STK::Tuple<size_t> SkinnedUnlitMat::ShadowTextures = STK::Tuple<size_t>(0);
const STK::Tuple<size_t> SkinnedUnlitMat::SecondPassTextures
= STK::Tuple<size_t>(0);
const STK::Tuple<size_t> SkinnedUnlitMat::ShadowTextures
= STK::Tuple<size_t>(0);
const STK::Tuple<size_t> SkinnedUnlitMat::RSMTextures = STK::Tuple<size_t>(0);
// ----------------------------------------------------------------------------
const InstanceType SkinnedNormalMat::Instance = InstanceTypeFourTex;
const STK::Tuple<size_t, size_t> SkinnedNormalMat::FirstPassTextures
= STK::Tuple<size_t, size_t>(3, 1);
const STK::Tuple<size_t, size_t, size_t> SkinnedNormalMat::SecondPassTextures
@ -50,6 +779,7 @@ const STK::Tuple<> SkinnedNormalMat::ShadowTextures;
const STK::Tuple<size_t> SkinnedNormalMat::RSMTextures = STK::Tuple<size_t>(0);
// ----------------------------------------------------------------------------
const InstanceType DefaultMaterial::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t> DefaultMaterial::FirstPassTextures
= STK::Tuple<size_t>(1);
const STK::Tuple<size_t, size_t, size_t> DefaultMaterial::SecondPassTextures
@ -58,6 +788,7 @@ const STK::Tuple<> DefaultMaterial::ShadowTextures;
const STK::Tuple<size_t> DefaultMaterial::RSMTextures = STK::Tuple<size_t>(0);
// ----------------------------------------------------------------------------
const InstanceType AlphaRef::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t, size_t> AlphaRef::FirstPassTextures
= STK::Tuple<size_t, size_t>(0, 1);
const STK::Tuple<size_t, size_t, size_t> AlphaRef::SecondPassTextures
@ -66,12 +797,14 @@ const STK::Tuple<size_t> AlphaRef::ShadowTextures = STK::Tuple<size_t>(0);
const STK::Tuple<size_t> AlphaRef::RSMTextures = STK::Tuple<size_t>(0);
// ----------------------------------------------------------------------------
const InstanceType SphereMap::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t> SphereMap::FirstPassTextures = STK::Tuple<size_t>(1);
const STK::Tuple<size_t> SphereMap::SecondPassTextures = STK::Tuple<size_t>(0);
const STK::Tuple<> SphereMap::ShadowTextures;
const STK::Tuple<size_t> SphereMap::RSMTextures = STK::Tuple<size_t>(0);
// ----------------------------------------------------------------------------
const InstanceType UnlitMat::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t, size_t> UnlitMat::FirstPassTextures
= STK::Tuple<size_t, size_t>(0, 1);
const STK::Tuple<size_t> UnlitMat::SecondPassTextures = STK::Tuple<size_t>(0);
@ -79,6 +812,7 @@ const STK::Tuple<size_t> UnlitMat::ShadowTextures = STK::Tuple<size_t>(0);
const STK::Tuple<size_t> UnlitMat::RSMTextures = STK::Tuple<size_t>(0);
// ----------------------------------------------------------------------------
const InstanceType GrassMat::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t, size_t> GrassMat::FirstPassTextures
= STK::Tuple<size_t, size_t>(0, 1);
const STK::Tuple<size_t, size_t, size_t> GrassMat::SecondPassTextures
@ -87,6 +821,7 @@ const STK::Tuple<size_t> GrassMat::ShadowTextures = STK::Tuple<size_t>(0);
const STK::Tuple<size_t> GrassMat::RSMTextures = STK::Tuple<size_t>(0);
// ----------------------------------------------------------------------------
const InstanceType NormalMat::Instance = InstanceTypeFourTex;
const STK::Tuple<size_t, size_t> NormalMat::FirstPassTextures
= STK::Tuple<size_t, size_t>(3, 1);
const STK::Tuple<size_t, size_t, size_t> NormalMat::SecondPassTextures
@ -95,6 +830,7 @@ const STK::Tuple<> NormalMat::ShadowTextures;
const STK::Tuple<size_t> NormalMat::RSMTextures = STK::Tuple<size_t>(0);
// ----------------------------------------------------------------------------
const InstanceType DetailMat::Instance = InstanceTypeFourTex;
const STK::Tuple<size_t> DetailMat::FirstPassTextures = STK::Tuple<size_t>(1);
const STK::Tuple<size_t, size_t, size_t> DetailMat::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t>(0, 3, 1);
@ -102,12 +838,15 @@ const STK::Tuple<> DetailMat::ShadowTextures;
const STK::Tuple<size_t> DetailMat::RSMTextures = STK::Tuple<size_t>(0);
// ----------------------------------------------------------------------------
const STK::Tuple<size_t> SplattingMat::FirstPassTextures = STK::Tuple<size_t>(7);
const STK::Tuple<size_t> SplattingMat::FirstPassTextures
= STK::Tuple<size_t>(7);
const STK::Tuple<size_t, size_t, size_t, size_t, size_t>
SplattingMat::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t, size_t, size_t>(1, 3, 4, 5, 6);
SplattingMat::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t, size_t, size_t>(1, 3, 4, 5, 6);
const STK::Tuple<> SplattingMat::ShadowTextures;
const STK::Tuple<size_t, size_t, size_t, size_t, size_t> SplattingMat::RSMTextures
const STK::Tuple<size_t, size_t, size_t, size_t, size_t>
SplattingMat::RSMTextures
= STK::Tuple<size_t, size_t, size_t, size_t, size_t>(1, 3, 4, 5, 6);
// ----------------------------------------------------------------------------
#endif

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,6 @@
#include "graphics/material.hpp"
#include "graphics/material_manager.hpp"
#include "graphics/particle_kind.hpp"
#include "graphics/shaders.hpp"
#include "graphics/wind.hpp"
#include "io/file_manager.hpp"
#include "tracks/track.hpp"

View File

@ -22,7 +22,7 @@
#include "config/user_config.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/glwrap.hpp"
#include "graphics/shaders.hpp"
#include "graphics/materials.hpp"
#include "utils/log.hpp"
static GLuint generateRTT3D(GLenum target, size_t w, size_t h, size_t d, GLint internalFormat, GLint format, GLint type, unsigned mipmaplevel = 1)
@ -299,22 +299,22 @@ RTT::RTT(size_t width, size_t height)
{
uint64_t handle =
glGetTextureSamplerHandleARB(getRenderTarget(RTT_DIFFUSE),
Shaders::ObjectPass2Shader::getInstance()->m_sampler_ids[0]);
ObjectPass2Shader::getInstance()->m_sampler_ids[0]);
glMakeTextureHandleResidentARB(handle);
m_prefilled_handles.push_back(handle);
handle =
glGetTextureSamplerHandleARB(getRenderTarget(RTT_SPECULAR),
Shaders::ObjectPass2Shader::getInstance()->m_sampler_ids[1]);
ObjectPass2Shader::getInstance()->m_sampler_ids[1]);
glMakeTextureHandleResidentARB(handle);
m_prefilled_handles.push_back(handle);
handle =
glGetTextureSamplerHandleARB(getRenderTarget(RTT_HALF1_R),
Shaders::ObjectPass2Shader::getInstance()->m_sampler_ids[2]);
ObjectPass2Shader::getInstance()->m_sampler_ids[2]);
glMakeTextureHandleResidentARB(handle);
m_prefilled_handles.push_back(handle);
handle =
glGetTextureSamplerHandleARB(getDepthStencilTexture(),
Shaders::ObjectPass2Shader::getInstance()->m_sampler_ids[3]);
ObjectPass2Shader::getInstance()->m_sampler_ids[3]);
glMakeTextureHandleResidentARB(handle);
m_prefilled_handles.push_back(handle);
}

View File

@ -273,31 +273,6 @@ void Shaders::check(const int num)
}
} // check
// ============================================================================
// Solid Normal and depth pass shaders
Shaders::ObjectPass1Shader::ObjectPass1Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
GL_FRAGMENT_SHADER, "object_pass1.frag");
assignUniforms("ModelMatrix", "InverseModelMatrix");
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // ObjectPass1Shader
// ============================================================================
// Solid Lit pass shaders
Shaders::ObjectPass2Shader::ObjectPass2Shader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "object_pass.vert",
GL_FRAGMENT_SHADER, "object_pass2.frag");
assignUniforms("ModelMatrix", "texture_trans", "color_change");
assignSamplerNames(0, "DiffuseMap", ST_NEAREST_FILTERED,
1, "SpecularMap", ST_NEAREST_FILTERED,
2, "SSAO", ST_BILINEAR_FILTERED,
3, "Albedo", ST_TRILINEAR_ANISOTROPIC_FILTERED,
4, "SpecMap", ST_TRILINEAR_ANISOTROPIC_FILTERED,
5, "colorization_mask", ST_TRILINEAR_ANISOTROPIC_FILTERED);
} // ObjectPass2Shader
// ============================================================================
Shaders::SkinnedTransparentShader::SkinnedTransparentShader()
{

View File

@ -137,23 +137,6 @@ public:
public:
TransparentFogShader();
}; // TransparentFogShader
// ========================================================================
class ObjectPass1Shader : public TextureShader<ObjectPass1Shader, 1,
core::matrix4, core::matrix4>
{
public:
ObjectPass1Shader();
}; // ObjectPass1Shader
// ========================================================================
class ObjectPass2Shader : public TextureShader < ObjectPass2Shader, 6,
core::matrix4, core::vector2df,
core::vector2df >
{
public:
ObjectPass2Shader();
}; // ObjectPass2Shader
// ========================================================================
class SkinnedTransparentShader : public TextureShader<SkinnedTransparentShader, 1,
core::matrix4, core::vector2df,

View File

@ -25,8 +25,8 @@
#include "graphics/irr_driver.hpp"
#include "graphics/post_processing.hpp"
#include "graphics/rtts.hpp"
#include "graphics/shaders.hpp"
#include "graphics/shared_gpu_objects.hpp"
#include "graphics/texture_shader.hpp"
#include "modes/world.hpp"
#include "physics/triangle_mesh.hpp"
#include "tracks/track.hpp"

View File

@ -20,8 +20,7 @@
#include "graphics/skybox.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/shaders.hpp"
#include "graphics/texture_shader.hpp"
#include <algorithm>
#include <cassert>

View File

@ -22,9 +22,9 @@
#include "graphics/irr_driver.hpp"
#include "graphics/material.hpp"
#include "graphics/material_manager.hpp"
#include "graphics/shaders.hpp"
#include "graphics/shared_gpu_objects.hpp"
#include "graphics/texture_manager.hpp"
#include "graphics/texture_shader.hpp"
#include <ISceneManager.h>

View File

@ -23,6 +23,7 @@
#include "graphics/central_settings.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/material_manager.hpp"
#include "graphics/materials.hpp"
#include "graphics/shaders.hpp"
#include "graphics/texture_manager.hpp"
@ -398,7 +399,7 @@ static void setTexture(GLMesh &mesh, unsigned i, bool is_srgb,
{
mesh.TextureHandles[i] = glGetTextureSamplerHandleARB(
getTextureGLuint(mesh.textures[i]),
Shaders::ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
}
if (!glIsTextureHandleResidentARB(mesh.TextureHandles[i]))
{
@ -488,7 +489,7 @@ void initTexturesTransparent(GLMesh &mesh)
{
mesh.TextureHandles[0] = glGetTextureSamplerHandleARB(
getTextureGLuint(mesh.textures[0]),
Shaders::ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
}
if (!glIsTextureHandleResidentARB(mesh.TextureHandles[0]))
{

View File

@ -22,9 +22,10 @@
#include "graphics/central_settings.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/material_manager.hpp"
#include "graphics/materials.hpp"
#include "graphics/render_info.hpp"
#include "graphics/rtts.hpp"
#include "graphics/stk_mesh.hpp"
#include "graphics/shaders.hpp"
#include "graphics/texture_manager.hpp"
#include "graphics/vao_manager.hpp"
#include "tracks/track.hpp"
@ -344,7 +345,7 @@ void STKMeshSceneNode::render()
glDisable(GL_CULL_FACE);
if (update_each_frame)
updatevbo();
Shaders::ObjectPass1Shader::getInstance()->use();
ObjectPass1Shader::getInstance()->use();
// Only untextured
for (unsigned i = 0; i < GLmeshes.size(); i++)
{
@ -362,7 +363,7 @@ void STKMeshSceneNode::render()
{
mesh.TextureHandles[0] =
glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[0]),
Shaders::ObjectPass1Shader
ObjectPass1Shader
::getInstance()->m_sampler_ids[0]);
}
if (!glIsTextureHandleResidentARB(mesh.TextureHandles[0]))
@ -370,12 +371,12 @@ void STKMeshSceneNode::render()
glMakeTextureHandleResidentARB(mesh.TextureHandles[0]);
insertTextureHandle(mesh.TextureHandles[0]);
}
Shaders::ObjectPass1Shader::getInstance()->setTextureHandles(mesh.TextureHandles[0]);
ObjectPass1Shader::getInstance()->setTextureHandles(mesh.TextureHandles[0]);
}
else
#endif
Shaders::ObjectPass1Shader::getInstance()->setTextureUnits(getTextureGLuint(mesh.textures[0]));
Shaders::ObjectPass1Shader::getInstance()->setUniforms(AbsoluteTransformation, invmodel);
ObjectPass1Shader::getInstance()->setTextureUnits(getTextureGLuint(mesh.textures[0]));
ObjectPass1Shader::getInstance()->setUniforms(AbsoluteTransformation, invmodel);
assert(mesh.vao);
glBindVertexArray(mesh.vao);
glDrawElements(ptype, count, itype, 0);
@ -393,7 +394,7 @@ void STKMeshSceneNode::render()
glDisable(GL_CULL_FACE);
if (update_each_frame && !CVS->isDefferedEnabled())
updatevbo();
Shaders::ObjectPass2Shader::getInstance()->use();
ObjectPass2Shader::getInstance()->use();
// Only untextured
for (unsigned i = 0; i < GLmeshes.size(); i++)
{
@ -408,21 +409,21 @@ void STKMeshSceneNode::render()
{
GLuint64 DiffuseHandle =
glGetTextureSamplerHandleARB(irr_driver->getRenderTargetTexture(RTT_DIFFUSE),
Shaders::ObjectPass2Shader
ObjectPass2Shader
::getInstance()->m_sampler_ids[0]);
GLuint64 SpecularHandle =
glGetTextureSamplerHandleARB(irr_driver->getRenderTargetTexture(RTT_SPECULAR),
Shaders::ObjectPass2Shader::getInstance()->m_sampler_ids[1]);
ObjectPass2Shader::getInstance()->m_sampler_ids[1]);
GLuint64 SSAOHandle =
glGetTextureSamplerHandleARB(irr_driver->getRenderTargetTexture(RTT_HALF1_R),
Shaders::ObjectPass2Shader::getInstance()->m_sampler_ids[2]);
ObjectPass2Shader::getInstance()->m_sampler_ids[2]);
if (!mesh.TextureHandles[0])
mesh.TextureHandles[0] =
glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[0]),
Shaders::ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
if (!glIsTextureHandleResidentARB(mesh.TextureHandles[0]))
{
glMakeTextureHandleResidentARB(mesh.TextureHandles[0]);
@ -432,7 +433,7 @@ void STKMeshSceneNode::render()
if (!mesh.TextureHandles[1])
mesh.TextureHandles[1] =
glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[1]),
Shaders::ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
if (!glIsTextureHandleResidentARB(mesh.TextureHandles[1]))
{
glMakeTextureHandleResidentARB(mesh.TextureHandles[1]);
@ -442,28 +443,28 @@ void STKMeshSceneNode::render()
if (!mesh.TextureHandles[2])
mesh.TextureHandles[2] =
glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[2]),
Shaders::ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
if (!glIsTextureHandleResidentARB(mesh.TextureHandles[2]))
{
glMakeTextureHandleResidentARB(mesh.TextureHandles[2]);
insertTextureHandle(mesh.TextureHandles[2]);
}
Shaders::ObjectPass2Shader::getInstance()
ObjectPass2Shader::getInstance()
->setTextureHandles(DiffuseHandle, SpecularHandle, SSAOHandle,
mesh.TextureHandles[0], mesh.TextureHandles[1],
mesh.TextureHandles[2]);
}
else
#endif
Shaders::ObjectPass2Shader::getInstance()->setTextureUnits(
ObjectPass2Shader::getInstance()->setTextureUnits(
irr_driver->getRenderTargetTexture(RTT_DIFFUSE),
irr_driver->getRenderTargetTexture(RTT_SPECULAR),
irr_driver->getRenderTargetTexture(RTT_HALF1_R),
getTextureGLuint(mesh.textures[0]),
getTextureGLuint(mesh.textures[1]),
getTextureGLuint(mesh.textures[2]));
Shaders::ObjectPass2Shader::getInstance()->setUniforms(AbsoluteTransformation,
ObjectPass2Shader::getInstance()->setUniforms(AbsoluteTransformation,
mesh.texture_trans,
core::vector2df(0.0f, 0.0f));
assert(mesh.vao);
@ -535,7 +536,7 @@ void STKMeshSceneNode::render()
if (!mesh.TextureHandles[0])
mesh.TextureHandles[0] =
glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[0]),
Shaders::ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
if (!glIsTextureHandleResidentARB(mesh.TextureHandles[0]))
{
glMakeTextureHandleResidentARB(mesh.TextureHandles[0]);
@ -578,7 +579,7 @@ void STKMeshSceneNode::render()
if (!mesh.TextureHandles[0])
mesh.TextureHandles[0] =
glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[0]),
Shaders::ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
ObjectPass1Shader::getInstance()->m_sampler_ids[0]);
if (!glIsTextureHandleResidentARB(mesh.TextureHandles[0]))
{
glMakeTextureHandleResidentARB(mesh.TextureHandles[0]);
@ -602,5 +603,19 @@ void STKMeshSceneNode::render()
}
}
void STKMeshSceneNode::setIsDisplacement(bool v)
{
isDisplacement = v;
for (u32 i = 0; i < Mesh->getMeshBufferCount(); ++i)
{
scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
if (!mb)
continue;
if (isDisplacement)
mb->getMaterial().MaterialType = Shaders::getShader(ES_DISPLACE);
}
}
#endif // !SERVER_ONLY

View File

@ -20,7 +20,6 @@
#include "graphics/stk_mesh.hpp"
#include "graphics/shaders.hpp"
#include "utils/ptr_vector.hpp"
class RenderInfo;
@ -65,19 +64,7 @@ public:
virtual void OnRegisterSceneNode();
virtual ~STKMeshSceneNode();
virtual bool isImmediateDraw() const { return immediate_draw; }
void setIsDisplacement(bool v) {
isDisplacement = v;
for (u32 i = 0; i < Mesh->getMeshBufferCount(); ++i)
{
scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
if (!mb)
continue;
#ifndef SERVER_ONLY
if (isDisplacement)
mb->getMaterial().MaterialType = Shaders::getShader(ES_DISPLACE);
#endif
}
}
void setIsDisplacement(bool v);
virtual bool glow() const { return isGlow; }
void setGlowColors(const video::SColor &c) { isGlow = true; glowcolor = c; }
video::SColor getGlowColor() const { return glowcolor; }

View File

@ -21,7 +21,7 @@
#include "graphics/central_settings.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/shaders.hpp"
#include "graphics/materials.hpp"
#if defined(USE_GLES2)
#define _IRR_COMPILE_WITH_OGLES2_
@ -70,7 +70,7 @@ void resetTextureTable()
{
glMakeTextureHandleNonResidentARB(handle);
}
Shaders::ObjectPass1Shader::getInstance()->recreateTrilinearSampler(0);
ObjectPass1Shader::getInstance()->recreateTrilinearSampler(0);
texture_handles.clear();
}
#endif

View File

@ -26,7 +26,7 @@
#include <map>
#include <unordered_map>
enum InstanceType
enum InstanceType : unsigned int
{
InstanceTypeThreeTex,
InstanceTypeFourTex,

View File

@ -20,7 +20,6 @@
#include "config/user_config.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/shaders.hpp"
#include "graphics/render_target.hpp"
#include "graphics/texture_manager.hpp"
#include "graphics/vao_manager.hpp"