Fixed const pointer function definitions
This commit is contained in:
parent
2b37d7ba61
commit
8b276ca731
217
gl-api.c
217
gl-api.c
|
@ -43,14 +43,15 @@ static GLfloat GL_KOS_POINT_SIZE = 0.02;
|
||||||
|
|
||||||
static pvr_poly_cxt_t GL_KOS_POLY_CXT;
|
static pvr_poly_cxt_t GL_KOS_POLY_CXT;
|
||||||
|
|
||||||
static inline GLvoid _glKosFlagsSetTriangleStrip();
|
static inline void _glKosFlagsSetTriangleStrip();
|
||||||
static inline GLvoid _glKosFlagsSetTriangle();
|
static inline void _glKosFlagsSetTriangle();
|
||||||
static inline GLvoid _glKosFlagsSetQuad();
|
static inline void _glKosFlagsSetQuad();
|
||||||
|
static inline void _glKosFinishRect();
|
||||||
|
|
||||||
//====================================================================================================//
|
//====================================================================================================//
|
||||||
//== API Initialization ==//
|
//== API Initialization ==//
|
||||||
|
|
||||||
GLvoid APIENTRY glKosInit() {
|
void APIENTRY glKosInit() {
|
||||||
_glKosInitPVR();
|
_glKosInitPVR();
|
||||||
|
|
||||||
_glKosInitTextures();
|
_glKosInitTextures();
|
||||||
|
@ -65,7 +66,7 @@ GLvoid APIENTRY glKosInit() {
|
||||||
//====================================================================================================//
|
//====================================================================================================//
|
||||||
//== Blending / Shading functions ==//
|
//== Blending / Shading functions ==//
|
||||||
|
|
||||||
GLvoid APIENTRY glShadeModel(GLenum mode) {
|
void APIENTRY glShadeModel(GLenum mode) {
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case GL_FLAT:
|
case GL_FLAT:
|
||||||
GL_KOS_SHADE_FUNC = PVR_SHADE_FLAT;
|
GL_KOS_SHADE_FUNC = PVR_SHADE_FLAT;
|
||||||
|
@ -77,7 +78,7 @@ GLvoid APIENTRY glShadeModel(GLenum mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) {
|
void APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) {
|
||||||
GL_KOS_BLEND_FUNC = 0;
|
GL_KOS_BLEND_FUNC = 0;
|
||||||
|
|
||||||
switch(sfactor) {
|
switch(sfactor) {
|
||||||
|
@ -160,12 +161,12 @@ GLvoid APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) {
|
||||||
//====================================================================================================//
|
//====================================================================================================//
|
||||||
//== Depth / Clear functions ==//
|
//== Depth / Clear functions ==//
|
||||||
|
|
||||||
GLvoid APIENTRY glClear(GLuint mode) {
|
void APIENTRY glClear(GLuint mode) {
|
||||||
if(mode & GL_COLOR_BUFFER_BIT)
|
if(mode & GL_COLOR_BUFFER_BIT)
|
||||||
pvr_set_bg_color(GL_KOS_COLOR_CLEAR[0], GL_KOS_COLOR_CLEAR[1], GL_KOS_COLOR_CLEAR[2]);
|
pvr_set_bg_color(GL_KOS_COLOR_CLEAR[0], GL_KOS_COLOR_CLEAR[1], GL_KOS_COLOR_CLEAR[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glClearColor(float r, float g, float b, float a) {
|
void APIENTRY glClearColor(float r, float g, float b, float a) {
|
||||||
if(r > 1) r = 1;
|
if(r > 1) r = 1;
|
||||||
|
|
||||||
if(g > 1) g = 1;
|
if(g > 1) g = 1;
|
||||||
|
@ -180,11 +181,11 @@ GLvoid APIENTRY glClearColor(float r, float g, float b, float a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//== NoOp ==//
|
//== NoOp ==//
|
||||||
GLvoid APIENTRY glClearDepthf(GLfloat depth) {
|
void APIENTRY glClearDepthf(GLfloat depth) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glDepthFunc(GLenum func) {
|
void APIENTRY glDepthFunc(GLenum func) {
|
||||||
switch(func) {
|
switch(func) {
|
||||||
case GL_LESS:
|
case GL_LESS:
|
||||||
GL_KOS_DEPTH_FUNC = PVR_DEPTHCMP_GEQUAL;
|
GL_KOS_DEPTH_FUNC = PVR_DEPTHCMP_GEQUAL;
|
||||||
|
@ -207,14 +208,14 @@ GLvoid APIENTRY glDepthFunc(GLenum func) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glDepthMask(GLboolean flag) {
|
void APIENTRY glDepthMask(GLboolean flag) {
|
||||||
GL_KOS_DEPTH_WRITE = !flag;
|
GL_KOS_DEPTH_WRITE = !flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
//====================================================================================================//
|
//====================================================================================================//
|
||||||
//== Culling functions ==//
|
//== Culling functions ==//
|
||||||
|
|
||||||
GLvoid APIENTRY glFrontFace(GLenum mode) {
|
void APIENTRY glFrontFace(GLenum mode) {
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case GL_CW:
|
case GL_CW:
|
||||||
case GL_CCW:
|
case GL_CCW:
|
||||||
|
@ -223,7 +224,7 @@ GLvoid APIENTRY glFrontFace(GLenum mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glCullFace(GLenum mode) {
|
void APIENTRY glCullFace(GLenum mode) {
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case GL_FRONT:
|
case GL_FRONT:
|
||||||
case GL_BACK:
|
case GL_BACK:
|
||||||
|
@ -238,57 +239,57 @@ GLvoid APIENTRY glCullFace(GLenum mode) {
|
||||||
|
|
||||||
//== Vertex Color Submission ==//
|
//== Vertex Color Submission ==//
|
||||||
|
|
||||||
GLvoid APIENTRY glColor1ui(GLuint argb) {
|
void APIENTRY glColor1ui(GLuint argb) {
|
||||||
GL_KOS_VERTEX_COLOR = argb;
|
GL_KOS_VERTEX_COLOR = argb;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a) {
|
void APIENTRY glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a) {
|
||||||
GL_KOS_VERTEX_COLOR = a << 24 | r << 16 | g << 8 | b;
|
GL_KOS_VERTEX_COLOR = a << 24 | r << 16 | g << 8 | b;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glColor3f(GLfloat r, GLfloat g, GLfloat b) {
|
void APIENTRY glColor3f(GLfloat r, GLfloat g, GLfloat b) {
|
||||||
GL_KOS_VERTEX_COLOR = PVR_PACK_COLOR(1.0f, r, g, b);
|
GL_KOS_VERTEX_COLOR = PVR_PACK_COLOR(1.0f, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glColor3fv(const GLfloat *rgb) {
|
void APIENTRY glColor3fv(const GLfloat *rgb) {
|
||||||
GL_KOS_VERTEX_COLOR = PVR_PACK_COLOR(1.0f, rgb[0], rgb[1], rgb[2]);
|
GL_KOS_VERTEX_COLOR = PVR_PACK_COLOR(1.0f, rgb[0], rgb[1], rgb[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
|
void APIENTRY glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
|
||||||
GL_KOS_VERTEX_COLOR = PVR_PACK_COLOR(a, r, g, b);
|
GL_KOS_VERTEX_COLOR = PVR_PACK_COLOR(a, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glColor4fv(const GLfloat *rgba) {
|
void APIENTRY glColor4fv(const GLfloat *rgba) {
|
||||||
GL_KOS_VERTEX_COLOR = PVR_PACK_COLOR(rgba[3], rgba[0], rgba[1], rgba[2]);
|
GL_KOS_VERTEX_COLOR = PVR_PACK_COLOR(rgba[3], rgba[0], rgba[1], rgba[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//== Texture Coordinate Submission ==//
|
//== Texture Coordinate Submission ==//
|
||||||
|
|
||||||
GLvoid APIENTRY glTexCoord2f(GLfloat u, GLfloat v) {
|
void APIENTRY glTexCoord2f(GLfloat u, GLfloat v) {
|
||||||
GL_KOS_VERTEX_UV[0] = u;
|
GL_KOS_VERTEX_UV[0] = u;
|
||||||
GL_KOS_VERTEX_UV[1] = v;
|
GL_KOS_VERTEX_UV[1] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glTexCoord2fv(const GLfloat *uv) {
|
void APIENTRY glTexCoord2fv(const GLfloat *uv) {
|
||||||
GL_KOS_VERTEX_UV[0] = uv[0];
|
GL_KOS_VERTEX_UV[0] = uv[0];
|
||||||
GL_KOS_VERTEX_UV[1] = uv[1];
|
GL_KOS_VERTEX_UV[1] = uv[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
//== Vertex Position Submission Functions ==//
|
//== Vertex Position Submission Functions ==//
|
||||||
|
|
||||||
GLvoid APIENTRY(*glVertex3f)(GLfloat, GLfloat, GLfloat);
|
void APIENTRY(*glVertex3f)(GLfloat, GLfloat, GLfloat);
|
||||||
|
|
||||||
GLvoid APIENTRY(*glVertex3fv)(GLfloat *);
|
void APIENTRY(*glVertex3fv)(const GLfloat *);
|
||||||
|
|
||||||
GLvoid APIENTRY glVertex2f(GLfloat x, GLfloat y) {
|
void APIENTRY glVertex2f(GLfloat x, GLfloat y) {
|
||||||
return _glKosVertex3ft(x, y, 0.0f);
|
return _glKosVertex3ft(x, y, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glVertex2fv(const GLfloat *xy) {
|
void APIENTRY glVertex2fv(const GLfloat *xy) {
|
||||||
return _glKosVertex3ft(xy[0], xy[1], 0.0f);
|
return _glKosVertex3ft(xy[0], xy[1], 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLAPI void APIENTRY glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) {
|
void APIENTRY glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) {
|
||||||
pvr_vertex_t * v = _glKosVertexBufPointer();
|
pvr_vertex_t * v = _glKosVertexBufPointer();
|
||||||
|
|
||||||
v[0].z = v[3].z = 0;
|
v[0].z = v[3].z = 0;
|
||||||
|
@ -296,24 +297,10 @@ GLAPI void APIENTRY glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) {
|
||||||
mat_trans_single3_nomod(x1, y1, v[0].z, v[0].x, v[0].y, v[0].z);
|
mat_trans_single3_nomod(x1, y1, v[0].z, v[0].x, v[0].y, v[0].z);
|
||||||
mat_trans_single3_nomod(x2, y2, v[3].z, v[3].x, v[3].y, v[3].z);
|
mat_trans_single3_nomod(x2, y2, v[3].z, v[3].x, v[3].y, v[3].z);
|
||||||
|
|
||||||
v[0].argb = v[1].argb = v[2].argb = v[3].argb = GL_KOS_VERTEX_COLOR;
|
_glKosFinishRect();
|
||||||
v[0].flags = v[1].flags = v[2].flags = PVR_CMD_VERTEX;
|
|
||||||
v[3].flags = PVR_CMD_VERTEX_EOL;
|
|
||||||
|
|
||||||
v[1].x = v[0].x;
|
|
||||||
v[1].y = v[3].y;
|
|
||||||
v[1].z = v[3].z;
|
|
||||||
|
|
||||||
v[2].x = v[3].x;
|
|
||||||
v[2].y = v[0].y;
|
|
||||||
v[2].z = v[0].z;
|
|
||||||
|
|
||||||
_glKosVertexBufAdd(4);
|
|
||||||
|
|
||||||
GL_KOS_VERTEX_COUNT += 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLAPI void APIENTRY glRectfv(const GLfloat *v1, const GLfloat *v2) {
|
void APIENTRY glRectfv(const GLfloat *v1, const GLfloat *v2) {
|
||||||
pvr_vertex_t * v = _glKosVertexBufPointer();
|
pvr_vertex_t * v = _glKosVertexBufPointer();
|
||||||
|
|
||||||
v[0].z = v[3].z = 0;
|
v[0].z = v[3].z = 0;
|
||||||
|
@ -321,32 +308,18 @@ GLAPI void APIENTRY glRectfv(const GLfloat *v1, const GLfloat *v2) {
|
||||||
mat_trans_single3_nomod(v1[0], v1[1], v[0].z, v[0].x, v[0].y, v[0].z);
|
mat_trans_single3_nomod(v1[0], v1[1], v[0].z, v[0].x, v[0].y, v[0].z);
|
||||||
mat_trans_single3_nomod(v2[0], v2[1], v[3].z, v[3].x, v[3].y, v[3].z);
|
mat_trans_single3_nomod(v2[0], v2[1], v[3].z, v[3].x, v[3].y, v[3].z);
|
||||||
|
|
||||||
v[0].argb = v[1].argb = v[2].argb = v[3].argb = GL_KOS_VERTEX_COLOR;
|
_glKosFinishRect();
|
||||||
v[0].flags = v[1].flags = v[2].flags = PVR_CMD_VERTEX;
|
|
||||||
v[3].flags = PVR_CMD_VERTEX_EOL;
|
|
||||||
|
|
||||||
v[1].x = v[0].x;
|
|
||||||
v[1].y = v[3].y;
|
|
||||||
v[1].z = v[3].z;
|
|
||||||
|
|
||||||
v[2].x = v[3].x;
|
|
||||||
v[2].y = v[0].y;
|
|
||||||
v[2].z = v[0].z;
|
|
||||||
|
|
||||||
_glKosVertexBufAdd(4);
|
|
||||||
|
|
||||||
GL_KOS_VERTEX_COUNT += 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLAPI void APIENTRY glRecti(GLint x1, GLint y1, GLint x2, GLint y2) {
|
void APIENTRY glRecti(GLint x1, GLint y1, GLint x2, GLint y2) {
|
||||||
return glRectf((GLfloat)x1, (GLfloat)y1, (GLfloat)x2, (GLfloat)y2);
|
return glRectf((GLfloat)x1, (GLfloat)y1, (GLfloat)x2, (GLfloat)y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLAPI void APIENTRY glRectiv(const GLint *v1, const GLint *v2) {
|
void APIENTRY glRectiv(const GLint *v1, const GLint *v2) {
|
||||||
return glRectfv((GLfloat *)v1, (GLfloat *)v2);
|
return glRectfv((const GLfloat *)v1, (const GLfloat *)v2);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glKosVertex2f(GLfloat x, GLfloat y) {
|
void APIENTRY glKosVertex2f(GLfloat x, GLfloat y) {
|
||||||
pvr_vertex_t *v = _glKosVertexBufPointer();
|
pvr_vertex_t *v = _glKosVertexBufPointer();
|
||||||
|
|
||||||
v->x = x;
|
v->x = x;
|
||||||
|
@ -361,7 +334,7 @@ GLvoid APIENTRY glKosVertex2f(GLfloat x, GLfloat y) {
|
||||||
++GL_KOS_VERTEX_COUNT;
|
++GL_KOS_VERTEX_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glKosVertex2fv(const GLfloat *xy) {
|
void APIENTRY glKosVertex2fv(const GLfloat *xy) {
|
||||||
pvr_vertex_t *v = _glKosVertexBufPointer();
|
pvr_vertex_t *v = _glKosVertexBufPointer();
|
||||||
|
|
||||||
v->x = xy[0];
|
v->x = xy[0];
|
||||||
|
@ -379,7 +352,7 @@ GLvoid APIENTRY glKosVertex2fv(const GLfloat *xy) {
|
||||||
//====================================================================================================//
|
//====================================================================================================//
|
||||||
//== GL Begin / End ==//
|
//== GL Begin / End ==//
|
||||||
|
|
||||||
GLvoid APIENTRY glBegin(GLenum mode) {
|
void APIENTRY glBegin(GLenum mode) {
|
||||||
_glKosMatrixApplyRender();
|
_glKosMatrixApplyRender();
|
||||||
|
|
||||||
_glKosArrayBufReset();
|
_glKosArrayBufReset();
|
||||||
|
@ -412,7 +385,7 @@ GLvoid APIENTRY glBegin(GLenum mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glEnd() {
|
void APIENTRY glEnd() {
|
||||||
if(_glKosEnabledNearZClip()) { /* Z-Clipping Enabled */
|
if(_glKosEnabledNearZClip()) { /* Z-Clipping Enabled */
|
||||||
if(_glKosEnabledLighting()) {
|
if(_glKosEnabledLighting()) {
|
||||||
_glKosVertexComputeLighting(_glKosClipBufAddress(), GL_KOS_VERTEX_COUNT);
|
_glKosVertexComputeLighting(_glKosClipBufAddress(), GL_KOS_VERTEX_COUNT);
|
||||||
|
@ -484,7 +457,7 @@ GLvoid APIENTRY glEnd() {
|
||||||
hand corner of the screen to be modified and glScissor(0, 0, 0, 0)
|
hand corner of the screen to be modified and glScissor(0, 0, 0, 0)
|
||||||
disallows modification to all 'tiles' on the screen.
|
disallows modification to all 'tiles' on the screen.
|
||||||
*/
|
*/
|
||||||
GLvoid APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
|
void APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
|
||||||
pvr_cmd_tclip_t *c = _glKosVertexBufPointer();
|
pvr_cmd_tclip_t *c = _glKosVertexBufPointer();
|
||||||
|
|
||||||
GLint miny, maxx, maxy;
|
GLint miny, maxx, maxy;
|
||||||
|
@ -507,7 +480,7 @@ GLvoid APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
|
||||||
_glKosVertexBufIncrement();
|
_glKosVertexBufIncrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid APIENTRY glHint(GLenum target, GLenum mode) {
|
void APIENTRY glHint(GLenum target, GLenum mode) {
|
||||||
switch(target) {
|
switch(target) {
|
||||||
case GL_PERSPECTIVE_CORRECTION_HINT:
|
case GL_PERSPECTIVE_CORRECTION_HINT:
|
||||||
if(mode == GL_NICEST)
|
if(mode == GL_NICEST)
|
||||||
|
@ -523,7 +496,7 @@ GLvoid APIENTRY glHint(GLenum target, GLenum mode) {
|
||||||
//====================================================================================================//
|
//====================================================================================================//
|
||||||
//== Internal API Vertex Submission functions ==//
|
//== Internal API Vertex Submission functions ==//
|
||||||
|
|
||||||
GLvoid _glKosVertex3fs(GLfloat x, GLfloat y, GLfloat z) {
|
void _glKosVertex3fs(GLfloat x, GLfloat y, GLfloat z) {
|
||||||
pvr_vertex_t *v = _glKosVertexBufPointer();
|
pvr_vertex_t *v = _glKosVertexBufPointer();
|
||||||
|
|
||||||
mat_trans_single3_nomod(x, y, z, v->x, v->y, v->z);
|
mat_trans_single3_nomod(x, y, z, v->x, v->y, v->z);
|
||||||
|
@ -536,7 +509,7 @@ GLvoid _glKosVertex3fs(GLfloat x, GLfloat y, GLfloat z) {
|
||||||
++GL_KOS_VERTEX_COUNT;
|
++GL_KOS_VERTEX_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid _glKosVertex3fsv(GLfloat *xyz) {
|
void _glKosVertex3fsv(const GLfloat *xyz) {
|
||||||
pvr_vertex_t *v = _glKosVertexBufPointer();
|
pvr_vertex_t *v = _glKosVertexBufPointer();
|
||||||
|
|
||||||
mat_trans_single3_nomod(xyz[0], xyz[1], xyz[2], v->x, v->y, v->z);
|
mat_trans_single3_nomod(xyz[0], xyz[1], xyz[2], v->x, v->y, v->z);
|
||||||
|
@ -549,7 +522,7 @@ GLvoid _glKosVertex3fsv(GLfloat *xyz) {
|
||||||
++GL_KOS_VERTEX_COUNT;
|
++GL_KOS_VERTEX_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid _glKosVertex3ft(GLfloat x, GLfloat y, GLfloat z) {
|
void _glKosVertex3ft(GLfloat x, GLfloat y, GLfloat z) {
|
||||||
pvr_vertex_t *v = _glKosVertexBufPointer();
|
pvr_vertex_t *v = _glKosVertexBufPointer();
|
||||||
|
|
||||||
mat_trans_single3_nomod(x, y, z, v->x, v->y, v->z);
|
mat_trans_single3_nomod(x, y, z, v->x, v->y, v->z);
|
||||||
|
@ -563,7 +536,7 @@ GLvoid _glKosVertex3ft(GLfloat x, GLfloat y, GLfloat z) {
|
||||||
++GL_KOS_VERTEX_COUNT;
|
++GL_KOS_VERTEX_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid _glKosVertex3ftv(GLfloat *xyz) {
|
void _glKosVertex3ftv(const GLfloat *xyz) {
|
||||||
pvr_vertex_t *v = _glKosVertexBufPointer();
|
pvr_vertex_t *v = _glKosVertexBufPointer();
|
||||||
|
|
||||||
mat_trans_single3_nomod(xyz[0], xyz[1], xyz[2], v->x, v->y, v->z);
|
mat_trans_single3_nomod(xyz[0], xyz[1], xyz[2], v->x, v->y, v->z);
|
||||||
|
@ -577,7 +550,7 @@ GLvoid _glKosVertex3ftv(GLfloat *xyz) {
|
||||||
++GL_KOS_VERTEX_COUNT;
|
++GL_KOS_VERTEX_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid _glKosVertex3fc(GLfloat x, GLfloat y, GLfloat z) {
|
void _glKosVertex3fc(GLfloat x, GLfloat y, GLfloat z) {
|
||||||
pvr_vertex_t *v = _glKosClipBufPointer();
|
pvr_vertex_t *v = _glKosClipBufPointer();
|
||||||
|
|
||||||
v->x = x;
|
v->x = x;
|
||||||
|
@ -592,7 +565,7 @@ GLvoid _glKosVertex3fc(GLfloat x, GLfloat y, GLfloat z) {
|
||||||
++GL_KOS_VERTEX_COUNT;
|
++GL_KOS_VERTEX_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid _glKosVertex3fcv(GLfloat *xyz) {
|
void _glKosVertex3fcv(const GLfloat *xyz) {
|
||||||
pvr_vertex_t *v = _glKosClipBufPointer();
|
pvr_vertex_t *v = _glKosClipBufPointer();
|
||||||
|
|
||||||
v->x = xyz[0];
|
v->x = xyz[0];
|
||||||
|
@ -608,44 +581,51 @@ GLvoid _glKosVertex3fcv(GLfloat *xyz) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GL_POINTS */
|
/* GL_POINTS */
|
||||||
|
|
||||||
inline GLvoid _glKosVertex3fpa(GLfloat x, GLfloat y, GLfloat z) {
|
|
||||||
pvr_vertex_t *v = _glKosVertexBufPointer();
|
|
||||||
|
|
||||||
mat_trans_single3_nomod(x, y, z, v->x, v->y, v->z);
|
|
||||||
|
|
||||||
v->argb = GL_KOS_VERTEX_COLOR;
|
|
||||||
v->flags = PVR_CMD_VERTEX;
|
|
||||||
|
|
||||||
_glKosVertexBufIncrement();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline GLvoid _glKosVertex3fpb(GLfloat x, GLfloat y, GLfloat z) {
|
|
||||||
pvr_vertex_t *v = _glKosVertexBufPointer();
|
|
||||||
|
|
||||||
mat_trans_single3_nomod(x, y, z, v->x, v->y, v->z);
|
|
||||||
|
|
||||||
v->argb = GL_KOS_VERTEX_COLOR;
|
|
||||||
v->flags = PVR_CMD_VERTEX_EOL;
|
|
||||||
|
|
||||||
_glKosVertexBufIncrement();
|
|
||||||
}
|
|
||||||
|
|
||||||
GLvoid _glKosVertex3fp(GLfloat x, GLfloat y, GLfloat z) {
|
GLvoid _glKosVertex3fp(GLfloat x, GLfloat y, GLfloat z) {
|
||||||
_glKosVertex3fpa(x - GL_KOS_POINT_SIZE, y - GL_KOS_POINT_SIZE, z);
|
pvr_vertex_t * v = _glKosVertexBufPointer();
|
||||||
_glKosVertex3fpa(x + GL_KOS_POINT_SIZE, y - GL_KOS_POINT_SIZE, z);
|
|
||||||
_glKosVertex3fpa(x - GL_KOS_POINT_SIZE, y + GL_KOS_POINT_SIZE, z);
|
mat_trans_single3_nomod(x - GL_KOS_POINT_SIZE, y + GL_KOS_POINT_SIZE, z,
|
||||||
_glKosVertex3fpb(x + GL_KOS_POINT_SIZE, y + GL_KOS_POINT_SIZE, z);
|
v[0].x, v[0].y, v[0].z);
|
||||||
|
mat_trans_single3_nomod(x + GL_KOS_POINT_SIZE, y - GL_KOS_POINT_SIZE, z,
|
||||||
|
v[3].x, v[3].y, v[3].z);
|
||||||
|
|
||||||
|
_glKosFinishRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid _glKosVertex3fpv(GLfloat *xyz) {
|
GLvoid _glKosVertex3fpv(const GLfloat *xyz) {
|
||||||
_glKosVertex3fpa(xyz[0] - GL_KOS_POINT_SIZE, xyz[1] - GL_KOS_POINT_SIZE, xyz[2]);
|
pvr_vertex_t * v = _glKosVertexBufPointer();
|
||||||
_glKosVertex3fpa(xyz[0] + GL_KOS_POINT_SIZE, xyz[1] - GL_KOS_POINT_SIZE, xyz[2]);
|
|
||||||
_glKosVertex3fpa(xyz[0] - GL_KOS_POINT_SIZE, xyz[1] + GL_KOS_POINT_SIZE, xyz[2]);
|
mat_trans_single3_nomod(xyz[0] - GL_KOS_POINT_SIZE, xyz[1] + GL_KOS_POINT_SIZE, xyz[2],
|
||||||
_glKosVertex3fpb(xyz[0] + GL_KOS_POINT_SIZE, xyz[1] + GL_KOS_POINT_SIZE, xyz[2]);
|
v[0].x, v[0].y, v[0].z);
|
||||||
|
mat_trans_single3_nomod(xyz[0] + GL_KOS_POINT_SIZE, xyz[1] - GL_KOS_POINT_SIZE, xyz[2],
|
||||||
|
v[3].x, v[3].y, v[3].z);
|
||||||
|
|
||||||
|
_glKosFinishRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid _glKosTransformClipBuf(pvr_vertex_t *v, GLuint verts) {
|
static inline void _glKosFinishRect()
|
||||||
|
{
|
||||||
|
pvr_vertex_t * v = _glKosVertexBufPointer();
|
||||||
|
|
||||||
|
v[0].argb = v[1].argb = v[2].argb = v[3].argb = GL_KOS_VERTEX_COLOR;
|
||||||
|
|
||||||
|
v[0].flags = v[1].flags = v[2].flags = PVR_CMD_VERTEX;
|
||||||
|
v[3].flags = PVR_CMD_VERTEX_EOL;
|
||||||
|
|
||||||
|
v[1].x = v[0].x;
|
||||||
|
v[1].y = v[3].y;
|
||||||
|
v[1].z = v[3].z;
|
||||||
|
|
||||||
|
v[2].x = v[3].x;
|
||||||
|
v[2].y = v[0].y;
|
||||||
|
v[2].z = v[0].z;
|
||||||
|
|
||||||
|
_glKosVertexBufAdd( 4 );
|
||||||
|
|
||||||
|
GL_KOS_VERTEX_COUNT += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glKosTransformClipBuf(pvr_vertex_t *v, GLuint verts) {
|
||||||
register float __x __asm__("fr12");
|
register float __x __asm__("fr12");
|
||||||
register float __y __asm__("fr13");
|
register float __y __asm__("fr13");
|
||||||
register float __z __asm__("fr14");
|
register float __z __asm__("fr14");
|
||||||
|
@ -664,13 +644,13 @@ GLvoid _glKosTransformClipBuf(pvr_vertex_t *v, GLuint verts) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GLvoid _glKosVertexSwap(pvr_vertex_t *v1, pvr_vertex_t *v2) {
|
static inline void _glKosVertexSwap(pvr_vertex_t *v1, pvr_vertex_t *v2) {
|
||||||
pvr_vertex_t tmp = *v1;
|
pvr_vertex_t tmp = *v1;
|
||||||
*v1 = *v2;
|
*v1 = *v2;
|
||||||
*v2 = * &tmp;
|
*v2 = * &tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GLvoid _glKosFlagsSetQuad() {
|
static inline void _glKosFlagsSetQuad() {
|
||||||
pvr_vertex_t *v = (pvr_vertex_t *)_glKosVertexBufPointer() - GL_KOS_VERTEX_COUNT;
|
pvr_vertex_t *v = (pvr_vertex_t *)_glKosVertexBufPointer() - GL_KOS_VERTEX_COUNT;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
|
@ -682,7 +662,7 @@ static inline GLvoid _glKosFlagsSetQuad() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GLvoid _glKosFlagsSetTriangle() {
|
static inline void _glKosFlagsSetTriangle() {
|
||||||
pvr_vertex_t *v = (pvr_vertex_t *)_glKosVertexBufPointer() - GL_KOS_VERTEX_COUNT;
|
pvr_vertex_t *v = (pvr_vertex_t *)_glKosVertexBufPointer() - GL_KOS_VERTEX_COUNT;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
|
@ -693,7 +673,7 @@ static inline GLvoid _glKosFlagsSetTriangle() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GLvoid _glKosFlagsSetTriangleStrip() {
|
static inline void _glKosFlagsSetTriangleStrip() {
|
||||||
pvr_vertex_t *v = (pvr_vertex_t *)_glKosVertexBufPointer() - GL_KOS_VERTEX_COUNT;
|
pvr_vertex_t *v = (pvr_vertex_t *)_glKosVertexBufPointer() - GL_KOS_VERTEX_COUNT;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
|
@ -708,7 +688,7 @@ static inline GLvoid _glKosFlagsSetTriangleStrip() {
|
||||||
//====================================================================================================//
|
//====================================================================================================//
|
||||||
//== GL KOS PVR Header Parameter Compilation Functions ==//
|
//== GL KOS PVR Header Parameter Compilation Functions ==//
|
||||||
|
|
||||||
static inline GLvoid _glKosApplyDepthFunc() {
|
static inline void _glKosApplyDepthFunc() {
|
||||||
if(_glKosEnabledDepthTest())
|
if(_glKosEnabledDepthTest())
|
||||||
GL_KOS_POLY_CXT.depth.comparison = GL_KOS_DEPTH_FUNC;
|
GL_KOS_POLY_CXT.depth.comparison = GL_KOS_DEPTH_FUNC;
|
||||||
else
|
else
|
||||||
|
@ -717,17 +697,17 @@ static inline GLvoid _glKosApplyDepthFunc() {
|
||||||
GL_KOS_POLY_CXT.depth.write = GL_KOS_DEPTH_WRITE;
|
GL_KOS_POLY_CXT.depth.write = GL_KOS_DEPTH_WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GLvoid _glKosApplyScissorFunc() {
|
static inline void _glKosApplyScissorFunc() {
|
||||||
if(_glKosEnabledScissorTest())
|
if(_glKosEnabledScissorTest())
|
||||||
GL_KOS_POLY_CXT.gen.clip_mode = PVR_USERCLIP_INSIDE;
|
GL_KOS_POLY_CXT.gen.clip_mode = PVR_USERCLIP_INSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GLvoid _glKosApplyFogFunc() {
|
static inline void _glKosApplyFogFunc() {
|
||||||
if(_glKosEnabledFog())
|
if(_glKosEnabledFog())
|
||||||
GL_KOS_POLY_CXT.gen.fog_type = PVR_FOG_TABLE;
|
GL_KOS_POLY_CXT.gen.fog_type = PVR_FOG_TABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GLvoid _glKosApplyCullingFunc() {
|
static inline void _glKosApplyCullingFunc() {
|
||||||
if(_glKosEnabledCulling()) {
|
if(_glKosEnabledCulling()) {
|
||||||
if(GL_KOS_CULL_FUNC == GL_BACK) {
|
if(GL_KOS_CULL_FUNC == GL_BACK) {
|
||||||
if(GL_KOS_FACE_FRONT == GL_CW)
|
if(GL_KOS_FACE_FRONT == GL_CW)
|
||||||
|
@ -746,14 +726,14 @@ static inline GLvoid _glKosApplyCullingFunc() {
|
||||||
GL_KOS_POLY_CXT.gen.culling = PVR_CULLING_NONE;
|
GL_KOS_POLY_CXT.gen.culling = PVR_CULLING_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GLvoid _glKosApplyBlendFunc() {
|
static inline void _glKosApplyBlendFunc() {
|
||||||
if(_glKosEnabledBlend()) {
|
if(_glKosEnabledBlend()) {
|
||||||
GL_KOS_POLY_CXT.blend.src = (GL_KOS_BLEND_FUNC & 0xF0) >> 4;
|
GL_KOS_POLY_CXT.blend.src = (GL_KOS_BLEND_FUNC & 0xF0) >> 4;
|
||||||
GL_KOS_POLY_CXT.blend.dst = (GL_KOS_BLEND_FUNC & 0x0F);
|
GL_KOS_POLY_CXT.blend.dst = (GL_KOS_BLEND_FUNC & 0x0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid _glKosCompileHdr() {
|
void _glKosCompileHdr() {
|
||||||
pvr_poly_hdr_t *hdr = _glKosVertexBufPointer();
|
pvr_poly_hdr_t *hdr = _glKosVertexBufPointer();
|
||||||
|
|
||||||
pvr_poly_cxt_col(&GL_KOS_POLY_CXT, _glKosList() * 2);
|
pvr_poly_cxt_col(&GL_KOS_POLY_CXT, _glKosList() * 2);
|
||||||
|
@ -775,7 +755,7 @@ GLvoid _glKosCompileHdr() {
|
||||||
_glKosVertexBufIncrement();
|
_glKosVertexBufIncrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid _glKosCompileHdrT(GL_TEXTURE_OBJECT *tex) {
|
void _glKosCompileHdrT(GL_TEXTURE_OBJECT *tex) {
|
||||||
pvr_poly_hdr_t *hdr = _glKosVertexBufPointer();
|
pvr_poly_hdr_t *hdr = _glKosVertexBufPointer();
|
||||||
|
|
||||||
pvr_poly_cxt_txr(&GL_KOS_POLY_CXT,
|
pvr_poly_cxt_txr(&GL_KOS_POLY_CXT,
|
||||||
|
@ -906,3 +886,8 @@ GLuint _glKosDepthFunc() {
|
||||||
GLubyte _glKosDepthMask() {
|
GLubyte _glKosDepthMask() {
|
||||||
return !GL_KOS_DEPTH_WRITE;
|
return !GL_KOS_DEPTH_WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLuint _glKosVertexColor()
|
||||||
|
{
|
||||||
|
return GL_KOS_VERTEX_COLOR;
|
||||||
|
}
|
17
gl-api.h
17
gl-api.h
|
@ -99,20 +99,18 @@ unsigned int _glKosVertexLightColor(glVertex *P);
|
||||||
void _glKosVertexLights(glVertex *P, pvr_vertex_t *v, GLuint count);
|
void _glKosVertexLights(glVertex *P, pvr_vertex_t *v, GLuint count);
|
||||||
|
|
||||||
/* Vertex Position Submission Internal Functions */
|
/* Vertex Position Submission Internal Functions */
|
||||||
void _glKosVertex2ft(GLfloat x, GLfloat y);
|
|
||||||
void _glKosVertex2ftv(GLfloat *xy);
|
|
||||||
void _glKosVertex3ft(GLfloat x, GLfloat y, GLfloat z);
|
void _glKosVertex3ft(GLfloat x, GLfloat y, GLfloat z);
|
||||||
void _glKosVertex3ftv(GLfloat *xyz);
|
void _glKosVertex3ftv(const GLfloat *xyz);
|
||||||
void _glKosVertex3fc(GLfloat x, GLfloat y, GLfloat z);
|
void _glKosVertex3fc(GLfloat x, GLfloat y, GLfloat z);
|
||||||
void _glKosVertex3fcv(GLfloat *xyz);
|
void _glKosVertex3fcv(const GLfloat *xyz);
|
||||||
void _glKosVertex3fp(GLfloat x, GLfloat y, GLfloat z);
|
void _glKosVertex3fp(GLfloat x, GLfloat y, GLfloat z);
|
||||||
void _glKosVertex3fpv(GLfloat *xyz);
|
void _glKosVertex3fpv(const GLfloat *xyz);
|
||||||
void _glKosVertex3fl(GLfloat x, GLfloat y, GLfloat z);
|
void _glKosVertex3fl(GLfloat x, GLfloat y, GLfloat z);
|
||||||
void _glKosVertex3flv(GLfloat *xyz);
|
void _glKosVertex3flv(const GLfloat *xyz);
|
||||||
void _glKosVertex3flc(GLfloat x, GLfloat y, GLfloat z);
|
void _glKosVertex3flc(GLfloat x, GLfloat y, GLfloat z);
|
||||||
void _glKosVertex3flcv(GLfloat *xyz);
|
void _glKosVertex3flcv(const GLfloat *xyz);
|
||||||
void _glKosVertex3fs(GLfloat x, GLfloat y, GLfloat z);
|
void _glKosVertex3fs(GLfloat x, GLfloat y, GLfloat z);
|
||||||
void _glKosVertex3fsv(GLfloat *xyz);
|
void _glKosVertex3fsv(const GLfloat *xyz);
|
||||||
|
|
||||||
/* Matrix Internal Functions */
|
/* Matrix Internal Functions */
|
||||||
void _glKosInitMatrix();
|
void _glKosInitMatrix();
|
||||||
|
@ -176,6 +174,7 @@ GLuint _glKosDepthFunc();
|
||||||
GLubyte _glKosDepthMask();
|
GLubyte _glKosDepthMask();
|
||||||
GLubyte _glKosIsLightEnabled(GLubyte light);
|
GLubyte _glKosIsLightEnabled(GLubyte light);
|
||||||
GLubyte _glKosGetMaxLights();
|
GLubyte _glKosGetMaxLights();
|
||||||
GLuint _glKosBoundTexID();
|
GLuint _glKosBoundTexID();
|
||||||
|
GLuint _glKosVertexColor();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -304,7 +304,7 @@ static inline void _glKosElementColor0(pvr_vertex_t *dst, GLuint count) {
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
for(i = 0; i < count; i++)
|
for(i = 0; i < count; i++)
|
||||||
dst[i].argb = 0xFFFFFFFF;
|
dst[i].argb = _glKosVertexColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _glKosElementColor1uiU8(pvr_vertex_t *dst, GLuint count) {
|
static inline void _glKosElementColor1uiU8(pvr_vertex_t *dst, GLuint count) {
|
||||||
|
@ -751,8 +751,6 @@ GLAPI void APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, cons
|
||||||
_glKosArraysResetState();
|
_glKosArraysResetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//========================================================================================//
|
//========================================================================================//
|
||||||
//== Array Attribute Functions ==//
|
//== Array Attribute Functions ==//
|
||||||
|
|
||||||
|
@ -762,7 +760,7 @@ static inline void _glKosArrayColor0(pvr_vertex_t *dst, GLuint count) {
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
for(i = 0; i < count; i++)
|
for(i = 0; i < count; i++)
|
||||||
dst[i].argb = 0xFFFFFFFF;
|
dst[i].argb = _glKosVertexColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _glKosArrayColor1ui(pvr_vertex_t *dst, GLuint count) {
|
static inline void _glKosArrayColor1ui(pvr_vertex_t *dst, GLuint count) {
|
||||||
|
@ -916,7 +914,7 @@ GLAPI void APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Transform vertices with no perspective divide, store w component */
|
/* Transform vertices with no perspective divde, store w component */
|
||||||
_glKosArraysTransformClip(count);
|
_glKosArraysTransformClip(count);
|
||||||
|
|
||||||
/* Finally, clip the input vertex data into the output vertex buffer */
|
/* Finally, clip the input vertex data into the output vertex buffer */
|
||||||
|
|
6
gl-cap.c
6
gl-cap.c
|
@ -195,7 +195,8 @@ void APIENTRY glGetIntegerv(GLenum pname, GLint *params) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
*params = -1; // Indicate invalid parameter //
|
_glKosThrowError(GL_INVALID_ENUM, "glGetIntegerv");
|
||||||
|
_glKosPrintError();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,7 +210,8 @@ void APIENTRY glGetFloatv(GLenum pname, GLfloat *params) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
*params = (GLfloat)GL_INVALID_ENUM;
|
_glKosThrowError(GL_INVALID_ENUM, "glGetFloatv");
|
||||||
|
_glKosPrintError();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
26
gl-light.c
26
gl-light.c
|
@ -66,18 +66,24 @@ void _glKosInitLighting() { /* Called internally by glInit() */
|
||||||
memcpy(&GL_MATERIAL, &GL_DEFAULT_MATERIAL, sizeof(glMaterial));
|
memcpy(&GL_MATERIAL, &GL_DEFAULT_MATERIAL, sizeof(glMaterial));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable a light - GL_LIGHT0->GL_LIGHT15 */
|
/* Enable a light - GL_LIGHT0->GL_LIGHT7 */
|
||||||
void _glKosEnableLight(const GLuint light) {
|
void _glKosEnableLight(const GLuint light) {
|
||||||
if(light < GL_LIGHT0 || light > GL_LIGHT0 + GL_KOS_MAX_LIGHTS)
|
if(light < GL_LIGHT0 || light > GL_LIGHT0 + GL_KOS_MAX_LIGHTS)
|
||||||
|
{
|
||||||
|
_glKosThrowError(GL_INVALID_ENUM, "glEnable(GL_LIGHT)");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GL_LIGHT_ENABLED |= (1 << (light & 0xF));
|
GL_LIGHT_ENABLED |= (1 << (light & 0xF));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable a light - GL_LIGHT0->GL_LIGHT15 */
|
/* Disable a light - GL_LIGHT0->GL_LIGHT7 */
|
||||||
void _glKosDisableLight(const GLuint light) {
|
void _glKosDisableLight(const GLuint light) {
|
||||||
if(light < GL_LIGHT0 || light > GL_LIGHT0 + GL_KOS_MAX_LIGHTS)
|
if(light < GL_LIGHT0 || light > GL_LIGHT0 + GL_KOS_MAX_LIGHTS)
|
||||||
|
{
|
||||||
|
_glKosThrowError(GL_INVALID_ENUM, "glDisable(GL_LIGHT)");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GL_LIGHT_ENABLED &= ~(1 << (light & 0xF));
|
GL_LIGHT_ENABLED &= ~(1 << (light & 0xF));
|
||||||
}
|
}
|
||||||
|
@ -104,14 +110,14 @@ void glNormal3fv(const GLfloat *xyz) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Global Ambient Light Parameters */
|
/* Global Ambient Light Parameters */
|
||||||
void glKosLightAmbient4fv(const GLfloat *rgba) {
|
void glKosLightAmbient4fv(const float *rgba) {
|
||||||
GL_GLOBAL_AMBIENT[0] = rgba[0];
|
GL_GLOBAL_AMBIENT[0] = rgba[0];
|
||||||
GL_GLOBAL_AMBIENT[1] = rgba[1];
|
GL_GLOBAL_AMBIENT[1] = rgba[1];
|
||||||
GL_GLOBAL_AMBIENT[2] = rgba[2];
|
GL_GLOBAL_AMBIENT[2] = rgba[2];
|
||||||
GL_GLOBAL_AMBIENT[3] = rgba[3];
|
GL_GLOBAL_AMBIENT[3] = rgba[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
void glKosLightAmbient4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
|
void glKosLightAmbient4f(float r, float g, float b, float a) {
|
||||||
GL_GLOBAL_AMBIENT[0] = r;
|
GL_GLOBAL_AMBIENT[0] = r;
|
||||||
GL_GLOBAL_AMBIENT[1] = g;
|
GL_GLOBAL_AMBIENT[1] = g;
|
||||||
GL_GLOBAL_AMBIENT[2] = b;
|
GL_GLOBAL_AMBIENT[2] = b;
|
||||||
|
@ -133,7 +139,7 @@ void glKosLightAmbient3f(float r, float g, float b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Misc Lighting Functions ************************************/
|
/* Misc Lighting Functions ************************************/
|
||||||
static inline void glCopyRGBA(rgba *src, rgba *dst) {
|
static inline void glCopyRGBA(const rgba *src, rgba *dst) {
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +348,7 @@ float FPOW(float b, float p) {
|
||||||
|
|
||||||
/* End FPOW Implementation */
|
/* End FPOW Implementation */
|
||||||
|
|
||||||
void _glKosVertex3flv(GLfloat *xyz) {
|
void _glKosVertex3flv(const GLfloat *xyz) {
|
||||||
glVertex *v = _glKosArrayBufPtr();
|
glVertex *v = _glKosArrayBufPtr();
|
||||||
|
|
||||||
v->pos[0] = xyz[0];
|
v->pos[0] = xyz[0];
|
||||||
|
@ -372,7 +378,7 @@ void _glKosVertex3fl(GLfloat x, GLfloat y, GLfloat z) {
|
||||||
_glKosVertex3fs(x, y, z);
|
_glKosVertex3fs(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glKosVertex3flcv(GLfloat *xyz) {
|
void _glKosVertex3flcv(const GLfloat *xyz) {
|
||||||
glVertex *v = _glKosArrayBufPtr();
|
glVertex *v = _glKosArrayBufPtr();
|
||||||
|
|
||||||
v->pos[0] = xyz[0];
|
v->pos[0] = xyz[0];
|
||||||
|
@ -566,3 +572,9 @@ void _glKosVertexComputeLighting(pvr_vertex_t *v, int verts) {
|
||||||
_glKosVertexLight(s++, v++);
|
_glKosVertexLight(s++, v++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glKosLightTransformScreenSpace(float *xyz) {
|
||||||
|
_glKosMatrixApplyScreenSpace();
|
||||||
|
mat_trans_single(xyz[0], xyz[1], xyz[2]);
|
||||||
|
_glKosMatrixLoadRender();
|
||||||
|
}
|
||||||
|
|
40
include/gl.h
40
include/gl.h
|
@ -403,31 +403,44 @@ GLAPI void APIENTRY glEnd();
|
||||||
|
|
||||||
/* Primitive Texture Coordinate Submission */
|
/* Primitive Texture Coordinate Submission */
|
||||||
GLAPI void APIENTRY glTexCoord2f(GLfloat u, GLfloat v);
|
GLAPI void APIENTRY glTexCoord2f(GLfloat u, GLfloat v);
|
||||||
GLAPI void APIENTRY glTexCoord2fv(GLfloat *uv);
|
GLAPI void APIENTRY glTexCoord2fv(const GLfloat *uv);
|
||||||
|
|
||||||
/* Primitive Color Submission */
|
/* Primitive Color Submission */
|
||||||
GLAPI void APIENTRY glColor1ui(GLuint argb);
|
GLAPI void APIENTRY glColor1ui(GLuint argb);
|
||||||
GLAPI void APIENTRY glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a);
|
GLAPI void APIENTRY glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a);
|
||||||
GLAPI void APIENTRY glColor3f(GLfloat r, GLfloat g, GLfloat b);
|
GLAPI void APIENTRY glColor3f(GLfloat r, GLfloat g, GLfloat b);
|
||||||
GLAPI void APIENTRY glColor3fv(GLfloat *rgb);
|
GLAPI void APIENTRY glColor3fv(const GLfloat *rgb);
|
||||||
GLAPI void APIENTRY glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
|
GLAPI void APIENTRY glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
|
||||||
GLAPI void APIENTRY glColor4fv(GLfloat *rgba);
|
GLAPI void APIENTRY glColor4fv(const GLfloat *rgba);
|
||||||
|
|
||||||
/* Primitive Normal Submission */
|
/* Primitive Normal Submission */
|
||||||
GLAPI void APIENTRY glNormal3f(float x, float y, float z);
|
GLAPI void APIENTRY glNormal3f(GLfloat x, GLfloat y, GLfloat z);
|
||||||
GLAPI void APIENTRY glNormal3fv(float *xyz);
|
GLAPI void APIENTRY glNormal3fv(const GLfloat *xyz);
|
||||||
|
|
||||||
/* Primitive 2D Position Submission */
|
/* Primitive 2D Position Submission */
|
||||||
GLAPI void APIENTRY glVertex2f(GLfloat x, GLfloat y);
|
GLAPI void APIENTRY glVertex2f(GLfloat x, GLfloat y);
|
||||||
GLAPI void APIENTRY glVertex2fv(GLfloat *xy);
|
GLAPI void APIENTRY glVertex2fv(const const GLfloat *xy);
|
||||||
|
|
||||||
/* Non-Standard KOS Primitive 2D Submission. This will perform no tranformations on the vertices. */
|
/* Non-Standard KOS Primitive 2D Submission. This will perform no tranformations on the vertices. */
|
||||||
GLAPI void APIENTRY glKosVertex2f(GLfloat x, GLfloat y);
|
GLAPI void APIENTRY glKosVertex2f(GLfloat x, GLfloat y);
|
||||||
GLAPI void APIENTRY glKosVertex2fv(GLfloat *xy);
|
GLAPI void APIENTRY glKosVertex2fv(const GLfloat *xy);
|
||||||
|
|
||||||
/* Primitive 3D Position Submission */
|
/* Primitive 3D Position Submission */
|
||||||
GLAPI void APIENTRY(*glVertex3f)(float, float, float);
|
GLAPI void APIENTRY(*glVertex3f)(GLfloat, GLfloat, GLfloat);
|
||||||
GLAPI void APIENTRY(*glVertex3fv)(float *);
|
GLAPI void APIENTRY(*glVertex3fv)(const GLfloat *);
|
||||||
|
|
||||||
|
/* 2D Non-Textured Rectangle Submission */
|
||||||
|
GLAPI GLvoid APIENTRY glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
|
||||||
|
#define glRectd glRectf
|
||||||
|
|
||||||
|
GLAPI GLvoid APIENTRY glRectfv(const GLfloat *v1, const GLfloat *v2);
|
||||||
|
#define glRectdv glRectfv
|
||||||
|
|
||||||
|
GLAPI GLvoid APIENTRY glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
|
||||||
|
#define glRects glRecti
|
||||||
|
|
||||||
|
GLAPI GLvoid APIENTRY glRectiv(const GLint *v1, const GLint *v2);
|
||||||
|
#define glRectsv glRectiv
|
||||||
|
|
||||||
/* Enable / Disable Capability */
|
/* Enable / Disable Capability */
|
||||||
/* Currently Supported Capabilities:
|
/* Currently Supported Capabilities:
|
||||||
|
@ -556,8 +569,8 @@ GLAPI void APIENTRY glFogfv(GLenum pname, const GLfloat *params);
|
||||||
/* Set Global Ambient Light Color */
|
/* Set Global Ambient Light Color */
|
||||||
GLAPI void APIENTRY glKosLightAmbient3f(GLfloat r, GLfloat g, GLfloat b);
|
GLAPI void APIENTRY glKosLightAmbient3f(GLfloat r, GLfloat g, GLfloat b);
|
||||||
GLAPI void APIENTRY glKosLightAmbient4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
|
GLAPI void APIENTRY glKosLightAmbient4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
|
||||||
GLAPI void APIENTRY glKosLightAmbient3fv(GLfloat *rgb);
|
GLAPI void APIENTRY glKosLightAmbient3fv(const GLfloat *rgb);
|
||||||
GLAPI void APIENTRY glKosLightAmbient4fv(GLfloat *rgba);
|
GLAPI void APIENTRY glKosLightAmbient4fv(const GLfloat *rgba);
|
||||||
|
|
||||||
/* Set Individual Light Parameters */
|
/* Set Individual Light Parameters */
|
||||||
GLAPI void APIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params);
|
GLAPI void APIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params);
|
||||||
|
@ -576,20 +589,21 @@ GLAPI void APIENTRY glGetIntegerv(GLenum pname, GLint *params);
|
||||||
GLAPI void APIENTRY glGetFloatv(GLenum pname, GLfloat *params);
|
GLAPI void APIENTRY glGetFloatv(GLenum pname, GLfloat *params);
|
||||||
GLAPI GLboolean APIENTRY glIsEnabled(GLenum cap);
|
GLAPI GLboolean APIENTRY glIsEnabled(GLenum cap);
|
||||||
|
|
||||||
/* Multi-Texture Extensions - Does not currently work with Z-Clipping Enabled */
|
/* Multi-Texture Extensions - Does not currently work with Z-Clipping Enabled
|
||||||
GLAPI void APIENTRY glActiveTexture(GLenum texture);
|
GLAPI void APIENTRY glActiveTexture(GLenum texture);
|
||||||
|
|
||||||
GLAPI void APIENTRY glClientActiveTexture(GLenum texture);
|
GLAPI void APIENTRY glClientActiveTexture(GLenum texture);
|
||||||
|
|
||||||
GLAPI void APIENTRY glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
|
GLAPI void APIENTRY glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);
|
||||||
GLAPI void APIENTRY glMultiTexCoord2fv(GLenum target, const GLfloat *v);
|
GLAPI void APIENTRY glMultiTexCoord2fv(GLenum target, const GLfloat *v);
|
||||||
|
*/
|
||||||
|
|
||||||
/* Frame Buffer Objects / Render-To-Texture Functions */
|
/* Frame Buffer Objects / Render-To-Texture Functions */
|
||||||
GLAPI void APIENTRY glGenFramebuffers(GLsizei n, GLuint * framebuffers);
|
GLAPI void APIENTRY glGenFramebuffers(GLsizei n, GLuint * framebuffers);
|
||||||
GLAPI void APIENTRY glDeleteFramebuffers(GLsizei n, GLuint * framebuffers);
|
GLAPI void APIENTRY glDeleteFramebuffers(GLsizei n, GLuint * framebuffers);
|
||||||
GLAPI void APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer);
|
GLAPI void APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer);
|
||||||
GLAPI void APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment,
|
GLAPI void APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment,
|
||||||
GLenum textarget, GLuint texture, GLint level);
|
GLenum textarget, GLuint texture, GLint level);
|
||||||
GLAPI GLenum APIENTRY glCheckFramebufferStatus(GLenum target);
|
GLAPI GLenum APIENTRY glCheckFramebufferStatus(GLenum target);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
Loading…
Reference in New Issue
Block a user