Skip to content

Commit

Permalink
Merge pull request mapbase-source#186 from Petercov/mapbase-feature/f…
Browse files Browse the repository at this point in the history
…ix-teeth-shader

Fix for brightly glowing teeth
  • Loading branch information
Blixibon authored Apr 26, 2022
2 parents 4bd06b6 + edc495d commit 2b22741
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions sp/src/materialsystem/stdshaders/teeth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ BEGIN_VS_SHADER( SDK_Teeth_DX9, "Help for SDK_Teeth_DX9" )

float vEyePos_SpecExponent[4];
pShaderAPI->GetWorldSpaceCameraPosition( vEyePos_SpecExponent );
vEyePos_SpecExponent[3] = 0.0f;
if (g_pHardwareConfig->HasFastVertexTextures() || g_pHardwareConfig->SupportsPixelShaders_2_b())
vEyePos_SpecExponent[3] = params[PHONGEXPONENT]->GetFloatValue();
else
vEyePos_SpecExponent[3] = 0.0f;
pShaderAPI->SetPixelShaderConstant( PSREG_EYEPOS_SPEC_EXPONENT, vEyePos_SpecExponent, 1 );

if ( hasBump )
Expand All @@ -244,11 +247,6 @@ BEGIN_VS_SHADER( SDK_Teeth_DX9, "Help for SDK_Teeth_DX9" )
// ps_2_b version which does Phong
if ( g_pHardwareConfig->SupportsPixelShaders_2_b() )
{
Vector4D vSpecExponent;
vSpecExponent[3] = params[PHONGEXPONENT]->GetFloatValue();

pShaderAPI->SetPixelShaderConstant( PSREG_EYEPOS_SPEC_EXPONENT, vSpecExponent.Base(), 1 );

DECLARE_DYNAMIC_PIXEL_SHADER( sdk_teeth_bump_ps20b );
SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() );
SET_DYNAMIC_PIXEL_SHADER_COMBO( NUM_LIGHTS, lightState.m_nNumLights );
Expand Down Expand Up @@ -278,10 +276,6 @@ BEGIN_VS_SHADER( SDK_Teeth_DX9, "Help for SDK_Teeth_DX9" )
SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression );
SET_DYNAMIC_VERTEX_SHADER( sdk_teeth_bump_vs30 );

Vector4D vSpecExponent;
vSpecExponent[3] = params[PHONGEXPONENT]->GetFloatValue();
pShaderAPI->SetPixelShaderConstant( PSREG_EYEPOS_SPEC_EXPONENT, vSpecExponent.Base(), 1 );

DECLARE_DYNAMIC_PIXEL_SHADER( sdk_teeth_bump_ps30 );
SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() );
SET_DYNAMIC_PIXEL_SHADER_COMBO( NUM_LIGHTS, lightState.m_nNumLights );
Expand Down

0 comments on commit 2b22741

Please sign in to comment.