Don't cull objects that we run into

This commit is contained in:
Robert Beckebans 2024-08-22 23:19:59 +02:00
parent fc6c1fef7a
commit 5107d12cc5
2 changed files with 29 additions and 7 deletions

View file

@ -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;

View file

@ -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 );