added the R_SetPVSCulling extension

This commit is contained in:
myT 2023-02-25 23:01:11 +01:00
parent ec95faad1b
commit 7e0de354c2
6 changed files with 27 additions and 2 deletions

View file

@ -356,6 +356,7 @@ static qbool CL_CG_GetValue( char* value, int valueSize, const char* key )
{ "trap_CNQ3_NDP_StartVideo", CG_EXT_NDP_STARTVIDEO },
{ "trap_CNQ3_NDP_StopVideo", CG_EXT_NDP_STOPVIDEO },
{ "trap_CNQ3_R_RenderScene", CG_EXT_R_RENDERSCENE },
{ "trap_CNQ3_R_SetPVSCulling", CG_EXT_R_SETPVSCULLING },
// commands
{ "screenshotnc", 1 },
{ "screenshotncJPEG", 1 },
@ -708,6 +709,10 @@ static intptr_t CL_CgameSystemCalls( intptr_t *args )
re.RenderScene( VMA(1), args[2] );
return 0;
case CG_EXT_R_SETPVSCULLING:
re.SetPVSCulling( (qbool)args[1] );
return 0;
default:
Com_Error( ERR_DROP, "Bad cgame system trap: %i", args[0] );
}

View file

@ -202,7 +202,8 @@ typedef enum {
CG_EXT_NDP_READUNTIL,
CG_EXT_NDP_STARTVIDEO,
CG_EXT_NDP_STOPVIDEO,
CG_EXT_R_RENDERSCENE
CG_EXT_R_RENDERSCENE,
CG_EXT_R_SETPVSCULLING
} cgameImport_t;

View file

@ -683,6 +683,12 @@ static qbool RE_IsDepthClampEnabled()
}
static void RE_SetPVSCulling( qbool enable )
{
tr.drawEntireMap = !enable;
}
const refexport_t* GetRefAPI( const refimport_t* rimp )
{
static refexport_t re;
@ -736,5 +742,7 @@ const refexport_t* GetRefAPI( const refimport_t* rimp )
re.DepthClamp = RE_IsDepthClampEnabled;
re.SetPVSCulling = RE_SetPVSCulling;
return &re;
}

View file

@ -936,6 +936,8 @@ typedef struct {
float mipFilter[4]; // only used by the GPU generators
qbool worldSurface; // is the currently added draw surface a world surface?
qbool drawEntireMap;
} trGlobals_t;
extern backEndState_t backEnd;

View file

@ -170,6 +170,9 @@ typedef struct {
// is depth clamping enabled?
qbool (*DepthClamp)();
// qfalse will force drawing the entire map
void (*SetPVSCulling)( qbool enable );
} refexport_t;
//

View file

@ -512,6 +512,12 @@ static void R_MarkLeaves()
return;
}
// when playing a demo on a different map, the area masks might not match
// it's safest to ignore the demo's area mask and mark all nodes as visible
if ( tr.drawEntireMap ) {
tr.refdef.areamaskModified = qtrue;
}
// current viewcluster
leaf = R_PointInLeaf( tr.viewParms.pvsOrigin );
cluster = leaf->cluster;
@ -528,7 +534,7 @@ static void R_MarkLeaves()
tr.visCount++;
tr.viewCluster = cluster;
if ( r_novis->integer || tr.viewCluster == -1 ) {
if ( r_novis->integer || tr.viewCluster == -1 || tr.drawEntireMap ) {
for ( i = 0; i < tr.world->numnodes; ++i ) {
if (tr.world->nodes[i].contents != CONTENTS_SOLID) {
tr.world->nodes[i].visframe = tr.visCount;