X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=source%2Fgles2rice%2Fsrc%2FRender.cpp;h=64868a4352428ad9f37a2ed16255e652c0b45de5;hb=6c7533683f3b805c127b433aa5a7c8b1ce0c775b;hp=d90633fb59c801634a925da6f4255449910fd26d;hpb=292f9317f53c38c181439013be7276f86517fd6b;p=mupen64plus-pandora.git diff --git a/source/gles2rice/src/Render.cpp b/source/gles2rice/src/Render.cpp old mode 100644 new mode 100755 index d90633f..64868a4 --- a/source/gles2rice/src/Render.cpp +++ b/source/gles2rice/src/Render.cpp @@ -214,6 +214,20 @@ void CRender::SetWorldView(const Matrix & mat, bool bPush, bool bReplace) { // Load projection matrix gRSP.modelviewMtxs[gRSP.modelViewMtxTop] = mat; + + //GSI: Hack needed to show heart in OOT & MM + //it renders at Z cordinate = 0.0f that gets clipped away. + //so we translate them a bit along Z to make them stick + if( options.enableHackForGames == HACK_FOR_ZELDA || options.enableHackForGames == HACK_FOR_ZELDA_MM) + { + if(gRSP.modelviewMtxs[gRSP.modelViewMtxTop]._43 == 0.0f + && gRSP.modelviewMtxs[gRSP.modelViewMtxTop]._42 != 0.0f + && gRSP.modelviewMtxs[gRSP.modelViewMtxTop]._42 <= 94.5f + && gRSP.modelviewMtxs[gRSP.modelViewMtxTop]._42 >= -94.5f) + { + gRSP.modelviewMtxs[gRSP.modelViewMtxTop]._43 -= 10.1f; + } + } } else { @@ -1663,10 +1677,12 @@ void CRender::SaveTextureToFile(int tex, TextureChannel channel, bool bShow) #endif extern RenderTextureInfo gRenderTextureInfos[]; -void SetVertexTextureUVCoord(TexCord &dst, float s, float t, int tile, TxtrCacheEntry *pEntry) +void SetVertexTextureUVCoord(TexCord &dst, const TexCord &src, int tile, TxtrCacheEntry *pEntry) { RenderTexture &txtr = g_textures[tile]; RenderTextureInfo &info = gRenderTextureInfos[pEntry->txtrBufIdx-1]; + float s = src.u; + float t = src.v; uint32 addrOffset = g_TI.dwAddr-info.CI_Info.dwAddr; uint32 extraTop = (addrOffset>>(info.CI_Info.dwSize-1)) /info.CI_Info.dwWidth; @@ -1686,21 +1702,30 @@ void SetVertexTextureUVCoord(TexCord &dst, float s, float t, int tile, TxtrCache dst.v = t; } -void CRender::SetVertexTextureUVCoord(TLITVERTEX &v, float fTex0S, float fTex0T) +void CRender::SetVertexTextureUVCoord(TLITVERTEX &v, const TexCord &fTex0) { RenderTexture &txtr = g_textures[0]; if( txtr.pTextureEntry && txtr.pTextureEntry->txtrBufIdx > 0 ) { - ::SetVertexTextureUVCoord(v.tcord[0], fTex0S, fTex0T, 0, txtr.pTextureEntry); + ::SetVertexTextureUVCoord(v.tcord[0], fTex0, 0, txtr.pTextureEntry); } else { - v.tcord[0].u = fTex0S; - v.tcord[0].v = fTex0T; + v.tcord[0] = fTex0; } } -void CRender::SetVertexTextureUVCoord(TLITVERTEX &v, float fTex0S, float fTex0T, float fTex1S, float fTex1T) + +void CRender::SetVertexTextureUVCoord(TLITVERTEX &v, float fTex0S, float fTex0T) { + TexCord t = { fTex0S, fTex0T }; + SetVertexTextureUVCoord(v, t); +} + +void CRender::SetVertexTextureUVCoord(TLITVERTEX &v, const TexCord &fTex0_, const TexCord &fTex1_) +{ + TexCord fTex0 = fTex0_; + TexCord fTex1 = fTex1_; + if( (options.enableHackForGames == HACK_FOR_ZELDA||options.enableHackForGames == HACK_FOR_ZELDA_MM) && m_Mux == 0x00262a60150c937fLL && gRSP.curTile == 0 ) { // Hack for Zelda Sun @@ -1710,36 +1735,41 @@ void CRender::SetVertexTextureUVCoord(TLITVERTEX &v, float fTex0S, float fTex0T, t1.dwFormat == TXT_FMT_I && t1.dwSize == TXT_SIZE_8b && t1.dwWidth == 64 && t0.dwHeight == t1.dwHeight ) { - fTex0S /= 2; - fTex0T /= 2; - fTex1S /= 2; - fTex1T /= 2; + fTex0.u /= 2; + fTex0.v /= 2; + fTex1.u /= 2; + fTex1.v /= 2; } } RenderTexture &txtr0 = g_textures[0]; if( txtr0.pTextureEntry && txtr0.pTextureEntry->txtrBufIdx > 0 ) { - ::SetVertexTextureUVCoord(v.tcord[0], fTex0S, fTex0T, 0, txtr0.pTextureEntry); + ::SetVertexTextureUVCoord(v.tcord[0], fTex0, 0, txtr0.pTextureEntry); } else { - v.tcord[0].u = fTex0S; - v.tcord[0].v = fTex0T; + v.tcord[0] = fTex0; } RenderTexture &txtr1 = g_textures[1]; if( txtr1.pTextureEntry && txtr1.pTextureEntry->txtrBufIdx > 0 ) { - ::SetVertexTextureUVCoord(v.tcord[1], fTex1S, fTex1T, 1, txtr1.pTextureEntry); + ::SetVertexTextureUVCoord(v.tcord[1], fTex1, 1, txtr1.pTextureEntry); } else { - v.tcord[1].u = fTex1S; - v.tcord[1].v = fTex1T; + v.tcord[1] = fTex1; } } +void CRender::SetVertexTextureUVCoord(TLITVERTEX &v, float fTex0S, float fTex0T, float fTex1S, float fTex1T) +{ + TexCord t0 = { fTex0S, fTex0T }; + TexCord t1 = { fTex1S, fTex1T }; + SetVertexTextureUVCoord(v, t0, t1); +} + void CRender::SetClipRatio(uint32 type, uint32 w1) { bool modified = false;