Add a premultiplied alpha render mode.
To render explosions with it, add a connector: CONNECTORS 1 0 3 0 Fixes ticket:3024.master
parent
a4d5181020
commit
f3ba2378e5
|
@ -142,11 +142,11 @@ static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELI
|
||||||
bool light = true;
|
bool light = true;
|
||||||
bool shaders = pie_GetShaderAvailability();
|
bool shaders = pie_GetShaderAvailability();
|
||||||
|
|
||||||
pie_SetAlphaTest(true);
|
pie_SetAlphaTest((pieFlag & pie_PREMULTIPLIED) == 0);
|
||||||
|
|
||||||
/* Set fog status */
|
/* Set fog status */
|
||||||
if (!(pieFlag & pie_FORCE_FOG) &&
|
if (!(pieFlag & pie_FORCE_FOG) &&
|
||||||
(pieFlag & pie_ADDITIVE || pieFlag & pie_TRANSLUCENT || pieFlag & pie_BUTTON))
|
(pieFlag & pie_ADDITIVE || pieFlag & pie_TRANSLUCENT || pieFlag & pie_BUTTON || pieFlag & pie_PREMULTIPLIED))
|
||||||
{
|
{
|
||||||
pie_SetFogStatus(false);
|
pie_SetFogStatus(false);
|
||||||
}
|
}
|
||||||
|
@ -168,6 +168,11 @@ static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELI
|
||||||
colour.byte.a = (UBYTE)pieFlagData;
|
colour.byte.a = (UBYTE)pieFlagData;
|
||||||
light = false;
|
light = false;
|
||||||
}
|
}
|
||||||
|
else if (pieFlag & pie_PREMULTIPLIED)
|
||||||
|
{
|
||||||
|
pie_SetRendMode(REND_PREMULTIPLIED);
|
||||||
|
light = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pieFlag & pie_BUTTON)
|
if (pieFlag & pie_BUTTON)
|
||||||
|
@ -471,7 +476,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pieFlag & (pie_ADDITIVE | pie_TRANSLUCENT) && !(pieFlag & pie_FORCE_IMMEDIATE))
|
if (pieFlag & (pie_ADDITIVE | pie_TRANSLUCENT | pie_PREMULTIPLIED) && !(pieFlag & pie_FORCE_IMMEDIATE))
|
||||||
{
|
{
|
||||||
if (tshapes_size <= nb_tshapes)
|
if (tshapes_size <= nb_tshapes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -636,6 +636,11 @@ void pie_SetRendMode(REND_MODE rendMode)
|
||||||
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
|
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case REND_PREMULTIPLIED:
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ASSERT(false, "Bad render state");
|
ASSERT(false, "Bad render state");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#define pie_BUTTON 0x40
|
#define pie_BUTTON 0x40
|
||||||
#define pie_SHADOW 0x80
|
#define pie_SHADOW 0x80
|
||||||
#define pie_STATIC_SHADOW 0x100
|
#define pie_STATIC_SHADOW 0x100
|
||||||
|
#define pie_PREMULTIPLIED 0x200
|
||||||
#define pie_FORCE_IMMEDIATE 0x400
|
#define pie_FORCE_IMMEDIATE 0x400
|
||||||
|
|
||||||
#define pie_RAISE_SCALE 256
|
#define pie_RAISE_SCALE 256
|
||||||
|
@ -74,7 +75,8 @@ enum REND_MODE
|
||||||
REND_ALPHA,
|
REND_ALPHA,
|
||||||
REND_ADDITIVE,
|
REND_ADDITIVE,
|
||||||
REND_OPAQUE,
|
REND_OPAQUE,
|
||||||
REND_MULTIPLICATIVE
|
REND_MULTIPLICATIVE,
|
||||||
|
REND_PREMULTIPLIED,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DEPTH_MODE
|
enum DEPTH_MODE
|
||||||
|
|
|
@ -1279,6 +1279,7 @@ void renderProjectile(PROJECTILE *psCurr)
|
||||||
{
|
{
|
||||||
bool rollToCamera = false;
|
bool rollToCamera = false;
|
||||||
bool pitchToCamera = false;
|
bool pitchToCamera = false;
|
||||||
|
bool premultiplied = false;
|
||||||
bool additive = psStats->weaponSubClass == WSC_ROCKET || psStats->weaponSubClass == WSC_MISSILE || psStats->weaponSubClass == WSC_SLOWROCKET || psStats->weaponSubClass == WSC_SLOWMISSILE;
|
bool additive = psStats->weaponSubClass == WSC_ROCKET || psStats->weaponSubClass == WSC_MISSILE || psStats->weaponSubClass == WSC_SLOWROCKET || psStats->weaponSubClass == WSC_SLOWMISSILE;
|
||||||
|
|
||||||
if (pIMD->nconnectors >= 2)
|
if (pIMD->nconnectors >= 2)
|
||||||
|
@ -1292,6 +1293,7 @@ void renderProjectile(PROJECTILE *psCurr)
|
||||||
{
|
{
|
||||||
case 1: additive = false; break;
|
case 1: additive = false; break;
|
||||||
case 2: additive = true; break;
|
case 2: additive = true; break;
|
||||||
|
case 3: additive = false; premultiplied = true; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1349,7 +1351,11 @@ void renderProjectile(PROJECTILE *psCurr)
|
||||||
camera -= Vector3i(-pIMD->connectors[1].x, -pIMD->connectors[1].y, -pIMD->connectors[1].z);
|
camera -= Vector3i(-pIMD->connectors[1].x, -pIMD->connectors[1].y, -pIMD->connectors[1].z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additive)
|
if (premultiplied)
|
||||||
|
{
|
||||||
|
pie_Draw3DShape(pIMD, 0, 0, WZCOL_WHITE, pie_PREMULTIPLIED, 0);
|
||||||
|
}
|
||||||
|
else if (additive)
|
||||||
{
|
{
|
||||||
pie_Draw3DShape(pIMD, 0, 0, WZCOL_WHITE, pie_ADDITIVE, 164);
|
pie_Draw3DShape(pIMD, 0, 0, WZCOL_WHITE, pie_ADDITIVE, 164);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1745,7 +1745,20 @@ static void renderExplosionEffect(const EFFECT *psEffect)
|
||||||
pie_MatScale(psEffect->size / 100.f);
|
pie_MatScale(psEffect->size / 100.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(psEffect->type == EXPLOSION_TYPE_PLASMA)
|
bool premultiplied = false;
|
||||||
|
if (psEffect->imd->nconnectors >= 1)
|
||||||
|
{
|
||||||
|
switch (psEffect->imd->connectors[0].y)
|
||||||
|
{
|
||||||
|
case 3: premultiplied = true; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (premultiplied)
|
||||||
|
{
|
||||||
|
pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, brightness, pie_PREMULTIPLIED, 0);
|
||||||
|
}
|
||||||
|
else if (psEffect->type == EXPLOSION_TYPE_PLASMA)
|
||||||
{
|
{
|
||||||
pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, brightness, pie_ADDITIVE, EFFECT_PLASMA_ADDITIVE);
|
pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, brightness, pie_ADDITIVE, EFFECT_PLASMA_ADDITIVE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue