mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-22 13:55:38 +00:00
The model3 has this weird issue where the 2d and 3d planes are misaligned by 2 pixels. Originally I made a quick hack that shifted subviewports 2 pixels. But apparently that wasn't enough, as the issue effects everything. Thanks to HarryTuttle for pointing this out, and making a patch :)
This commit is contained in:
parent
b19ceb0b6a
commit
9780f333b4
|
@ -703,14 +703,6 @@ void CNew3D::RenderViewport(UINT32 addr)
|
|||
|
||||
uint32_t matrixBase = vpnode[0x16] & 0xFFFFFF; // matrix base address
|
||||
|
||||
if (vp->vpX) {
|
||||
vp->vpX += 2;
|
||||
}
|
||||
|
||||
if (vp->vpY) {
|
||||
vp->vpY += 2;
|
||||
}
|
||||
|
||||
LODBlendTable* tableTest = (LODBlendTable*)TranslateCullingAddress(vpnode[0x17]);
|
||||
|
||||
vp->angle_left = -atan2(*(float *)&vpnode[12], *(float *)&vpnode[13]);
|
||||
|
|
|
@ -536,24 +536,15 @@ void CRender2D::Setup2D(bool isBottom, bool clearAll)
|
|||
glUseProgram(m_shaderProgram);
|
||||
|
||||
// Clear everything if requested or just overscan areas for wide screen mode
|
||||
if (clearAll)
|
||||
if (clearAll || isBottom)
|
||||
{
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glViewport(0, 0, m_totalXPixels, m_totalYPixels);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
else if (isBottom && g_Config.wideScreen)
|
||||
{
|
||||
// For now, clear w/ black (may want to use color 0 later)
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glViewport(0, 0, m_xOffset, m_totalYPixels);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glViewport(m_xOffset + m_xPixels, 0, m_totalXPixels, m_totalYPixels);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
// Set up the viewport and orthogonal projection
|
||||
glViewport(m_xOffset, m_yOffset, m_xPixels, m_yPixels);
|
||||
glViewport(m_xOffset - m_correction, m_yOffset + m_correction, m_xPixels, m_yPixels);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0.0, 1.0, 1.0, 0.0, 1.0, -1.0);
|
||||
|
@ -672,6 +663,7 @@ bool CRender2D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned
|
|||
m_yOffset = yOffset;
|
||||
m_totalXPixels = totalXRes;
|
||||
m_totalYPixels = totalYRes;
|
||||
m_correction = (UINT32)(((yRes / 384.f) * 2) + 0.5f); // for some reason the 2d layer is 2 pixels off the 3D
|
||||
|
||||
// Create textures
|
||||
glActiveTexture(GL_TEXTURE0); // texture unit 0
|
||||
|
|
|
@ -186,6 +186,7 @@ private:
|
|||
unsigned m_yOffset = 0;
|
||||
unsigned m_totalXPixels; // total display surface resolution
|
||||
unsigned m_totalYPixels;
|
||||
unsigned m_correction = 0;
|
||||
|
||||
// Shader programs and input data locations
|
||||
GLuint m_shaderProgram; // shader program object
|
||||
|
|
|
@ -1076,7 +1076,7 @@ CReal3D::CReal3D(void)
|
|||
CReal3D::~CReal3D(void)
|
||||
{
|
||||
// Dump memory
|
||||
#if 0
|
||||
#if 1
|
||||
FILE *fp;
|
||||
fp = fopen("8c000000", "wb");
|
||||
if (NULL != fp)
|
||||
|
|
|
@ -135,16 +135,22 @@ static bool SetGLGeometry(unsigned *xOffsetPtr, unsigned *yOffsetPtr, unsigned *
|
|||
// Write back resolution parameters
|
||||
*xResPtr = (unsigned) xRes;
|
||||
*yResPtr = (unsigned) yRes;
|
||||
|
||||
UINT32 correction = (UINT32)(((yRes / 384.f) * 2) + 0.5f);
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
// Scissor box (to clip visible area)
|
||||
if (!g_Config.wideScreen)
|
||||
{
|
||||
if (VideoInfo->current_w > int(*xResPtr) || VideoInfo->current_h > int(*yResPtr))
|
||||
{
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glScissor(*xOffsetPtr, *yOffsetPtr, *xResPtr, *yResPtr);
|
||||
glScissor(*xOffsetPtr + correction, *yOffsetPtr + correction, *xResPtr - (correction*2), *yResPtr - (correction*2));
|
||||
}
|
||||
}
|
||||
else {
|
||||
glScissor(0, correction, *totalXResPtr, *totalYResPtr - (correction * 2));
|
||||
}
|
||||
return OKAY;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue