Skip to content

Commit

Permalink
Don't set global uniforms in UpdateSurfaceData*
Browse files Browse the repository at this point in the history
  • Loading branch information
VReaperV committed Jan 3, 2025
1 parent 7406196 commit 99fa09d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions src/engine/renderer/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@ void UpdateSurfaceDataGeneric3D( uint32_t* materials, Material& material, drawSu

gl_genericShaderMaterial->BindProgram( material.deformIndex );

gl_genericShaderMaterial->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix );
gl_genericShaderMaterial->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[glState.stackIndex] );

// u_AlphaThreshold
gl_genericShaderMaterial->SetUniform_AlphaTest( pStage->stateBits );

Expand Down Expand Up @@ -548,10 +545,6 @@ void UpdateSurfaceDataLiquid( uint32_t* materials, Material& material, drawSurf_
gl_liquidShaderMaterial->SetUniform_FogDensity( fogDensity );
gl_liquidShaderMaterial->SetUniform_FogColor( fogColor );

gl_liquidShaderMaterial->SetUniform_UnprojectMatrix( backEnd.viewParms.unprojectionMatrix );
gl_liquidShaderMaterial->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix );
gl_liquidShaderMaterial->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[glState.stackIndex] );

// NOTE: specular component is computed by shader.
// FIXME: physical mapping is not implemented.
if ( pStage->enableSpecularMapping ) {
Expand Down Expand Up @@ -1183,6 +1176,7 @@ void BindShaderLiquid( Material* material ) {

// Set shader uniforms.
gl_liquidShaderMaterial->SetUniform_ViewOrigin( backEnd.viewParms.orientation.origin );
gl_liquidShaderMaterial->SetUniform_UnprojectMatrix( backEnd.viewParms.unprojectionMatrix );
gl_liquidShaderMaterial->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix );
gl_liquidShaderMaterial->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[glState.stackIndex] );

Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/gl_shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -3458,7 +3458,7 @@ class u_UnprojectMatrix :
{
public:
u_UnprojectMatrix( GLShader *shader ) :
GLUniformMatrix4f( shader, "u_UnprojectMatrix" )
GLUniformMatrix4f( shader, "u_UnprojectMatrix", true )
{
}

Expand Down

0 comments on commit 99fa09d

Please sign in to comment.