mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Add g_bN64DepthCompare parameter
If it is true, N64 depth compare algorithm is used instead of OpenGL depth buffer.
This commit is contained in:
parent
344df93374
commit
b0f17ef953
|
@ -12,7 +12,9 @@ const GLuint ZlutImageUnit = 0;
|
|||
const GLuint TlutImageUnit = 1;
|
||||
const GLuint depthImageUnit = 2;
|
||||
|
||||
void DepthBuffer_Init()
|
||||
bool g_bN64DepthCompare = true;
|
||||
|
||||
void DepthBuffer_Init()
|
||||
{
|
||||
depthBuffer.current = NULL;
|
||||
depthBuffer.top = NULL;
|
||||
|
|
|
@ -26,6 +26,8 @@ extern const GLuint ZlutImageUnit;
|
|||
extern const GLuint TlutImageUnit;
|
||||
extern const GLuint depthImageUnit;
|
||||
|
||||
extern bool g_bN64DepthCompare;
|
||||
|
||||
void DepthBuffer_Init();
|
||||
void DepthBuffer_Destroy();
|
||||
void DepthBuffer_SetBuffer( u32 address );
|
||||
|
|
|
@ -401,9 +401,12 @@ GLSLCombiner::GLSLCombiner(Combiner *_color, Combiner *_alpha) {
|
|||
strcat(fragment_shader, " gl_FragColor = vec4(color2, alpha2); \n");
|
||||
|
||||
strcat(fragment_shader, " if (!alpha_test(gl_FragColor.a)) discard; \n");
|
||||
if (OGL.bImageTexture)
|
||||
// strcat(fragment_shader, " bool bDC = depth_compare(); \n");
|
||||
strcat(fragment_shader, " if (!depth_compare()) discard; \n");
|
||||
if (OGL.bImageTexture) {
|
||||
if (g_bN64DepthCompare)
|
||||
strcat(fragment_shader, " if (!depth_compare()) discard; \n");
|
||||
else
|
||||
strcat(fragment_shader, " depth_compare(); \n");
|
||||
}
|
||||
|
||||
#ifdef USE_TOONIFY
|
||||
strcat(fragment_shader, " toonify(intensity); \n");
|
||||
|
|
20
OpenGL.cpp
20
OpenGL.cpp
|
@ -290,7 +290,13 @@ void OGL_InitStates()
|
|||
glEnableClientState( GL_FOG_COORDINATE_ARRAY_EXT );
|
||||
}
|
||||
|
||||
glPolygonOffset( -3.0f, -3.0f );
|
||||
if (g_bN64DepthCompare) {
|
||||
glDisable( GL_DEPTH_TEST );
|
||||
glDisable( GL_POLYGON_OFFSET_FILL );
|
||||
glDepthFunc( GL_ALWAYS );
|
||||
glDepthMask( FALSE );
|
||||
} else
|
||||
glPolygonOffset( -3.0f, -3.0f );
|
||||
|
||||
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
@ -559,8 +565,7 @@ void OGL_UpdateStates()
|
|||
else
|
||||
glDisable( GL_DEPTH_TEST );
|
||||
|
||||
if (gDP.changed & CHANGED_RENDERMODE)
|
||||
{
|
||||
if (!g_bN64DepthCompare && (gDP.changed & CHANGED_RENDERMODE) > 0) {
|
||||
if (gDP.otherMode.depthCompare)
|
||||
glDepthFunc( GL_LEQUAL );
|
||||
else
|
||||
|
@ -568,13 +573,10 @@ void OGL_UpdateStates()
|
|||
|
||||
OGL_UpdateDepthUpdate();
|
||||
|
||||
// if (gDP.otherMode.depthMode == ZMODE_DEC)
|
||||
// glEnable( GL_POLYGON_OFFSET_FILL );
|
||||
// else
|
||||
{
|
||||
// glPolygonOffset( -3.0f, -3.0f );
|
||||
if (gDP.otherMode.depthMode == ZMODE_DEC)
|
||||
glEnable( GL_POLYGON_OFFSET_FILL );
|
||||
else
|
||||
glDisable( GL_POLYGON_OFFSET_FILL );
|
||||
}
|
||||
}
|
||||
|
||||
if ((gDP.changed & CHANGED_ALPHACOMPARE) || (gDP.changed & CHANGED_RENDERMODE))
|
||||
|
|
Loading…
Reference in New Issue
Block a user