Skip to content

Commit ec4bdaf

Browse files
committed
fixup: fixes
1 parent 60e7dc8 commit ec4bdaf

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/engine/renderer/gl_shader.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3747,7 +3747,7 @@ struct colorModulation_t {
37473747
float colorGen = 0.0f;
37483748
float alphaGen = 0.0f;
37493749
float lightFactor = 1.0f;
3750-
bool isLightStyle = false;
3750+
bool useVertexLightFactor = false;
37513751
bool alphaAddOne = true;
37523752
};
37533753

@@ -3762,13 +3762,13 @@ static colorModulation_t ColorModulateColorGen(
37623762
switch ( colorGen )
37633763
{
37643764
case colorGen_t::CGEN_VERTEX:
3765-
colorModulation.alphaAddOne = false;;
3765+
colorModulation.alphaAddOne = false;
37663766

37673767
if ( vertexOverbright )
37683768
{
37693769
// vertexOverbright is only needed for non-lightmapped cases. When there is a
37703770
// lightmap, this is done by multiplying with the overbright-scaled white image
3771-
colorModulation.isLightStyle = true;
3771+
colorModulation.useVertexLightFactor = true;
37723772
colorModulation.lightFactor = tr.mapLightFactor;
37733773
}
37743774
else
@@ -3778,7 +3778,7 @@ static colorModulation_t ColorModulateColorGen(
37783778
break;
37793779

37803780
case colorGen_t::CGEN_ONE_MINUS_VERTEX:
3781-
colorModulation.alphaAddOne = false;;
3781+
colorModulation.alphaAddOne = false;
37823782
colorModulation.colorGen = -1.0f;
37833783
break;
37843784

@@ -3840,7 +3840,7 @@ class u_ColorModulateColorGen_Float :
38403840
vec4_t colorModulate_Float;
38413841
colorModulate_Float[ 0 ] = colorModulation.colorGen;
38423842
colorModulate_Float[ 1 ] = colorModulation.lightFactor;
3843-
colorModulate_Float[ 1 ] *= colorModulation.isLightStyle ? -1.0f : 1.0f;
3843+
colorModulate_Float[ 1 ] *= colorModulation.useVertexLightFactor ? -1.0f : 1.0f;
38443844
colorModulate_Float[ 2 ] = colorModulation.alphaAddOne;
38453845
colorModulate_Float[ 3 ] = colorModulation.alphaGen;
38463846

@@ -3899,7 +3899,7 @@ class u_ColorModulateColorGen_Uint :
38993899
<< Util::ordinal( ColorModulate_Bit::ALPHA_MINUS_ONE );
39003900
colorModulate_Uint |= colorModulation.alphaAddOne
39013901
<< Util::ordinal( ColorModulate_Bit::ALPHA_ADD_ONE );
3902-
colorModulate_Uint |= colorModulation.isLightStyle
3902+
colorModulate_Uint |= colorModulation.useVertexLightFactor
39033903
<< Util::ordinal( ColorModulate_Bit::IS_LIGHT_STYLE );
39043904
colorModulate_Uint |= uint32_t( colorModulation.lightFactor )
39053905
<< Util::ordinal( ColorModulate_Bit::LIGHTFACTOR_BIT0 );

src/engine/renderer/glsl_source/common.glsl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,22 @@ vec4 ColorModulateToColor( const in colorModulatePack colorMod )
9999
return vec4( rgb, rgb, rgb, alpha );
100100
}
101101

102-
struct modBits_t {
102+
struct ModBits_t
103+
{
103104
bool alphaAddOne;
104-
bool isLightStyle;
105+
bool useVertexLightFactor;
105106
};
106107

107-
modBits_t ColorModulateToBits( const in colorModulatePack colorMod )
108+
ModBits_t ColorModulateToBits( const in colorModulatePack colorMod )
108109
{
109-
modBits_t modBits;
110+
ModBits_t modBits;
110111

111112
#if defined(HAVE_EXT_gpu_shader4)
112113
modBits.alphaAddOne = bool( ( colorMod >> 4u ) & 1u );
113-
modBits.isLightStyle = bool( ( colorMod >> 27u ) & 1u );
114+
modBits.useVertexLightFactor = bool( ( colorMod >> 27u ) & 1u );
114115
#else
115116
modBits.alphaAddOne = colorMod.b != 0;
116-
modBits.isLightStyle = colorMod.g < 0;
117+
modBits.useVertexLightFactor = colorMod.g < 0;
117118
#endif
118119

119120
return modBits;
@@ -155,13 +156,13 @@ void ColorModulateColor_lightFactor(
155156
inout vec4 color )
156157
{
157158
vec4 colorModulation = ColorModulateToColor( colorMod );
158-
modBits_t modBits = ColorModulateToBits( colorMod );
159+
ModBits_t modBits = ColorModulateToBits( colorMod );
159160
float lightFactor = ColorModulateToLightFactor( colorMod );
160161

161162
// This is used to skip vertex colours if the colorMod doesn't need them.
162163
color.a = modBits.alphaAddOne ? 1.0 : color.a;
163164

164-
colorModulation.rgb += vec3( modBits.isLightStyle ? lightFactor : 0 );
165+
colorModulation.rgb += vec3( modBits.useVertexLightFactor ? lightFactor : 0 );
165166

166167
vec4 unpackedColor = UnpackColor( packedColor );
167168

0 commit comments

Comments
 (0)