mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-04-10 19:15:14 +00:00
cache bound texture
This commit is contained in:
parent
48a79a8f14
commit
d799c63b1a
|
@ -92,6 +92,8 @@ void CNew3D::RenderScene(int priority, bool alpha)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<Texture> tex1;
|
||||||
|
|
||||||
glViewport (n.viewport.x, n.viewport.y, n.viewport.width, n.viewport.height);
|
glViewport (n.viewport.x, n.viewport.y, n.viewport.width, n.viewport.height);
|
||||||
glMatrixMode (GL_PROJECTION);
|
glMatrixMode (GL_PROJECTION);
|
||||||
glLoadMatrixf (n.viewport.projectionMatrix);
|
glLoadMatrixf (n.viewport.projectionMatrix);
|
||||||
|
@ -132,11 +134,16 @@ void CNew3D::RenderScene(int priority, bool alpha)
|
||||||
int x, y;
|
int x, y;
|
||||||
CalcTexOffset(m.textureOffsetX, m.textureOffsetY, m.page, mesh.x, mesh.y, x, y);
|
CalcTexOffset(m.textureOffsetX, m.textureOffsetY, m.page, mesh.x, mesh.y, x, y);
|
||||||
|
|
||||||
auto tex1 = m_texSheet.BindTexture(m_textureRAM, mesh.format, mesh.mirrorU, mesh.mirrorV, x, y, mesh.width, mesh.height);
|
if (tex1 && tex1->Compare(x, y, mesh.width, mesh.height, mesh.format)) {
|
||||||
if (tex1) {
|
|
||||||
tex1->BindTexture();
|
|
||||||
tex1->SetWrapMode(mesh.mirrorU, mesh.mirrorV);
|
tex1->SetWrapMode(mesh.mirrorU, mesh.mirrorV);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
tex1 = m_texSheet.BindTexture(m_textureRAM, mesh.format, mesh.mirrorU, mesh.mirrorV, x, y, mesh.width, mesh.height);
|
||||||
|
if (tex1) {
|
||||||
|
tex1->BindTexture();
|
||||||
|
tex1->SetWrapMode(mesh.mirrorU, mesh.mirrorV);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mesh.microTexture) {
|
if (mesh.microTexture) {
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
|
|
|
@ -325,4 +325,13 @@ void Texture::GetDetails(int& x, int&y, int& width, int& height, int& format)
|
||||||
format = m_format;
|
format = m_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Texture::Compare(int x, int y, int width, int height, int format)
|
||||||
|
{
|
||||||
|
if (m_x == x && m_y == y && m_width == width && m_height == height && m_format == format) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // New3D
|
} // New3D
|
||||||
|
|
|
@ -19,6 +19,7 @@ public:
|
||||||
void GetCoordinates (UINT16 uIn, UINT16 vIn, float uvScale, float& uOut, float& vOut);
|
void GetCoordinates (UINT16 uIn, UINT16 vIn, float uvScale, float& uOut, float& vOut);
|
||||||
void GetDetails (int& x, int&y, int& width, int& height, int& format);
|
void GetDetails (int& x, int&y, int& width, int& height, int& format);
|
||||||
void SetWrapMode (bool mirrorU, bool mirrorV);
|
void SetWrapMode (bool mirrorU, bool mirrorV);
|
||||||
|
bool Compare (int x, int y, int width, int height, int format);
|
||||||
|
|
||||||
static void GetCoordinates(int width, int height, UINT16 uIn, UINT16 vIn, float uvScale, float& uOut, float& vOut);
|
static void GetCoordinates(int width, int height, UINT16 uIn, UINT16 vIn, float uvScale, float& uOut, float& vOut);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue