iViS engine tweaks. Closes #1667.
- Replace glBlend calls with iVis blending wrapper. - Remove pie_NO_BILINEAR flag and replace it with pie_FORCE_FOG flag. - Enable fogging for structure baseplate with pie_FORCE_FOG. git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@10209 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
8061ad7d95
commit
627a6d1860
|
@ -52,7 +52,7 @@
|
|||
//Render style flags for all pie draw functions
|
||||
#define pie_TRANSLUCENT 0x2
|
||||
#define pie_ADDITIVE 0x4
|
||||
#define pie_NO_BILINEAR 0x8
|
||||
#define pie_FORCE_FOG 0x8
|
||||
#define pie_HEIGHT_SCALED 0x10
|
||||
#define pie_RAISE 0x20
|
||||
#define pie_BUTTON 0x40
|
||||
|
|
|
@ -308,9 +308,8 @@ void pie_DownLoadRadar(UDWORD *buffer, int width, int height)
|
|||
void pie_RenderRadar(int x, int y, int width, int height)
|
||||
{
|
||||
pie_SetTexturePage(radarTexture);
|
||||
pie_SetRendMode(REND_OPAQUE);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
pie_SetRendMode(REND_ALPHA);
|
||||
|
||||
glColor4ubv(WZCOL_WHITE.vector);
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord2f(0, 0); glVertex2f(x, y);
|
||||
|
|
|
@ -142,17 +142,26 @@ static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELI
|
|||
|
||||
pie_SetAlphaTest(true);
|
||||
|
||||
/* Set fog status */
|
||||
if (!(pieFlag & pie_FORCE_FOG) &&
|
||||
(pieFlag & pie_ADDITIVE || pieFlag & pie_TRANSLUCENT || pieFlag & pie_BUTTON))
|
||||
{
|
||||
pie_SetFogStatus(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
pie_SetFogStatus(true);
|
||||
}
|
||||
|
||||
/* Set tranlucency */
|
||||
if (pieFlag & pie_ADDITIVE)
|
||||
{ //Assume also translucent
|
||||
pie_SetFogStatus(false);
|
||||
{
|
||||
pie_SetRendMode(REND_ADDITIVE);
|
||||
colour.byte.a = (UBYTE)pieFlagData;
|
||||
light = false;
|
||||
}
|
||||
else if (pieFlag & pie_TRANSLUCENT)
|
||||
{
|
||||
pie_SetFogStatus(false);
|
||||
pie_SetRendMode(REND_ALPHA);
|
||||
colour.byte.a = (UBYTE)pieFlagData;
|
||||
light = false;
|
||||
|
@ -161,13 +170,8 @@ static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELI
|
|||
{
|
||||
if (pieFlag & pie_BUTTON)
|
||||
{
|
||||
pie_SetFogStatus(false);
|
||||
pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON);
|
||||
}
|
||||
else
|
||||
{
|
||||
pie_SetFogStatus(true);
|
||||
}
|
||||
pie_SetRendMode(REND_OPAQUE);
|
||||
}
|
||||
|
||||
|
@ -766,13 +770,12 @@ static void pie_DrawShadows(void)
|
|||
pie_ShadowDrawLoop();
|
||||
}
|
||||
|
||||
pie_SetRendMode(REND_ALPHA);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
glStencilMask(~0);
|
||||
glStencilFunc(GL_LESS, 0, ~0);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4f(0, 0, 0, 0.5);
|
||||
|
||||
pie_PerspectiveEnd();
|
||||
|
@ -786,7 +789,7 @@ static void pie_DrawShadows(void)
|
|||
glEnd();
|
||||
pie_PerspectiveBegin();
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
pie_SetRendMode(REND_OPAQUE);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_TRUE);
|
||||
|
|
|
@ -130,8 +130,7 @@ void pie_DrawSkybox(float scale, int u, int v, int w, int h)
|
|||
glColor4ub(0xFF,0xFF,0xFF,0xFF);
|
||||
|
||||
// enable alpha
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
pie_SetRendMode(REND_ALPHA);
|
||||
|
||||
// for the nice blend of the sky with the fog
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
|
|
|
@ -365,7 +365,7 @@ void renderParticle( ATPART *psPart )
|
|||
/* Draw it... */
|
||||
centreX = player.p.x + world_coord(visibleTiles.x / 2);
|
||||
centreZ = player.p.z + world_coord(visibleTiles.y / 2);
|
||||
pie_Draw3DShape(psPart->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_NO_BILINEAR, 0);
|
||||
pie_Draw3DShape(psPart->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0);
|
||||
iV_MatrixEnd();
|
||||
}
|
||||
|
||||
|
|
|
@ -1165,7 +1165,7 @@ void renderProjectile(PROJECTILE *psCurr)
|
|||
}
|
||||
else
|
||||
{
|
||||
pie_Draw3DShape(pIMD, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_NO_BILINEAR, 0);
|
||||
pie_Draw3DShape(pIMD, 0, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0);
|
||||
}
|
||||
|
||||
iV_MatrixEnd();
|
||||
|
@ -1276,7 +1276,7 @@ void renderAnimComponent( const COMPONENT_OBJECT *psObj )
|
|||
iV_MatrixRotateZ(-psObj->orientation.y);
|
||||
iV_MatrixRotateX(-psObj->orientation.x);
|
||||
|
||||
pie_Draw3DShape(psObj->psShape, 0, iPlayer, brightness, WZCOL_BLACK, pie_NO_BILINEAR|pie_STATIC_SHADOW, 0);
|
||||
pie_Draw3DShape(psObj->psShape, 0, iPlayer, brightness, WZCOL_BLACK, pie_STATIC_SHADOW, 0);
|
||||
|
||||
/* clear stack */
|
||||
iV_MatrixEnd();
|
||||
|
@ -2105,7 +2105,7 @@ void renderStructure(STRUCTURE *psStructure)
|
|||
}
|
||||
else
|
||||
{
|
||||
pieFlag = pie_TRANSLUCENT;
|
||||
pieFlag = pie_TRANSLUCENT | pie_FORCE_FOG;
|
||||
pieFlagData = 255;
|
||||
}
|
||||
pie_Draw3DShape(psStructure->pStructureType->pBaseIMD, 0, colour, buildingBrightness, WZCOL_BLACK, pieFlag, pieFlagData);
|
||||
|
|
|
@ -1243,8 +1243,8 @@ void drawTerrain(void)
|
|||
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
|
||||
|
||||
// additive blending
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
pie_SetRendMode(REND_ADDITIVE);
|
||||
|
||||
// only draw colors
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
|
@ -1310,7 +1310,7 @@ void drawTerrain(void)
|
|||
// select the terrain texture page
|
||||
pie_SetTexturePage(terrainPage); glError();
|
||||
// use the alpha to blend
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
pie_SetRendMode(REND_ALPHA);
|
||||
// and the texture coordinates buffer
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glError();
|
||||
glEnableClientState( GL_VERTEX_ARRAY ); glError();
|
||||
|
@ -1355,7 +1355,7 @@ void drawTerrain(void)
|
|||
glDisableClientState( GL_VERTEX_ARRAY );
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
glDisable(GL_BLEND);
|
||||
pie_SetRendMode(REND_OPAQUE);
|
||||
|
||||
glPopAttrib();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue