mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-30 04:30:43 +00:00
id's sky code is back (gl_sky_clip 2 when no skybox is loaded). Not as fast
as the black polygons (duh:) and not as nice looking as the sky dome, but also not as slow (fps when standing in the normal coridor looking at the sky in start: 26 for skydome, 37 for id skys, 44 for black). Good for when you want to see sky other than black but your card can't handle the fillrate requirements of skydome. I'll clean up the sqrt in there soonish.
This commit is contained in:
parent
ed4de07e9a
commit
dc4cd343b5
4 changed files with 61 additions and 5 deletions
|
@ -139,6 +139,9 @@ extern void SetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
|
|||
extern int r_skymade;
|
||||
extern void R_MakeSky (void);
|
||||
|
||||
extern int solidskytexture;
|
||||
extern int alphaskytexture;
|
||||
|
||||
extern int ubasestep, errorterm, erroradjustup, erroradjustdown;
|
||||
|
||||
extern double r_realtime;
|
||||
|
|
|
@ -335,10 +335,6 @@ R_TextureAnimation (texture_t *base)
|
|||
|
||||
/* BRUSH MODELS */
|
||||
|
||||
extern float speedscale; // for top sky and bottom sky
|
||||
extern int solidskytexture;
|
||||
extern int alphaskytexture;
|
||||
|
||||
void
|
||||
GL_UploadLightmap (int i, int x, int y, int w, int h)
|
||||
{
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
#include "r_cvar.h"
|
||||
|
||||
char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" };
|
||||
float speedscale; // for top sky and bottom sky
|
||||
int solidskytexture;
|
||||
int alphaskytexture;
|
||||
|
||||
|
@ -230,6 +229,8 @@ R_DrawSkyLayer (float s)
|
|||
void
|
||||
R_DrawSkyDome (void)
|
||||
{
|
||||
float speedscale; // for top sky and bottom sky
|
||||
|
||||
qfglDisable (GL_DEPTH_TEST);
|
||||
qfglDepthRange (gldepthmax, gldepthmax);
|
||||
|
||||
|
|
|
@ -658,6 +658,38 @@ R_DrawSkyDomePoly (glpoly_t *poly)
|
|||
qfglEnd ();
|
||||
}
|
||||
|
||||
void
|
||||
EmitSkyPolys (float speedscale, msurface_t *fa)
|
||||
{
|
||||
glpoly_t *p;
|
||||
float *v;
|
||||
int i;
|
||||
float s, t;
|
||||
vec3_t dir;
|
||||
float length;
|
||||
|
||||
for (p = fa->polys; p; p = p->next) {
|
||||
qfglBegin (GL_POLYGON);
|
||||
for (i = 0, v = p->verts[0]; i < p->numverts; i++, v += VERTEXSIZE) {
|
||||
VectorSubtract (v, r_origin, dir);
|
||||
dir[2] *= 3; // flatten the sphere
|
||||
|
||||
length = DotProduct (dir, dir);
|
||||
length = 6 * 63 / sqrt (length);
|
||||
|
||||
dir[0] *= length;
|
||||
dir[1] *= length;
|
||||
|
||||
s = (speedscale + dir[0]) * (1.0/128);
|
||||
t = (speedscale + dir[1]) * (1.0/128);
|
||||
|
||||
qfglTexCoord2f (s, t);
|
||||
qfglVertex3fv (v);
|
||||
}
|
||||
qfglEnd ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_DrawSkyChain (msurface_t *sky_chain)
|
||||
{
|
||||
|
@ -694,6 +726,30 @@ R_DrawSkyChain (msurface_t *sky_chain)
|
|||
sc = sc->texturechain;
|
||||
}
|
||||
qfglDepthRange (gldepthmin, gldepthmax);
|
||||
} else if (gl_sky_clip->int_val == 2) {
|
||||
float speedscale;
|
||||
|
||||
speedscale = r_realtime*8;
|
||||
speedscale -= (int)speedscale & ~127 ;
|
||||
|
||||
qfglBindTexture (GL_TEXTURE_2D, solidskytexture);
|
||||
while (sc) {
|
||||
EmitSkyPolys (speedscale, sc);
|
||||
sc = sc->texturechain;
|
||||
}
|
||||
|
||||
if (gl_skymultipass->int_val) {
|
||||
sc = sky_chain;
|
||||
|
||||
speedscale = r_realtime*16;
|
||||
speedscale -= (int)speedscale & ~127 ;
|
||||
|
||||
qfglBindTexture (GL_TEXTURE_2D, alphaskytexture);
|
||||
while (sc) {
|
||||
EmitSkyPolys (speedscale, sc);
|
||||
sc = sc->texturechain;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// this code is duplicated from above because skydome is not yet
|
||||
// clipped
|
||||
|
|
Loading…
Reference in a new issue