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

Disable near plane clipping for NoN ucodes.

This commit is contained in:
Sergey Lipskiy 2014-12-06 00:17:03 +06:00
parent 27eed46e83
commit 8a70d44110
4 changed files with 18 additions and 3 deletions

11
GBI.cpp
View File

@ -24,6 +24,7 @@
#include "ZSort.h"
#include "CRC.h"
#include "Log.h"
#include "OpenGL.h"
#include "Debug.h"
u32 last_good_ucode = (u32) -1;
@ -170,6 +171,16 @@ void GBIInfo::_makeCurrent(MicrocodeInfo * _pCurrent)
case ZSortp: ZSort_Init(); break;
case F3DEX2CBFD:F3DEX2CBFD_Init(); break;
}
if (m_pCurrent->NoN) {
// Disable near and far plane clipping
glEnable(GL_DEPTH_CLAMP);
// Enable Far clipping plane in vertex shader
glEnable(GL_CLIP_DISTANCE0);
} else {
glDisable(GL_DEPTH_CLAMP);
glDisable(GL_CLIP_DISTANCE0);
}
}
}

1
GBI.h
View File

@ -691,6 +691,7 @@ struct GBIInfo
void loadMicrocode(u32 uc_start, u32 uc_dstart, u16 uc_dsize);
u32 getMicrocodeType() const {return m_pCurrent != NULL ? m_pCurrent->type : NONE;}
bool isHWLSupported() const;
bool isNoN() const { return m_pCurrent != NULL ? m_pCurrent->NoN != 0 : false; }
private:
void _makeCurrent(MicrocodeInfo * _pCurrent);

View File

@ -556,11 +556,13 @@ void OGLRender::_updateStates() const
} else {
if ((gSP.geometryMode & G_ZBUFFER) || gDP.otherMode.depthSource == G_ZS_PRIM) {
glEnable(GL_DEPTH_TEST);
glDisable(GL_DEPTH_CLAMP);
if (!GBI.isNoN())
glDisable(GL_DEPTH_CLAMP);
}
else {
glDisable(GL_DEPTH_TEST);
glEnable(GL_DEPTH_CLAMP);
if (!GBI.isNoN())
glEnable(GL_DEPTH_CLAMP);
}
if ((gDP.changed & CHANGED_RENDERMODE) > 0) {

View File

@ -120,8 +120,9 @@ static const char* vertex_shader =
" break; \n"
" } \n"
" vFogFragCoord = clamp(vFogFragCoord, 0.0, 1.0); \n"
" if ((uFogUsage&255) == 1 && uFogMode == 0) \n"
" if ((uFogUsage&255) == 1 && uFogMode == 0) \n"
" vShadeColor.a = vFogFragCoord; \n"
" gl_ClipDistance[0] = gl_Position.w - gl_Position.z; \n"
"} \n"
;