[iortcw] 77/497: All: Rend2: Use areamask and leaf cluster for PVS when VIS is missing
Simon McVittie
smcv at debian.org
Fri Sep 8 10:36:28 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit 536b5829c1a379e56f16adc0d1d21296cc494a03
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date: Thu Mar 20 11:48:26 2014 +0000
All: Rend2: Use areamask and leaf cluster for PVS when VIS is missing
---
MP/code/rend2/tr_bsp.c | 2 --
MP/code/rend2/tr_local.h | 2 --
MP/code/rend2/tr_world.c | 45 +++++++++++++--------------------------------
SP/code/rend2/tr_bsp.c | 2 --
SP/code/rend2/tr_local.h | 2 --
SP/code/rend2/tr_world.c | 45 +++++++++++++--------------------------------
6 files changed, 26 insertions(+), 72 deletions(-)
diff --git a/MP/code/rend2/tr_bsp.c b/MP/code/rend2/tr_bsp.c
index 71c4406..db88eb1 100644
--- a/MP/code/rend2/tr_bsp.c
+++ b/MP/code/rend2/tr_bsp.c
@@ -604,8 +604,6 @@ static void R_LoadVisibility( lump_t *l ) {
byte *buf;
len = ( s_worldData.numClusters + 63 ) & ~63;
- s_worldData.novis = ri.Hunk_Alloc( len, h_low );
- memset( s_worldData.novis, 0xff, len );
len = l->filelen;
if ( !len ) {
diff --git a/MP/code/rend2/tr_local.h b/MP/code/rend2/tr_local.h
index 7f31447..f7f49f0 100644
--- a/MP/code/rend2/tr_local.h
+++ b/MP/code/rend2/tr_local.h
@@ -1287,8 +1287,6 @@ typedef struct {
int clusterBytes;
const byte *vis; // may be passed in by CM_LoadMap to save space
- byte *novis; // clusterBytes of 0xff
-
char *entityString;
char *entityParsePoint;
} world_t;
diff --git a/MP/code/rend2/tr_world.c b/MP/code/rend2/tr_world.c
index 5d19564..98e9b25 100644
--- a/MP/code/rend2/tr_world.c
+++ b/MP/code/rend2/tr_world.c
@@ -735,7 +735,7 @@ R_ClusterPVS
*/
static const byte *R_ClusterPVS( int cluster ) {
if ( !tr.world->vis || cluster < 0 || cluster >= tr.world->numClusters ) {
- return tr.world->novis;
+ return NULL;
}
return tr.world->vis + cluster * tr.world->clusterBytes;
@@ -772,29 +772,21 @@ static void R_MarkLeaves( void ) {
for(i = 0; i < MAX_VISCOUNTS; i++)
{
- if(tr.visClusters[i] == cluster)
+ // if the areamask or r_showcluster was modified, invalidate all visclusters
+ // this caused doors to open into undrawn areas
+ if (tr.refdef.areamaskModified || r_showcluster->modified)
{
- //tr.visIndex = i;
- break;
+ tr.visClusters[i] = -2;
}
- }
-
- // if r_showcluster was just turned on, remark everything
- if(i != MAX_VISCOUNTS && !tr.refdef.areamaskModified && !r_showcluster->modified)// && !r_dynamicBspOcclusionCulling->modified)
- {
- if(tr.visClusters[i] != tr.visClusters[tr.visIndex] && r_showcluster->integer)
+ else if(tr.visClusters[i] == cluster)
{
- ri.Printf(PRINT_ALL, "found cluster:%i area:%i index:%i\n", cluster, leaf->area, i);
+ if(tr.visClusters[i] != tr.visClusters[tr.visIndex] && r_showcluster->integer)
+ {
+ ri.Printf(PRINT_ALL, "found cluster:%i area:%i index:%i\n", cluster, leaf->area, i);
+ }
+ tr.visIndex = i;
+ return;
}
- tr.visIndex = i;
- return;
- }
-
- // if the areamask was modified, invalidate all visclusters
- // this caused doors to open into undrawn areas
- if (tr.refdef.areamaskModified)
- {
- memset(tr.visClusters, -2, sizeof(tr.visClusters));
}
tr.visIndex = (tr.visIndex + 1) % MAX_VISCOUNTS;
@@ -808,17 +800,6 @@ static void R_MarkLeaves( void ) {
}
}
- // set all nodes to visible if there is no vis
- // this caused some levels to simply not render
- if (r_novis->integer || !tr.world->vis || tr.visClusters[tr.visIndex] == -1) {
- for ( i = 0 ; i < tr.world->numnodes ; i++ ) {
- if ( tr.world->nodes[i].contents != CONTENTS_SOLID ) {
- tr.world->nodes[i].visCounts[tr.visIndex] = tr.visCounts[tr.visIndex];
- }
- }
- return;
- }
-
vis = R_ClusterPVS(tr.visClusters[tr.visIndex]);
for ( i = 0,leaf = tr.world->nodes ; i < tr.world->numnodes ; i++, leaf++ ) {
@@ -828,7 +809,7 @@ static void R_MarkLeaves( void ) {
}
// check general pvs
- if ( !( vis[cluster >> 3] & ( 1 << ( cluster & 7 ) ) ) ) {
+ if ( vis && !(vis[cluster>>3] & (1<<(cluster&7))) ) {
continue;
}
diff --git a/SP/code/rend2/tr_bsp.c b/SP/code/rend2/tr_bsp.c
index 70b46b4..3dde8f9 100644
--- a/SP/code/rend2/tr_bsp.c
+++ b/SP/code/rend2/tr_bsp.c
@@ -603,8 +603,6 @@ static void R_LoadVisibility( lump_t *l ) {
byte *buf;
len = ( s_worldData.numClusters + 63 ) & ~63;
- s_worldData.novis = ri.Hunk_Alloc( len, h_low );
- memset( s_worldData.novis, 0xff, len );
len = l->filelen;
if ( !len ) {
diff --git a/SP/code/rend2/tr_local.h b/SP/code/rend2/tr_local.h
index 33925f8..c1e743d 100644
--- a/SP/code/rend2/tr_local.h
+++ b/SP/code/rend2/tr_local.h
@@ -1293,8 +1293,6 @@ typedef struct {
int clusterBytes;
const byte *vis; // may be passed in by CM_LoadMap to save space
- byte *novis; // clusterBytes of 0xff
-
char *entityString;
char *entityParsePoint;
} world_t;
diff --git a/SP/code/rend2/tr_world.c b/SP/code/rend2/tr_world.c
index b80497c..135bca6 100644
--- a/SP/code/rend2/tr_world.c
+++ b/SP/code/rend2/tr_world.c
@@ -736,7 +736,7 @@ R_ClusterPVS
*/
static const byte *R_ClusterPVS( int cluster ) {
if ( !tr.world->vis || cluster < 0 || cluster >= tr.world->numClusters ) {
- return tr.world->novis;
+ return NULL;
}
return tr.world->vis + cluster * tr.world->clusterBytes;
@@ -773,29 +773,21 @@ static void R_MarkLeaves( void ) {
for(i = 0; i < MAX_VISCOUNTS; i++)
{
- if(tr.visClusters[i] == cluster)
+ // if the areamask or r_showcluster was modified, invalidate all visclusters
+ // this caused doors to open into undrawn areas
+ if (tr.refdef.areamaskModified || r_showcluster->modified)
{
- //tr.visIndex = i;
- break;
+ tr.visClusters[i] = -2;
}
- }
-
- // if r_showcluster was just turned on, remark everything
- if(i != MAX_VISCOUNTS && !tr.refdef.areamaskModified && !r_showcluster->modified)// && !r_dynamicBspOcclusionCulling->modified)
- {
- if(tr.visClusters[i] != tr.visClusters[tr.visIndex] && r_showcluster->integer)
+ else if(tr.visClusters[i] == cluster)
{
- ri.Printf(PRINT_ALL, "found cluster:%i area:%i index:%i\n", cluster, leaf->area, i);
+ if(tr.visClusters[i] != tr.visClusters[tr.visIndex] && r_showcluster->integer)
+ {
+ ri.Printf(PRINT_ALL, "found cluster:%i area:%i index:%i\n", cluster, leaf->area, i);
+ }
+ tr.visIndex = i;
+ return;
}
- tr.visIndex = i;
- return;
- }
-
- // if the areamask was modified, invalidate all visclusters
- // this caused doors to open into undrawn areas
- if (tr.refdef.areamaskModified)
- {
- memset(tr.visClusters, -2, sizeof(tr.visClusters));
}
tr.visIndex = (tr.visIndex + 1) % MAX_VISCOUNTS;
@@ -809,17 +801,6 @@ static void R_MarkLeaves( void ) {
}
}
- // set all nodes to visible if there is no vis
- // this caused some levels to simply not render
- if (r_novis->integer || !tr.world->vis || tr.visClusters[tr.visIndex] == -1) {
- for ( i = 0 ; i < tr.world->numnodes ; i++ ) {
- if ( tr.world->nodes[i].contents != CONTENTS_SOLID ) {
- tr.world->nodes[i].visCounts[tr.visIndex] = tr.visCounts[tr.visIndex];
- }
- }
- return;
- }
-
vis = R_ClusterPVS(tr.visClusters[tr.visIndex]);
for ( i = 0,leaf = tr.world->nodes ; i < tr.world->numnodes ; i++, leaf++ ) {
@@ -829,7 +810,7 @@ static void R_MarkLeaves( void ) {
}
// check general pvs
- if ( !( vis[cluster >> 3] & ( 1 << ( cluster & 7 ) ) ) ) {
+ if ( vis && !(vis[cluster>>3] & (1<<(cluster&7))) ) {
continue;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list