Skip to content

Commit

Permalink
Fix drawing sky portals
Browse files Browse the repository at this point in the history
Fixes #25
  • Loading branch information
SomaZ committed Nov 8, 2019
1 parent cde6ef0 commit f212f36
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion codemp/rd-rend2/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,7 @@ typedef struct {
int numGridArrayElements;



int skyboxportal;
int numClusters;
int clusterBytes;
const byte *vis; // may be passed in by CM_LoadMap to save space
Expand Down
5 changes: 5 additions & 0 deletions codemp/rd-rend2/tr_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,11 @@ void RE_BeginScene(const refdef_t *fd)
tr.refdef.num_dlights = 0;
}

if (fd->rdflags & RDF_SKYBOXPORTAL)
{
tr.world->skyboxportal = 1;
}

// a single frame may have multiple scenes draw inside it --
// a 3D game view, 3D status bar renderings, 3D menus, etc.
// They need to be distinguished by the light flare code, because
Expand Down
16 changes: 16 additions & 0 deletions codemp/rd-rend2/tr_shade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,22 @@ void RB_EndSurface( void ) {
return;
}

if (tr.world) {
if (tr.world->skyboxportal)
{
// world
if (!(backEnd.refdef.rdflags & RDF_SKYBOXPORTAL) && (tess.currentStageIteratorFunc == RB_StageIteratorSky))
{ // don't process these tris at all
return;
}
// portal sky
else if (!(backEnd.refdef.rdflags & RDF_DRAWSKYBOX) && (tess.currentStageIteratorFunc != RB_StageIteratorSky))
{ // /only/ process sky tris
return;
}
}
}

//
// update performance counters
//
Expand Down
4 changes: 4 additions & 0 deletions codemp/rd-rend2/tr_sky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,10 @@ void RB_StageIteratorSky( void ) {
return;
}

if (tr.world->skyboxportal && !(backEnd.refdef.rdflags & RDF_SKYBOXPORTAL)) {
return;
}

// go through all the polygons and project them onto
// the sky box to see which blocks on each side need
// to be drawn
Expand Down

0 comments on commit f212f36

Please sign in to comment.