Skip to content

Commit f78667d

Browse files
committed
renderer: deduplicate u_Color and u_ColorGlobal
1 parent 2a3ebd8 commit f78667d

5 files changed

Lines changed: 8 additions & 20 deletions

File tree

src/engine/renderer/Material.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ void BindShaderFog( Material* material ) {
10591059
gl_fogQuake3ShaderMaterial->SetUniform_FogDepthVector( fogDepthVector );
10601060
gl_fogQuake3ShaderMaterial->SetUniform_FogEyeT( eyeT );
10611061

1062-
gl_fogQuake3ShaderMaterial->SetUniform_ColorGlobal( fog->color );
1062+
gl_fogQuake3ShaderMaterial->SetUniform_Color( fog->color );
10631063

10641064
gl_fogQuake3ShaderMaterial->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix );
10651065
gl_fogQuake3ShaderMaterial->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[glState.stackIndex] );

src/engine/renderer/gl_shader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,7 +2747,7 @@ GLShader_fogQuake3::GLShader_fogQuake3( GLShaderManager *manager ) :
27472747
u_FogMap( this ),
27482748
u_ModelMatrix( this ),
27492749
u_ModelViewProjectionMatrix( this ),
2750-
u_ColorGlobal( this ),
2750+
u_Color( this ),
27512751
u_Bones( this ),
27522752
u_VertexInterpolation( this ),
27532753
u_FogDistanceVector( this ),
@@ -2769,7 +2769,7 @@ GLShader_fogQuake3Material::GLShader_fogQuake3Material( GLShaderManager* manager
27692769
u_FogMap( this ),
27702770
u_ModelMatrix( this ),
27712771
u_ModelViewProjectionMatrix( this ),
2772-
u_ColorGlobal( this ),
2772+
u_Color( this ),
27732773
u_FogDistanceVector( this ),
27742774
u_FogDepthVector( this ),
27752775
u_FogEyeT( this ),

src/engine/renderer/gl_shader.h

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3057,18 +3057,6 @@ class u_Color :
30573057
}
30583058
};
30593059

3060-
class u_ColorGlobal :
3061-
GLUniform1ui {
3062-
public:
3063-
u_ColorGlobal( GLShader* shader ) :
3064-
GLUniform1ui( shader, "u_ColorGlobal", true ) {
3065-
}
3066-
3067-
void SetUniform_ColorGlobal( const Color::Color& color ) {
3068-
this->SetValue( packUnorm4x8( color.ToArray() ) );
3069-
}
3070-
};
3071-
30723060
class u_Frame :
30733061
GLUniform1ui {
30743062
public:
@@ -4329,7 +4317,7 @@ class GLShader_fogQuake3 :
43294317
public u_FogMap,
43304318
public u_ModelMatrix,
43314319
public u_ModelViewProjectionMatrix,
4332-
public u_ColorGlobal,
4320+
public u_Color,
43334321
public u_Bones,
43344322
public u_VertexInterpolation,
43354323
public u_FogDistanceVector,
@@ -4349,7 +4337,7 @@ class GLShader_fogQuake3Material :
43494337
public u_FogMap,
43504338
public u_ModelMatrix,
43514339
public u_ModelViewProjectionMatrix,
4352-
public u_ColorGlobal,
4340+
public u_Color,
43534341
public u_FogDistanceVector,
43544342
public u_FogDepthVector,
43554343
public u_FogEyeT,

src/engine/renderer/glsl_source/fogQuake3_vp.glsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2929
uniform float u_Time;
3030

3131
uniform vec4 u_ColorModulate;
32-
uniform uint u_ColorGlobal;
32+
uniform uint u_Color;
3333
uniform mat4 u_ModelMatrix;
3434
uniform mat4 u_ModelViewProjectionMatrix;
3535

@@ -58,7 +58,7 @@ void main()
5858

5959
VertexFetch( position, LB, color, texCoord, lmCoord );
6060

61-
color = /* color * u_ColorModulate + */ unpackUnorm4x8( u_ColorGlobal );
61+
color = /* color * u_ColorModulate + */ unpackUnorm4x8( u_Color );
6262

6363
DeformVertex( position,
6464
LB.normal,

src/engine/renderer/tr_shade.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2272,7 +2272,7 @@ void Render_fog( shaderStage_t* pStage )
22722272
gl_fogQuake3Shader->SetUniform_FogEyeT( eyeT );
22732273

22742274
// u_Color
2275-
gl_fogQuake3Shader->SetUniform_ColorGlobal( fog->color );
2275+
gl_fogQuake3Shader->SetUniform_Color( fog->color );
22762276

22772277
gl_fogQuake3Shader->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix );
22782278
gl_fogQuake3Shader->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[ glState.stackIndex ] );

0 commit comments

Comments
 (0)