- 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:
Christoph Oelckers 2020-02-09 15:51:16 +01:00
parent 77403f3b85
commit a5fc374b59
3 changed files with 18 additions and 41 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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,32 +249,20 @@ 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); const int32_t ourxdimen = (windowxy2.x-windowxy1.x+1);
float ratio = 1; float ratio = 1;
const int32_t fovcorrect = (int32_t)(ourxdimen*ratio - ourxdimen); 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;
glox2 = (float)windowxy2.x; gloy2 = (float)windowxy2.y;
GLInterface.SetViewport(windowxy1.x-(fovcorrect/2), ydim-(windowxy2.y+1), GLInterface.SetViewport(windowxy1.x-(fovcorrect/2), ydim-(windowxy2.y+1),
ourxdimen+fovcorrect, windowxy2.y-windowxy1.y+1); ourxdimen+fovcorrect, windowxy2.y-windowxy1.y+1);
float m[4][4]; float m[4][4]{};
Bmemset(m,0,sizeof(m));
float const nearclip = 4.0f / (gxyaspect * gyxscale * 1024.f); float const nearclip = 4.0f / (gxyaspect * gyxscale * 1024.f);
float const farclip = 64.f; float const farclip = 64.f;
gloxyaspect = gxyaspect;
gloyxscale = gyxscale;
glohoriz2 = ghoriz2;
glohorizcorrect = ghorizcorrect;
glotang = gtang;
m[0][0] = 1.f; m[0][0] = 1.f;
m[1][1] = fxdimen / (fydimen * ratio); m[1][1] = fxdimen / (fydimen * ratio);
m[2][0] = 2.f * ghoriz2 * gstang / fxdimen; m[2][0] = 2.f * ghoriz2 * gstang / fxdimen;
@ -290,7 +273,6 @@ static void resizeglcheck(void)
GLInterface.SetMatrix(Matrix_Projection, &m[0][0]); GLInterface.SetMatrix(Matrix_Projection, &m[0][0]);
GLInterface.SetIdentityMatrix(Matrix_Model); 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)
} }
{ {