mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-22 03:51:42 +00:00
Mask off sky depth after drawing skyrooms, to avoid nasty surprises. Also don't get confused by the viewmodel's depthhack.
This commit is contained in:
parent
8a3b440e59
commit
f1cc25c0b8
3 changed files with 37 additions and 3 deletions
|
@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// r_main.c
|
// r_main.c
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#include "glquake.h"
|
||||||
|
|
||||||
qboolean r_cache_thrash; // compatability
|
qboolean r_cache_thrash; // compatability
|
||||||
|
|
||||||
|
@ -727,7 +728,7 @@ R_DrawViewModel -- johnfitz -- gutted
|
||||||
*/
|
*/
|
||||||
void R_DrawViewModel (void)
|
void R_DrawViewModel (void)
|
||||||
{
|
{
|
||||||
if (!r_drawviewmodel.value || !r_drawentities.value || chase_active.value)
|
if (!r_drawviewmodel.value || !r_drawentities.value || chase_active.value || skyroom_drawing/*silly depthrange*/)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cl.items & IT_INVISIBILITY || cl.stats[STAT_HEALTH] <= 0)
|
if (cl.items & IT_INVISIBILITY || cl.stats[STAT_HEALTH] <= 0)
|
||||||
|
@ -1208,6 +1209,7 @@ void R_RenderView (void)
|
||||||
VectorAngles(axis[0], axis[2], r_refdef.viewangles);
|
VectorAngles(axis[0], axis[2], r_refdef.viewangles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skyroom_drawing = true;
|
||||||
R_SetupView ();
|
R_SetupView ();
|
||||||
//note: sky boxes are generally considered an 'infinite' distance away such that you'd not see paralax.
|
//note: sky boxes are generally considered an 'infinite' distance away such that you'd not see paralax.
|
||||||
//that's my excuse for not handling r_stereo here, and I'm sticking to it.
|
//that's my excuse for not handling r_stereo here, and I'm sticking to it.
|
||||||
|
@ -1217,6 +1219,7 @@ void R_RenderView (void)
|
||||||
VectorCopy(viewang, r_refdef.viewangles);
|
VectorCopy(viewang, r_refdef.viewangles);
|
||||||
skyroom_drawn = true; //disable glClear(GL_COLOR_BUFFER_BIT)
|
skyroom_drawn = true; //disable glClear(GL_COLOR_BUFFER_BIT)
|
||||||
}
|
}
|
||||||
|
skyroom_drawing = false;
|
||||||
//skyroom end
|
//skyroom end
|
||||||
|
|
||||||
R_SetupView (); //johnfitz -- this does everything that should be done once per frame
|
R_SetupView (); //johnfitz -- this does everything that should be done once per frame
|
||||||
|
|
|
@ -35,6 +35,7 @@ extern int rs_skypasses; //for r_speeds readout
|
||||||
float skyflatcolor[3];
|
float skyflatcolor[3];
|
||||||
float skymins[2][6], skymaxs[2][6];
|
float skymins[2][6], skymaxs[2][6];
|
||||||
|
|
||||||
|
qboolean skyroom_drawing;
|
||||||
qboolean skyroom_drawn;
|
qboolean skyroom_drawn;
|
||||||
qboolean skyroom_enabled;
|
qboolean skyroom_enabled;
|
||||||
vec4_t skyroom_origin;
|
vec4_t skyroom_origin;
|
||||||
|
@ -1068,9 +1069,39 @@ void Sky_DrawSky (void)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
//in these special render modes, the sky faces are handled in the normal world/brush renderer
|
//in these special render modes, the sky faces are handled in the normal world/brush renderer
|
||||||
if (r_drawflat_cheatsafe || r_lightmap_cheatsafe || skyroom_drawn)
|
if (r_drawflat_cheatsafe || r_lightmap_cheatsafe)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (skyroom_drawn)
|
||||||
|
{ //Spike: We already drew a skyroom underneath. If we draw an actual sky now then we'll have wasted all that effort.
|
||||||
|
//however, if we fiddle with stuff, we can make sure that other surfaces don't draw over it either.
|
||||||
|
|
||||||
|
int i;
|
||||||
|
msurface_t *s;
|
||||||
|
texture_t *t;
|
||||||
|
|
||||||
|
glColorMask(false,false,false,false);
|
||||||
|
glDisable (GL_TEXTURE_2D);
|
||||||
|
for (i=0 ; i<cl.worldmodel->numtextures ; i++)
|
||||||
|
{
|
||||||
|
t = cl.worldmodel->textures[i];
|
||||||
|
|
||||||
|
if (!t || !t->texturechains[chain_world] || !(t->texturechains[chain_world]->flags & SURF_DRAWSKY))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (s = t->texturechains[chain_world]; s; s = s->texturechain)
|
||||||
|
if (!s->culled)
|
||||||
|
{
|
||||||
|
DrawGLPoly(s->polys);
|
||||||
|
rs_brushpasses++;
|
||||||
|
Sky_ProcessPoly (s->polys);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
glEnable (GL_TEXTURE_2D);
|
||||||
|
glColorMask(true,true,true,true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// reset sky bounds
|
// reset sky bounds
|
||||||
//
|
//
|
||||||
|
|
|
@ -440,7 +440,7 @@ void Sky_DrawSky (void);
|
||||||
void Sky_NewMap (void);
|
void Sky_NewMap (void);
|
||||||
void Sky_LoadTexture (texture_t *mt, enum srcformat fmt, unsigned int width, unsigned int height);
|
void Sky_LoadTexture (texture_t *mt, enum srcformat fmt, unsigned int width, unsigned int height);
|
||||||
void Sky_LoadSkyBox (const char *name);
|
void Sky_LoadSkyBox (const char *name);
|
||||||
extern qboolean skyroom_drawn; //we draw a skyroom this frame
|
extern qboolean skyroom_drawn, skyroom_drawing; //we draw a skyroom this frame
|
||||||
extern qboolean skyroom_enabled; //we know where the skyroom is ...
|
extern qboolean skyroom_enabled; //we know where the skyroom is ...
|
||||||
extern vec4_t skyroom_origin; //... and it is here. [3] is paralax scale
|
extern vec4_t skyroom_origin; //... and it is here. [3] is paralax scale
|
||||||
extern vec4_t skyroom_orientation;
|
extern vec4_t skyroom_orientation;
|
||||||
|
|
Loading…
Reference in a new issue