mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
- always recalculate the projection matrix.
Trying to cache this is not useful, it barely saves time and was causing display errors. # Conflicts: # source/build/src/polymost.cpp
This commit is contained in:
parent
77403f3b85
commit
a5fc374b59
3 changed files with 18 additions and 41 deletions
|
@ -14,7 +14,6 @@ typedef struct { float r, g, b, a; } coltypef;
|
||||||
extern bool playing_rr;
|
extern bool playing_rr;
|
||||||
extern int32_t rendmode;
|
extern int32_t rendmode;
|
||||||
extern float gtang;
|
extern float gtang;
|
||||||
extern float glox1;
|
|
||||||
extern double gxyaspect;
|
extern double gxyaspect;
|
||||||
extern float grhalfxdown10x;
|
extern float grhalfxdown10x;
|
||||||
extern float gcosang, gsinang, gcosang2, gsinang2;
|
extern float gcosang, gsinang, gcosang2, gsinang2;
|
||||||
|
|
|
@ -10137,8 +10137,6 @@ void videoClearScreen(int32_t dacol)
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (videoGetRenderMode() >= REND_POLYMOST)
|
if (videoGetRenderMode() >= REND_POLYMOST)
|
||||||
{
|
{
|
||||||
glox1 = -1;
|
|
||||||
|
|
||||||
palette_t const p = paletteGetColor(dacol);
|
palette_t const p = paletteGetColor(dacol);
|
||||||
GLInterface.ClearScreen(PalEntry(255, p.r, p.g, p.b));
|
GLInterface.ClearScreen(PalEntry(255, p.r, p.g, p.b));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -157,9 +157,6 @@ void gltexapplyprops(void)
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
float glox1;
|
|
||||||
static float gloy1, glox2, gloy2, gloyxscale, gloxyaspect, glohoriz2, glohorizcorrect, glotang;
|
|
||||||
|
|
||||||
//Use this for both initialization and uninitialization of OpenGL.
|
//Use this for both initialization and uninitialization of OpenGL.
|
||||||
static int32_t gltexcacnum = -1;
|
static int32_t gltexcacnum = -1;
|
||||||
|
|
||||||
|
@ -218,8 +215,6 @@ void polymost_glreset()
|
||||||
delete polymosttext;
|
delete polymosttext;
|
||||||
polymosttext=nullptr;
|
polymosttext=nullptr;
|
||||||
|
|
||||||
glox1 = -1;
|
|
||||||
|
|
||||||
#ifdef DEBUGGINGAIDS
|
#ifdef DEBUGGINGAIDS
|
||||||
OSD_Printf("polymost_glreset()\n");
|
OSD_Printf("polymost_glreset()\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -254,42 +249,29 @@ static void resizeglcheck(void)
|
||||||
GLInterface.ClearScreen(0xffffff, true);
|
GLInterface.ClearScreen(0xffffff, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((glox1 != windowxy1.x) || (gloy1 != windowxy1.y) || (glox2 != windowxy2.x) || (gloy2 != windowxy2.y) || (gloxyaspect != gxyaspect) || (gloyxscale != gyxscale) || (glohoriz2 != ghoriz2) || (glohorizcorrect != ghorizcorrect) || (glotang != gtang))
|
const int32_t ourxdimen = (windowxy2.x-windowxy1.x+1);
|
||||||
{
|
float ratio = 1;
|
||||||
const int32_t ourxdimen = (windowxy2.x-windowxy1.x+1);
|
const int32_t fovcorrect = (int32_t)(ourxdimen*ratio - ourxdimen);
|
||||||
float ratio = 1;
|
|
||||||
const int32_t fovcorrect = (int32_t)(ourxdimen*ratio - ourxdimen);
|
|
||||||
|
|
||||||
ratio = 1.f/ratio;
|
ratio = 1.f/ratio;
|
||||||
|
|
||||||
glox1 = (float)windowxy1.x; gloy1 = (float)windowxy1.y;
|
GLInterface.SetViewport(windowxy1.x-(fovcorrect/2), ydim-(windowxy2.y+1),
|
||||||
glox2 = (float)windowxy2.x; gloy2 = (float)windowxy2.y;
|
ourxdimen+fovcorrect, windowxy2.y-windowxy1.y+1);
|
||||||
|
|
||||||
GLInterface.SetViewport(windowxy1.x-(fovcorrect/2), ydim-(windowxy2.y+1),
|
float m[4][4]{};
|
||||||
ourxdimen+fovcorrect, windowxy2.y-windowxy1.y+1);
|
|
||||||
|
|
||||||
float m[4][4];
|
float const nearclip = 4.0f / (gxyaspect * gyxscale * 1024.f);
|
||||||
Bmemset(m,0,sizeof(m));
|
float const farclip = 64.f;
|
||||||
|
|
||||||
float const nearclip = 4.0f / (gxyaspect * gyxscale * 1024.f);
|
m[0][0] = 1.f;
|
||||||
float const farclip = 64.f;
|
m[1][1] = fxdimen / (fydimen * ratio);
|
||||||
|
m[2][0] = 2.f * ghoriz2 * gstang / fxdimen;
|
||||||
gloxyaspect = gxyaspect;
|
m[2][1] = 2.f * (ghoriz2 * gctang + ghorizcorrect) / fydimen;
|
||||||
gloyxscale = gyxscale;
|
m[2][2] = (farclip + nearclip) / (farclip - nearclip);
|
||||||
glohoriz2 = ghoriz2;
|
m[2][3] = 1.f;
|
||||||
glohorizcorrect = ghorizcorrect;
|
m[3][2] = -(2.f * farclip * nearclip) / (farclip - nearclip);
|
||||||
glotang = gtang;
|
GLInterface.SetMatrix(Matrix_Projection, &m[0][0]);
|
||||||
|
GLInterface.SetIdentityMatrix(Matrix_Model);
|
||||||
m[0][0] = 1.f;
|
|
||||||
m[1][1] = fxdimen / (fydimen * ratio);
|
|
||||||
m[2][0] = 2.f * ghoriz2 * gstang / fxdimen;
|
|
||||||
m[2][1] = 2.f * (ghoriz2 * gctang + ghorizcorrect) / fydimen;
|
|
||||||
m[2][2] = (farclip + nearclip) / (farclip - nearclip);
|
|
||||||
m[2][3] = 1.f;
|
|
||||||
m[3][2] = -(2.f * farclip * nearclip) / (farclip - nearclip);
|
|
||||||
GLInterface.SetMatrix(Matrix_Projection, &m[0][0]);
|
|
||||||
GLInterface.SetIdentityMatrix(Matrix_Model);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void uploadbasepalette(int32_t basepalnum)
|
void uploadbasepalette(int32_t basepalnum)
|
||||||
|
@ -4562,12 +4544,10 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a,
|
||||||
if ((dastat&(RS_AUTO|RS_NOCLIP)) == RS_AUTO)
|
if ((dastat&(RS_AUTO|RS_NOCLIP)) == RS_AUTO)
|
||||||
{
|
{
|
||||||
GLInterface.SetViewport(windowxy1.x, ydim-(windowxy2.y+1), windowxy2.x-windowxy1.x+1, windowxy2.y-windowxy1.y+1);
|
GLInterface.SetViewport(windowxy1.x, ydim-(windowxy2.y+1), windowxy2.x-windowxy1.x+1, windowxy2.y-windowxy1.y+1);
|
||||||
glox1 = -1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GLInterface.SetViewport(0, 0, xdim, ydim);
|
GLInterface.SetViewport(0, 0, xdim, ydim);
|
||||||
glox1 = -1; //Force fullscreen (glox1=-1 forces it to restore)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue