mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- reconnected the HUD model drawer.
This will have to be done differently later when the postprocessor is fully working, but for now it's sufficient to just render the model right away.
This commit is contained in:
parent
9ceb47fdb2
commit
7ea053bd90
3 changed files with 6 additions and 256 deletions
|
@ -30,8 +30,7 @@ void uploadbasepalette(int32_t basepalnum);
|
|||
void uploadpalswaps(int count, int32_t *palookupnum);
|
||||
void polymost_drawsprite(int32_t snum);
|
||||
void polymost_drawmaskwall(int32_t damaskwallcnt);
|
||||
void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, int32_t uniqid);
|
||||
void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, int32_t uniqid);
|
||||
void polymost_fillpolygon(int32_t npoints);
|
||||
void polymost_initosdfuncs(void);
|
||||
void polymost_drawrooms(void);
|
||||
|
|
|
@ -10742,16 +10742,17 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
|||
tileUpdatePicnum(&picnum, (int16_t)0xc000);
|
||||
if ((tilesiz[picnum].x <= 0) || (tilesiz[picnum].y <= 0)) return;
|
||||
|
||||
// Experimental / development bits. ONLY FOR INTERNAL USE!
|
||||
// bit RS_CENTERORIGIN: see dorotspr_handle_bit2
|
||||
////////////////////
|
||||
|
||||
if (r_rotatespritenowidescreen)
|
||||
{
|
||||
dastat |= RS_STRETCH;
|
||||
dastat &= ~RS_ALIGN_MASK;
|
||||
}
|
||||
|
||||
if (hw_models && tile2model[picnum].hudmem[(dastat & 4) >> 2])
|
||||
{
|
||||
polymost_dorotatespritemodel(sx, sy, z, a, picnum, dashade, dapalnum, dastat, daalpha, dablend, guniqhudid);
|
||||
return;
|
||||
}
|
||||
// We must store all calls in the 2D drawer so that the backend can operate on a clean 3D view.
|
||||
twod.rotatesprite(sx, sy, z, a, picnum, dashade, dapalnum, dastat, daalpha, dablend, cx1, cy1, cx2, cy2);
|
||||
|
||||
|
|
|
@ -4719,256 +4719,6 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a,
|
|||
polymost_identityrotmat();
|
||||
}
|
||||
|
||||
void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend,
|
||||
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, int32_t uniqid)
|
||||
{
|
||||
if (hw_models && tile2model[picnum].hudmem[(dastat&4)>>2])
|
||||
{
|
||||
polymost_dorotatespritemodel(sx, sy, z, a, picnum, dashade, dapalnum, dastat, daalpha, dablend, uniqid);
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
|
||||
polymost_outputGLDebugMessage(3, "polymost_dorotatesprite(sx:%d, sy:%d, z:%d, a:%hd, picnum:%hd, dashade:%hhd, dapalnum:%hhu, dastat:%d, daalpha:%hhu, dablend:%hhu, cx1:%d, cy1:%d, cx2:%d, cy2:%d, uniqid:%d)",
|
||||
sx, sy, z, a, picnum, dashade, dapalnum, dastat, daalpha, dablend, cx1, cy1, cx2, cy2, uniqid);
|
||||
|
||||
GLInterface.SetViewport(0,0,xdim,ydim); glox1 = -1; //Force fullscreen (glox1=-1 forces it to restore)
|
||||
auto oldproj = GLInterface.GetMatrix(Matrix_Projection);
|
||||
auto oldmv = GLInterface.GetMatrix(Matrix_ModelView);
|
||||
|
||||
globvis = 0;
|
||||
globvis2 = 0;
|
||||
GLInterface.SetClamp(1+2);
|
||||
GLInterface.SetVisibility(globvis2, fviewingrange);
|
||||
|
||||
int32_t const ogpicnum = globalpicnum;
|
||||
globalpicnum = picnum;
|
||||
int32_t const ogshade = globalshade;
|
||||
globalshade = dashade;
|
||||
int32_t const ogpal = globalpal;
|
||||
globalpal = (int32_t)((uint8_t)dapalnum);
|
||||
float const oghalfx = ghalfx;
|
||||
ghalfx = fxdim * .5f;
|
||||
float const oghalfy = ghalfy;
|
||||
ghalfy = fydim * .5f;
|
||||
float const ogrhalfxdown10 = grhalfxdown10;
|
||||
grhalfxdown10 = 1.f / (ghalfx * 1024.f);
|
||||
float const ogrhalfxdown10x = grhalfxdown10x;
|
||||
grhalfxdown10x = grhalfxdown10;
|
||||
float const oghoriz = ghoriz;
|
||||
ghoriz = fydim * .5f;
|
||||
int32_t const ofoffset = frameoffset;
|
||||
frameoffset = frameplace;
|
||||
float const ogchang = gchang;
|
||||
gchang = 1.f;
|
||||
float const ogshang = gshang;
|
||||
gshang = 0.f;
|
||||
float const ogctang = gctang;
|
||||
gctang = 1.f;
|
||||
float const ogstang = gstang;
|
||||
gstang = 0.f;
|
||||
float const ogvrcorrection = gvrcorrection;
|
||||
gvrcorrection = 1.f;
|
||||
|
||||
polymost_updaterotmat();
|
||||
|
||||
float m[4][4];
|
||||
|
||||
Bmemset(m,0,sizeof(m));
|
||||
m[0][0] = m[2][3] = 1.0f;
|
||||
m[1][1] = fxdim / fydim;
|
||||
m[2][2] = 1.0001f;
|
||||
m[3][2] = 1 - m[2][2];
|
||||
|
||||
GLInterface.SetMatrix(Matrix_Projection, &m[0][0]);
|
||||
VSMatrix identity(0);
|
||||
GLInterface.SetMatrix(Matrix_ModelView, &identity);
|
||||
GLInterface.EnableDepthTest(false);
|
||||
|
||||
int32_t method = DAMETH_CLAMPED; //Use OpenGL clamping - dorotatesprite never repeats
|
||||
|
||||
if (!(dastat & RS_NOMASK))
|
||||
{
|
||||
GLInterface.EnableAlphaTest(true);
|
||||
GLInterface.EnableBlend(true);
|
||||
|
||||
if (dastat & RS_TRANS1)
|
||||
method |= (dastat & RS_TRANS2) ? DAMETH_TRANS2 : DAMETH_TRANS1;
|
||||
else
|
||||
method |= DAMETH_MASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
GLInterface.EnableAlphaTest(false);
|
||||
GLInterface.EnableBlend(false);
|
||||
}
|
||||
|
||||
handle_blend(!!(dastat & RS_TRANS1), dablend, !!(dastat & RS_TRANS2));
|
||||
|
||||
|
||||
drawpoly_alpha = daalpha * (1.0f / 255.0f);
|
||||
drawpoly_blend = dablend;
|
||||
|
||||
vec2_16_t const siz = tilesiz[globalpicnum];
|
||||
vec2_16_t ofs = { 0, 0 };
|
||||
|
||||
if (!(dastat & RS_TOPLEFT))
|
||||
{
|
||||
ofs = { int16_t(picanm[globalpicnum].xofs + (siz.x>>1)),
|
||||
int16_t(picanm[globalpicnum].yofs + (siz.y>>1)) };
|
||||
}
|
||||
|
||||
if (dastat & RS_YFLIP)
|
||||
ofs.y = siz.y - ofs.y;
|
||||
|
||||
int32_t ourxyaspect, ouryxaspect;
|
||||
dorotspr_handle_bit2(&sx, &sy, &z, dastat, cx1 + cx2, cy1 + cy2, &ouryxaspect, &ourxyaspect);
|
||||
|
||||
int32_t cosang = mulscale14(sintable[(a + 512) & 2047], z);
|
||||
int32_t cosang2 = cosang;
|
||||
int32_t sinang = mulscale14(sintable[a & 2047], z);
|
||||
int32_t sinang2 = sinang;
|
||||
|
||||
if ((dastat & RS_AUTO) || (!(dastat & RS_NOCLIP))) // Don't aspect unscaled perms
|
||||
{
|
||||
cosang2 = mulscale16(cosang2,ourxyaspect);
|
||||
sinang2 = mulscale16(sinang2,ourxyaspect);
|
||||
}
|
||||
|
||||
int32_t const cx = sx - ofs.x * cosang2 + ofs.y * sinang2;
|
||||
int32_t const cy = sy - ofs.x * sinang - ofs.y * cosang;
|
||||
|
||||
vec2_t pxy[8] = { { cx, cy },
|
||||
{ cx + siz.x * cosang2, cy + siz.x * sinang },
|
||||
{ 0, 0 },
|
||||
{ cx - siz.y * sinang2, cy + siz.y * cosang } };
|
||||
|
||||
pxy[2]= { pxy[1].x + pxy[3].x - pxy[0].x,
|
||||
pxy[1].y + pxy[3].y - pxy[0].y };
|
||||
|
||||
vec2_t const gxy = pxy[0];
|
||||
|
||||
//Clippoly4
|
||||
|
||||
int32_t n = 4, nn = 0, nz = 0;
|
||||
int32_t px2[8], py2[8];
|
||||
|
||||
cx2++;
|
||||
cy2++;
|
||||
|
||||
cx1 <<= 16;
|
||||
cy1 <<= 16;
|
||||
cx2 <<= 16;
|
||||
cy2 <<= 16;
|
||||
|
||||
do
|
||||
{
|
||||
int32_t zz = nz+1; if (zz == n) zz = 0;
|
||||
int32_t const x1 = pxy[nz].x, x2 = pxy[zz].x-x1;
|
||||
if ((cx1 <= x1) && (x1 <= cx2)) { px2[nn] = x1; py2[nn] = pxy[nz].y; nn++; }
|
||||
int32_t fx = (x2 <= 0 ? cx2 : cx1), t = fx-x1;
|
||||
if ((t < x2) != (t < 0)) { px2[nn] = fx; py2[nn] = scale(pxy[zz].y-pxy[nz].y,t,x2) + pxy[nz].y; nn++; }
|
||||
fx = (x2 <= 0 ? cx1 : cx2); t = fx-x1;
|
||||
if ((t < x2) != (t < 0)) { px2[nn] = fx; py2[nn] = scale(pxy[zz].y-pxy[nz].y,t,x2) + pxy[nz].y; nn++; }
|
||||
nz = zz;
|
||||
}
|
||||
while (nz);
|
||||
|
||||
n = 0;
|
||||
|
||||
if (nn >= 3)
|
||||
{
|
||||
nz = 0;
|
||||
do
|
||||
{
|
||||
int32_t zz = nz+1; if (zz == nn) zz = 0;
|
||||
int32_t const y1 = py2[nz], y2 = py2[zz]-y1;
|
||||
if ((cy1 <= y1) && (y1 <= cy2)) { pxy[n].y = y1; pxy[n].x = px2[nz]; n++; }
|
||||
int32_t fy = (y2 <= 0 ? cy2 : cy1), t = fy - y1;
|
||||
if ((t < y2) != (t < 0)) { pxy[n].y = fy; pxy[n].x = scale(px2[zz]-px2[nz],t,y2) + px2[nz]; n++; }
|
||||
fy = (y2 <= 0 ? cy1 : cy2); t = fy - y1;
|
||||
if ((t < y2) != (t < 0)) { pxy[n].y = fy; pxy[n].x = scale(px2[zz]-px2[nz],t,y2) + px2[nz]; n++; }
|
||||
nz = zz;
|
||||
}
|
||||
while (nz);
|
||||
}
|
||||
|
||||
if (n >= 3)
|
||||
{
|
||||
int32_t i = divscale32(1,z);
|
||||
int32_t xv = mulscale14(sintable[a&2047],i);
|
||||
int32_t yv = mulscale14(sintable[(a+512)&2047],i);
|
||||
int32_t xv2, yv2;
|
||||
if ((dastat&RS_AUTO) || (dastat&RS_NOCLIP)==0) //Don't aspect unscaled perms
|
||||
{
|
||||
yv2 = mulscale16(-xv,ouryxaspect);
|
||||
xv2 = mulscale16(yv,ouryxaspect);
|
||||
}
|
||||
else
|
||||
{
|
||||
yv2 = -xv;
|
||||
xv2 = yv;
|
||||
}
|
||||
|
||||
int32_t lx = pxy[0].x;
|
||||
for (int v=n-1; v>0; v--)
|
||||
if (pxy[v].x < lx) lx = pxy[v].x;
|
||||
|
||||
vec2_t oxy = { (lx>>16), 0 };
|
||||
int32_t x = (oxy.x<<16)-1-gxy.x;
|
||||
int32_t y = (oxy.y<<16)+65535-gxy.y;
|
||||
int32_t bx = dmulscale16(x,xv2,y,xv);
|
||||
int32_t by = dmulscale16(x,yv2,y,yv);
|
||||
|
||||
if (dastat & RS_YFLIP)
|
||||
{
|
||||
yv = -yv;
|
||||
yv2 = -yv2;
|
||||
by = (siz.y<<16)-1-by;
|
||||
}
|
||||
|
||||
vec2f_t fpxy[8];
|
||||
for (int v=0; v<n; v++)
|
||||
fpxy[v] = { float((pxy[v].x+8192)>>16), float((pxy[v].y+8192)>>16) };
|
||||
|
||||
xtex.d = 0; ytex.d = 0; otex.d = 1.0;
|
||||
otex.u = (bx-(oxy.x-1+0.7)*xv2-(oxy.y+0.7)*xv)*(1.0/65536.0);
|
||||
xtex.u = xv2*(1.0/65536.0);
|
||||
ytex.u = xv*(1.0/65536.0);
|
||||
otex.v = (by-(oxy.x-1+0.7)*yv2-(oxy.y+0.7)*yv)*(1.0/65536.0);
|
||||
xtex.v = yv2*(1.0/65536.0);
|
||||
ytex.v = yv*(1.0/65536.0);
|
||||
|
||||
pow2xsplit = 0; polymost_drawpoly(fpxy,n,method, tilesiz[globalpicnum]);
|
||||
}
|
||||
|
||||
GLInterface.EnableAlphaTest(false);
|
||||
GLInterface.EnableBlend(false);
|
||||
GLInterface.SetClamp(0);
|
||||
|
||||
GLInterface.SetMatrix(Matrix_Projection, &oldproj);
|
||||
GLInterface.SetMatrix(Matrix_ModelView, &oldmv);
|
||||
|
||||
globalpicnum = ogpicnum;
|
||||
globalshade = ogshade;
|
||||
globalpal = ogpal;
|
||||
ghalfx = oghalfx;
|
||||
ghalfy = oghalfy;
|
||||
grhalfxdown10 = ogrhalfxdown10;
|
||||
grhalfxdown10x = ogrhalfxdown10x;
|
||||
ghoriz = oghoriz;
|
||||
frameoffset = ofoffset;
|
||||
gchang = ogchang;
|
||||
gshang = ogshang;
|
||||
gctang = ogctang;
|
||||
gstang = ogstang;
|
||||
gvrcorrection = ogvrcorrection;
|
||||
|
||||
polymost_identityrotmat();
|
||||
#endif
|
||||
}
|
||||
|
||||
static float trapextx[2];
|
||||
static void drawtrap(float x0, float x1, float y0, float x2, float x3, float y1)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue