Update SH4_math.h and stop storing the near plane
This commit is contained in:
parent
f2a39a4229
commit
a1eda16a26
33
GL/matrix.c
33
GL/matrix.c
|
@ -36,15 +36,6 @@ static const Matrix4x4 IDENTITY = {
|
||||||
|
|
||||||
GLfloat NEAR_PLANE_DISTANCE = 0.0f;
|
GLfloat NEAR_PLANE_DISTANCE = 0.0f;
|
||||||
|
|
||||||
static void _glStoreNearPlane() {
|
|
||||||
Matrix4x4* proj = (Matrix4x4*) stack_top(MATRIX_STACKS + (GL_PROJECTION & 0xF));
|
|
||||||
|
|
||||||
GLfloat a = *(*proj + 10);
|
|
||||||
GLfloat b = *(*proj + 14);
|
|
||||||
|
|
||||||
NEAR_PLANE_DISTANCE = -b / (1.0f - a);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void upload_matrix(Matrix4x4* m) {
|
static inline void upload_matrix(Matrix4x4* m) {
|
||||||
mat_load((matrix_t*) m);
|
mat_load((matrix_t*) m);
|
||||||
}
|
}
|
||||||
|
@ -315,10 +306,6 @@ void APIENTRY glFrustum(GLfloat left, GLfloat right,
|
||||||
upload_matrix(stack_top(MATRIX_STACKS + MATRIX_IDX));
|
upload_matrix(stack_top(MATRIX_STACKS + MATRIX_IDX));
|
||||||
multiply_matrix(&FrustumMatrix);
|
multiply_matrix(&FrustumMatrix);
|
||||||
download_matrix(stack_top(MATRIX_STACKS + MATRIX_IDX));
|
download_matrix(stack_top(MATRIX_STACKS + MATRIX_IDX));
|
||||||
|
|
||||||
if(MATRIX_MODE == GL_PROJECTION) {
|
|
||||||
_glStoreNearPlane();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -353,10 +340,6 @@ void glMultMatrixf(const GLfloat *m) {
|
||||||
if(MATRIX_MODE == GL_MODELVIEW) {
|
if(MATRIX_MODE == GL_MODELVIEW) {
|
||||||
recalculateNormalMatrix();
|
recalculateNormalMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(MATRIX_MODE == GL_PROJECTION) {
|
|
||||||
_glStoreNearPlane();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load an arbitrary transposed matrix */
|
/* Load an arbitrary transposed matrix */
|
||||||
|
@ -391,10 +374,6 @@ void glLoadTransposeMatrixf(const GLfloat *m) {
|
||||||
if(MATRIX_MODE == GL_MODELVIEW) {
|
if(MATRIX_MODE == GL_MODELVIEW) {
|
||||||
recalculateNormalMatrix();
|
recalculateNormalMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(MATRIX_MODE == GL_PROJECTION) {
|
|
||||||
_glStoreNearPlane();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Multiply the current matrix by an arbitrary transposed matrix */
|
/* Multiply the current matrix by an arbitrary transposed matrix */
|
||||||
|
@ -428,10 +407,6 @@ void glMultTransposeMatrixf(const GLfloat *m) {
|
||||||
if(MATRIX_MODE == GL_MODELVIEW) {
|
if(MATRIX_MODE == GL_MODELVIEW) {
|
||||||
recalculateNormalMatrix();
|
recalculateNormalMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(MATRIX_MODE == GL_PROJECTION) {
|
|
||||||
_glStoreNearPlane();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the GL viewport */
|
/* Set the GL viewport */
|
||||||
|
@ -456,10 +431,6 @@ void APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
|
||||||
SCREENVIEW_MATRIX[M13] = (tw + bw) / 2.0f;
|
SCREENVIEW_MATRIX[M13] = (tw + bw) / 2.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLfloat _glGetNearPlane() {
|
|
||||||
return NEAR_PLANE_DISTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the depth range */
|
/* Set the depth range */
|
||||||
void APIENTRY glDepthRangef(GLclampf n, GLclampf f) {
|
void APIENTRY glDepthRangef(GLclampf n, GLclampf f) {
|
||||||
if(n < 0.0f) n = 0.0f;
|
if(n < 0.0f) n = 0.0f;
|
||||||
|
@ -483,11 +454,11 @@ static inline void vec3f_cross(const GLfloat* v1, const GLfloat* v2, GLfloat* re
|
||||||
result[2] = v1[0] * v2[1] - v1[1] * v2[0];
|
result[2] = v1[0] * v2[1] - v1[1] * v2[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void vec3f_normalize_sh4(float *v){
|
GL_FORCE_INLINE void vec3f_normalize_sh4(float *v){
|
||||||
float length, ilength;
|
float length, ilength;
|
||||||
|
|
||||||
ilength = MATH_fsrra(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
|
ilength = MATH_fsrra(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
|
||||||
length = MATH_Invert(ilength);
|
length = MATH_Fast_Invert(ilength);
|
||||||
if (length)
|
if (length)
|
||||||
{
|
{
|
||||||
v[0] *= ilength;
|
v[0] *= ilength;
|
||||||
|
|
|
@ -272,10 +272,6 @@ GLubyte _glInitTextures();
|
||||||
void _glUpdatePVRTextureContext(pvr_poly_cxt_t* context, GLshort textureUnit);
|
void _glUpdatePVRTextureContext(pvr_poly_cxt_t* context, GLshort textureUnit);
|
||||||
void _glAllocateSpaceForMipmaps(TextureObject* active);
|
void _glAllocateSpaceForMipmaps(TextureObject* active);
|
||||||
|
|
||||||
extern GLfloat NEAR_PLANE_DISTANCE;
|
|
||||||
|
|
||||||
GLfloat _glGetNearPlane();
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const void* ptr;
|
const void* ptr;
|
||||||
GLenum type;
|
GLenum type;
|
||||||
|
|
1806
GL/sh4_math.h
1806
GL/sh4_math.h
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +1,3 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#define GLDC_VERSION "1.1-102-g71c25-dirty"
|
#define GLDC_VERSION "1.1-104-gf2a3-dirty"
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ void InitGL(int Width, int Height) // We call this right after our OpenG
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity(); // Reset The Projection Matrix
|
glLoadIdentity(); // Reset The Projection Matrix
|
||||||
|
|
||||||
gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f); // Calculate The Aspect Ratio Of The Window
|
gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,1.0f,100.0f); // Calculate The Aspect Ratio Of The Window
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
@ -37,7 +37,7 @@ void ReSizeGLScene(int Width, int Height)
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f);
|
gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,1.0f,100.0f);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user