From 4079b7275474dd262b5731bdf8cd5970980cfcb5 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Sat, 30 Mar 2019 21:41:10 +0100 Subject: [PATCH] use only one texCoords per surface the extra compute and boilerplate code seem useless and it already ended in bugs when parallax offset was applied to diffuse, normal, specular but nor glow map, and I would find stupid to add more boilerplate when height map will be implemented diffuse/normal/specular/glow/height maps are component of the same material, so there is no reason to handle their coordinates separately doing this would also avoid the need for a lot of ifdef code when normal/specular/glow/parallax support is disabled and well, that extra code seems useless even when they are enabled it unify the symbol names to var_TexCoords alongside the var_TexDiffuse, var_TexNormal, var_TexSpecular, var_TexGlow there was some occurrence of var_Tex some comments in already rewritten code told that Tr3b had issue with some driver/hardware suffered from "too much var" issue when passed from vp to fp shaders, leading him to abuse some variables, see 72268b, even if I have not faced this issue with hardware that is so old the game is unplayable, this is an even better way to reduce the number of variables passed from vp to fp for multimap material (diffuse/normal/specular/glow), the texCoords used is the diffuse one note that we already computed the parallax texOffset from diffuse coords only, and applied it to other maps as it would be stupid and inefficient to compute the parallax texOffset on each normal/specular/glow coords --- src/engine/renderer/gl_shader.cpp | 39 ++----- src/engine/renderer/gl_shader.h | 107 +++--------------- .../glsl_source/cameraEffects_fp.glsl | 2 +- .../glsl_source/cameraEffects_vp.glsl | 6 +- .../renderer/glsl_source/fogQuake3_fp.glsl | 4 +- .../renderer/glsl_source/fogQuake3_vp.glsl | 4 +- .../glsl_source/forwardLighting_fp.glsl | 21 ++-- .../glsl_source/forwardLighting_vp.glsl | 23 +--- .../renderer/glsl_source/generic_fp.glsl | 4 +- .../renderer/glsl_source/generic_vp.glsl | 10 +- .../renderer/glsl_source/heatHaze_fp.glsl | 4 +- .../renderer/glsl_source/heatHaze_vp.glsl | 6 +- .../renderer/glsl_source/lightMapping_fp.glsl | 25 ++-- .../renderer/glsl_source/lightMapping_vp.glsl | 22 +--- .../glsl_source/lightVolume_omni_fp.glsl | 1 - .../renderer/glsl_source/liquid_fp.glsl | 4 +- .../renderer/glsl_source/liquid_vp.glsl | 6 +- .../glsl_source/reflection_CB_fp.glsl | 4 +- .../glsl_source/reflection_CB_vp.glsl | 6 +- .../renderer/glsl_source/shadowFill_fp.glsl | 4 +- .../renderer/glsl_source/shadowFill_vp.glsl | 6 +- .../vertexLighting_DBS_entity_fp.glsl | 28 ++--- .../vertexLighting_DBS_entity_vp.glsl | 21 +--- .../vertexLighting_DBS_world_fp.glsl | 26 ++--- .../vertexLighting_DBS_world_vp.glsl | 21 +--- src/engine/renderer/tr_backend.cpp | 30 ++--- src/engine/renderer/tr_shade.cpp | 64 +++-------- 27 files changed, 140 insertions(+), 358 deletions(-) diff --git a/src/engine/renderer/gl_shader.cpp b/src/engine/renderer/gl_shader.cpp index 080faee711..6d7c9a5502 100644 --- a/src/engine/renderer/gl_shader.cpp +++ b/src/engine/renderer/gl_shader.cpp @@ -1410,7 +1410,7 @@ void GLShader::SetRequiredVertexPointers() GLShader_generic::GLShader_generic( GLShaderManager *manager ) : GLShader( "generic", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT, manager ), - u_ColorTextureMatrix( this ), + u_TextureMatrix( this ), u_ViewOrigin( this ), u_ViewUp( this ), u_AlphaThreshold( this ), @@ -1446,10 +1446,7 @@ void GLShader_generic::SetShaderProgramUniforms( shaderProgram_t *shaderProgram GLShader_lightMapping::GLShader_lightMapping( GLShaderManager *manager ) : GLShader( "lightMapping", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT | ATTR_COLOR, manager ), - u_DiffuseTextureMatrix( this ), - u_NormalTextureMatrix( this ), - u_SpecularTextureMatrix( this ), - u_GlowTextureMatrix( this ), + u_TextureMatrix( this ), u_SpecularExponent( this ), u_ColorModulate( this ), u_Color( this ), @@ -1500,10 +1497,7 @@ void GLShader_lightMapping::SetShaderProgramUniforms( shaderProgram_t *shaderPro GLShader_vertexLighting_DBS_entity::GLShader_vertexLighting_DBS_entity( GLShaderManager *manager ) : GLShader( "vertexLighting_DBS_entity", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT, manager ), - u_DiffuseTextureMatrix( this ), - u_NormalTextureMatrix( this ), - u_SpecularTextureMatrix( this ), - u_GlowTextureMatrix( this ), + u_TextureMatrix( this ), u_SpecularExponent( this ), u_AlphaThreshold( this ), u_ViewOrigin( this ), @@ -1564,10 +1558,7 @@ GLShader_vertexLighting_DBS_world::GLShader_vertexLighting_DBS_world( GLShaderMa ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT | ATTR_COLOR, manager ), - u_DiffuseTextureMatrix( this ), - u_NormalTextureMatrix( this ), - u_SpecularTextureMatrix( this ), - u_GlowTextureMatrix( this ), + u_TextureMatrix( this ), u_SpecularExponent( this ), u_ColorModulate( this ), u_Color( this ), @@ -1619,9 +1610,7 @@ void GLShader_vertexLighting_DBS_world::SetShaderProgramUniforms( shaderProgram_ GLShader_forwardLighting_omniXYZ::GLShader_forwardLighting_omniXYZ( GLShaderManager *manager ): GLShader("forwardLighting_omniXYZ", "forwardLighting", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT, manager), - u_DiffuseTextureMatrix( this ), - u_NormalTextureMatrix( this ), - u_SpecularTextureMatrix( this ), + u_TextureMatrix( this ), u_SpecularExponent( this ), u_AlphaThreshold( this ), u_ColorModulate( this ), @@ -1679,9 +1668,7 @@ void GLShader_forwardLighting_omniXYZ::SetShaderProgramUniforms( shaderProgram_t GLShader_forwardLighting_projXYZ::GLShader_forwardLighting_projXYZ( GLShaderManager *manager ): GLShader("forwardLighting_projXYZ", "forwardLighting", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT, manager), - u_DiffuseTextureMatrix( this ), - u_NormalTextureMatrix( this ), - u_SpecularTextureMatrix( this ), + u_TextureMatrix( this ), u_SpecularExponent( this ), u_AlphaThreshold( this ), u_ColorModulate( this ), @@ -1741,9 +1728,7 @@ void GLShader_forwardLighting_projXYZ::SetShaderProgramUniforms( shaderProgram_t GLShader_forwardLighting_directionalSun::GLShader_forwardLighting_directionalSun( GLShaderManager *manager ): GLShader("forwardLighting_directionalSun", "forwardLighting", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT, manager), - u_DiffuseTextureMatrix( this ), - u_NormalTextureMatrix( this ), - u_SpecularTextureMatrix( this ), + u_TextureMatrix( this ), u_SpecularExponent( this ), u_AlphaThreshold( this ), u_ColorModulate( this ), @@ -1812,7 +1797,7 @@ void GLShader_forwardLighting_directionalSun::SetShaderProgramUniforms( shaderPr GLShader_shadowFill::GLShader_shadowFill( GLShaderManager *manager ) : GLShader( "shadowFill", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT, manager ), - u_ColorTextureMatrix( this ), + u_TextureMatrix( this ), u_ViewOrigin( this ), u_AlphaThreshold( this ), u_LightOrigin( this ), @@ -1841,7 +1826,7 @@ void GLShader_shadowFill::SetShaderProgramUniforms( shaderProgram_t *shaderProgr GLShader_reflection::GLShader_reflection( GLShaderManager *manager ): GLShader("reflection", "reflection_CB", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT, manager ), - u_NormalTextureMatrix( this ), + u_TextureMatrix( this ), u_ViewOrigin( this ), u_ModelMatrix( this ), u_ModelViewProjectionMatrix( this ), @@ -1941,7 +1926,7 @@ void GLShader_fogGlobal::SetShaderProgramUniforms( shaderProgram_t *shaderProgra GLShader_heatHaze::GLShader_heatHaze( GLShaderManager *manager ) : GLShader( "heatHaze", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT, manager ), - u_NormalTextureMatrix( this ), + u_TextureMatrix( this ), u_ViewOrigin( this ), u_ViewUp( this ), u_DeformMagnitude( this ), @@ -2015,7 +2000,7 @@ void GLShader_contrast::SetShaderProgramUniforms( shaderProgram_t *shaderProgram GLShader_cameraEffects::GLShader_cameraEffects( GLShaderManager *manager ) : GLShader( "cameraEffects", ATTR_POSITION | ATTR_TEXCOORD, manager ), u_ColorModulate( this ), - u_ColorTextureMatrix( this ), + u_TextureMatrix( this ), u_ModelViewProjectionMatrix( this ), u_DeformMagnitude( this ), u_InverseGamma( this ) @@ -2103,7 +2088,7 @@ void GLShader_lightVolume_omni::SetShaderProgramUniforms( shaderProgram_t *shade GLShader_liquid::GLShader_liquid( GLShaderManager *manager ) : GLShader( "liquid", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT, manager ), - u_NormalTextureMatrix( this ), + u_TextureMatrix( this ), u_ViewOrigin( this ), u_RefractionIndex( this ), u_ModelMatrix( this ), diff --git a/src/engine/renderer/gl_shader.h b/src/engine/renderer/gl_shader.h index ec2f79b182..db7994f43c 100644 --- a/src/engine/renderer/gl_shader.h +++ b/src/engine/renderer/gl_shader.h @@ -1185,76 +1185,16 @@ class GLCompileMacro_USE_ALPHA_TESTING : } }; -class u_ColorTextureMatrix : +class u_TextureMatrix : GLUniformMatrix4f { public: - u_ColorTextureMatrix( GLShader *shader ) : - GLUniformMatrix4f( shader, "u_ColorTextureMatrix" ) + u_TextureMatrix( GLShader *shader ) : + GLUniformMatrix4f( shader, "u_TextureMatrix" ) { } - void SetUniform_ColorTextureMatrix( const matrix_t m ) - { - this->SetValue( GL_FALSE, m ); - } -}; - -class u_DiffuseTextureMatrix : - GLUniformMatrix4f -{ -public: - u_DiffuseTextureMatrix( GLShader *shader ) : - GLUniformMatrix4f( shader, "u_DiffuseTextureMatrix" ) - { - } - - void SetUniform_DiffuseTextureMatrix( const matrix_t m ) - { - this->SetValue( GL_FALSE, m ); - } -}; - -class u_NormalTextureMatrix : - GLUniformMatrix4f -{ -public: - u_NormalTextureMatrix( GLShader *shader ) : - GLUniformMatrix4f( shader, "u_NormalTextureMatrix" ) - { - } - - void SetUniform_NormalTextureMatrix( const matrix_t m ) - { - this->SetValue( GL_FALSE, m ); - } -}; - -class u_SpecularTextureMatrix : - GLUniformMatrix4f -{ -public: - u_SpecularTextureMatrix( GLShader *shader ) : - GLUniformMatrix4f( shader, "u_SpecularTextureMatrix" ) - { - } - - void SetUniform_SpecularTextureMatrix( const matrix_t m ) - { - this->SetValue( GL_FALSE, m ); - } -}; - -class u_GlowTextureMatrix : - GLUniformMatrix4f -{ -public: - u_GlowTextureMatrix( GLShader *shader ) : - GLUniformMatrix4f( shader, "u_GlowTextureMatrix" ) - { - } - - void SetUniform_GlowTextureMatrix( const matrix_t m ) + void SetUniform_TextureMatrix( const matrix_t m ) { this->SetValue( GL_FALSE, m ); } @@ -2180,7 +2120,7 @@ class u_Lights : class GLShader_generic : public GLShader, - public u_ColorTextureMatrix, + public u_TextureMatrix, public u_ViewOrigin, public u_ViewUp, public u_AlphaThreshold, @@ -2209,10 +2149,7 @@ class GLShader_generic : class GLShader_lightMapping : public GLShader, - public u_DiffuseTextureMatrix, - public u_NormalTextureMatrix, - public u_SpecularTextureMatrix, - public u_GlowTextureMatrix, + public u_TextureMatrix, public u_SpecularExponent, public u_ColorModulate, public u_Color, @@ -2241,10 +2178,7 @@ class GLShader_lightMapping : class GLShader_vertexLighting_DBS_entity : public GLShader, - public u_DiffuseTextureMatrix, - public u_NormalTextureMatrix, - public u_SpecularTextureMatrix, - public u_GlowTextureMatrix, + public u_TextureMatrix, public u_SpecularExponent, public u_AlphaThreshold, public u_ViewOrigin, @@ -2278,10 +2212,7 @@ class GLShader_vertexLighting_DBS_entity : class GLShader_vertexLighting_DBS_world : public GLShader, - public u_DiffuseTextureMatrix, - public u_NormalTextureMatrix, - public u_SpecularTextureMatrix, - public u_GlowTextureMatrix, + public u_TextureMatrix, public u_SpecularExponent, public u_ColorModulate, public u_Color, @@ -2312,9 +2243,7 @@ class GLShader_vertexLighting_DBS_world : class GLShader_forwardLighting_omniXYZ : public GLShader, - public u_DiffuseTextureMatrix, - public u_NormalTextureMatrix, - public u_SpecularTextureMatrix, + public u_TextureMatrix, public u_SpecularExponent, public u_AlphaThreshold, public u_ColorModulate, @@ -2352,9 +2281,7 @@ class GLShader_forwardLighting_omniXYZ : class GLShader_forwardLighting_projXYZ : public GLShader, - public u_DiffuseTextureMatrix, - public u_NormalTextureMatrix, - public u_SpecularTextureMatrix, + public u_TextureMatrix, public u_SpecularExponent, public u_AlphaThreshold, public u_ColorModulate, @@ -2393,9 +2320,7 @@ class GLShader_forwardLighting_projXYZ : class GLShader_forwardLighting_directionalSun : public GLShader, - public u_DiffuseTextureMatrix, - public u_NormalTextureMatrix, - public u_SpecularTextureMatrix, + public u_TextureMatrix, public u_SpecularExponent, public u_AlphaThreshold, public u_ColorModulate, @@ -2436,7 +2361,7 @@ class GLShader_forwardLighting_directionalSun : class GLShader_shadowFill : public GLShader, - public u_ColorTextureMatrix, + public u_TextureMatrix, public u_ViewOrigin, public u_AlphaThreshold, public u_LightOrigin, @@ -2459,7 +2384,7 @@ class GLShader_shadowFill : class GLShader_reflection : public GLShader, - public u_NormalTextureMatrix, + public u_TextureMatrix, public u_ViewOrigin, public u_ModelMatrix, public u_ModelViewProjectionMatrix, @@ -2534,7 +2459,7 @@ class GLShader_fogGlobal : class GLShader_heatHaze : public GLShader, - public u_NormalTextureMatrix, + public u_TextureMatrix, public u_ViewOrigin, public u_ViewUp, public u_DeformMagnitude, @@ -2591,7 +2516,7 @@ class GLShader_contrast : class GLShader_cameraEffects : public GLShader, public u_ColorModulate, - public u_ColorTextureMatrix, + public u_TextureMatrix, public u_ModelViewProjectionMatrix, public u_DeformMagnitude, public u_InverseGamma @@ -2662,7 +2587,7 @@ class GLShader_lightVolume_omni : class GLShader_liquid : public GLShader, - public u_NormalTextureMatrix, + public u_TextureMatrix, public u_ViewOrigin, public u_RefractionIndex, public u_ModelMatrix, diff --git a/src/engine/renderer/glsl_source/cameraEffects_fp.glsl b/src/engine/renderer/glsl_source/cameraEffects_fp.glsl index 1e1a4146d8..b977c8eb4d 100644 --- a/src/engine/renderer/glsl_source/cameraEffects_fp.glsl +++ b/src/engine/renderer/glsl_source/cameraEffects_fp.glsl @@ -27,7 +27,7 @@ uniform sampler3D u_ColorMap; uniform vec4 u_ColorModulate; uniform float u_InverseGamma; -IN(smooth) vec2 var_Tex; +IN(smooth) vec2 var_TexCoords; DECLARE_OUTPUT(vec4) diff --git a/src/engine/renderer/glsl_source/cameraEffects_vp.glsl b/src/engine/renderer/glsl_source/cameraEffects_vp.glsl index 4c1e5cdbcc..2ba54052a1 100644 --- a/src/engine/renderer/glsl_source/cameraEffects_vp.glsl +++ b/src/engine/renderer/glsl_source/cameraEffects_vp.glsl @@ -26,14 +26,14 @@ IN vec3 attr_Position; IN vec2 attr_TexCoord0; uniform mat4 u_ModelViewProjectionMatrix; -uniform mat4 u_ColorTextureMatrix; +uniform mat4 u_TextureMatrix; -OUT(smooth) vec2 var_Tex; +OUT(smooth) vec2 var_TexCoords; void main() { // transform vertex position into homogenous clip-space gl_Position = u_ModelViewProjectionMatrix * vec4(attr_Position, 1.0); - var_Tex = (u_ColorTextureMatrix * vec4(attr_TexCoord0, 0.0, 1.0)).st; + var_TexCoords = (u_TextureMatrix * vec4(attr_TexCoord0, 0.0, 1.0)).st; } diff --git a/src/engine/renderer/glsl_source/fogQuake3_fp.glsl b/src/engine/renderer/glsl_source/fogQuake3_fp.glsl index 0e517d7b20..f618ea294c 100644 --- a/src/engine/renderer/glsl_source/fogQuake3_fp.glsl +++ b/src/engine/renderer/glsl_source/fogQuake3_fp.glsl @@ -25,14 +25,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA uniform sampler2D u_ColorMap; IN(smooth) vec3 var_Position; -IN(smooth) vec2 var_Tex; +IN(smooth) vec2 var_TexCoords; IN(smooth) vec4 var_Color; DECLARE_OUTPUT(vec4) void main() { - vec4 color = texture2D(u_ColorMap, var_Tex); + vec4 color = texture2D(u_ColorMap, var_TexCoords); color *= var_Color; outputColor = color; diff --git a/src/engine/renderer/glsl_source/fogQuake3_vp.glsl b/src/engine/renderer/glsl_source/fogQuake3_vp.glsl index 83d3703c3f..9eaae25117 100644 --- a/src/engine/renderer/glsl_source/fogQuake3_vp.glsl +++ b/src/engine/renderer/glsl_source/fogQuake3_vp.glsl @@ -36,7 +36,7 @@ uniform vec4 u_FogDepthVector; uniform float u_FogEyeT; OUT(smooth) vec3 var_Position; -OUT(smooth) vec2 var_Tex; +OUT(smooth) vec2 var_TexCoords; OUT(smooth) vec4 var_Color; void DeformVertex( inout vec4 pos, @@ -96,7 +96,7 @@ void main() } } - var_Tex = vec2(s, t); + var_TexCoords = vec2(s, t); var_Color = color; } diff --git a/src/engine/renderer/glsl_source/forwardLighting_fp.glsl b/src/engine/renderer/glsl_source/forwardLighting_fp.glsl index 223f5a9e9b..8932950ddc 100644 --- a/src/engine/renderer/glsl_source/forwardLighting_fp.glsl +++ b/src/engine/renderer/glsl_source/forwardLighting_fp.glsl @@ -78,9 +78,7 @@ uniform float u_ShadowBlur; uniform mat4 u_ViewMatrix; IN(smooth) vec3 var_Position; -IN(smooth) vec2 var_TexDiffuse; -IN(smooth) vec2 var_TexNormal; -IN(smooth) vec2 var_TexSpecular; +IN(smooth) vec2 var_TexCoords; IN(smooth) vec4 var_TexAttenuation; IN(smooth) vec4 var_Tangent; IN(smooth) vec4 var_Binormal; @@ -941,30 +939,25 @@ void main() vec3 L = normalize(u_LightOrigin - var_Position); #endif - vec2 texDiffuse = var_TexDiffuse; + vec2 texCoords = var_TexCoords; mat3 tangentToWorldMatrix = mat3(var_Tangent.xyz, var_Binormal.xyz, var_Normal.xyz); - vec2 texNormal = var_TexNormal; - vec2 texSpecular = var_TexSpecular; - // compute view direction in world space vec3 viewDir = normalize(u_ViewOrigin - var_Position.xyz); #if defined(USE_PARALLAX_MAPPING) // compute texcoords offset from heightmap - vec2 texOffset = ParallaxTexOffset(texNormal, viewDir, tangentToWorldMatrix); + vec2 texOffset = ParallaxTexOffset(texCoords, viewDir, tangentToWorldMatrix); - texDiffuse += texOffset; - texNormal += texOffset; - texSpecular += texOffset; + texCoords += texOffset; #endif // USE_PARALLAX_MAPPING // compute half angle in world space vec3 H = normalize(L + viewDir); // compute normal in world space from normal map - vec3 N = NormalInWorldSpace(texNormal, tangentToWorldMatrix); + vec3 N = NormalInWorldSpace(texCoords, tangentToWorldMatrix); // compute the light term #if defined(r_WrapAroundLighting) @@ -974,7 +967,7 @@ void main() #endif // compute the diffuse term - vec4 diffuse = texture2D(u_DiffuseMap, texDiffuse); + vec4 diffuse = texture2D(u_DiffuseMap, texCoords); if( abs(diffuse.a + u_AlphaThreshold) <= 1.0 ) { discard; @@ -984,7 +977,7 @@ void main() #if defined(r_specularMapping) // compute the specular term - vec4 spec = texture2D(u_SpecularMap, texSpecular).rgba; + vec4 spec = texture2D(u_SpecularMap, texCoords).rgba; vec3 specular = spec.rgb * u_LightColor * pow(clamp(dot(N, H), 0.0, 1.0), u_SpecularExponent.x * spec.a + u_SpecularExponent.y) * r_SpecularScale; #endif // r_specularMapping diff --git a/src/engine/renderer/glsl_source/forwardLighting_vp.glsl b/src/engine/renderer/glsl_source/forwardLighting_vp.glsl index 522de5f939..f1a3bb21ba 100644 --- a/src/engine/renderer/glsl_source/forwardLighting_vp.glsl +++ b/src/engine/renderer/glsl_source/forwardLighting_vp.glsl @@ -22,23 +22,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /* forwardLighting_vp.glsl */ -uniform mat4 u_DiffuseTextureMatrix; -uniform mat4 u_NormalTextureMatrix; -uniform mat4 u_SpecularTextureMatrix; - -uniform vec4 u_ColorModulate; -uniform vec4 u_Color; - +uniform mat4 u_TextureMatrix; uniform mat4 u_LightAttenuationMatrix; uniform mat4 u_ModelMatrix; uniform mat4 u_ModelViewProjectionMatrix; +uniform vec4 u_ColorModulate; +uniform vec4 u_Color; + uniform float u_Time; OUT(smooth) vec3 var_Position; -OUT(smooth) vec2 var_TexDiffuse; -OUT(smooth) vec2 var_TexNormal; -OUT(smooth) vec2 var_TexSpecular; +OUT(smooth) vec2 var_TexCoords; OUT(smooth) vec4 var_TexAttenuation; @@ -86,13 +81,7 @@ void main() var_TexAttenuation = u_LightAttenuationMatrix * position; // transform diffusemap texcoords - var_TexDiffuse = (u_DiffuseTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; - - // transform normalmap texcoords - var_TexNormal = (u_NormalTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; - - // transform specularmap texture coords - var_TexSpecular = (u_SpecularTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; + var_TexCoords = (u_TextureMatrix * vec4(texCoord, 0.0, 1.0)).st; var_Color = color; } diff --git a/src/engine/renderer/glsl_source/generic_fp.glsl b/src/engine/renderer/glsl_source/generic_fp.glsl index 87d90cfb99..9129b31983 100644 --- a/src/engine/renderer/glsl_source/generic_fp.glsl +++ b/src/engine/renderer/glsl_source/generic_fp.glsl @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA uniform sampler2D u_ColorMap; uniform float u_AlphaThreshold; -IN(smooth) vec2 var_Tex; +IN(smooth) vec2 var_TexCoords; IN(smooth) vec4 var_Color; #if defined(USE_DEPTH_FADE) || defined(USE_VERTEX_SPRITE) @@ -37,7 +37,7 @@ DECLARE_OUTPUT(vec4) void main() { - vec4 color = texture2D(u_ColorMap, var_Tex); + vec4 color = texture2D(u_ColorMap, var_TexCoords); #if defined(USE_ALPHA_TESTING) if( abs(color.a + u_AlphaThreshold) <= 1.0 ) diff --git a/src/engine/renderer/glsl_source/generic_vp.glsl b/src/engine/renderer/glsl_source/generic_vp.glsl index 2ab41788a4..adcab067ca 100644 --- a/src/engine/renderer/glsl_source/generic_vp.glsl +++ b/src/engine/renderer/glsl_source/generic_vp.glsl @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /* generic_vp.glsl */ -uniform mat4 u_ColorTextureMatrix; +uniform mat4 u_TextureMatrix; #if !defined(USE_VERTEX_SPRITE) uniform vec3 u_ViewOrigin; #endif @@ -44,7 +44,7 @@ uniform float u_DepthScale; OUT(smooth) vec2 var_FadeDepth; #endif -OUT(smooth) vec2 var_Tex; +OUT(smooth) vec2 var_TexCoords; OUT(smooth) vec4 var_Color; void DeformVertex( inout vec4 pos, @@ -84,12 +84,12 @@ void main() vec3 reflected = LB.normal * 2.0 * d - viewer; - var_Tex = 0.5 + vec2(0.5, -0.5) * reflected.yz; + var_TexCoords = 0.5 + vec2(0.5, -0.5) * reflected.yz; } #elif defined(USE_TCGEN_LIGHTMAP) - var_Tex = (u_ColorTextureMatrix * vec4(lmCoord, 0.0, 1.0)).xy; + var_TexCoords = (u_TextureMatrix * vec4(lmCoord, 0.0, 1.0)).xy; #else - var_Tex = (u_ColorTextureMatrix * vec4(texCoord, 0.0, 1.0)).xy; + var_TexCoords = (u_TextureMatrix * vec4(texCoord, 0.0, 1.0)).xy; #endif #if defined(USE_DEPTH_FADE) || defined(USE_VERTEX_SPRITE) diff --git a/src/engine/renderer/glsl_source/heatHaze_fp.glsl b/src/engine/renderer/glsl_source/heatHaze_fp.glsl index 72a694b9ae..9978564edd 100644 --- a/src/engine/renderer/glsl_source/heatHaze_fp.glsl +++ b/src/engine/renderer/glsl_source/heatHaze_fp.glsl @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA uniform sampler2D u_CurrentMap; uniform float u_AlphaThreshold; -IN(smooth) vec2 var_TexNormal; +IN(smooth) vec2 var_TexCoords; IN(smooth) float var_Deform; DECLARE_OUTPUT(vec4) @@ -35,7 +35,7 @@ void main() vec4 color; // compute normal in tangent space from normalmap - vec3 N = NormalInTangentSpace(var_TexNormal); + vec3 N = NormalInTangentSpace(var_TexCoords); // calculate the screen texcoord in the 0.0 to 1.0 range vec2 st = gl_FragCoord.st * r_FBufScale; diff --git a/src/engine/renderer/glsl_source/heatHaze_vp.glsl b/src/engine/renderer/glsl_source/heatHaze_vp.glsl index dea5cc3eb0..a7fe1f3d7f 100644 --- a/src/engine/renderer/glsl_source/heatHaze_vp.glsl +++ b/src/engine/renderer/glsl_source/heatHaze_vp.glsl @@ -24,14 +24,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA uniform float u_Time; -uniform mat4 u_NormalTextureMatrix; +uniform mat4 u_TextureMatrix; uniform mat4 u_ProjectionMatrixTranspose; uniform mat4 u_ModelViewMatrixTranspose; uniform mat4 u_ModelViewProjectionMatrix; uniform float u_DeformMagnitude; -OUT(smooth) vec2 var_TexNormal; +OUT(smooth) vec2 var_TexCoords; OUT(smooth) float var_Deform; void DeformVertex( inout vec4 pos, @@ -66,7 +66,7 @@ void main() deformVec.z = dot(u_ModelViewMatrixTranspose[2], position); // transform normalmap texcoords - var_TexNormal = (u_NormalTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; + var_TexCoords = (u_TextureMatrix * vec4(texCoord, 0.0, 1.0)).st; d1 = dot(u_ProjectionMatrixTranspose[0], deformVec); d2 = dot(u_ProjectionMatrixTranspose[3], deformVec); diff --git a/src/engine/renderer/glsl_source/lightMapping_fp.glsl b/src/engine/renderer/glsl_source/lightMapping_fp.glsl index 55648c7657..b8f123a3dd 100644 --- a/src/engine/renderer/glsl_source/lightMapping_fp.glsl +++ b/src/engine/renderer/glsl_source/lightMapping_fp.glsl @@ -30,10 +30,7 @@ uniform float u_AlphaThreshold; uniform vec3 u_ViewOrigin; IN(smooth) vec3 var_Position; -IN(smooth) vec2 var_TexDiffuse; -IN(smooth) vec2 var_TexGlow; -IN(smooth) vec2 var_TexNormal; -IN(smooth) vec2 var_TexSpecular; +IN(smooth) vec2 var_TexCoords; IN(smooth) vec2 var_TexLight; IN(smooth) vec3 var_Tangent; @@ -49,25 +46,19 @@ void main() // compute view direction in world space vec3 viewDir = normalize(u_ViewOrigin - var_Position); - vec2 texDiffuse = var_TexDiffuse; - vec2 texGlow = var_TexGlow; - vec2 texNormal = var_TexNormal; - vec2 texSpecular = var_TexSpecular; + vec2 texCoords = var_TexCoords; mat3 tangentToWorldMatrix = mat3(var_Tangent.xyz, var_Binormal.xyz, var_Normal.xyz); #if defined(USE_PARALLAX_MAPPING) // compute texcoords offset from heightmap - vec2 texOffset = ParallaxTexOffset(texNormal, viewDir, tangentToWorldMatrix); + vec2 texOffset = ParallaxTexOffset(texCoords, viewDir, tangentToWorldMatrix); - texDiffuse += texOffset; - texGlow += texOffset; - texNormal += texOffset; - texSpecular += texOffset; + texCoords += texOffset; #endif // USE_PARALLAX_MAPPING // compute the diffuse term - vec4 diffuse = texture2D(u_DiffuseMap, texDiffuse); + vec4 diffuse = texture2D(u_DiffuseMap, texCoords); if( abs(diffuse.a + u_AlphaThreshold) <= 1.0 ) { @@ -76,10 +67,10 @@ void main() } // compute the specular term - vec4 specular = texture2D(u_SpecularMap, texSpecular); + vec4 specular = texture2D(u_SpecularMap, texCoords); // compute normal in world space from normalmap - vec3 N = NormalInWorldSpace(texNormal, tangentToWorldMatrix); + vec3 N = NormalInWorldSpace(texCoords, tangentToWorldMatrix); // compute light color from world space lightmap vec3 lightColor = texture2D(u_LightMap, var_TexLight).xyz; @@ -108,7 +99,7 @@ void main() computeDLights( var_Position, N, viewDir, diffuse, specular, color ); #if defined(r_glowMapping) - color.rgb += texture2D(u_GlowMap, texGlow).rgb; + color.rgb += texture2D(u_GlowMap, texCoords).rgb; #endif // r_glowMapping outputColor = color; diff --git a/src/engine/renderer/glsl_source/lightMapping_vp.glsl b/src/engine/renderer/glsl_source/lightMapping_vp.glsl index 0c47765f78..993f394339 100644 --- a/src/engine/renderer/glsl_source/lightMapping_vp.glsl +++ b/src/engine/renderer/glsl_source/lightMapping_vp.glsl @@ -22,10 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /* lightMapping_vp.glsl */ -uniform mat4 u_DiffuseTextureMatrix; -uniform mat4 u_NormalTextureMatrix; -uniform mat4 u_SpecularTextureMatrix; -uniform mat4 u_GlowTextureMatrix; +uniform mat4 u_TextureMatrix; uniform mat4 u_ModelMatrix; uniform mat4 u_ModelViewProjectionMatrix; @@ -35,10 +32,7 @@ uniform vec4 u_ColorModulate; uniform vec4 u_Color; OUT(smooth) vec3 var_Position; -OUT(smooth) vec2 var_TexDiffuse; -OUT(smooth) vec2 var_TexGlow; -OUT(smooth) vec2 var_TexNormal; -OUT(smooth) vec2 var_TexSpecular; +OUT(smooth) vec2 var_TexCoords; OUT(smooth) vec2 var_TexLight; OUT(smooth) vec3 var_Tangent; OUT(smooth) vec3 var_Binormal; @@ -72,17 +66,9 @@ void main() gl_Position = u_ModelViewProjectionMatrix * position; // transform diffusemap texcoords - var_TexDiffuse = (u_DiffuseTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; - var_TexLight = lmCoord; - - // transform normalmap texcoords - var_TexNormal = (u_NormalTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; + var_TexCoords = (u_TextureMatrix * vec4(texCoord, 0.0, 1.0)).st; - // transform specularmap texcoords - var_TexSpecular = (u_SpecularTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; - - // transform glowmap texcoords - var_TexGlow = (u_GlowTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; + var_TexLight = lmCoord; var_Position = position.xyz; diff --git a/src/engine/renderer/glsl_source/lightVolume_omni_fp.glsl b/src/engine/renderer/glsl_source/lightVolume_omni_fp.glsl index 937fe73458..0886ad2a3a 100644 --- a/src/engine/renderer/glsl_source/lightVolume_omni_fp.glsl +++ b/src/engine/renderer/glsl_source/lightVolume_omni_fp.glsl @@ -43,7 +43,6 @@ uniform float u_LightScale; uniform mat4 u_LightAttenuationMatrix; uniform mat4 u_UnprojectMatrix; -IN(smooth) vec2 var_TexDiffuse; IN(smooth) vec3 var_TexAttenXYZ; DECLARE_OUTPUT(vec4) diff --git a/src/engine/renderer/glsl_source/liquid_fp.glsl b/src/engine/renderer/glsl_source/liquid_fp.glsl index ac7a190990..292fa6d1e5 100644 --- a/src/engine/renderer/glsl_source/liquid_fp.glsl +++ b/src/engine/renderer/glsl_source/liquid_fp.glsl @@ -43,7 +43,7 @@ uniform vec3 u_LightGridOrigin; uniform vec3 u_LightGridScale; IN(smooth) vec3 var_Position; -IN(smooth) vec2 var_TexNormal; +IN(smooth) vec2 var_TexCoords; IN(smooth) vec3 var_Tangent; IN(smooth) vec3 var_Binormal; IN(smooth) vec3 var_Normal; @@ -90,7 +90,7 @@ void main() // calculate the screen texcoord in the 0.0 to 1.0 range vec2 texScreen = gl_FragCoord.st * r_FBufScale; - vec2 texNormal = var_TexNormal; + vec2 texNormal = var_TexCoords; #if defined(USE_PARALLAX_MAPPING) // ray intersect in view direction diff --git a/src/engine/renderer/glsl_source/liquid_vp.glsl b/src/engine/renderer/glsl_source/liquid_vp.glsl index 0ad3fc40cd..66d6b0de13 100644 --- a/src/engine/renderer/glsl_source/liquid_vp.glsl +++ b/src/engine/renderer/glsl_source/liquid_vp.glsl @@ -28,12 +28,12 @@ IN vec3 attr_Tangent; IN vec3 attr_Binormal; IN vec3 attr_Normal; -uniform mat4 u_NormalTextureMatrix; +uniform mat4 u_TextureMatrix; uniform mat4 u_ModelMatrix; uniform mat4 u_ModelViewProjectionMatrix; OUT(smooth) vec3 var_Position; -OUT(smooth) vec2 var_TexNormal; +OUT(smooth) vec2 var_TexCoords; OUT(smooth) vec3 var_Tangent; OUT(smooth) vec3 var_Binormal; OUT(smooth) vec3 var_Normal; @@ -47,7 +47,7 @@ void main() var_Position = (u_ModelMatrix * vec4(attr_Position, 1.0)).xyz; // transform normalmap texcoords - var_TexNormal = (u_NormalTextureMatrix * vec4(attr_TexCoord0, 0.0, 1.0)).st; + var_TexCoords = (u_TextureMatrix * vec4(attr_TexCoord0, 0.0, 1.0)).st; var_Tangent.xyz = (u_ModelMatrix * vec4(attr_Tangent, 0.0)).xyz; var_Binormal.xyz = (u_ModelMatrix * vec4(attr_Binormal, 0.0)).xyz; diff --git a/src/engine/renderer/glsl_source/reflection_CB_fp.glsl b/src/engine/renderer/glsl_source/reflection_CB_fp.glsl index dfc3ba285f..8a678b74e1 100644 --- a/src/engine/renderer/glsl_source/reflection_CB_fp.glsl +++ b/src/engine/renderer/glsl_source/reflection_CB_fp.glsl @@ -27,7 +27,7 @@ uniform vec3 u_ViewOrigin; uniform mat4 u_ModelMatrix; IN(smooth) vec3 var_Position; -IN(smooth) vec2 var_TexNormal; +IN(smooth) vec2 var_TexCoords; IN(smooth) vec4 var_Tangent; IN(smooth) vec4 var_Binormal; IN(smooth) vec4 var_Normal; @@ -41,7 +41,7 @@ void main() mat3 tangentToWorldMatrix = mat3(var_Tangent.xyz, var_Binormal.xyz, var_Normal.xyz); - vec2 texNormal = var_TexNormal; + vec2 texNormal = var_TexCoords; #if defined(USE_PARALLAX_MAPPING) // compute texcoords offset from heightmap diff --git a/src/engine/renderer/glsl_source/reflection_CB_vp.glsl b/src/engine/renderer/glsl_source/reflection_CB_vp.glsl index 5b5a92883f..6a09fb574b 100644 --- a/src/engine/renderer/glsl_source/reflection_CB_vp.glsl +++ b/src/engine/renderer/glsl_source/reflection_CB_vp.glsl @@ -22,14 +22,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /* reflection_CB_vp.glsl */ -uniform mat4 u_NormalTextureMatrix; +uniform mat4 u_TextureMatrix; uniform mat4 u_ModelMatrix; uniform mat4 u_ModelViewProjectionMatrix; uniform float u_Time; OUT(smooth) vec3 var_Position; -OUT(smooth) vec2 var_TexNormal; +OUT(smooth) vec2 var_TexCoords; OUT(smooth) vec4 var_Tangent; OUT(smooth) vec4 var_Binormal; OUT(smooth) vec4 var_Normal; @@ -66,6 +66,6 @@ void main() var_Normal.xyz = (u_ModelMatrix * vec4(LB.normal, 0.0)).xyz; // transform normalmap texcoords - var_TexNormal = (u_NormalTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; + var_TexCoords = (u_TextureMatrix * vec4(texCoord, 0.0, 1.0)).st; } diff --git a/src/engine/renderer/glsl_source/shadowFill_fp.glsl b/src/engine/renderer/glsl_source/shadowFill_fp.glsl index be9fd19c41..a232e40a02 100644 --- a/src/engine/renderer/glsl_source/shadowFill_fp.glsl +++ b/src/engine/renderer/glsl_source/shadowFill_fp.glsl @@ -28,7 +28,7 @@ uniform vec3 u_LightOrigin; uniform float u_LightRadius; IN(smooth) vec3 var_Position; -IN(smooth) vec2 var_Tex; +IN(smooth) vec2 var_TexCoords; IN(smooth) vec4 var_Color; DECLARE_OUTPUT(vec4) @@ -63,7 +63,7 @@ vec4 ShadowDepthToEVSM(float depth) void main() { - vec4 color = texture2D(u_ColorMap, var_Tex); + vec4 color = texture2D(u_ColorMap, var_TexCoords); if( abs(color.a + u_AlphaThreshold) <= 1.0 ) { diff --git a/src/engine/renderer/glsl_source/shadowFill_vp.glsl b/src/engine/renderer/glsl_source/shadowFill_vp.glsl index efda6dc788..19d5d8ac02 100644 --- a/src/engine/renderer/glsl_source/shadowFill_vp.glsl +++ b/src/engine/renderer/glsl_source/shadowFill_vp.glsl @@ -24,14 +24,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA uniform vec4 u_Color; -uniform mat4 u_ColorTextureMatrix; +uniform mat4 u_TextureMatrix; uniform mat4 u_ModelMatrix; uniform mat4 u_ModelViewProjectionMatrix; uniform float u_Time; OUT(smooth) vec3 var_Position; -OUT(smooth) vec2 var_Tex; +OUT(smooth) vec2 var_TexCoords; OUT(smooth) vec4 var_Color; void DeformVertex( inout vec4 pos, @@ -66,7 +66,7 @@ void main() #endif // transform texcoords - var_Tex = (u_ColorTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; + var_TexCoords = (u_TextureMatrix * vec4(texCoord, 0.0, 1.0)).st; // assign color var_Color = u_Color; diff --git a/src/engine/renderer/glsl_source/vertexLighting_DBS_entity_fp.glsl b/src/engine/renderer/glsl_source/vertexLighting_DBS_entity_fp.glsl index bed8ba05ec..38f6295691 100644 --- a/src/engine/renderer/glsl_source/vertexLighting_DBS_entity_fp.glsl +++ b/src/engine/renderer/glsl_source/vertexLighting_DBS_entity_fp.glsl @@ -39,13 +39,10 @@ uniform vec3 u_LightGridOrigin; uniform vec3 u_LightGridScale; IN(smooth) vec3 var_Position; -IN(smooth) vec2 var_TexDiffuse; +IN(smooth) vec2 var_TexCoords; IN(smooth) vec4 var_Color; -IN(smooth) vec2 var_TexNormal; -IN(smooth) vec2 var_TexSpecular; IN(smooth) vec3 var_Tangent; IN(smooth) vec3 var_Binormal; -IN(smooth) vec2 var_TexGlow; IN(smooth) vec3 var_Normal; DECLARE_OUTPUT(vec4) @@ -83,31 +80,24 @@ void main() // compute view direction in world space vec3 viewDir = normalize(u_ViewOrigin - var_Position); - vec2 texDiffuse = var_TexDiffuse; - vec2 texGlow = var_TexGlow; + vec2 texCoords = var_TexCoords; mat3 tangentToWorldMatrix = mat3(var_Tangent.xyz, var_Binormal.xyz, var_Normal.xyz); - vec2 texNormal = var_TexNormal; - vec2 texSpecular = var_TexSpecular; - #if defined(USE_PARALLAX_MAPPING) // compute texcoords offset from heightmap - vec2 texOffset = ParallaxTexOffset(texNormal, viewDir, tangentToWorldMatrix); + vec2 texOffset = ParallaxTexOffset(texCoords, viewDir, tangentToWorldMatrix); - texDiffuse += texOffset; - texGlow += texOffset; - texNormal += texOffset; - texSpecular += texOffset; + texCoords += texOffset; #endif // USE_PARALLAX_MAPPING // compute normal in world space from normalmap - vec3 N = NormalInWorldSpace(texNormal, tangentToWorldMatrix); + vec3 N = NormalInWorldSpace(texCoords, tangentToWorldMatrix); // compute the specular term #if defined(USE_REFLECTIVE_SPECULAR) - vec4 specBase = texture2D(u_SpecularMap, texSpecular).rgba; + vec4 specBase = texture2D(u_SpecularMap, texCoords).rgba; vec4 envColor0 = textureCube(u_EnvironmentMap0, reflect(-viewDir, N)).rgba; vec4 envColor1 = textureCube(u_EnvironmentMap1, reflect(-viewDir, N)).rgba; @@ -116,12 +106,12 @@ void main() #else // simple Blinn-Phong - vec4 specBase = texture2D(u_SpecularMap, texSpecular).rgba; + vec4 specBase = texture2D(u_SpecularMap, texCoords).rgba; #endif // USE_REFLECTIVE_SPECULAR // compute the diffuse term - vec4 diffuse = texture2D(u_DiffuseMap, texDiffuse) * var_Color; + vec4 diffuse = texture2D(u_DiffuseMap, texCoords) * var_Color; if( abs(diffuse.a + u_AlphaThreshold) <= 1.0 ) { @@ -146,7 +136,7 @@ void main() #endif #if defined(r_glowMapping) - color.rgb += texture2D(u_GlowMap, texGlow).rgb; + color.rgb += texture2D(u_GlowMap, texCoords).rgb; #endif // r_glowMapping outputColor = color; diff --git a/src/engine/renderer/glsl_source/vertexLighting_DBS_entity_vp.glsl b/src/engine/renderer/glsl_source/vertexLighting_DBS_entity_vp.glsl index 089a5ce77b..c7da181add 100644 --- a/src/engine/renderer/glsl_source/vertexLighting_DBS_entity_vp.glsl +++ b/src/engine/renderer/glsl_source/vertexLighting_DBS_entity_vp.glsl @@ -22,23 +22,17 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /* vertexLighting_DBS_entity_vp.glsl */ -uniform mat4 u_DiffuseTextureMatrix; -uniform mat4 u_NormalTextureMatrix; -uniform mat4 u_SpecularTextureMatrix; -uniform mat4 u_GlowTextureMatrix; +uniform mat4 u_TextureMatrix; uniform mat4 u_ModelMatrix; uniform mat4 u_ModelViewProjectionMatrix; uniform float u_Time; OUT(smooth) vec3 var_Position; -OUT(smooth) vec2 var_TexDiffuse; +OUT(smooth) vec2 var_TexCoords; OUT(smooth) vec4 var_Color; -OUT(smooth) vec2 var_TexNormal; -OUT(smooth) vec2 var_TexSpecular; OUT(smooth) vec3 var_Tangent; OUT(smooth) vec3 var_Binormal; -OUT(smooth) vec2 var_TexGlow; OUT(smooth) vec3 var_Normal; @@ -74,15 +68,6 @@ void main() var_Normal.xyz = (u_ModelMatrix * vec4(LB.normal, 0.0)).xyz; // transform diffusemap texcoords - var_TexDiffuse = (u_DiffuseTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; + var_TexCoords = (u_TextureMatrix * vec4(texCoord, 0.0, 1.0)).st; var_Color = color; - - // transform normalmap texcoords - var_TexNormal = (u_NormalTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; - - // transform specularmap texture coords - var_TexSpecular = (u_SpecularTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; - - // transform glowmap texcoords - var_TexGlow = (u_GlowTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; } diff --git a/src/engine/renderer/glsl_source/vertexLighting_DBS_world_fp.glsl b/src/engine/renderer/glsl_source/vertexLighting_DBS_world_fp.glsl index 4c284767b1..a4c5d4ea6a 100644 --- a/src/engine/renderer/glsl_source/vertexLighting_DBS_world_fp.glsl +++ b/src/engine/renderer/glsl_source/vertexLighting_DBS_world_fp.glsl @@ -37,12 +37,9 @@ uniform vec3 u_LightGridScale; uniform vec3 u_ViewOrigin; IN(smooth) vec3 var_Position; -IN(smooth) vec2 var_TexDiffuse; -IN(smooth) vec2 var_TexGlow; +IN(smooth) vec2 var_TexCoords; IN(smooth) vec4 var_Color; -IN(smooth) vec2 var_TexNormal; -IN(smooth) vec2 var_TexSpecular; IN(smooth) vec3 var_Tangent; IN(smooth) vec3 var_Binormal; @@ -72,8 +69,7 @@ void ReadLightGrid(in vec3 pos, out vec3 lgtDir, void main() { - vec2 texDiffuse = var_TexDiffuse; - vec2 texGlow = var_TexGlow; + vec2 texCoords = var_TexCoords; // compute view direction in world space vec3 viewDir = normalize(u_ViewOrigin - var_Position); @@ -84,21 +80,15 @@ void main() ReadLightGrid( (var_Position - u_LightGridOrigin) * u_LightGridScale, L, ambCol, dirCol); - vec2 texNormal = var_TexNormal; - vec2 texSpecular = var_TexSpecular; - #if defined(USE_PARALLAX_MAPPING) // compute texcoords offset from heightmap - vec2 texOffset = ParallaxTexOffset(texNormal, viewDir, tangentToWorldMatrix); + vec2 texOffset = ParallaxTexOffset(texCoords, viewDir, tangentToWorldMatrix); - texDiffuse += texOffset; - texGlow += texOffset; - texNormal += texOffset; - texSpecular += texOffset; + texCoords += texOffset; #endif // USE_PARALLAX_MAPPING // compute the diffuse term - vec4 diffuse = texture2D(u_DiffuseMap, texDiffuse) * var_Color; + vec4 diffuse = texture2D(u_DiffuseMap, texCoords) * var_Color; if( abs(diffuse.a + u_AlphaThreshold) <= 1.0 ) { @@ -106,10 +96,10 @@ void main() return; } - vec4 specular = texture2D(u_SpecularMap, texSpecular); + vec4 specular = texture2D(u_SpecularMap, texCoords); // compute normal in world space from normalmap - vec3 N = NormalInWorldSpace(texNormal, tangentToWorldMatrix); + vec3 N = NormalInWorldSpace(texCoords, tangentToWorldMatrix); // compute final color vec4 color = vec4( ambCol * diffuse.xyz, diffuse.a ); @@ -118,7 +108,7 @@ void main() computeDLights( var_Position, N, viewDir, diffuse, specular, color ); #if defined(r_glowMapping) - color.rgb += texture2D(u_GlowMap, texGlow).rgb; + color.rgb += texture2D(u_GlowMap, texCoords).rgb; #endif // r_glowMapping outputColor = color; diff --git a/src/engine/renderer/glsl_source/vertexLighting_DBS_world_vp.glsl b/src/engine/renderer/glsl_source/vertexLighting_DBS_world_vp.glsl index 92fb9b2020..14b6dcf871 100644 --- a/src/engine/renderer/glsl_source/vertexLighting_DBS_world_vp.glsl +++ b/src/engine/renderer/glsl_source/vertexLighting_DBS_world_vp.glsl @@ -22,10 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /* vertexLighting_DBS_world_vp.glsl */ -uniform mat4 u_DiffuseTextureMatrix; -uniform mat4 u_NormalTextureMatrix; -uniform mat4 u_SpecularTextureMatrix; -uniform mat4 u_GlowTextureMatrix; +uniform mat4 u_TextureMatrix; uniform mat4 u_ModelViewProjectionMatrix; uniform float u_Time; @@ -34,12 +31,9 @@ uniform vec4 u_ColorModulate; uniform vec4 u_Color; OUT(smooth) vec3 var_Position; -OUT(smooth) vec2 var_TexDiffuse; -OUT(smooth) vec2 var_TexGlow; +OUT(smooth) vec2 var_TexCoords; OUT(smooth) vec4 var_Color; -OUT(smooth) vec2 var_TexNormal; -OUT(smooth) vec2 var_TexSpecular; OUT(smooth) vec3 var_Tangent; OUT(smooth) vec3 var_Binormal; @@ -75,22 +69,13 @@ void main() var_Position = position.xyz; // transform diffusemap texcoords - var_TexDiffuse = (u_DiffuseTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; + var_TexCoords = (u_TextureMatrix * vec4(texCoord, 0.0, 1.0)).st; // assign color var_Color = color; - // transform normalmap texcoords - var_TexNormal = (u_NormalTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; - - // transform specularmap texture coords - var_TexSpecular = (u_SpecularTextureMatrix * vec4(texCoord, 0.0, 1.0)).st; - var_Tangent = LB.tangent; var_Binormal = LB.binormal; var_Normal = LB.normal; - - // transform glowmap texture coords - var_TexGlow = ( u_GlowTextureMatrix * vec4(texCoord, 0.0, 1.0) ).st; } diff --git a/src/engine/renderer/tr_backend.cpp b/src/engine/renderer/tr_backend.cpp index d75b99ff32..f7ee57f580 100644 --- a/src/engine/renderer/tr_backend.cpp +++ b/src/engine/renderer/tr_backend.cpp @@ -1869,7 +1869,7 @@ static void RB_SetupLightForLighting( trRefLight_t *light ) // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); gl_genericShader->SetUniform_ModelViewProjectionMatrix( light->shadowMatrices[ frustumIndex ] ); @@ -2737,7 +2737,7 @@ void RB_RunVisTests( ) // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( tess.svars.texMatrices[ TB_COLORMAP ] ); + gl_genericShader->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_COLORMAP ] ); GL_State( GLS_DEPTHTEST_DISABLE | GLS_COLORMASK_BITS ); glBeginQuery( GL_SAMPLES_PASSED, testState->hQueryRef ); @@ -3265,7 +3265,7 @@ static void RB_RenderDebugUtils() // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); ia = nullptr; Color::Color lightColor; @@ -3425,7 +3425,7 @@ static void RB_RenderDebugUtils() // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); for ( iaCount = 0, ia = &backEnd.viewParms.interactions[ 0 ]; iaCount < backEnd.viewParms.numInteractions; ia++, iaCount++ ) { @@ -3550,7 +3550,7 @@ static void RB_RenderDebugUtils() // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); ent = backEnd.refdef.entities; @@ -3632,7 +3632,7 @@ static void RB_RenderDebugUtils() #else GL_BindToTMU( 0, tr.whiteImage ); #endif - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); ent = backEnd.refdef.entities; @@ -3855,7 +3855,7 @@ static void RB_RenderDebugUtils() // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); // set 2D virtual screen size GL_PushMatrix(); @@ -3980,7 +3980,7 @@ static void RB_RenderDebugUtils() // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); GL_CheckErrors(); @@ -4056,7 +4056,7 @@ static void RB_RenderDebugUtils() // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); GL_CheckErrors(); @@ -4141,7 +4141,7 @@ static void RB_RenderDebugUtils() // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); GL_CheckErrors(); @@ -4236,7 +4236,7 @@ static void RB_RenderDebugUtils() // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); gl_genericShader->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[ glState.stackIndex ] ); @@ -4438,7 +4438,7 @@ static void RB_RenderDebugUtils() // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); GL_CheckErrors(); @@ -4530,7 +4530,7 @@ void DebugDrawBegin( debugDrawMode_t mode, float size ) { // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); // render in world space backEnd.orientation = backEnd.viewParms.world; @@ -4842,7 +4842,7 @@ void RE_StretchRaw( int x, int y, int w, int h, int cols, int rows, const byte * // bind u_ColorMap GL_BindToTMU( 0, tr.scratchImage[ client ] ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); // if the scratchImage isn't in the format we want, specify it as a new texture if ( cols != tr.scratchImage[ client ]->width || rows != tr.scratchImage[ client ]->height ) @@ -5754,7 +5754,7 @@ void RB_ShowImages() // set uniforms //gl_genericShader->SetUniform_AlphaTest( GLS_ATEST_NONE ); gl_genericShader->SetUniform_ColorModulate( colorGen_t::CGEN_VERTEX, alphaGen_t::AGEN_VERTEX ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); GL_SelectTexture( 0 ); diff --git a/src/engine/renderer/tr_shade.cpp b/src/engine/renderer/tr_shade.cpp index 07a940e783..d0057d67bd 100644 --- a/src/engine/renderer/tr_shade.cpp +++ b/src/engine/renderer/tr_shade.cpp @@ -479,7 +479,7 @@ static void DrawTris() // bind u_ColorMap GL_BindToTMU( 0, tr.whiteImage ); - gl_genericShader->SetUniform_ColorTextureMatrix( tess.svars.texMatrices[ TB_COLORMAP ] ); + gl_genericShader->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_COLORMAP ] ); gl_genericShader->SetRequiredVertexPointers(); glDepthRange( 0, 0 ); @@ -678,7 +678,7 @@ static void Render_generic( int stage ) // bind u_ColorMap GL_SelectTexture( 0 ); BindAnimatedImage( &pStage->bundle[ TB_COLORMAP ] ); - gl_genericShader->SetUniform_ColorTextureMatrix( tess.svars.texMatrices[ TB_COLORMAP ] ); + gl_genericShader->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_COLORMAP ] ); if ( hasDepthFade ) { @@ -801,7 +801,7 @@ static void Render_vertexLighting_DBS_entity( int stage ) // bind u_DiffuseMap GL_BindToTMU( 0, pStage->bundle[ TB_DIFFUSEMAP ].image[ 0 ] ); - gl_vertexLightingShader_DBS_entity->SetUniform_DiffuseTextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); + gl_vertexLightingShader_DBS_entity->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); if ( normalMapping || heightMapInNormalMap ) { @@ -816,8 +816,6 @@ static void Render_vertexLighting_DBS_entity( int stage ) GL_BindToTMU( 1, tr.flatImage ); } - gl_vertexLightingShader_DBS_entity->SetUniform_NormalTextureMatrix( tess.svars.texMatrices[ TB_NORMALMAP ] ); - if ( specularMapping ) { // bind u_SpecularMap @@ -833,8 +831,6 @@ static void Render_vertexLighting_DBS_entity( int stage ) GL_BindToTMU( 2, tr.blackImage ); } - gl_vertexLightingShader_DBS_entity->SetUniform_SpecularTextureMatrix( tess.svars.texMatrices[ TB_SPECULARMAP ] ); - if ( tr.cubeHashTable != nullptr ) { cubemapProbe_t *cubeProbeNearest; @@ -922,12 +918,8 @@ static void Render_vertexLighting_DBS_entity( int stage ) if ( glowMapping ) { GL_BindToTMU( 5, pStage->bundle[ TB_GLOWMAP ].image[ 0 ] ); - - gl_vertexLightingShader_DBS_entity->SetUniform_GlowTextureMatrix( tess.svars.texMatrices[ TB_GLOWMAP ] ); } else { GL_BindToTMU( 5, tr.blackImage ); - - gl_vertexLightingShader_DBS_entity->SetUniform_GlowTextureMatrix( tess.svars.texMatrices[ TB_GLOWMAP ] ); } if ( tr.lightGrid1Image && tr.lightGrid2Image ) { @@ -1053,7 +1045,7 @@ static void Render_vertexLighting_DBS_world( int stage ) // bind u_DiffuseMap GL_BindToTMU( 0, pStage->bundle[ TB_DIFFUSEMAP ].image[ 0 ] ); - gl_vertexLightingShader_DBS_world->SetUniform_DiffuseTextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); + gl_vertexLightingShader_DBS_world->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); if ( normalMapping || heightMapInNormalMap ) { @@ -1068,8 +1060,6 @@ static void Render_vertexLighting_DBS_world( int stage ) GL_BindToTMU( 1, tr.flatImage ); } - gl_vertexLightingShader_DBS_world->SetUniform_NormalTextureMatrix( tess.svars.texMatrices[ TB_NORMALMAP ] ); - if ( specularMapping ) { // bind u_SpecularMap @@ -1085,8 +1075,6 @@ static void Render_vertexLighting_DBS_world( int stage ) GL_BindToTMU( 2, tr.blackImage ); } - gl_vertexLightingShader_DBS_world->SetUniform_SpecularTextureMatrix( tess.svars.texMatrices[ TB_SPECULARMAP ] ); - if ( tr.lightGrid1Image && tr.lightGrid2Image ) { GL_BindToTMU( 6, tr.lightGrid1Image ); GL_BindToTMU( 7, tr.lightGrid2Image ); @@ -1095,12 +1083,8 @@ static void Render_vertexLighting_DBS_world( int stage ) if ( glowMapping ) { GL_BindToTMU( 3, pStage->bundle[ TB_GLOWMAP ].image[ 0 ] ); - - gl_vertexLightingShader_DBS_world->SetUniform_GlowTextureMatrix( tess.svars.texMatrices[ TB_GLOWMAP ] ); } else { GL_BindToTMU( 3, tr.blackImage ); - - gl_vertexLightingShader_DBS_world->SetUniform_GlowTextureMatrix( tess.svars.texMatrices[ TB_GLOWMAP ] ); } gl_vertexLightingShader_DBS_world->SetRequiredVertexPointers(); @@ -1221,7 +1205,7 @@ static void Render_lightMapping( int stage, bool asColorMap, bool normalMapping, else { GL_BindToTMU( 0, pStage->bundle[ TB_DIFFUSEMAP ].image[ 0 ] ); - gl_lightMappingShader->SetUniform_DiffuseTextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); + gl_lightMappingShader->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); } // bind u_NormalMap @@ -1237,8 +1221,6 @@ static void Render_lightMapping( int stage, bool asColorMap, bool normalMapping, GL_BindToTMU( 1, tr.flatImage ); } - gl_lightMappingShader->SetUniform_NormalTextureMatrix( tess.svars.texMatrices[ TB_NORMALMAP ] ); - if ( specularMapping ) { // bind u_SpecularMap @@ -1254,8 +1236,6 @@ static void Render_lightMapping( int stage, bool asColorMap, bool normalMapping, GL_BindToTMU( 2, tr.blackImage ); } - gl_lightMappingShader->SetUniform_SpecularTextureMatrix( tess.svars.texMatrices[ TB_SPECULARMAP ] ); - // bind u_DeluxeMap if ( deluxeMapping ) { @@ -1280,12 +1260,8 @@ static void Render_lightMapping( int stage, bool asColorMap, bool normalMapping, if ( glowMapping ) { GL_BindToTMU( 5, pStage->bundle[ TB_GLOWMAP ].image[ 0 ] ); - - gl_lightMappingShader->SetUniform_GlowTextureMatrix( tess.svars.texMatrices[ TB_GLOWMAP ] ); } else { GL_BindToTMU( 5, tr.blackImage ); - - gl_lightMappingShader->SetUniform_GlowTextureMatrix( tess.svars.texMatrices[ TB_GLOWMAP ] ); } gl_lightMappingShader->SetRequiredVertexPointers(); @@ -1358,13 +1334,13 @@ static void Render_depthFill(int stage) if ( alphaBits != 0 ) { GL_BindToTMU( 0, pStage->bundle[ TB_DIFFUSEMAP ].image[ 0 ] ); - gl_genericShader->SetUniform_ColorTextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); + gl_genericShader->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); } else { //GL_Bind(tr.defaultImage); GL_BindToTMU( 0, pStage->bundle[ TB_DIFFUSEMAP ].image[ 0 ] ); - gl_genericShader->SetUniform_ColorTextureMatrix( matrixIdentity ); + gl_genericShader->SetUniform_TextureMatrix( matrixIdentity ); } gl_genericShader->SetRequiredVertexPointers(); @@ -1433,7 +1409,7 @@ static void Render_shadowFill( int stage ) if ( ( pStage->stateBits & GLS_ATEST_BITS ) != 0 ) { GL_BindToTMU( 0, pStage->bundle[ TB_COLORMAP ].image[ 0 ] ); - gl_shadowFillShader->SetUniform_ColorTextureMatrix( tess.svars.texMatrices[ TB_COLORMAP ] ); + gl_shadowFillShader->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_COLORMAP ] ); } else { @@ -1576,7 +1552,7 @@ static void Render_forwardLighting_DBS_omni( shaderStage_t *diffuseStage, // bind u_DiffuseMap GL_BindToTMU( 0, diffuseStage->bundle[ TB_DIFFUSEMAP ].image[ 0 ] ); - gl_forwardLightingShader_omniXYZ->SetUniform_DiffuseTextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); + gl_forwardLightingShader_omniXYZ->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); if ( normalMapping || heightMapInNormalMap ) { @@ -1591,8 +1567,6 @@ static void Render_forwardLighting_DBS_omni( shaderStage_t *diffuseStage, GL_BindToTMU( 1, tr.flatImage ); } - gl_forwardLightingShader_omniXYZ->SetUniform_NormalTextureMatrix( tess.svars.texMatrices[ TB_NORMALMAP ] ); - if ( specularMapping ) { // bind u_SpecularMap @@ -1608,8 +1582,6 @@ static void Render_forwardLighting_DBS_omni( shaderStage_t *diffuseStage, GL_BindToTMU( 2, tr.blackImage ); } - gl_forwardLightingShader_omniXYZ->SetUniform_SpecularTextureMatrix( tess.svars.texMatrices[ TB_SPECULARMAP ] ); - // bind u_AttenuationMapXY GL_SelectTexture( 3 ); BindAnimatedImage( &attenuationXYStage->bundle[ TB_COLORMAP ] ); @@ -1767,7 +1739,7 @@ static void Render_forwardLighting_DBS_proj( shaderStage_t *diffuseStage, // bind u_DiffuseMap GL_BindToTMU( 0, diffuseStage->bundle[ TB_DIFFUSEMAP ].image[ 0 ] ); - gl_forwardLightingShader_projXYZ->SetUniform_DiffuseTextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); + gl_forwardLightingShader_projXYZ->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); if ( normalMapping || heightMapInNormalMap ) { @@ -1782,8 +1754,6 @@ static void Render_forwardLighting_DBS_proj( shaderStage_t *diffuseStage, GL_BindToTMU( 1, tr.flatImage ); } - gl_forwardLightingShader_projXYZ->SetUniform_NormalTextureMatrix( tess.svars.texMatrices[ TB_NORMALMAP ] ); - if ( specularMapping ) { // bind u_SpecularMap @@ -1799,8 +1769,6 @@ static void Render_forwardLighting_DBS_proj( shaderStage_t *diffuseStage, GL_BindToTMU( 2, tr.blackImage ); } - gl_forwardLightingShader_projXYZ->SetUniform_SpecularTextureMatrix( tess.svars.texMatrices[ TB_SPECULARMAP ] ); - // bind u_AttenuationMapXY GL_SelectTexture( 3 ); BindAnimatedImage( &attenuationXYStage->bundle[ TB_COLORMAP ] ); @@ -1960,7 +1928,7 @@ static void Render_forwardLighting_DBS_directional( shaderStage_t *diffuseStage, // bind u_DiffuseMap GL_BindToTMU( 0, diffuseStage->bundle[ TB_DIFFUSEMAP ].image[ 0 ] ); - gl_forwardLightingShader_directionalSun->SetUniform_DiffuseTextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); + gl_forwardLightingShader_directionalSun->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_DIFFUSEMAP ] ); if ( normalMapping || heightMapInNormalMap ) { @@ -1975,8 +1943,6 @@ static void Render_forwardLighting_DBS_directional( shaderStage_t *diffuseStage, GL_BindToTMU( 1, tr.flatImage ); } - gl_forwardLightingShader_directionalSun->SetUniform_NormalTextureMatrix( tess.svars.texMatrices[ TB_NORMALMAP ] ); - if ( specularMapping ) { // bind u_SpecularMap @@ -1992,8 +1958,6 @@ static void Render_forwardLighting_DBS_directional( shaderStage_t *diffuseStage, GL_BindToTMU( 2, tr.blackImage ); } - gl_forwardLightingShader_directionalSun->SetUniform_SpecularTextureMatrix( tess.svars.texMatrices[ TB_SPECULARMAP ] ); - // bind u_ShadowMap if ( shadowCompare ) { @@ -2091,7 +2055,7 @@ static void Render_reflection_CB( int stage ) GL_BindToTMU( 1, tr.flatImage ); } - gl_reflectionShader->SetUniform_NormalTextureMatrix( tess.svars.texMatrices[ TB_NORMALMAP ] ); + gl_reflectionShader->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_NORMALMAP ] ); // bind u_depthScale u_parallaxOffsetBias if ( parallaxMapping ) @@ -2272,7 +2236,7 @@ static void Render_heatHaze( int stage ) // bind u_NormalMap GL_BindToTMU( 0, pStage->bundle[ TB_COLORMAP ].image[ 0 ] ); - gl_heatHazeShader->SetUniform_NormalTextureMatrix( tess.svars.texMatrices[ TB_COLORMAP ] ); + gl_heatHazeShader->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_COLORMAP ] ); // bind u_NormalFormat gl_heatHazeShader->SetUniform_NormalFormat( tess.surfaceShader->normalFormat ); @@ -2361,7 +2325,7 @@ static void Render_liquid( int stage ) gl_liquidShader->SetUniform_NormalFormat( tess.surfaceShader->normalFormat ); } - gl_liquidShader->SetUniform_NormalTextureMatrix( tess.svars.texMatrices[ TB_COLORMAP ] ); + gl_liquidShader->SetUniform_TextureMatrix( tess.svars.texMatrices[ TB_COLORMAP ] ); Tess_DrawElements();