mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-30 13:10:55 +00:00
Merge branch 'openglskydome2' into 'master'
OpenGL sky dome See merge request STJr/SRB2Internal!350
This commit is contained in:
commit
a03ecac921
9 changed files with 331 additions and 73 deletions
|
@ -47,6 +47,7 @@ EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal, RGBA_t *pgamma);
|
||||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
|
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
|
||||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||||
|
EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform);
|
||||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
|
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
|
||||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FRGBAFloat *ClearColor);
|
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FRGBAFloat *ClearColor);
|
||||||
EXPORT void HWRAPI(SetTexture) (FTextureInfo *TexInfo);
|
EXPORT void HWRAPI(SetTexture) (FTextureInfo *TexInfo);
|
||||||
|
@ -89,6 +90,7 @@ struct hwdriver_s
|
||||||
FinishUpdate pfnFinishUpdate;
|
FinishUpdate pfnFinishUpdate;
|
||||||
Draw2DLine pfnDraw2DLine;
|
Draw2DLine pfnDraw2DLine;
|
||||||
DrawPolygon pfnDrawPolygon;
|
DrawPolygon pfnDrawPolygon;
|
||||||
|
RenderSkyDome pfnRenderSkyDome;
|
||||||
SetBlend pfnSetBlend;
|
SetBlend pfnSetBlend;
|
||||||
ClearBuffer pfnClearBuffer;
|
ClearBuffer pfnClearBuffer;
|
||||||
SetTexture pfnSetTexture;
|
SetTexture pfnSetTexture;
|
||||||
|
|
|
@ -5886,86 +5886,122 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
//
|
//
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
static void HWR_DrawSkyBackground(void)
|
static void HWR_DrawSkyBackground(player_t *player)
|
||||||
{
|
{
|
||||||
FOutVector v[4];
|
if (cv_grskydome.value)
|
||||||
angle_t angle;
|
|
||||||
float dimensionmultiply;
|
|
||||||
float aspectratio;
|
|
||||||
float angleturn;
|
|
||||||
|
|
||||||
HWR_GetTexture(texturetranslation[skytexture]);
|
|
||||||
aspectratio = (float)vid.width/(float)vid.height;
|
|
||||||
|
|
||||||
//Hurdler: the sky is the only texture who need 4.0f instead of 1.0
|
|
||||||
// because it's called just after clearing the screen
|
|
||||||
// and thus, the near clipping plane is set to 3.99
|
|
||||||
// Sryder: Just use the near clipping plane value then
|
|
||||||
|
|
||||||
// 3--2
|
|
||||||
// | /|
|
|
||||||
// |/ |
|
|
||||||
// 0--1
|
|
||||||
v[0].x = v[3].x = -ZCLIP_PLANE-1;
|
|
||||||
v[1].x = v[2].x = ZCLIP_PLANE+1;
|
|
||||||
v[0].y = v[1].y = -ZCLIP_PLANE-1;
|
|
||||||
v[2].y = v[3].y = ZCLIP_PLANE+1;
|
|
||||||
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = ZCLIP_PLANE+1;
|
|
||||||
|
|
||||||
// X
|
|
||||||
|
|
||||||
// NOTE: This doesn't work right with texture widths greater than 1024
|
|
||||||
// software doesn't draw any further than 1024 for skies anyway, but this doesn't overlap properly
|
|
||||||
// The only time this will probably be an issue is when a sky wider than 1024 is used as a sky AND a regular wall texture
|
|
||||||
|
|
||||||
angle = (dup_viewangle + gr_xtoviewangle[0]);
|
|
||||||
|
|
||||||
dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->width/256.0f);
|
|
||||||
|
|
||||||
v[0].sow = v[3].sow = (-1.0f * angle) / ((ANGLE_90-1)*dimensionmultiply); // left
|
|
||||||
v[2].sow = v[1].sow = v[0].sow + (1.0f/dimensionmultiply); // right (or left + 1.0f)
|
|
||||||
// use +angle and -1.0f above instead if you wanted old backwards behavior
|
|
||||||
|
|
||||||
// Y
|
|
||||||
angle = aimingangle;
|
|
||||||
dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->height/(128.0f*aspectratio));
|
|
||||||
|
|
||||||
if (splitscreen)
|
|
||||||
{
|
{
|
||||||
dimensionmultiply *= 2;
|
FTransform transform;
|
||||||
angle *= 2;
|
const float fpov = FIXED_TO_FLOAT(cv_grfov.value+player->fovadd);
|
||||||
}
|
postimg_t *type;
|
||||||
|
|
||||||
// Middle of the sky should always be at angle 0
|
if (splitscreen && player == &players[secondarydisplayplayer])
|
||||||
// need to keep correct aspect ratio with X
|
type = &postimgtype2;
|
||||||
if (atransform.flip)
|
else
|
||||||
{
|
type = &postimgtype;
|
||||||
// During vertical flip the sky should be flipped and it's y movement should also be flipped obviously
|
|
||||||
v[3].tow = v[2].tow = -(0.5f-(0.5f/dimensionmultiply)); // top
|
memset(&transform, 0x00, sizeof(FTransform));
|
||||||
v[0].tow = v[1].tow = v[3].tow - (1.0f/dimensionmultiply); // bottom (or top - 1.0f)
|
|
||||||
|
//04/01/2000: Hurdler: added for T&L
|
||||||
|
// It should replace all other gr_viewxxx when finished
|
||||||
|
transform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||||
|
transform.angley = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||||
|
|
||||||
|
if (*type == postimg_flip)
|
||||||
|
transform.flip = true;
|
||||||
|
else
|
||||||
|
transform.flip = false;
|
||||||
|
|
||||||
|
transform.scalex = 1;
|
||||||
|
transform.scaley = (float)vid.width/vid.height;
|
||||||
|
transform.scalez = 1;
|
||||||
|
transform.fovxangle = fpov; // Tails
|
||||||
|
transform.fovyangle = fpov; // Tails
|
||||||
|
transform.splitscreen = splitscreen;
|
||||||
|
|
||||||
|
HWR_GetTexture(texturetranslation[skytexture]);
|
||||||
|
HWD.pfnRenderSkyDome(skytexture, textures[skytexture]->width, textures[skytexture]->height, transform);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v[0].tow = v[1].tow = -(0.5f-(0.5f/dimensionmultiply)); // bottom
|
FOutVector v[4];
|
||||||
v[3].tow = v[2].tow = v[0].tow - (1.0f/dimensionmultiply); // top (or bottom - 1.0f)
|
angle_t angle;
|
||||||
}
|
float dimensionmultiply;
|
||||||
|
float aspectratio;
|
||||||
|
float angleturn;
|
||||||
|
|
||||||
angleturn = (((float)ANGLE_45-1.0f)*aspectratio)*dimensionmultiply;
|
HWR_GetTexture(texturetranslation[skytexture]);
|
||||||
|
aspectratio = (float)vid.width/(float)vid.height;
|
||||||
|
|
||||||
if (angle > ANGLE_180) // Do this because we don't want the sky to suddenly teleport when crossing over 0 to 360 and vice versa
|
//Hurdler: the sky is the only texture who need 4.0f instead of 1.0
|
||||||
{
|
// because it's called just after clearing the screen
|
||||||
angle = InvAngle(angle);
|
// and thus, the near clipping plane is set to 3.99
|
||||||
v[3].tow = v[2].tow += ((float) angle / angleturn);
|
// Sryder: Just use the near clipping plane value then
|
||||||
v[0].tow = v[1].tow += ((float) angle / angleturn);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
v[3].tow = v[2].tow -= ((float) angle / angleturn);
|
|
||||||
v[0].tow = v[1].tow -= ((float) angle / angleturn);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWD.pfnDrawPolygon(NULL, v, 4, 0);
|
// 3--2
|
||||||
|
// | /|
|
||||||
|
// |/ |
|
||||||
|
// 0--1
|
||||||
|
v[0].x = v[3].x = -ZCLIP_PLANE-1;
|
||||||
|
v[1].x = v[2].x = ZCLIP_PLANE+1;
|
||||||
|
v[0].y = v[1].y = -ZCLIP_PLANE-1;
|
||||||
|
v[2].y = v[3].y = ZCLIP_PLANE+1;
|
||||||
|
|
||||||
|
v[0].z = v[1].z = v[2].z = v[3].z = ZCLIP_PLANE+1;
|
||||||
|
|
||||||
|
// X
|
||||||
|
|
||||||
|
// NOTE: This doesn't work right with texture widths greater than 1024
|
||||||
|
// software doesn't draw any further than 1024 for skies anyway, but this doesn't overlap properly
|
||||||
|
// The only time this will probably be an issue is when a sky wider than 1024 is used as a sky AND a regular wall texture
|
||||||
|
|
||||||
|
angle = (dup_viewangle + gr_xtoviewangle[0]);
|
||||||
|
|
||||||
|
dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->width/256.0f);
|
||||||
|
|
||||||
|
v[0].sow = v[3].sow = (-1.0f * angle) / ((ANGLE_90-1)*dimensionmultiply); // left
|
||||||
|
v[2].sow = v[1].sow = v[0].sow + (1.0f/dimensionmultiply); // right (or left + 1.0f)
|
||||||
|
// use +angle and -1.0f above instead if you wanted old backwards behavior
|
||||||
|
|
||||||
|
// Y
|
||||||
|
angle = aimingangle;
|
||||||
|
dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->height/(128.0f*aspectratio));
|
||||||
|
|
||||||
|
if (splitscreen)
|
||||||
|
{
|
||||||
|
dimensionmultiply *= 2;
|
||||||
|
angle *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Middle of the sky should always be at angle 0
|
||||||
|
// need to keep correct aspect ratio with X
|
||||||
|
if (atransform.flip)
|
||||||
|
{
|
||||||
|
// During vertical flip the sky should be flipped and it's y movement should also be flipped obviously
|
||||||
|
v[3].tow = v[2].tow = -(0.5f-(0.5f/dimensionmultiply)); // top
|
||||||
|
v[0].tow = v[1].tow = v[3].tow - (1.0f/dimensionmultiply); // bottom (or top - 1.0f)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v[0].tow = v[1].tow = -(0.5f-(0.5f/dimensionmultiply)); // bottom
|
||||||
|
v[3].tow = v[2].tow = v[0].tow - (1.0f/dimensionmultiply); // top (or bottom - 1.0f)
|
||||||
|
}
|
||||||
|
|
||||||
|
angleturn = (((float)ANGLE_45-1.0f)*aspectratio)*dimensionmultiply;
|
||||||
|
|
||||||
|
if (angle > ANGLE_180) // Do this because we don't want the sky to suddenly teleport when crossing over 0 to 360 and vice versa
|
||||||
|
{
|
||||||
|
angle = InvAngle(angle);
|
||||||
|
v[3].tow = v[2].tow += ((float) angle / angleturn);
|
||||||
|
v[0].tow = v[1].tow += ((float) angle / angleturn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v[3].tow = v[2].tow -= ((float) angle / angleturn);
|
||||||
|
v[0].tow = v[1].tow -= ((float) angle / angleturn);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWD.pfnDrawPolygon(NULL, v, 4, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6117,7 +6153,7 @@ if (0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawsky)
|
if (drawsky)
|
||||||
HWR_DrawSkyBackground();
|
HWR_DrawSkyBackground(player);
|
||||||
|
|
||||||
//Hurdler: it doesn't work in splitscreen mode
|
//Hurdler: it doesn't work in splitscreen mode
|
||||||
drawsky = splitscreen;
|
drawsky = splitscreen;
|
||||||
|
@ -6334,7 +6370,7 @@ if (0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skybox && drawsky) // Don't draw the regular sky if there's a skybox
|
if (!skybox && drawsky) // Don't draw the regular sky if there's a skybox
|
||||||
HWR_DrawSkyBackground();
|
HWR_DrawSkyBackground(player);
|
||||||
|
|
||||||
//Hurdler: it doesn't work in splitscreen mode
|
//Hurdler: it doesn't work in splitscreen mode
|
||||||
drawsky = splitscreen;
|
drawsky = splitscreen;
|
||||||
|
|
|
@ -98,6 +98,7 @@ extern consvar_t cv_voodoocompatibility;
|
||||||
extern consvar_t cv_grfovchange;
|
extern consvar_t cv_grfovchange;
|
||||||
extern consvar_t cv_grsolvetjoin;
|
extern consvar_t cv_grsolvetjoin;
|
||||||
extern consvar_t cv_grspritebillboarding;
|
extern consvar_t cv_grspritebillboarding;
|
||||||
|
extern consvar_t cv_grskydome;
|
||||||
|
|
||||||
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy;
|
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy;
|
||||||
|
|
||||||
|
|
|
@ -1427,6 +1427,219 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf,
|
||||||
Clamp2D(GL_TEXTURE_WRAP_T);
|
Clamp2D(GL_TEXTURE_WRAP_T);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct vbo_vertex_s
|
||||||
|
{
|
||||||
|
float x, y, z;
|
||||||
|
float u, v;
|
||||||
|
unsigned char r, g, b, a;
|
||||||
|
} vbo_vertex_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int mode;
|
||||||
|
int vertexcount;
|
||||||
|
int vertexindex;
|
||||||
|
int use_texture;
|
||||||
|
} GLSkyLoopDef;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
int rows, columns;
|
||||||
|
int loopcount;
|
||||||
|
GLSkyLoopDef *loops;
|
||||||
|
vbo_vertex_t *data;
|
||||||
|
} GLSkyVBO;
|
||||||
|
|
||||||
|
// The texture offset to be applied to the texture coordinates in SkyVertex().
|
||||||
|
static int rows, columns;
|
||||||
|
static boolean yflip;
|
||||||
|
static int texw, texh;
|
||||||
|
static boolean foglayer;
|
||||||
|
static float delta = 0.0f;
|
||||||
|
|
||||||
|
static int gl_sky_detail = 16;
|
||||||
|
|
||||||
|
static INT32 lasttex = -1;
|
||||||
|
|
||||||
|
#define MAP_COEFF 128.0f
|
||||||
|
|
||||||
|
static void SkyVertex(vbo_vertex_t *vbo, int r, int c)
|
||||||
|
{
|
||||||
|
const float radians = (M_PIl / 180.0f);
|
||||||
|
const float scale = 10000.0f;
|
||||||
|
const float maxSideAngle = 60.0f;
|
||||||
|
|
||||||
|
float topAngle = (c / (float)columns * 360.0f);
|
||||||
|
float sideAngle = (maxSideAngle * (rows - r) / rows);
|
||||||
|
float height = sin(sideAngle * radians);
|
||||||
|
float realRadius = scale * cos(sideAngle * radians);
|
||||||
|
float x = realRadius * cos(topAngle * radians);
|
||||||
|
float y = (!yflip) ? scale * height : -scale * height;
|
||||||
|
float z = realRadius * sin(topAngle * radians);
|
||||||
|
float timesRepeat = (4 * (256.0f / texw));
|
||||||
|
if (fpclassify(timesRepeat) == FP_ZERO)
|
||||||
|
timesRepeat = 1.0f;
|
||||||
|
|
||||||
|
if (!foglayer)
|
||||||
|
{
|
||||||
|
vbo->r = 255;
|
||||||
|
vbo->g = 255;
|
||||||
|
vbo->b = 255;
|
||||||
|
vbo->a = (r == 0 ? 0 : 255);
|
||||||
|
|
||||||
|
// And the texture coordinates.
|
||||||
|
vbo->u = (-timesRepeat * c / (float)columns);
|
||||||
|
if (!yflip) // Flipped Y is for the lower hemisphere.
|
||||||
|
vbo->v = (r / (float)rows) + 0.5f;
|
||||||
|
else
|
||||||
|
vbo->v = 1.0f + ((rows - r) / (float)rows) + 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r != 4)
|
||||||
|
{
|
||||||
|
y += 300.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// And finally the vertex.
|
||||||
|
vbo->x = x;
|
||||||
|
vbo->y = y + delta;
|
||||||
|
vbo->z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLSkyVBO sky_vbo;
|
||||||
|
|
||||||
|
static void gld_BuildSky(int row_count, int col_count)
|
||||||
|
{
|
||||||
|
int c, r;
|
||||||
|
vbo_vertex_t *vertex_p;
|
||||||
|
int vertex_count = 2 * row_count * (col_count * 2 + 2) + col_count * 2;
|
||||||
|
|
||||||
|
GLSkyVBO *vbo = &sky_vbo;
|
||||||
|
|
||||||
|
if ((vbo->columns != col_count) || (vbo->rows != row_count))
|
||||||
|
{
|
||||||
|
free(vbo->loops);
|
||||||
|
free(vbo->data);
|
||||||
|
memset(vbo, 0, sizeof(&vbo));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!vbo->data)
|
||||||
|
{
|
||||||
|
memset(vbo, 0, sizeof(&vbo));
|
||||||
|
vbo->loops = malloc((row_count * 2 + 2) * sizeof(vbo->loops[0]));
|
||||||
|
// create vertex array
|
||||||
|
vbo->data = malloc(vertex_count * sizeof(vbo->data[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
vbo->columns = col_count;
|
||||||
|
vbo->rows = row_count;
|
||||||
|
|
||||||
|
vertex_p = &vbo->data[0];
|
||||||
|
vbo->loopcount = 0;
|
||||||
|
|
||||||
|
for (yflip = 0; yflip < 2; yflip++)
|
||||||
|
{
|
||||||
|
vbo->loops[vbo->loopcount].mode = GL_TRIANGLE_FAN;
|
||||||
|
vbo->loops[vbo->loopcount].vertexindex = vertex_p - &vbo->data[0];
|
||||||
|
vbo->loops[vbo->loopcount].vertexcount = col_count;
|
||||||
|
vbo->loops[vbo->loopcount].use_texture = false;
|
||||||
|
vbo->loopcount++;
|
||||||
|
|
||||||
|
delta = 0.0f;
|
||||||
|
foglayer = true;
|
||||||
|
for (c = 0; c < col_count; c++)
|
||||||
|
{
|
||||||
|
SkyVertex(vertex_p, 1, c);
|
||||||
|
vertex_p->r = 255;
|
||||||
|
vertex_p->g = 255;
|
||||||
|
vertex_p->b = 255;
|
||||||
|
vertex_p->a = 255;
|
||||||
|
vertex_p++;
|
||||||
|
}
|
||||||
|
foglayer = false;
|
||||||
|
|
||||||
|
delta = (yflip ? 5.0f : -5.0f) / MAP_COEFF;
|
||||||
|
|
||||||
|
for (r = 0; r < row_count; r++)
|
||||||
|
{
|
||||||
|
vbo->loops[vbo->loopcount].mode = GL_TRIANGLE_STRIP;
|
||||||
|
vbo->loops[vbo->loopcount].vertexindex = vertex_p - &vbo->data[0];
|
||||||
|
vbo->loops[vbo->loopcount].vertexcount = 2 * col_count + 2;
|
||||||
|
vbo->loops[vbo->loopcount].use_texture = true;
|
||||||
|
vbo->loopcount++;
|
||||||
|
|
||||||
|
for (c = 0; c <= col_count; c++)
|
||||||
|
{
|
||||||
|
SkyVertex(vertex_p++, r + (yflip ? 1 : 0), (c ? c : 0));
|
||||||
|
SkyVertex(vertex_p++, r + (yflip ? 0 : 1), (c ? c : 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void RenderDome(INT32 skytexture)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
GLSkyVBO *vbo = &sky_vbo;
|
||||||
|
|
||||||
|
pglRotatef(270.0f, 0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
|
rows = 4;
|
||||||
|
columns = 4 * gl_sky_detail;
|
||||||
|
|
||||||
|
if (lasttex != skytexture)
|
||||||
|
{
|
||||||
|
lasttex = skytexture;
|
||||||
|
gld_BuildSky(rows, columns);
|
||||||
|
}
|
||||||
|
|
||||||
|
pglScalef(1.0f, (float)texh / 230.0f, 1.0f);
|
||||||
|
|
||||||
|
for (j = 0; j < 2; j++)
|
||||||
|
{
|
||||||
|
for (i = 0; i < vbo->loopcount; i++)
|
||||||
|
{
|
||||||
|
GLSkyLoopDef *loop = &vbo->loops[i];
|
||||||
|
|
||||||
|
if (j == 0 ? loop->use_texture : !loop->use_texture)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int k;
|
||||||
|
pglBegin(loop->mode);
|
||||||
|
for (k = loop->vertexindex; k < (loop->vertexindex + loop->vertexcount); k++)
|
||||||
|
{
|
||||||
|
vbo_vertex_t *v = &vbo->data[k];
|
||||||
|
if (loop->use_texture)
|
||||||
|
pglTexCoord2f(v->u, v->v);
|
||||||
|
pglColor4f(v->r, v->g, v->b, v->a);
|
||||||
|
pglVertex3f(v->x, v->y, v->z);
|
||||||
|
}
|
||||||
|
pglEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pglScalef(1.0f, 1.0f, 1.0f);
|
||||||
|
pglColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform)
|
||||||
|
{
|
||||||
|
SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||||
|
SetTransform(&transform);
|
||||||
|
texw = texture_width;
|
||||||
|
texh = texture_height;
|
||||||
|
RenderDome(tex);
|
||||||
|
SetBlend(0);
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
//
|
//
|
||||||
|
|
|
@ -1219,6 +1219,7 @@ void R_RegisterEngineStuff(void)
|
||||||
#endif
|
#endif
|
||||||
CV_RegisterVar(&cv_grmd2);
|
CV_RegisterVar(&cv_grmd2);
|
||||||
CV_RegisterVar(&cv_grspritebillboarding);
|
CV_RegisterVar(&cv_grspritebillboarding);
|
||||||
|
CV_RegisterVar(&cv_grskydome);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
|
|
|
@ -79,6 +79,7 @@ void *hwSym(const char *funcName,void *handle)
|
||||||
GETFUNC(Init);
|
GETFUNC(Init);
|
||||||
GETFUNC(Draw2DLine);
|
GETFUNC(Draw2DLine);
|
||||||
GETFUNC(DrawPolygon);
|
GETFUNC(DrawPolygon);
|
||||||
|
GETFUNC(RenderSkyDome);
|
||||||
GETFUNC(SetBlend);
|
GETFUNC(SetBlend);
|
||||||
GETFUNC(ClearBuffer);
|
GETFUNC(ClearBuffer);
|
||||||
GETFUNC(SetTexture);
|
GETFUNC(SetTexture);
|
||||||
|
|
|
@ -1629,6 +1629,7 @@ void I_StartupGraphics(void)
|
||||||
HWD.pfnFinishUpdate = NULL;
|
HWD.pfnFinishUpdate = NULL;
|
||||||
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
|
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
|
||||||
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
|
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
|
||||||
|
HWD.pfnRenderSkyDome = hwSym("RenderSkyDome",NULL);
|
||||||
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
|
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
|
||||||
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
|
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
|
||||||
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
|
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
|
||||||
|
|
|
@ -112,6 +112,7 @@ static CV_PossibleValue_t CV_MD2[] = {{0, "Off"}, {1, "On"}, {2, "Old"}, {0, NUL
|
||||||
// console variables in development
|
// console variables in development
|
||||||
consvar_t cv_grmd2 = {"gr_md2", "Off", CV_SAVE, CV_MD2, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grmd2 = {"gr_md2", "Off", CV_SAVE, CV_MD2, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
consvar_t cv_grskydome = {"gr_skydome", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// local copy of the palette for V_GetColor()
|
// local copy of the palette for V_GetColor()
|
||||||
|
|
|
@ -102,6 +102,7 @@ static loadfunc_t hwdFuncTable[] = {
|
||||||
{"FinishUpdate@4", &hwdriver.pfnFinishUpdate},
|
{"FinishUpdate@4", &hwdriver.pfnFinishUpdate},
|
||||||
{"Draw2DLine@12", &hwdriver.pfnDraw2DLine},
|
{"Draw2DLine@12", &hwdriver.pfnDraw2DLine},
|
||||||
{"DrawPolygon@16", &hwdriver.pfnDrawPolygon},
|
{"DrawPolygon@16", &hwdriver.pfnDrawPolygon},
|
||||||
|
{"RenderSkyDome@16", &hwdriver.pfnRenderSkyDome},
|
||||||
{"SetBlend@4", &hwdriver.pfnSetBlend},
|
{"SetBlend@4", &hwdriver.pfnSetBlend},
|
||||||
{"ClearBuffer@12", &hwdriver.pfnClearBuffer},
|
{"ClearBuffer@12", &hwdriver.pfnClearBuffer},
|
||||||
{"SetTexture@4", &hwdriver.pfnSetTexture},
|
{"SetTexture@4", &hwdriver.pfnSetTexture},
|
||||||
|
@ -133,6 +134,7 @@ static loadfunc_t hwdFuncTable[] = {
|
||||||
{"FinishUpdate", &hwdriver.pfnFinishUpdate},
|
{"FinishUpdate", &hwdriver.pfnFinishUpdate},
|
||||||
{"Draw2DLine", &hwdriver.pfnDraw2DLine},
|
{"Draw2DLine", &hwdriver.pfnDraw2DLine},
|
||||||
{"DrawPolygon", &hwdriver.pfnDrawPolygon},
|
{"DrawPolygon", &hwdriver.pfnDrawPolygon},
|
||||||
|
{"RenderSkyDome", &hwdriver.pfnRenderSkyDome},
|
||||||
{"SetBlend", &hwdriver.pfnSetBlend},
|
{"SetBlend", &hwdriver.pfnSetBlend},
|
||||||
{"ClearBuffer", &hwdriver.pfnClearBuffer},
|
{"ClearBuffer", &hwdriver.pfnClearBuffer},
|
||||||
{"SetTexture", &hwdriver.pfnSetTexture},
|
{"SetTexture", &hwdriver.pfnSetTexture},
|
||||||
|
|
Loading…
Reference in a new issue