1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Add correctTexrectCoords option: make texrect coordinates continuous to avoid black lines between them.

This commit is contained in:
Sergey Lipskiy 2016-04-16 12:28:39 +06:00
parent f767eb79d2
commit 269b3c19e9
5 changed files with 43 additions and 3 deletions

View File

@ -35,6 +35,7 @@ void Config::resetToDefaults()
generalEmulation.enableHWLighting = 0;
generalEmulation.enableCustomSettings = 1;
generalEmulation.enableShadersStorage = 1;
generalEmulation.correctTexrectCoords = tcDisable;
generalEmulation.hacks = 0;
#ifdef ANDROID
generalEmulation.forcePolygonOffset = 0;

View File

@ -35,13 +35,20 @@ struct Config
u32 screenShotFormat;
} texture;
struct {
enum TexrectCorrectionMode {
tcDisable = 0,
tcSmart,
tcForce
};
struct {
u32 enableFog;
u32 enableNoise;
u32 enableLOD;
u32 enableHWLighting;
u32 enableCustomSettings;
u32 enableShadersStorage;
u32 correctTexrectCoords;
u32 hacks;
#ifdef ANDROID
u32 forcePolygonOffset;

View File

@ -1261,6 +1261,28 @@ void OGLRender::drawTexturedRect(const TexturedRectParams & _params)
gSP.changed |= CHANGED_GEOMETRYMODE | CHANGED_VIEWPORT;
}
void OGLRender::correctTexturedRectParams(TexturedRectParams & _params)
{
if (config.generalEmulation.correctTexrectCoords == Config::tcSmart) {
if (_params.ulx == m_texrectParams.ulx && _params.lrx == m_texrectParams.lrx) {
if (fabsf(_params.uly - m_texrectParams.lry) < 0.51f)
_params.uly = m_texrectParams.lry;
else if (fabsf(_params.lry - m_texrectParams.uly) < 0.51f)
_params.lry = m_texrectParams.uly;
} else if (_params.uly == m_texrectParams.uly && _params.lry == m_texrectParams.lry) {
if (fabsf(_params.ulx - m_texrectParams.lrx) < 0.51f)
_params.ulx = m_texrectParams.lrx;
else if (fabsf(_params.lrx - m_texrectParams.ulx) < 0.51f)
_params.lrx = m_texrectParams.ulx;
}
} else if (config.generalEmulation.correctTexrectCoords == Config::tcForce) {
_params.lrx += 0.25f;
_params.lry += 0.25f;
}
m_texrectParams = _params;
}
void OGLRender::drawText(const char *_pText, float x, float y)
{
m_renderState = rsNone;

View File

@ -100,7 +100,13 @@ public:
flip(_flip), forceAjustScale(_forceAjustScale), texrectCmd(_texrectCmd),
pBuffer(_pBuffer)
{}
private:
friend class OGLRender;
TexturedRectParams() :
ulx(0), uly(0), lrx(0), lry(0)
{};
};
void correctTexturedRectParams(TexturedRectParams & _params);
void drawTexturedRect(const TexturedRectParams & _params);
void drawText(const char *_pText, float x, float y);
void clearDepthBuffer(u32 _uly, u32 _lry);
@ -181,6 +187,7 @@ private:
RENDER_STATE m_renderState;
OGL_RENDERER m_oglRenderer;
TexturedRectParams m_texrectParams;
GLVertex m_rect[4];
u32 m_modifyVertices;
bool m_bImageTexture;

View File

@ -867,8 +867,11 @@ void gDPTextureRectangle(f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f3
}
OGLRender::TexturedRectParams params(ulx, uly, lrx, lry, s, t, lrs, lrt, fabsf(dsdx), fabsf(dtdy),
flip, false, true, frameBufferList().getCurrent());
video().getRender().drawTexturedRect(params);
flip, false, true, frameBufferList().getCurrent());
OGLRender & render = video().getRender();
if (config.generalEmulation.correctTexrectCoords != Config::tcDisable)
render.correctTexturedRectParams(params);
render.drawTexturedRect(params);
gSP.textureTile[0] = textureTileOrg[0];
gSP.textureTile[1] = textureTileOrg[1];