From 5107d12cc5a31ce810098a35a1a4e61feb8817b4 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Thu, 22 Aug 2024 23:19:59 +0200 Subject: [PATCH] Don't cull objects that we run into --- neo/renderer/tr_frontend_addmodels.cpp | 15 +++++++++++-- .../tr_frontend_masked_occlusion_culling.cpp | 21 ++++++++++++++----- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/neo/renderer/tr_frontend_addmodels.cpp b/neo/renderer/tr_frontend_addmodels.cpp index 3b01c968..87eebe1c 100644 --- a/neo/renderer/tr_frontend_addmodels.cpp +++ b/neo/renderer/tr_frontend_addmodels.cpp @@ -693,7 +693,17 @@ void R_AddSingleModel( viewEntity_t* vEntity ) const float size = 16.0f; idBounds debugBounds( idVec3( -size ), idVec3( size ) ); //debugBounds = vEntity->entityDef->localReferenceBounds; - debugBounds = tri->bounds; +#if 0 + if( gpuSkinned ) + { + //debugBounds = vEntity->entityDef->localReferenceBounds; + debugBounds = model->Bounds(); + } + else +#endif + { + debugBounds = tri->bounds; + } idRenderMatrix inverseBaseModelProject; idRenderMatrix::OffsetScaleForBounds( modelRenderMatrix, debugBounds, inverseBaseModelProject ); @@ -717,7 +727,8 @@ void R_AddSingleModel( viewEntity_t* vEntity ) invProjectMVPMatrix.TransformPoint( v1, triVerts[1] ); invProjectMVPMatrix.TransformPoint( v2, triVerts[2] ); - MaskedOcclusionCulling::CullingResult result = tr.maskedOcclusionCulling->TestTriangles( ( float* )triVerts, triIndices, 1, NULL, MaskedOcclusionCulling::BACKFACE_CCW ); + // backface none so objects are still visible where we run into + MaskedOcclusionCulling::CullingResult result = tr.maskedOcclusionCulling->TestTriangles( ( float* )triVerts, triIndices, 1, NULL, MaskedOcclusionCulling::BACKFACE_NONE ); if( result == MaskedOcclusionCulling::VISIBLE ) { maskVisible = true; diff --git a/neo/renderer/tr_frontend_masked_occlusion_culling.cpp b/neo/renderer/tr_frontend_masked_occlusion_culling.cpp index 259deee1..2b5a6cab 100644 --- a/neo/renderer/tr_frontend_masked_occlusion_culling.cpp +++ b/neo/renderer/tr_frontend_masked_occlusion_culling.cpp @@ -418,10 +418,11 @@ void R_RenderSingleModel( viewEntity_t* vEntity ) const float* shaderRegisters = NULL; drawSurf_t* baseDrawSurf = NULL; if( surfaceDirectlyVisible && shader->IsDrawn() && shader->Coverage() == MC_OPAQUE && !renderEntity->weaponDepthHack && renderEntity->modelDepthHack == 0.0f ) + //if( surfaceDirectlyVisible && shader->IsDrawn() && !renderEntity->weaponDepthHack && renderEntity->modelDepthHack == 0.0f ) { // render to masked occlusion buffer - //if( model->IsStaticWorldModel() ) + if( !gpuSkinned ) //model->IsStaticWorldModel() ) { // super simple bruteforce idVec4 triVerts[3]; @@ -461,10 +462,20 @@ void R_RenderSingleModel( viewEntity_t* vEntity ) idRenderMatrix modelRenderMatrix; idRenderMatrix::CreateFromOriginAxis( renderEntity->origin, renderEntity->axis, modelRenderMatrix ); - const float size = 16.0f; - idBounds debugBounds( idVec3( -size ), idVec3( size ) ); - //debugBounds = vEntity->entityDef->localReferenceBounds; - debugBounds = tri->bounds; + //const float size = 16.0f; + //idBounds debugBounds( idVec3( -size ), idVec3( size ) ); + idBounds debugBounds; +#if 0 + if( gpuSkinned ) + { + //debugBounds = vEntity->entityDef->localReferenceBounds; + debugBounds = model->Bounds(); + } + else +#endif + { + debugBounds = tri->bounds; + } idRenderMatrix inverseBaseModelProject; idRenderMatrix::OffsetScaleForBounds( modelRenderMatrix, debugBounds, inverseBaseModelProject );