101 lines
No EOL
3.5 KiB
C
101 lines
No EOL
3.5 KiB
C
/*
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License
|
|
as published by the Free Software Foundation; either version 2
|
|
of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
//
|
|
// gl_sky.c all sky related stuff
|
|
//
|
|
#include "quakedef.h"
|
|
|
|
int skytexture[6];
|
|
|
|
/*
|
|
==================
|
|
R_LoadSkys
|
|
==================
|
|
*/
|
|
void R_LoadSkys (void)
|
|
{
|
|
skytexture[0] = loadtextureimage ("gfx/sky/nightft", true ,true);
|
|
skytexture[1] = loadtextureimage ("gfx/sky/nightbk", true ,true);
|
|
skytexture[2] = loadtextureimage ("gfx/sky/nightrt", true ,true);
|
|
skytexture[3] = loadtextureimage ("gfx/sky/nightlf", true ,true);
|
|
skytexture[4] = loadtextureimage ("gfx/sky/nightup", true ,true);
|
|
skytexture[5] = loadtextureimage ("gfx/sky/nightdn", true ,true);
|
|
}
|
|
|
|
/*
|
|
==============
|
|
R_DrawSkyBox
|
|
==============
|
|
*/
|
|
|
|
#define R_SkyBoxPolyVec(s,t,x,y,z) \
|
|
glTexCoord2f(s, t);\
|
|
glVertex3f((x) + r_refdef.vieworg[0], (y) + r_refdef.vieworg[1], (z) + r_refdef.vieworg[2]);
|
|
|
|
void R_DrawSkyBox (void)
|
|
{
|
|
glBindTexture(GL_TEXTURE_2D, skytexture[0]); // front
|
|
glBegin(GL_QUADS);
|
|
R_SkyBoxPolyVec(0.998047f, 0.001953f, 3072, -3072, 3072);
|
|
R_SkyBoxPolyVec(0.998047f, 0.998047f, 3072, -3072, -3072);
|
|
R_SkyBoxPolyVec(0.001953f, 0.998047f, 3072, 3072, -3072);
|
|
R_SkyBoxPolyVec(0.001953f, 0.001953f, 3072, 3072, 3072);
|
|
glEnd();
|
|
|
|
glBindTexture(GL_TEXTURE_2D, skytexture[1]); // back
|
|
glBegin(GL_QUADS);
|
|
R_SkyBoxPolyVec(0.998047f, 0.001953f, -3072, 3072, 3072);
|
|
R_SkyBoxPolyVec(0.998047f, 0.998047f, -3072, 3072, -3072);
|
|
R_SkyBoxPolyVec(0.001953f, 0.998047f, -3072, -3072, -3072);
|
|
R_SkyBoxPolyVec(0.001953f, 0.001953f, -3072, -3072, 3072);
|
|
glEnd();
|
|
|
|
glBindTexture(GL_TEXTURE_2D, skytexture[2]); // right
|
|
glBegin(GL_QUADS);
|
|
R_SkyBoxPolyVec(0.998047f, 0.001953f, 3072, 3072, 3072);
|
|
R_SkyBoxPolyVec(0.998047f, 0.998047f, 3072, 3072, -3072);
|
|
R_SkyBoxPolyVec(0.001953f, 0.998047f, -3072, 3072, -3072);
|
|
R_SkyBoxPolyVec(0.001953f, 0.001953f, -3072, 3072, 3072);
|
|
glEnd();
|
|
|
|
glBindTexture(GL_TEXTURE_2D, skytexture[3]); // left
|
|
glBegin(GL_QUADS);
|
|
R_SkyBoxPolyVec(0.998047f, 0.001953f, -3072, -3072, 3072);
|
|
R_SkyBoxPolyVec(0.998047f, 0.998047f, -3072, -3072, -3072);
|
|
R_SkyBoxPolyVec(0.001953f, 0.998047f, 3072, -3072, -3072);
|
|
R_SkyBoxPolyVec(0.001953f, 0.001953f, 3072, -3072, 3072);
|
|
glEnd();
|
|
|
|
glBindTexture(GL_TEXTURE_2D, skytexture[4]); // up
|
|
glBegin(GL_QUADS);
|
|
R_SkyBoxPolyVec(0.998047f, 0.001953f, 3072, -3072, 3072);
|
|
R_SkyBoxPolyVec(0.998047f, 0.998047f, 3072, 3072, 3072);
|
|
R_SkyBoxPolyVec(0.001953f, 0.998047f, -3072, 3072, 3072);
|
|
R_SkyBoxPolyVec(0.001953f, 0.001953f, -3072, -3072, 3072);
|
|
glEnd();
|
|
|
|
glBindTexture(GL_TEXTURE_2D, skytexture[5]); // down
|
|
glBegin(GL_QUADS);
|
|
R_SkyBoxPolyVec(0.998047f, 0.001953f, 3072, 3072, -3072);
|
|
R_SkyBoxPolyVec(0.998047f, 0.998047f, 3072, -3072, -3072);
|
|
R_SkyBoxPolyVec(0.001953f, 0.998047f, -3072, -3072, -3072);
|
|
R_SkyBoxPolyVec(0.001953f, 0.001953f, -3072, 3072, -3072);
|
|
glEnd();
|
|
} |