1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Do not shift texture coordinates by 0.5 for point-sampled textures.

Attempt to fix texture mapping issue from #2097.
This commit is contained in:
Sergey Lipskiy 2019-10-07 17:25:22 +07:00
parent 1384584af6
commit 0338f27225
2 changed files with 8 additions and 5 deletions

View File

@ -257,6 +257,7 @@ public:
"IN highp vec4 aModify; \n"
" \n"
"uniform int uTexturePersp; \n"
"uniform lowp int uTextureFilterMode; \n"
" \n"
"uniform lowp int uFogUsage; \n"
"uniform mediump vec2 uFogScale; \n"
@ -278,7 +279,9 @@ public:
"{ \n"
" vec2 texCoordOut = texCoord*uCacheShiftScale[idx]; \n"
" texCoordOut -= uTexOffset[idx]; \n"
" return (uCacheOffset[idx] + texCoordOut)* uCacheScale[idx];\n"
" texCoordOut += uCacheOffset[idx]; \n"
" if (uTextureFilterMode != 0) texCoordOut += vec2(0.5); \n"
" return texCoordOut* uCacheScale[idx]; \n"
"} \n"
" \n"
"void main() \n"

View File

@ -1401,8 +1401,8 @@ void TextureCache::_updateBackground()
pCurrent->shiftScaleS = 1.0f;
pCurrent->shiftScaleT = 1.0f;
pCurrent->offsetS = 0.5f;
pCurrent->offsetT = 0.5f;
pCurrent->offsetS = 0.0f;
pCurrent->offsetT = 0.0f;
_loadBackground(pCurrent);
activateTexture(0, pCurrent);
@ -1553,8 +1553,8 @@ void TextureCache::update(u32 _t)
pCurrent->scaleS = 1.0f / (pCurrent->maskS ? f32(pow2(pCurrent->width)) : f32(pCurrent->width));
pCurrent->scaleT = 1.0f / (pCurrent->maskT ? f32(pow2(pCurrent->height)) : f32(pCurrent->height));
pCurrent->offsetS = 0.5f;
pCurrent->offsetT = 0.5f;
pCurrent->offsetS = 0.0f;
pCurrent->offsetT = 0.0f;
_load(_t, pCurrent);
activateTexture( _t, pCurrent );