diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-02-10 12:20:15 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-02-10 12:20:15 -0800 |
commit | d5a4b3c3b497ec15e8851ee5f087468f558d27de (patch) | |
tree | 97304b5f8f74db72a76e9c6a51178873c8ed4250 | |
parent | 762aa24b9b9f7b100a04a7230f000fd20fda9009 (diff) |
"near" and "far" are magic words in Visual Studio
Thanks for adhering to the C standard, guys.
-rw-r--r-- | src/matrix.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/matrix.c b/src/matrix.c index b4859d0..0c97ee9 100644 --- a/src/matrix.c +++ b/src/matrix.c @@ -158,36 +158,36 @@ void gluRotate4v(GLUmat4 *result, const GLUvec4 *_axis, GLfloat angle) void gluFrustum6f(GLUmat4 *result, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, - GLfloat near, GLfloat far) + GLfloat n, GLfloat f) { - if ((right == left) || (top == bottom) || (near == far) - || (near < 0.0) || (far < 0.0)) + if ((right == left) || (top == bottom) || (n == f) + || (n < 0.0) || (f < 0.0)) return; memcpy(result, &gluIdentityMatrix, sizeof(gluIdentityMatrix)); - result->col[0].values[0] = (2.0 * near) / (right - left); - result->col[1].values[1] = (2.0 * near) / (top - bottom); + result->col[0].values[0] = (2.0 * n) / (right - left); + result->col[1].values[1] = (2.0 * n) / (top - bottom); result->col[2].values[0] = (right + left) / (right - left); result->col[2].values[1] = (top + bottom) / (top - bottom); - result->col[2].values[2] = -(far + near) / (far - near); + result->col[2].values[2] = -(f + n) / (f - n); result->col[2].values[3] = -1.0; - result->col[3].values[2] = -(2.0 * far * near) / (far - near); + result->col[3].values[2] = -(2.0 * f * n) / (f - n); result->col[3].values[3] = 0.0; } void gluPerspective4f(GLUmat4 *result, - GLfloat fovy, GLfloat aspect, GLfloat near, GLfloat far) + GLfloat fovy, GLfloat aspect, GLfloat n, GLfloat f) { const double sine = sin(DEG2RAD(fovy / 2.0)); const double cosine = cos(DEG2RAD(fovy / 2.0)); const double sine_aspect = sine * aspect; - const double dz = far - near; + const double dz = f - n; memcpy(result, &gluIdentityMatrix, sizeof(gluIdentityMatrix)); @@ -197,9 +197,9 @@ gluPerspective4f(GLUmat4 *result, result->col[0].values[0] = cosine / sine_aspect; result->col[1].values[1] = cosine / sine; - result->col[2].values[2] = -(far + near) / dz; + result->col[2].values[2] = -(f + n) / dz; result->col[2].values[3] = -1.0; - result->col[3].values[2] = -2.0 * near * far / dz; + result->col[3].values[2] = -2.0 * n * f / dz; result->col[3].values[3] = 0.0; } @@ -207,19 +207,19 @@ gluPerspective4f(GLUmat4 *result, void gluOrtho6f(GLUmat4 *result, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, - GLfloat near, GLfloat far) + GLfloat n, GLfloat f) { - if ((right == left) || (top == bottom) || (near == far)) + if ((right == left) || (top == bottom) || (n == f)) return; (void) memcpy(result, & gluIdentityMatrix, sizeof(*result)); result->col[0].values[0] = 2.0 / (right - left); result->col[1].values[1] = 2.0 / (top - bottom); - result->col[2].values[2] = -2.0 / (far - near); + result->col[2].values[2] = -2.0 / (f - n); result->col[3].values[0] = -(right + left) / (right - left); result->col[3].values[1] = -(top + bottom) / (top - bottom); - result->col[3].values[2] = -(far + near) / (far - near); + result->col[3].values[2] = -(f + n) / (f - n); } |