summaryrefslogtreecommitdiff
path: root/src/renderergl2/tr_world.c
diff options
context:
space:
mode:
authorSmileTheory <SmileTheory@gmail.com>2014-03-19 17:59:07 -0700
committerTim Angus <tim@ngus.net>2014-06-17 17:43:42 +0100
commitba44931c368a5376ff26e97e4d1f25a9a7ae9976 (patch)
tree6fa2228ab9f42f47ff8bdff132595fde8a6d4300 /src/renderergl2/tr_world.c
parent4b1c828f2ee6a24934630408c7b95669555d2092 (diff)
#6095: OpenGL2: Use areamask and leaf cluster for PVS when VIS is missing.
Diffstat (limited to 'src/renderergl2/tr_world.c')
-rw-r--r--src/renderergl2/tr_world.c45
1 files changed, 13 insertions, 32 deletions
diff --git a/src/renderergl2/tr_world.c b/src/renderergl2/tr_world.c
index 1a25d26a..6608d70b 100644
--- a/src/renderergl2/tr_world.c
+++ b/src/renderergl2/tr_world.c
@@ -645,7 +645,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;
@@ -699,29 +699,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;
@@ -735,17 +727,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++) {
@@ -755,7 +736,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;
}