mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 19:20:46 +00:00
- two more
This commit is contained in:
parent
cb80e877ff
commit
f992aebf33
5 changed files with 87 additions and 94 deletions
|
@ -9001,7 +9001,7 @@ killsprite:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glDepthMask(GL_FALSE);
|
GLInterface.SetDepthMask(false);
|
||||||
|
|
||||||
for (bssize_t k = j-1; k >= i; k--)
|
for (bssize_t k = j-1; k >= i; k--)
|
||||||
{
|
{
|
||||||
|
@ -9009,9 +9009,9 @@ killsprite:
|
||||||
renderDrawSprite(k);
|
renderDrawSprite(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
glDepthMask(GL_TRUE);
|
GLInterface.SetDepthMask(true);
|
||||||
|
|
||||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
GLInterface.SetColorMask(false);
|
||||||
|
|
||||||
for (bssize_t k = j-1; k >= i; k--)
|
for (bssize_t k = j-1; k >= i; k--)
|
||||||
{
|
{
|
||||||
|
@ -9019,7 +9019,7 @@ killsprite:
|
||||||
tspriteptr[k] = NULL;
|
tspriteptr[k] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
GLInterface.SetColorMask(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
i = j;
|
i = j;
|
||||||
|
@ -9042,29 +9042,7 @@ killsprite:
|
||||||
|
|
||||||
GLInterface.EnableBlend(true);
|
GLInterface.EnableBlend(true);
|
||||||
GLInterface.EnableAlphaTest(true);
|
GLInterface.EnableAlphaTest(true);
|
||||||
glDepthMask(GL_FALSE);
|
GLInterface.SetDepthMask(false);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
for (i=spritesortcnt-1; i>=0; i--)
|
|
||||||
{
|
|
||||||
double xs = tspriteptr[i]->x-globalposx;
|
|
||||||
double ys = tspriteptr[i]->y-globalposy;
|
|
||||||
int32_t zs = tspriteptr[i]->z-globalposz;
|
|
||||||
|
|
||||||
int32_t xp = ys*cosglobalang-xs*singlobalang;
|
|
||||||
int32_t yp = (zs<<1);
|
|
||||||
int32_t zp = xs*cosglobalang+ys*singlobalang;
|
|
||||||
|
|
||||||
xs = ((double)xp*(halfxdimen<<12)/zp)+((halfxdimen+windowxy1.x)<<12);
|
|
||||||
ys = ((double)yp*(xdimenscale<<12)/zp)+((globalhoriz+windowxy1.y)<<12);
|
|
||||||
|
|
||||||
if (xs >= INT32_MIN && xs <= INT32_MAX && ys >= INT32_MIN && ys <= INT32_MAX)
|
|
||||||
{
|
|
||||||
drawline256(xs-65536,ys-65536,xs+65536,ys+65536,31);
|
|
||||||
drawline256(xs+65536,ys-65536,xs-65536,ys+65536,31);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -9204,45 +9182,11 @@ killsprite:
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (videoGetRenderMode() == REND_POLYMOST)
|
if (videoGetRenderMode() == REND_POLYMOST)
|
||||||
{
|
{
|
||||||
glDepthMask(GL_TRUE);
|
GLInterface.SetDepthMask(true);
|
||||||
polymost_setClamp(0);
|
polymost_setClamp(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef POLYMER
|
|
||||||
if (videoGetRenderMode() == REND_POLYMER)
|
|
||||||
polymer_drawmasks();
|
|
||||||
#endif
|
|
||||||
#ifdef DEBUG_MASK_DRAWING
|
|
||||||
if (g_maskDrawMode && videoGetRenderMode() == REND_CLASSIC)
|
|
||||||
{
|
|
||||||
for (i=0; i<dmasknum; i++)
|
|
||||||
{
|
|
||||||
EDUKE32_STATIC_ASSERT(MAXWALLS <= 32768 && MAXSPRITES <= 32768);
|
|
||||||
int32_t spritep = !!(debugmask[i].di & 32768);
|
|
||||||
int32_t di = debugmask[i].di & 32767;
|
|
||||||
// int32_t ii = debugmask[i].i;
|
|
||||||
|
|
||||||
char numstr[12];
|
|
||||||
Bsprintf(numstr, "%d", i+1);
|
|
||||||
|
|
||||||
if (spritep)
|
|
||||||
{
|
|
||||||
int32_t sx = spritesxyz[di].x>>8, sy = ydim/2 + 8;
|
|
||||||
// XXX: printext256 really ought to do bound checking on the
|
|
||||||
// x/y coords!
|
|
||||||
sx = clamp(sx, 0, xdim-8*Bstrlen(numstr)-1);
|
|
||||||
printext256(sx, sy, 241, 0, numstr, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int32_t sx = xb1[di] + (xb2[di]-xb1[di])/2, sy = ydim/2;
|
|
||||||
sx = clamp(sx, 0, xdim-8*Bstrlen(numstr)-1);
|
|
||||||
printext256(sx, sy, 31, 0, numstr, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
videoEndDrawing(); //}}}
|
videoEndDrawing(); //}}}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f)
|
||||||
GLInterface.EnableAlphaTest(false);
|
GLInterface.EnableAlphaTest(false);
|
||||||
polymost_setFogEnabled(false);
|
polymost_setFogEnabled(false);
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
GLInterface.SetBlendFunc(STYLEALPHA_Src, STYLEALPHA_InvSrc);
|
||||||
GLInterface.EnableBlend(true);
|
GLInterface.EnableBlend(true);
|
||||||
GLInterface.SetColorub(r, g, b, f);
|
GLInterface.SetColorub(r, g, b, f);
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ void fullscreen_tint_gl_blood(void)
|
||||||
GLInterface.EnableAlphaTest(false);
|
GLInterface.EnableAlphaTest(false);
|
||||||
polymost_setFogEnabled(false);
|
polymost_setFogEnabled(false);
|
||||||
|
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
GLInterface.SetBlendFunc(STYLEALPHA_One, STYLEALPHA_One);
|
||||||
GLInterface.EnableBlend(true);
|
GLInterface.EnableBlend(true);
|
||||||
|
|
||||||
polymost_useColorOnly(true);
|
polymost_useColorOnly(true);
|
||||||
|
@ -106,7 +106,7 @@ void fullscreen_tint_gl_blood(void)
|
||||||
vt[1].Set(2.5f, 1.f);
|
vt[1].Set(2.5f, 1.f);
|
||||||
vt[2].Set(.0f, -2.5f);
|
vt[2].Set(.0f, -2.5f);
|
||||||
GLInterface.Draw(DT_TRIANGLES, data.first, 3);
|
GLInterface.Draw(DT_TRIANGLES, data.first, 3);
|
||||||
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
|
GLInterface.SetBlendOp(STYLEOP_RevSub);
|
||||||
GLInterface.SetColorub(max(-tint_blood_r, 0), max(-tint_blood_g, 0), max(-tint_blood_b, 0), 255);
|
GLInterface.SetColorub(max(-tint_blood_r, 0), max(-tint_blood_g, 0), max(-tint_blood_b, 0), 255);
|
||||||
data = GLInterface.AllocVertices(3);
|
data = GLInterface.AllocVertices(3);
|
||||||
vt = data.second;
|
vt = data.second;
|
||||||
|
@ -114,9 +114,9 @@ void fullscreen_tint_gl_blood(void)
|
||||||
vt[1].Set(2.5f, 1.f);
|
vt[1].Set(2.5f, 1.f);
|
||||||
vt[2].Set(.0f, -2.5f);
|
vt[2].Set(.0f, -2.5f);
|
||||||
GLInterface.Draw(DT_TRIANGLES, data.first, 3);
|
GLInterface.Draw(DT_TRIANGLES, data.first, 3);
|
||||||
glBlendEquation(GL_FUNC_ADD);
|
GLInterface.SetBlendOp(STYLEOP_Add);
|
||||||
GLInterface.SetColorub(0,0,0,0);
|
GLInterface.SetColorub(0,0,0,0);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
GLInterface.SetBlendFunc(STYLEALPHA_Src, STYLEALPHA_InvSrc);
|
||||||
polymost_useColorOnly(false);
|
polymost_useColorOnly(false);
|
||||||
|
|
||||||
GLInterface.SetMatrix(Matrix_Projection, &oldproj);
|
GLInterface.SetMatrix(Matrix_Projection, &oldproj);
|
||||||
|
@ -579,26 +579,26 @@ void handle_blend(uint8_t enable, uint8_t blend, uint8_t def)
|
||||||
{
|
{
|
||||||
static GLenum const blendFuncTokens[NUMBLENDFACTORS] =
|
static GLenum const blendFuncTokens[NUMBLENDFACTORS] =
|
||||||
{
|
{
|
||||||
GL_ZERO,
|
STYLEALPHA_Zero,
|
||||||
GL_ONE,
|
STYLEALPHA_One,
|
||||||
GL_SRC_COLOR,
|
STYLEALPHA_SrcCol,
|
||||||
GL_ONE_MINUS_SRC_COLOR,
|
STYLEALPHA_InvSrcCol,
|
||||||
GL_SRC_ALPHA,
|
STYLEALPHA_Src,
|
||||||
GL_ONE_MINUS_SRC_ALPHA,
|
STYLEALPHA_InvSrc,
|
||||||
GL_DST_ALPHA,
|
STYLEALPHA_Dst,
|
||||||
GL_ONE_MINUS_DST_ALPHA,
|
STYLEALPHA_InvDst,
|
||||||
GL_DST_COLOR,
|
STYLEALPHA_DstCol,
|
||||||
GL_ONE_MINUS_DST_COLOR,
|
STYLEALPHA_InvDstCol,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!enable)
|
if (!enable)
|
||||||
{
|
{
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
GLInterface.SetBlendFunc(STYLEALPHA_Src, STYLEALPHA_InvSrc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glblenddef_t const * const glbdef = glblend[blend].def + def;
|
glblenddef_t const * const glbdef = glblend[blend].def + def;
|
||||||
glBlendFunc(blendFuncTokens[glbdef->src], blendFuncTokens[glbdef->dst]);
|
GLInterface.SetBlendFunc(blendFuncTokens[glbdef->src], blendFuncTokens[glbdef->dst]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -2022,7 +2022,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
||||||
if (!waloff[globalpicnum])
|
if (!waloff[globalpicnum])
|
||||||
{
|
{
|
||||||
tsiz.x = tsiz.y = 1;
|
tsiz.x = tsiz.y = 1;
|
||||||
glColorMask(false, false, false, false); //Hack to update Z-buffer for invalid mirror textures
|
GLInterface.SetColorMask(false); //Hack to update Z-buffer for invalid mirror textures
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t fullbright_pass = 0;
|
static int32_t fullbright_pass = 0;
|
||||||
|
@ -2371,7 +2371,7 @@ do
|
||||||
if (videoGetRenderMode() != REND_POLYMOST)
|
if (videoGetRenderMode() != REND_POLYMOST)
|
||||||
{
|
{
|
||||||
if (!waloff[globalpicnum])
|
if (!waloff[globalpicnum])
|
||||||
glColorMask(true, true, true, true);
|
GLInterface.SetColorMask(true);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2408,15 +2408,15 @@ do
|
||||||
vec3d_t const bxtex = xtex, bytex = ytex, botex = otex;
|
vec3d_t const bxtex = xtex, bytex = ytex, botex = otex;
|
||||||
xtex = xtex2, ytex = ytex2, otex = otex2;
|
xtex = xtex2, ytex = ytex2, otex = otex2;
|
||||||
skyzbufferhack_pass++;
|
skyzbufferhack_pass++;
|
||||||
glColorMask(false, false, false, false);
|
GLInterface.SetColorMask(false);
|
||||||
polymost_drawpoly(dpxy, n, DAMETH_MASK);
|
polymost_drawpoly(dpxy, n, DAMETH_MASK);
|
||||||
glColorMask(true, true, true, true);
|
GLInterface.SetColorMask(true);
|
||||||
xtex = bxtex, ytex = bytex, otex = botex;
|
xtex = bxtex, ytex = bytex, otex = botex;
|
||||||
skyzbufferhack_pass--;
|
skyzbufferhack_pass--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!waloff[globalpicnum])
|
if (!waloff[globalpicnum])
|
||||||
glColorMask(true, true, true, true);
|
GLInterface.SetColorMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7290,7 +7290,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
|
||||||
polymostSet2dView(); // disables blending, texturing, and depth testing
|
polymostSet2dView(); // disables blending, texturing, and depth testing
|
||||||
|
|
||||||
GLInterface.EnableAlphaTest(false);
|
GLInterface.EnableAlphaTest(false);
|
||||||
glDepthMask(GL_FALSE); // disable writing to the z-buffer
|
GLInterface.SetDepthMask(false);
|
||||||
|
|
||||||
// XXX: Don't fogify the OSD text in Mapster32 with r_usenewshading >= 2.
|
// XXX: Don't fogify the OSD text in Mapster32 with r_usenewshading >= 2.
|
||||||
polymost_setFogEnabled(false);
|
polymost_setFogEnabled(false);
|
||||||
|
@ -7380,7 +7380,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glDepthMask(GL_TRUE); // re-enable writing to the z-buffer
|
GLInterface.SetDepthMask(true);
|
||||||
|
|
||||||
if (!nofog) polymost_setFogEnabled(true);
|
if (!nofog) polymost_setFogEnabled(true);
|
||||||
|
|
||||||
|
|
|
@ -221,3 +221,27 @@ void GLInstance::SetFogExp2(float* color, float coefficient)
|
||||||
glFogf(GL_FOG_DENSITY, coefficient);
|
glFogf(GL_FOG_DENSITY, coefficient);
|
||||||
glFogfv(GL_FOG_COLOR, color);
|
glFogfv(GL_FOG_COLOR, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLInstance::SetColorMask(bool on)
|
||||||
|
{
|
||||||
|
glColorMask(on, on, on, on);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLInstance::SetDepthMask(bool on)
|
||||||
|
{
|
||||||
|
glDepthMask(on);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int blendstyles[] = { GL_ZERO, GL_ONE, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA };
|
||||||
|
|
||||||
|
void GLInstance::SetBlendFunc(int src, int dst)
|
||||||
|
{
|
||||||
|
glBlendFunc(blendstyles[src], blendstyles[dst]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int renderops[] = { GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT };
|
||||||
|
|
||||||
|
void GLInstance::SetBlendOp(int op)
|
||||||
|
{
|
||||||
|
glBlendEquation(renderops[op]);
|
||||||
|
}
|
||||||
|
|
|
@ -76,6 +76,27 @@ enum EDepthFunc
|
||||||
Depth_LessEqual
|
Depth_LessEqual
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ERenderAlpha
|
||||||
|
{
|
||||||
|
STYLEALPHA_Zero, // Blend factor is 0.0
|
||||||
|
STYLEALPHA_One, // Blend factor is 1.0
|
||||||
|
STYLEALPHA_Src, // Blend factor is alpha
|
||||||
|
STYLEALPHA_InvSrc, // Blend factor is 1.0 - alpha
|
||||||
|
STYLEALPHA_SrcCol, // Blend factor is color (HWR only)
|
||||||
|
STYLEALPHA_InvSrcCol, // Blend factor is 1.0 - color (HWR only)
|
||||||
|
STYLEALPHA_DstCol, // Blend factor is dest. color (HWR only)
|
||||||
|
STYLEALPHA_InvDstCol, // Blend factor is 1.0 - dest. color (HWR only)
|
||||||
|
STYLEALPHA_Dst, // Blend factor is dest. alpha
|
||||||
|
STYLEALPHA_InvDst, // Blend factor is 1.0 - dest. alpha
|
||||||
|
STYLEALPHA_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ERenderOp
|
||||||
|
{
|
||||||
|
STYLEOP_Add, // Add source to destination
|
||||||
|
STYLEOP_Sub, // Subtract source from destination
|
||||||
|
STYLEOP_RevSub, // Subtract destination from source
|
||||||
|
};
|
||||||
class GLInstance
|
class GLInstance
|
||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
|
@ -140,6 +161,10 @@ public:
|
||||||
void SetDepthFunc(int func);
|
void SetDepthFunc(int func);
|
||||||
void SetFogLinear(float* color, float start, float end);
|
void SetFogLinear(float* color, float start, float end);
|
||||||
void SetFogExp2(float* color, float coefficient);
|
void SetFogExp2(float* color, float coefficient);
|
||||||
|
void SetColorMask(bool on);
|
||||||
|
void SetDepthMask(bool on);
|
||||||
|
void SetBlendFunc(int src, int dst);
|
||||||
|
void SetBlendOp(int op);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GLInstance GLInterface;
|
extern GLInstance GLInterface;
|
||||||
|
|
Loading…
Reference in a new issue