Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions src/engine/renderer/gl_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1466,12 +1466,12 @@ GLShader_lightMapping::GLShader_lightMapping( GLShaderManager *manager ) :
u_ModelViewProjectionMatrix( this ),
u_ParallaxDepthScale( this ),
u_ParallaxOffsetBias( this ),
u_HeightMapInNormalMap( this ),
u_NormalScale( this ),
u_numLights( this ),
u_Lights( this ),
GLDeformStage( this ),
GLCompileMacro_USE_DELUXE_MAPPING( this ),
GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
GLCompileMacro_USE_PARALLAX_MAPPING( this ),
GLCompileMacro_USE_PHYSICAL_SHADING( this )
{
Expand Down Expand Up @@ -1503,6 +1503,7 @@ void GLShader_lightMapping::SetShaderProgramUniforms( shaderProgram_t *shaderPro
if( !glConfig2.uniformBufferObjectAvailable ) {
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_Lights" ), 9 );
}
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_HeightMap" ), 15 );
}

GLShader_vertexLighting_DBS_entity::GLShader_vertexLighting_DBS_entity( GLShaderManager *manager ) :
Expand All @@ -1517,7 +1518,6 @@ GLShader_vertexLighting_DBS_entity::GLShader_vertexLighting_DBS_entity( GLShader
u_VertexInterpolation( this ),
u_ParallaxDepthScale( this ),
u_ParallaxOffsetBias( this ),
u_HeightMapInNormalMap( this ),
u_NormalScale( this ),
u_EnvironmentInterpolation( this ),
u_LightGridOrigin( this ),
Expand All @@ -1527,6 +1527,7 @@ GLShader_vertexLighting_DBS_entity::GLShader_vertexLighting_DBS_entity( GLShader
GLDeformStage( this ),
GLCompileMacro_USE_VERTEX_SKINNING( this ),
GLCompileMacro_USE_VERTEX_ANIMATION( this ),
GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
GLCompileMacro_USE_PARALLAX_MAPPING( this ),
GLCompileMacro_USE_REFLECTIVE_SPECULAR( this ),
GLCompileMacro_USE_PHYSICAL_SHADING( this )
Expand Down Expand Up @@ -1561,6 +1562,7 @@ void GLShader_vertexLighting_DBS_entity::SetShaderProgramUniforms( shaderProgram
if( !glConfig2.uniformBufferObjectAvailable ) {
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_Lights" ), 9 );
}
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_HeightMap" ), 15 );
}

GLShader_vertexLighting_DBS_world::GLShader_vertexLighting_DBS_world( GLShaderManager *manager ) :
Expand All @@ -1578,14 +1580,14 @@ GLShader_vertexLighting_DBS_world::GLShader_vertexLighting_DBS_world( GLShaderMa
u_ModelViewProjectionMatrix( this ),
u_ParallaxDepthScale( this ),
u_ParallaxOffsetBias( this ),
u_HeightMapInNormalMap( this ),
u_NormalScale( this ),
u_LightWrapAround( this ),
u_LightGridOrigin( this ),
u_LightGridScale( this ),
u_numLights( this ),
u_Lights( this ),
GLDeformStage( this ),
GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
GLCompileMacro_USE_PARALLAX_MAPPING( this ),
GLCompileMacro_USE_PHYSICAL_SHADING( this )
{
Expand Down Expand Up @@ -1616,6 +1618,7 @@ void GLShader_vertexLighting_DBS_world::SetShaderProgramUniforms( shaderProgram_
if( !glConfig2.uniformBufferObjectAvailable ) {
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_Lights" ), 9 );
}
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_HeightMap" ), 15 );
}

GLShader_forwardLighting_omniXYZ::GLShader_forwardLighting_omniXYZ( GLShaderManager *manager ):
Expand All @@ -1640,11 +1643,11 @@ GLShader_forwardLighting_omniXYZ::GLShader_forwardLighting_omniXYZ( GLShaderMana
u_VertexInterpolation( this ),
u_ParallaxDepthScale( this ),
u_ParallaxOffsetBias( this ),
u_HeightMapInNormalMap( this ),
u_NormalScale( this ),
GLDeformStage( this ),
GLCompileMacro_USE_VERTEX_SKINNING( this ),
GLCompileMacro_USE_VERTEX_ANIMATION( this ),
GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
GLCompileMacro_USE_PARALLAX_MAPPING( this ),
GLCompileMacro_USE_SHADOWING( this )
{
Expand Down Expand Up @@ -1674,6 +1677,7 @@ void GLShader_forwardLighting_omniXYZ::SetShaderProgramUniforms( shaderProgram_t
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_ShadowMap" ), 5 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_RandomMap" ), 6 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_ShadowClipMap" ), 7 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_HeightMap" ), 15 );
}

GLShader_forwardLighting_projXYZ::GLShader_forwardLighting_projXYZ( GLShaderManager *manager ):
Expand All @@ -1699,11 +1703,11 @@ GLShader_forwardLighting_projXYZ::GLShader_forwardLighting_projXYZ( GLShaderMana
u_VertexInterpolation( this ),
u_ParallaxDepthScale( this ),
u_ParallaxOffsetBias( this ),
u_HeightMapInNormalMap( this ),
u_NormalScale( this ),
GLDeformStage( this ),
GLCompileMacro_USE_VERTEX_SKINNING( this ),
GLCompileMacro_USE_VERTEX_ANIMATION( this ),
GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
GLCompileMacro_USE_PARALLAX_MAPPING( this ),
GLCompileMacro_USE_SHADOWING( this )
{
Expand Down Expand Up @@ -1734,6 +1738,7 @@ void GLShader_forwardLighting_projXYZ::SetShaderProgramUniforms( shaderProgram_t
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_ShadowMap0" ), 5 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_RandomMap" ), 6 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_ShadowClipMap0" ), 7 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_HeightMap" ), 15 );
}

GLShader_forwardLighting_directionalSun::GLShader_forwardLighting_directionalSun( GLShaderManager *manager ):
Expand Down Expand Up @@ -1761,11 +1766,11 @@ GLShader_forwardLighting_directionalSun::GLShader_forwardLighting_directionalSun
u_VertexInterpolation( this ),
u_ParallaxDepthScale( this ),
u_ParallaxOffsetBias( this ),
u_HeightMapInNormalMap( this ),
u_NormalScale( this ),
GLDeformStage( this ),
GLCompileMacro_USE_VERTEX_SKINNING( this ),
GLCompileMacro_USE_VERTEX_ANIMATION( this ),
GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
GLCompileMacro_USE_PARALLAX_MAPPING( this ),
GLCompileMacro_USE_SHADOWING( this )
{
Expand Down Expand Up @@ -1803,6 +1808,7 @@ void GLShader_forwardLighting_directionalSun::SetShaderProgramUniforms( shaderPr
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_ShadowClipMap2" ), 12 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_ShadowClipMap3" ), 13 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_ShadowClipMap4" ), 14 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_HeightMap" ), 15 );
}

GLShader_shadowFill::GLShader_shadowFill( GLShaderManager *manager ) :
Expand Down Expand Up @@ -1843,12 +1849,12 @@ GLShader_reflection::GLShader_reflection( GLShaderManager *manager ):
u_Bones( this ),
u_ParallaxDepthScale( this ),
u_ParallaxOffsetBias( this ),
u_HeightMapInNormalMap( this ),
u_NormalScale( this ),
u_VertexInterpolation( this ),
GLDeformStage( this ),
GLCompileMacro_USE_VERTEX_SKINNING( this ),
GLCompileMacro_USE_VERTEX_ANIMATION( this ),
GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
GLCompileMacro_USE_PARALLAX_MAPPING( this )
{
}
Expand All @@ -1871,6 +1877,7 @@ void GLShader_reflection::SetShaderProgramUniforms( shaderProgram_t *shaderProgr
{
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_ColorMap" ), 0 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_NormalMap" ), 1 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_HeightMap" ), 15 );
}

GLShader_skybox::GLShader_skybox( GLShaderManager *manager ) :
Expand Down Expand Up @@ -1969,6 +1976,7 @@ void GLShader_heatHaze::SetShaderProgramUniforms( shaderProgram_t *shaderProgram
{
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_NormalMap" ), 0 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_CurrentMap" ), 1 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_HeightMap" ), 15 );
}

GLShader_screen::GLShader_screen( GLShaderManager *manager ) :
Expand Down Expand Up @@ -2108,13 +2116,13 @@ GLShader_liquid::GLShader_liquid( GLShaderManager *manager ) :
u_FresnelBias( this ),
u_ParallaxDepthScale( this ),
u_ParallaxOffsetBias( this ),
u_HeightMapInNormalMap( this ),
u_NormalScale( this ),
u_FogDensity( this ),
u_FogColor( this ),
u_SpecularExponent( this ),
u_LightGridOrigin( this ),
u_LightGridScale( this ),
GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
GLCompileMacro_USE_PARALLAX_MAPPING( this )
{
}
Expand All @@ -2132,6 +2140,7 @@ void GLShader_liquid::SetShaderProgramUniforms( shaderProgram_t *shaderProgram )
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_NormalMap" ), 3 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_LightGrid1" ), 6 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_LightGrid2" ), 7 );
glUniform1i( glGetUniformLocation( shaderProgram->program, "u_HeightMap" ), 15 );
}

GLShader_volumetricFog::GLShader_volumetricFog( GLShaderManager *manager ) :
Expand Down
57 changes: 34 additions & 23 deletions src/engine/renderer/gl_shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ class GLCompileMacro
USE_TCGEN_ENVIRONMENT,
USE_TCGEN_LIGHTMAP,
USE_DELUXE_MAPPING,
USE_HEIGHTMAP_IN_NORMALMAP,
USE_PARALLAX_MAPPING,
USE_REFLECTIVE_SPECULAR,
USE_SHADOWING,
Expand Down Expand Up @@ -1009,6 +1010,31 @@ class GLCompileMacro_USE_DELUXE_MAPPING :
}
};

class GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP :
GLCompileMacro
{
public:
GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( GLShader *shader ) :
GLCompileMacro( shader )
{
}

const char *GetName() const
{
return "USE_HEIGHTMAP_IN_NORMALMAP";
}

EGLCompileMacro GetType() const
{
return EGLCompileMacro::USE_HEIGHTMAP_IN_NORMALMAP;
}

void SetHeightMapInNormalMap( bool enable )
{
SetMacro( enable );
}
};

class GLCompileMacro_USE_PARALLAX_MAPPING :
GLCompileMacro
{
Expand Down Expand Up @@ -1766,21 +1792,6 @@ class u_ParallaxOffsetBias :
}
};

class u_HeightMapInNormalMap :
GLUniform1i
{
public:
u_HeightMapInNormalMap( GLShader *shader ) :
GLUniform1i( shader, "u_HeightMapInNormalMap" )
{
}

void SetUniform_HeightMapInNormalMap( int value )
{
this->SetValue( value );
}
};

class u_EnvironmentInterpolation :
GLUniform1f
{
Expand Down Expand Up @@ -2146,12 +2157,12 @@ class GLShader_lightMapping :
public u_ModelViewProjectionMatrix,
public u_ParallaxDepthScale,
public u_ParallaxOffsetBias,
public u_HeightMapInNormalMap,
public u_NormalScale,
public u_numLights,
public u_Lights,
public GLDeformStage,
public GLCompileMacro_USE_DELUXE_MAPPING,
public GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP,
public GLCompileMacro_USE_PARALLAX_MAPPING,
public GLCompileMacro_USE_PHYSICAL_SHADING
{
Expand All @@ -2175,7 +2186,6 @@ class GLShader_vertexLighting_DBS_entity :
public u_VertexInterpolation,
public u_ParallaxDepthScale,
public u_ParallaxOffsetBias,
public u_HeightMapInNormalMap,
public u_NormalScale,
public u_EnvironmentInterpolation,
public u_LightGridOrigin,
Expand All @@ -2185,6 +2195,7 @@ class GLShader_vertexLighting_DBS_entity :
public GLDeformStage,
public GLCompileMacro_USE_VERTEX_SKINNING,
public GLCompileMacro_USE_VERTEX_ANIMATION,
public GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP,
public GLCompileMacro_USE_PARALLAX_MAPPING,
public GLCompileMacro_USE_REFLECTIVE_SPECULAR,
public GLCompileMacro_USE_PHYSICAL_SHADING
Expand All @@ -2209,14 +2220,14 @@ class GLShader_vertexLighting_DBS_world :
public u_ModelViewProjectionMatrix,
public u_ParallaxDepthScale,
public u_ParallaxOffsetBias,
public u_HeightMapInNormalMap,
public u_NormalScale,
public u_LightWrapAround,
public u_LightGridOrigin,
public u_LightGridScale,
public u_numLights,
public u_Lights,
public GLDeformStage,
public GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP,
public GLCompileMacro_USE_PARALLAX_MAPPING,
public GLCompileMacro_USE_PHYSICAL_SHADING
{
Expand Down Expand Up @@ -2250,11 +2261,11 @@ class GLShader_forwardLighting_omniXYZ :
public u_VertexInterpolation,
public u_ParallaxDepthScale,
public u_ParallaxOffsetBias,
public u_HeightMapInNormalMap,
public u_NormalScale,
public GLDeformStage,
public GLCompileMacro_USE_VERTEX_SKINNING,
public GLCompileMacro_USE_VERTEX_ANIMATION,
public GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP,
public GLCompileMacro_USE_PARALLAX_MAPPING,
public GLCompileMacro_USE_SHADOWING //,
{
Expand Down Expand Up @@ -2289,11 +2300,11 @@ class GLShader_forwardLighting_projXYZ :
public u_VertexInterpolation,
public u_ParallaxDepthScale,
public u_ParallaxOffsetBias,
public u_HeightMapInNormalMap,
public u_NormalScale,
public GLDeformStage,
public GLCompileMacro_USE_VERTEX_SKINNING,
public GLCompileMacro_USE_VERTEX_ANIMATION,
public GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP,
public GLCompileMacro_USE_PARALLAX_MAPPING,
public GLCompileMacro_USE_SHADOWING //,
{
Expand Down Expand Up @@ -2330,11 +2341,11 @@ class GLShader_forwardLighting_directionalSun :
public u_VertexInterpolation,
public u_ParallaxDepthScale,
public u_ParallaxOffsetBias,
public u_HeightMapInNormalMap,
public u_NormalScale,
public GLDeformStage,
public GLCompileMacro_USE_VERTEX_SKINNING,
public GLCompileMacro_USE_VERTEX_ANIMATION,
public GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP,
public GLCompileMacro_USE_PARALLAX_MAPPING,
public GLCompileMacro_USE_SHADOWING //,
{
Expand Down Expand Up @@ -2378,12 +2389,12 @@ class GLShader_reflection :
public u_Bones,
public u_ParallaxDepthScale,
public u_ParallaxOffsetBias,
public u_HeightMapInNormalMap,
public u_NormalScale,
public u_VertexInterpolation,
public GLDeformStage,
public GLCompileMacro_USE_VERTEX_SKINNING,
public GLCompileMacro_USE_VERTEX_ANIMATION,
public GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP,
public GLCompileMacro_USE_PARALLAX_MAPPING
{
public:
Expand Down Expand Up @@ -2584,13 +2595,13 @@ class GLShader_liquid :
public u_FresnelBias,
public u_ParallaxDepthScale,
public u_ParallaxOffsetBias,
public u_HeightMapInNormalMap,
public u_NormalScale,
public u_FogDensity,
public u_FogColor,
public u_SpecularExponent,
public u_LightGridOrigin,
public u_LightGridScale,
public GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP,
public GLCompileMacro_USE_PARALLAX_MAPPING
{
public:
Expand Down
Loading