Skip to content

Commit

Permalink
Fix skybox debug draw
Browse files Browse the repository at this point in the history
Skybox is rendered with a mesh that has only position, so it can't be used with generic shader. Fixes the log spam and correctly shows where the skybox tris are.
  • Loading branch information
VReaperV committed Sep 25, 2024
1 parent 5d689e4 commit b16695f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/engine/renderer/tr_shade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3053,7 +3053,10 @@ void Tess_End()
// draw debugging stuff
if ( r_showTris->integer || r_showBatches->integer || ( r_showLightBatches->integer && ( tess.stageIteratorFunc == Tess_StageIteratorLighting ) ) )
{
DrawTris();
// Skybox triangle rendering is done in Tess_StageIteratorSky()
if ( tess.stageIteratorFunc != Tess_StageIteratorSky ) {
DrawTris();
}
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions src/engine/renderer/tr_sky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,23 @@ void Tess_StageIteratorSky()
Tess_DrawElements();
}

if ( r_showTris->integer ) {
GL_State( GLS_POLYMODE_LINE | GLS_DEPTHFUNC_ALWAYS );

// bind u_ColorMap
gl_skyboxShader->SetUniform_ColorMapCubeBindless(
GL_BindToTMU( 0, tr.whiteCubeImage )
);

// Only render the outer skybox outline at this stage
gl_skyboxShader->SetUniform_UseCloudMap( false );

// u_AlphaThreshold
gl_skyboxShader->SetUniform_AlphaTest( GLS_ATEST_NONE );

Tess_DrawElements();
}

// Only render clouds at these stages
gl_skyboxShader->SetUniform_UseCloudMap( true );
gl_skyboxShader->SetUniform_CloudHeight( tess.surfaceShader->sky.cloudHeight );
Expand Down

0 comments on commit b16695f

Please sign in to comment.