Allow disabling near-z

This commit is contained in:
Luke Benstead 2022-06-13 20:16:37 +01:00
parent 99ae70a72b
commit 3d69003c5f
4 changed files with 35 additions and 5 deletions

View File

@ -188,6 +188,22 @@ void SceneListSubmit(void* src, int n) {
const float h = GetVideoMode()->height;
if(!ZNEAR_CLIPPING_ENABLED) {
for(int i = 0; i < n; ++i, ++vertex) {
PREFETCH(vertex + 1);
if(glIsVertex(vertex->flags)) {
_glPerspectiveDivideVertex(vertex, h);
}
_glSubmitHeaderOrVertex(vertex);
}
/* Wait for both store queues to complete */
d = (uint32_t *)0xe0000000;
d[0] = d[8] = 0;
return;
}
tri_count = 0;
strip_count = 0;

View File

@ -260,6 +260,19 @@ void SceneListSubmit(void* src, int n) {
const float h = GetVideoMode()->height;
/* If Z-clipping is disabled, just fire everything over to the buffer */
if(!ZNEAR_CLIPPING_ENABLED) {
for(int i = 0; i < n; ++i, ++vertex) {
PREFETCH(vertex + 1);
if(glIsVertex(vertex->flags)) {
_glPerspectiveDivideVertex(vertex, h);
}
_glSubmitHeaderOrVertex(vertex);
}
return;
}
tri_count = 0;
strip_count = 0;

View File

@ -279,9 +279,6 @@ typedef enum {
struct SubmissionTarget;
float _glClipLineToNearZ(const Vertex* v1, const Vertex* v2, Vertex* vout);
void _glClipTriangleStrip(SubmissionTarget* target, uint8_t fladeShade);
PolyList* _glOpaquePolyList();
PolyList* _glPunchThruPolyList();
PolyList *_glTransparentPolyList();
@ -385,6 +382,8 @@ GLboolean _glIsMipmapComplete(const TextureObject* obj);
GLubyte* _glGetMipmapLocation(const TextureObject* obj, GLuint level);
GLuint _glGetMipmapLevelCount(const TextureObject* obj);
extern GLboolean ZNEAR_CLIPPING_ENABLED;
extern GLboolean LIGHTING_ENABLED;
GLboolean _glIsLightingEnabled();

View File

@ -18,6 +18,8 @@ static GLenum FRONT_FACE = GL_CCW;
static GLboolean CULLING_ENABLED = GL_FALSE;
static GLboolean COLOR_MATERIAL_ENABLED = GL_FALSE;
GLboolean ZNEAR_CLIPPING_ENABLED = GL_TRUE;
GLboolean LIGHTING_ENABLED = GL_FALSE;
/* Is the shared texture palette enabled? */
@ -356,7 +358,7 @@ GLAPI void APIENTRY glEnable(GLenum cap) {
_glEnableLight(cap & 0xF, GL_TRUE);
break;
case GL_NEARZ_CLIPPING_KOS:
_glEnableClipping(GL_TRUE);
ZNEAR_CLIPPING_ENABLED = GL_TRUE;
break;
case GL_POLYGON_OFFSET_POINT:
case GL_POLYGON_OFFSET_LINE:
@ -418,7 +420,7 @@ GLAPI void APIENTRY glDisable(GLenum cap) {
_glEnableLight(cap & 0xF, GL_FALSE);
break;
case GL_NEARZ_CLIPPING_KOS:
_glEnableClipping(GL_FALSE);
ZNEAR_CLIPPING_ENABLED = GL_FALSE;
break;
case GL_POLYGON_OFFSET_POINT:
case GL_POLYGON_OFFSET_LINE: