From 06c6dd0e4a92725b63cbe00a14e4e4062b94b102 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Tue, 27 Aug 2024 23:01:08 +0200 Subject: [PATCH] Fixed viewInsideSurface check which caused much flickering --- base/devtools.cfg | 9 ++++++--- neo/renderer/NVRHI/RenderDebug_NVRHI.cpp | 7 +++++++ neo/renderer/RenderWorld_portals.cpp | 2 +- neo/renderer/tr_frontend_addmodels.cpp | 19 +++++++++++++++---- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/base/devtools.cfg b/base/devtools.cfg index 7144cf0d..b8120691 100644 --- a/base/devtools.cfg +++ b/base/devtools.cfg @@ -2,16 +2,19 @@ bind "I" "toggle r_showSurfaceInfo" bind "N" "noclip" bind "M" "spawn moveable_macbethchart" +bind "O" "toggle r_useMaskedOcclusionCulling" +bind "P" "toggle r_showPortals" +// bind "F1" "toggle r_showViewEnvprobes 1 2 0" bind "F1" "editLights" bind "F2" "toggle r_showTris 1 2 0" -bind "F3" "toggle r_forceAmbient 0.5 1.0 0" +bind "F3" "toggle r_forceAmbient 0.3 0.5 1.0 0" bind "F4" "toggle r_skipInteractions" bind "F5" "savegame quick" -//bind "F6" "toggle r_showLightGrid 1 3 4 0" +// bind "F6" "toggle r_showLightGrid 1 3 4 0" bind "F6" "toggle r_renderMode 0 1 3 5 7 9 11" bind "F7" "toggle r_renderMode 0 1 2 3 4 5 6 7 8 9 10 11" bind "F8" "toggle r_useCRTPostFX 0 1 2 3" bind "F9" "loadgame quick" -//bind "F10" "toggle com_fixedTic" +// bind "F10" "toggle com_fixedTic" bind "F11" "toggle r_useFilmicPostFX" diff --git a/neo/renderer/NVRHI/RenderDebug_NVRHI.cpp b/neo/renderer/NVRHI/RenderDebug_NVRHI.cpp index e8507393..a447ba7c 100644 --- a/neo/renderer/NVRHI/RenderDebug_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderDebug_NVRHI.cpp @@ -388,6 +388,11 @@ void idRenderBackend::DBG_RenderDrawSurfListWithFunction( drawSurf_t** drawSurfs RB_SetMVP( drawSurf->space->mvp ); } + + // give every surface a different color + //static idVec4 colors[] = { colorRed, colorGreen, colorBlue, colorYellow, colorMagenta, colorCyan, colorWhite, colorPurple }; + //GL_Color( colors[i & 7] ); + //GL_Color( colors[drawSurf->ambientCache & 7] ); #else if( drawSurf->space != NULL ) // is it ever NULL? Do we need to check? @@ -423,10 +428,12 @@ void idRenderBackend::DBG_RenderDrawSurfListWithFunction( drawSurf_t** drawSurfs if( drawSurf->jointCache ) { + GL_Color( colorRed ); renderProgManager.BindShader_ColorSkinned(); } else { + GL_Color( colorCyan ); renderProgManager.BindShader_Color(); } // RB end diff --git a/neo/renderer/RenderWorld_portals.cpp b/neo/renderer/RenderWorld_portals.cpp index 54d649f3..d386e264 100644 --- a/neo/renderer/RenderWorld_portals.cpp +++ b/neo/renderer/RenderWorld_portals.cpp @@ -371,7 +371,7 @@ void idRenderWorldLocal::AddAreaViewLights( int areaNum, const portalStack_t* ps // debug tool to allow viewing of only one light at a time // RB: use this elsewhere in the backend debug drawing code -#if 1 +#if 0 if( r_singleLight.GetInteger() >= 0 && r_singleLight.GetInteger() != light->index ) { continue; diff --git a/neo/renderer/tr_frontend_addmodels.cpp b/neo/renderer/tr_frontend_addmodels.cpp index 1cb445b6..1a22233e 100644 --- a/neo/renderer/tr_frontend_addmodels.cpp +++ b/neo/renderer/tr_frontend_addmodels.cpp @@ -677,11 +677,22 @@ void R_AddSingleModel( viewEntity_t* vEntity ) // RB: added check wether GPU skinning is available at all const bool gpuSkinned = ( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() ); -#if defined(USE_INTRINSICS_SSE) - idRenderMatrix cullSurfaceProject; - idRenderMatrix::InverseOffsetScaleForBounds( renderMatrix_identity, tri->bounds, cullSurfaceProject ); + //const char* shaderName = shader->GetName(); + //if( idStr::Cmp( shaderName, "textures/rock/sharprock_dark") == 0 ) + //{ + // tr.pc.c_mocTests += 0; + //} - const bool viewInsideSurface = !idRenderMatrix::CullPointToMVP( cullSurfaceProject, localViewOrigin, false ); +#if defined(USE_INTRINSICS_SSE) + + const bool viewInsideSurface = tri->bounds.ContainsPoint( localViewOrigin ); + + //if( viewInsideSurface && idStr::Cmp( shaderName, "models/weapons/berserk/fist") != 0 ) + //{ + // tr.pc.c_mocTests += 1; + // + // tr.viewDef->renderWorld->DebugBounds( colorCyan, tri->bounds, renderEntity->origin ); + //} // RB: test surface visibility by drawing the triangles of the bounds if( r_useMaskedOcclusionCulling.GetBool() && !viewInsideSurface && !viewDef->isMirror && !viewDef->isSubview )