@@ -3591,11 +3591,11 @@ class u_ColorModulate :
35913591};
35923592
35933593enum class ColorModulate {
3594- COLOR_ADD = BIT( 0 ),
3595- COLOR_NEGATE = BIT( 1 ),
3594+ COLOR_ONE = BIT( 0 ),
3595+ COLOR_MINUS_ONE = BIT( 1 ),
35963596 COLOR_LIGHTFACTOR = BIT( 2 ),
3597- ALPHA_ADD = BIT( 3 ),
3598- ALPHA_NEGATE = BIT( 4 )
3597+ ALPHA_ONE = BIT( 3 ),
3598+ ALPHA_MINUS_ONE = BIT( 4 )
35993599};
36003600
36013601class u_ColorModulateColorGen :
@@ -3617,22 +3617,23 @@ class u_ColorModulateColorGen :
36173617 );
36183618 }
36193619
3620+ uint32_t lightFactor = 0 ;
36203621 switch ( colorGen ) {
36213622 case colorGen_t::CGEN_VERTEX:
36223623 needAttrib = true ;
36233624 if ( vertexOverbright ) {
36243625 // vertexOverbright is only needed for non-lightmapped cases. When there is a
36253626 // lightmap, this is done by multiplying with the overbright-scaled white image
36263627 colorModulate |= Util::ordinal ( ColorModulate::COLOR_LIGHTFACTOR );
3627- colorModulate | = uint32_t ( tr.mapLightFactor / 4 ) << 5 ;
3628+ lightFactor = uint32_t ( tr.mapLightFactor ) << 5 ;
36283629 } else {
3629- colorModulate |= Util::ordinal ( ColorModulate::COLOR_ADD );
3630+ colorModulate |= Util::ordinal ( ColorModulate::COLOR_ONE );
36303631 }
36313632 break ;
36323633
36333634 case colorGen_t::CGEN_ONE_MINUS_VERTEX:
36343635 needAttrib = true ;
3635- colorModulate |= Util::ordinal ( ColorModulate::COLOR_ADD ) | Util::ordinal ( ColorModulate::COLOR_NEGATE );
3636+ colorModulate |= Util::ordinal ( ColorModulate::COLOR_MINUS_ONE );
36363637 break ;
36373638
36383639 default :
@@ -3641,20 +3642,20 @@ class u_ColorModulateColorGen :
36413642
36423643 if ( useMapLightFactor ) {
36433644 ASSERT_EQ ( vertexOverbright, false );
3644- colorModulate |= uint32_t ( tr.mapLightFactor ) << 5 ;
3645- } else {
3646- colorModulate |= 1 << 5 ;
3645+ lightFactor = uint32_t ( tr.mapLightFactor ) << 5 ;
36473646 }
36483647
3648+ colorModulate |= lightFactor ? lightFactor : 1 << 5 ;
3649+
36493650 switch ( alphaGen ) {
36503651 case alphaGen_t::AGEN_VERTEX:
36513652 needAttrib = true ;
3652- colorModulate |= Util::ordinal ( ColorModulate::ALPHA_ADD );
3653+ colorModulate |= Util::ordinal ( ColorModulate::ALPHA_ONE );
36533654 break ;
36543655
36553656 case alphaGen_t::AGEN_ONE_MINUS_VERTEX:
36563657 needAttrib = true ;
3657- colorModulate |= Util::ordinal ( ColorModulate::ALPHA_ADD ) | Util::ordinal ( ColorModulate::ALPHA_NEGATE );
3658+ colorModulate |= Util::ordinal ( ColorModulate::ALPHA_MINUS_ONE );
36583659 break ;
36593660
36603661 default :
0 commit comments