Skip to content

Commit 7d15e92

Browse files
committed
fixup: fixes
1 parent 70f44fd commit 7d15e92

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
@@ -3707,7 +3707,7 @@ struct colorModulation_t {
37073707
float colorGen = 0.0f;
37083708
float alphaGen = 0.0f;
37093709
float lightFactor = 1.0f;
3710-
bool isLightStyle = false;
3710+
bool useVertexLightFactor = false;
37113711
bool alphaAddOne = true;
37123712
};
37133713

@@ -3722,13 +3722,13 @@ static colorModulation_t ColorModulateColorGen(
37223722
switch ( colorGen )
37233723
{
37243724
case colorGen_t::CGEN_VERTEX:
3725-
colorModulation.alphaAddOne = false;;
3725+
colorModulation.alphaAddOne = false;
37263726

37273727
if ( vertexOverbright )
37283728
{
37293729
// vertexOverbright is only needed for non-lightmapped cases. When there is a
37303730
// lightmap, this is done by multiplying with the overbright-scaled white image
3731-
colorModulation.isLightStyle = true;
3731+
colorModulation.useVertexLightFactor = true;
37323732
colorModulation.lightFactor = tr.mapLightFactor;
37333733
}
37343734
else
@@ -3738,7 +3738,7 @@ static colorModulation_t ColorModulateColorGen(
37383738
break;
37393739

37403740
case colorGen_t::CGEN_ONE_MINUS_VERTEX:
3741-
colorModulation.alphaAddOne = false;;
3741+
colorModulation.alphaAddOne = false;
37423742
colorModulation.colorGen = -1.0f;
37433743
break;
37443744

@@ -3800,7 +3800,7 @@ class u_ColorModulateColorGen_Float :
38003800
vec4_t colorModulate_Float;
38013801
colorModulate_Float[ 0 ] = colorModulation.colorGen;
38023802
colorModulate_Float[ 1 ] = colorModulation.lightFactor;
3803-
colorModulate_Float[ 1 ] *= colorModulation.isLightStyle ? -1.0f : 1.0f;
3803+
colorModulate_Float[ 1 ] *= colorModulation.useVertexLightFactor ? -1.0f : 1.0f;
38043804
colorModulate_Float[ 2 ] = colorModulation.alphaAddOne;
38053805
colorModulate_Float[ 3 ] = colorModulation.alphaGen;
38063806

@@ -3859,7 +3859,7 @@ class u_ColorModulateColorGen_Uint :
38593859
<< Util::ordinal( ColorModulate_Bit::ALPHA_MINUS_ONE );
38603860
colorModulate_Uint |= colorModulation.alphaAddOne
38613861
<< Util::ordinal( ColorModulate_Bit::ALPHA_ADD_ONE );
3862-
colorModulate_Uint |= colorModulation.isLightStyle
3862+
colorModulate_Uint |= colorModulation.useVertexLightFactor
38633863
<< Util::ordinal( ColorModulate_Bit::IS_LIGHT_STYLE );
38643864
colorModulate_Uint |= uint32_t( colorModulation.lightFactor )
38653865
<< 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)