Skip to content
Open
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
4 changes: 3 additions & 1 deletion src/engine/renderer/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,12 +776,14 @@ static std::string GetStageInfo( const shaderStage_t* pStage, const uint32_t dyn
"base variant ",
"vertex overbright ",
"vertex-lit ",
"fullbright ",
"vertex overbright vertex-lit ",
"fullbright ",
"vertex overbright fullbright ",
"vertex-lit fullbright ",
"vertex overbright vertex-lit fullbright"
};
static_assert( ARRAY_LEN( stageVariants ) == ShaderStageVariant::ALL,
"update stage variant text descriptions" );

uint32_t variants = 0;
for ( int i = 0; i < ShaderStageVariant::ALL && variants < pStage->variantOffset; i++ ) {
Expand Down
11 changes: 1 addition & 10 deletions src/engine/renderer/gl_shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -2738,7 +2738,6 @@ struct colorModulation_t {
float alphaGen = 0.0f;
float lightFactor = 1.0f;
bool useVertexLightFactor = false;
bool alphaAddOne = true;
};

static colorModulation_t ColorModulateColorGen(
Expand All @@ -2752,8 +2751,6 @@ static colorModulation_t ColorModulateColorGen(
switch ( colorGen )
{
case colorGen_t::CGEN_VERTEX:
colorModulation.alphaAddOne = false;

if ( vertexOverbright )
{
// vertexOverbright is only needed for non-lightmapped cases. When there is a
Expand All @@ -2768,7 +2765,6 @@ static colorModulation_t ColorModulateColorGen(
break;

case colorGen_t::CGEN_ONE_MINUS_VERTEX:
colorModulation.alphaAddOne = false;
colorModulation.colorGen = -1.0f;
break;

Expand All @@ -2785,12 +2781,10 @@ static colorModulation_t ColorModulateColorGen(
switch ( alphaGen )
{
case alphaGen_t::AGEN_VERTEX:
colorModulation.alphaAddOne = false;;
colorModulation.alphaGen = 1.0f;
break;

case alphaGen_t::AGEN_ONE_MINUS_VERTEX:
colorModulation.alphaAddOne = false;;
colorModulation.alphaGen = -1.0f;
break;

Expand Down Expand Up @@ -2827,7 +2821,7 @@ class u_ColorModulateColorGen_Float :
colorModulate_Float[ 0 ] = colorModulation.colorGen;
colorModulate_Float[ 1 ] = colorModulation.lightFactor;
colorModulate_Float[ 1 ] *= colorModulation.useVertexLightFactor ? -1.0f : 1.0f;
colorModulate_Float[ 2 ] = colorModulation.alphaAddOne;
colorModulate_Float[ 2 ] = {};
colorModulate_Float[ 3 ] = colorModulation.alphaGen;

this->SetValue( colorModulate_Float );
Expand Down Expand Up @@ -2859,7 +2853,6 @@ class u_ColorModulateColorGen_Uint :
COLOR_MINUS_ONE = 1,
ALPHA_ONE = 2,
ALPHA_MINUS_ONE = 3,
ALPHA_ADD_ONE = 4,
// <-- Insert new bits there.
IS_LIGHT_STYLE = 27,
LIGHTFACTOR_BIT0 = 28,
Expand All @@ -2879,8 +2872,6 @@ class u_ColorModulateColorGen_Uint :
<< Util::ordinal( ColorModulate_Bit::ALPHA_ONE );
colorModulate_Uint |= ( colorModulation.alphaGen == -1.0f )
<< Util::ordinal( ColorModulate_Bit::ALPHA_MINUS_ONE );
colorModulate_Uint |= colorModulation.alphaAddOne
<< Util::ordinal( ColorModulate_Bit::ALPHA_ADD_ONE );
colorModulate_Uint |= colorModulation.useVertexLightFactor
<< Util::ordinal( ColorModulate_Bit::IS_LIGHT_STYLE );
colorModulate_Uint |= uint32_t( colorModulation.lightFactor )
Expand Down
10 changes: 1 addition & 9 deletions src/engine/renderer/glsl_source/common.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ colorMod << 0: color * 1
colorMod << 1: color * ( -1 )
colorMod << 2: alpha * 1
colorMod << 3: alpha * ( -1 )
colorMod << 4: alpha = 1
colorMod << 5-26: available for future usage
colorMod << 4-26: available for future usage
colorMod << 27: color += lightFactor
colorMod << 28-31: lightFactor
Expand All @@ -78,7 +77,6 @@ colorMod float format:
colorMod[ 0 ]: color * f
colorMod[ 1 ] absolute value: lightFactor
colorMod[ 1 ] minus sign: color += lightFactor
colorMod[ 2 ]: alpha = 1
colorMod[ 3 ]: alpha * f */

vec4 ColorModulateToColor( const in colorModulatePack colorMod )
Expand All @@ -101,7 +99,6 @@ vec4 ColorModulateToColor( const in colorModulatePack colorMod )

struct ModBits_t
{
bool alphaAddOne;
bool useVertexLightFactor;
};

Expand All @@ -110,10 +107,8 @@ ModBits_t ColorModulateToBits( const in colorModulatePack colorMod )
ModBits_t modBits;

#if defined(HAVE_EXT_gpu_shader4)
modBits.alphaAddOne = bool( ( colorMod >> 4u ) & 1u );
modBits.useVertexLightFactor = bool( ( colorMod >> 27u ) & 1u );
#else
modBits.alphaAddOne = colorMod.b != 0;
modBits.useVertexLightFactor = colorMod.g < 0;
#endif

Expand Down Expand Up @@ -159,9 +154,6 @@ void ColorModulateColor_lightFactor(
ModBits_t modBits = ColorModulateToBits( colorMod );
float lightFactor = ColorModulateToLightFactor( colorMod );

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

colorModulation.rgb += vec3( modBits.useVertexLightFactor ? lightFactor : 0 );

vec4 unpackedColor = UnpackColor( packedColor );
Expand Down