Skip to content

Commit

Permalink
renderer: remove glsl r_NormalScale define, leverage normalScale instead
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed Dec 15, 2019
1 parent c3ab496 commit 2e91742
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/engine/renderer/gl_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,6 @@ std::string GLShaderManager::BuildGPUShaderText( Str::StringRef mainShaderNa

AddDefine( env, "r_AmbientScale", r_ambientScale->value );
AddDefine( env, "r_SpecularScale", r_specularScale->value );
AddDefine( env, "r_NormalScale", r_normalScale->value );
AddDefine( env, "r_zNear", r_znear->value );

AddDefine( env, "M_PI", static_cast<float>( M_PI ) );
Expand Down
4 changes: 0 additions & 4 deletions src/engine/renderer/glsl_source/reliefMapping_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ vec3 NormalInTangentSpace(vec2 texNormal)
{
normal *= u_NormalScale;
}

#if defined(r_NormalScale)
normal.z *= r_NormalScale;
#endif
#else // !r_normalMapping
normal = vec3(0.5, 0.5, 1.0);
#endif // !r_normalMapping
Expand Down
6 changes: 6 additions & 0 deletions src/engine/renderer/tr_shade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,12 @@ void SetNormalScale( shaderStage_t *pStage, vec3_t normalScale)
normalScale[ 1 ] *= pStage->normalScale[ 1 ];
normalScale[ 2 ] *= pStage->normalScale[ 2 ];
}

// never multiply normal Z by zero, it's wrong
if ( r_normalScale->integer )
{
normalScale[ 2 ] *= r_normalScale->integer;
}
}

// *INDENT-ON*
Expand Down

0 comments on commit 2e91742

Please sign in to comment.