Allow toggling z clipping
This commit is contained in:
parent
31e666c77a
commit
bebca59796
10
GL/clip.c
10
GL/clip.c
|
@ -11,6 +11,16 @@
|
|||
#include "../containers/aligned_vector.h"
|
||||
|
||||
|
||||
static unsigned char ZCLIP_ENABLED = 1;
|
||||
|
||||
unsigned char isClippingEnabled() {
|
||||
return ZCLIP_ENABLED;
|
||||
}
|
||||
|
||||
void enableClipping(unsigned char v) {
|
||||
ZCLIP_ENABLED = v;
|
||||
}
|
||||
|
||||
void clipLineToNearZ(const ClipVertex* v1, const ClipVertex* v2, ClipVertex* vout, float* t) {
|
||||
const float NEAR_PLANE = 0.2; // FIXME: this needs to be read from the projection matrix.. somehow
|
||||
|
||||
|
|
|
@ -479,7 +479,11 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ
|
|||
generate(buffer, mode, first, count, (GLubyte*) indices, type, vptr, vstride, cptr, cstride, uvptr, uvstride, nptr, nstride);
|
||||
light(buffer);
|
||||
transform(buffer);
|
||||
clip(buffer);
|
||||
|
||||
if(isClippingEnabled()) {
|
||||
clip(buffer);
|
||||
}
|
||||
|
||||
divide(buffer);
|
||||
push(buffer, activePolyList());
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ typedef struct {
|
|||
GLfloat emissive[4];
|
||||
GLfloat ambient[4];
|
||||
GLfloat diffuse[4];
|
||||
GLfloat specular[4];
|
||||
GLfloat specular[4];
|
||||
GLfloat exponent;
|
||||
} Material;
|
||||
|
||||
|
@ -91,6 +91,9 @@ GLboolean isLightingEnabled();
|
|||
GLboolean isLightEnabled(GLubyte light);
|
||||
void calculateLightingContribution(const GLint light, const GLfloat* pos, const GLfloat* normal, GLfloat* colour);
|
||||
|
||||
unsigned char isClippingEnabled();
|
||||
void enableClipping(unsigned char v);
|
||||
|
||||
void _glKosThrowError(GLenum error, const char *function);
|
||||
void _glKosPrintError();
|
||||
GLubyte _glKosHasError();
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <dc/video.h>
|
||||
|
||||
#include "../include/gl.h"
|
||||
#include "../include/glkos.h"
|
||||
|
||||
#include "private.h"
|
||||
|
||||
static pvr_poly_cxt_t GL_CONTEXT;
|
||||
|
@ -218,6 +220,9 @@ GLAPI void APIENTRY glEnable(GLenum cap) {
|
|||
case GL_LIGHT7:
|
||||
LIGHT_ENABLED[cap & 0xF] = GL_TRUE;
|
||||
break;
|
||||
case GL_NEARZ_CLIPPING_KOS:
|
||||
enableClipping(GL_TRUE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -259,6 +264,9 @@ GLAPI void APIENTRY glDisable(GLenum cap) {
|
|||
case GL_LIGHT7:
|
||||
LIGHT_ENABLED[cap & 0xF] = GL_FALSE;
|
||||
break;
|
||||
case GL_NEARZ_CLIPPING_KOS:
|
||||
enableClipping(GL_FALSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -329,9 +329,6 @@ __BEGIN_DECLS
|
|||
#define GL_VERSION 0x1F02
|
||||
#define GL_EXTENSIONS 0x1F03
|
||||
|
||||
/* GL KOS near Z-CLIPPING */
|
||||
#define GL_KOS_NEARZ_CLIPPING 0x0020 /* capability bit */
|
||||
|
||||
/* GL KOS Texture Matrix Enable Bit */
|
||||
#define GL_KOS_TEXTURE_MATRIX 0x002F
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
#define GL_NEARZ_CLIPPING_KOS 0xEEFA
|
||||
|
||||
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
|
||||
#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
|
||||
#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "glu.h"
|
||||
#include "glkos.h"
|
||||
|
||||
#define TERRAIN_SIZE 250
|
||||
#define TERRAIN_SIZE 100
|
||||
#define TERRAIN_SCALE 1.0f
|
||||
#define TERRAIN_HEIGHT_SCALE 1.0f
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user