diff --git a/configure.ac b/configure.ac index 737aa8487..69b1ac3c5 100644 --- a/configure.ac +++ b/configure.ac @@ -2163,7 +2163,6 @@ Xi/Makefile xfixes/Makefile exa/Makefile glamor/Makefile -glamor/glu3/Makefile hw/Makefile hw/xfree86/Makefile hw/xfree86/common/Makefile diff --git a/glamor/Makefile.am b/glamor/Makefile.am index 2df76bd53..ec38ac4e8 100644 --- a/glamor/Makefile.am +++ b/glamor/Makefile.am @@ -4,8 +4,6 @@ noinst_LTLIBRARIES = libglamor.la # built (in hw/xfree86/os-support/solaris) until after glamor is built SOLARIS_ASM_CFLAGS="" -SUBDIRS = glu3 - if XORG sdk_HEADERS = glamor.h endif @@ -39,5 +37,4 @@ libglamor_la_SOURCES = \ glamor_picture.c\ glamor_window.c\ glamor.h -libglamor_la_LIBADD = \ - glu3/libglu3.la + diff --git a/glamor/glu3/Makefile.am b/glamor/glu3/Makefile.am deleted file mode 100644 index 7d141a7fc..000000000 --- a/glamor/glu3/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -noinst_LTLIBRARIES = libglu3.la - -# Override these since glu3 doesn't need them and the needed files aren't -# built (in hw/xfree86/os-support/solaris) until after glu3 is built -SOLARIS_ASM_CFLAGS="" - -INCLUDES = \ - $(XORG_INCS) - -AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS) - -libglu3_la_SOURCES = \ - matrix.c \ - glu3.h \ - glu3_scalar.h diff --git a/glamor/glu3/glu3.h b/glamor/glu3/glu3.h deleted file mode 100644 index 0a698cc02..000000000 --- a/glamor/glu3/glu3.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright © 2009 Ian D. Romanick - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef __glu3_h__ -#define __glu3_h__ - -#include - -#define GLU_VERSION_3_0 - -struct GLUmat4; - -struct GLUvec4 { - GLfloat values[4]; - -#ifdef __cplusplus - inline GLUvec4(void) - { - } - - inline GLUvec4(GLfloat x , GLfloat y, GLfloat z, GLfloat w) - { - values[0] = x; - values[1] = y; - values[2] = z; - values[3] = w; - } - - inline GLUvec4(const GLUvec4 &v) - { - values[0] = v.values[0]; - values[1] = v.values[1]; - values[2] = v.values[2]; - values[3] = v.values[3]; - } - - GLUvec4 operator *(const GLUmat4 &) const; - GLUvec4 operator *(const GLUvec4 &) const; - GLUvec4 operator *(GLfloat) const; - - GLUvec4 operator +(const GLUvec4 &) const; - GLUvec4 operator -(const GLUvec4 &) const; -#endif /* __cplusplus */ -}; - - -struct GLUmat4 { - struct GLUvec4 col[4]; - -#ifdef __cplusplus - inline GLUmat4(void) - { - } - - inline GLUmat4(const GLUvec4 & c0, const GLUvec4 & c1, - const GLUvec4 & c2, const GLUvec4 & c3) - { - col[0] = c0; - col[1] = c1; - col[2] = c2; - col[3] = c3; - } - - inline GLUmat4(const GLUmat4 &m) - { - col[0] = m.col[0]; - col[1] = m.col[1]; - col[2] = m.col[2]; - col[3] = m.col[3]; - } - - - GLUvec4 operator *(const GLUvec4 &) const; - GLUmat4 operator *(const GLUmat4 &) const; - GLUmat4 operator *(GLfloat) const; - - GLUmat4 operator +(const GLUmat4 &) const; - GLUmat4 operator -(const GLUmat4 &) const; -#endif /* __cplusplus */ -}; - -#define GLU_MAX_STACK_DEPTH 32 - -struct GLUmat4Stack { - struct GLUmat4 stack[GLU_MAX_STACK_DEPTH]; - unsigned top; - -#ifdef __cplusplus - GLUmat4Stack() : top(0) - { - /* empty */ - } -#endif /* __cplusplus */ -}; - -#ifndef __cplusplus -typedef struct GLUvec4 GLUvec4; -typedef struct GLUmat4 GLUmat4; -typedef struct GLUmat4Stack GLUmat4Stack; -#endif /* __cplusplus */ - - -#ifdef __cplusplus -extern "C" { -#endif - -void gluScale4v(GLUmat4 *result, const GLUvec4 *); -void gluTranslate4v(GLUmat4 *result, const GLUvec4 *); -void gluRotate4v(GLUmat4 *result, const GLUvec4 *axis, GLfloat angle); -void gluLookAt4v(GLUmat4 *result, const GLUvec4 *eye, const GLUvec4 *center, - const GLUvec4 *up); -void gluPerspective4f(GLUmat4 *result, GLfloat fovy, GLfloat aspect, - GLfloat near, GLfloat far); -void gluFrustum6f(GLUmat4 *result, - GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat near, GLfloat far); -void gluOrtho6f(GLUmat4 *result, - GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat near, GLfloat far); -extern const GLUmat4 gluIdentityMatrix; - -#ifdef __cplusplus -}; -#endif - -#ifdef __cplusplus -GLfloat gluDot4(const GLUvec4 &, const GLUvec4 &); -GLfloat gluDot3(const GLUvec4 &, const GLUvec4 &); -GLfloat gluDot2(const GLUvec4 &, const GLUvec4 &); - -GLUvec4 gluCross(const GLUvec4 &, const GLUvec4 &); -GLUvec4 gluNormalize(const GLUvec4 &); -GLfloat gluLength(const GLUvec4 &); -GLfloat gluLengthSqr(const GLUvec4 &); -#endif /* __cplusplus */ - -#include "glu3_scalar.h" - -#endif /* __glu3_h__ */ diff --git a/glamor/glu3/glu3_scalar.h b/glamor/glu3/glu3_scalar.h deleted file mode 100644 index 00592f0dc..000000000 --- a/glamor/glu3/glu3_scalar.h +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright © 2009 Ian D. Romanick - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include -#include - -static inline void gluMult4v_4v(GLUvec4 *result, - const GLUvec4 *v1, const GLUvec4 *v2) -{ - result->values[0] = v1->values[0] * v2->values[0]; - result->values[1] = v1->values[1] * v2->values[1]; - result->values[2] = v1->values[2] * v2->values[2]; - result->values[3] = v1->values[3] * v2->values[3]; -} - - -static inline void gluDiv4v_4v(GLUvec4 *result, - const GLUvec4 *v1, const GLUvec4 *v2) -{ - result->values[0] = v1->values[0] / v2->values[0]; - result->values[1] = v1->values[1] / v2->values[1]; - result->values[2] = v1->values[2] / v2->values[2]; - result->values[3] = v1->values[3] / v2->values[3]; -} - - -static inline void gluAdd4v_4v(GLUvec4 *result, - const GLUvec4 *v1, const GLUvec4 *v2) -{ - result->values[0] = v1->values[0] + v2->values[0]; - result->values[1] = v1->values[1] + v2->values[1]; - result->values[2] = v1->values[2] + v2->values[2]; - result->values[3] = v1->values[3] + v2->values[3]; -} - - -static inline void gluSub4v_4v(GLUvec4 *result, - const GLUvec4 *v1, const GLUvec4 *v2) -{ - result->values[0] = v1->values[0] - v2->values[0]; - result->values[1] = v1->values[1] - v2->values[1]; - result->values[2] = v1->values[2] - v2->values[2]; - result->values[3] = v1->values[3] - v2->values[3]; -} - - -static inline void gluMult4v_f(GLUvec4 *result, - const GLUvec4 *v1, GLfloat f) -{ - result->values[0] = v1->values[0] * f; - result->values[1] = v1->values[1] * f; - result->values[2] = v1->values[2] * f; - result->values[3] = v1->values[3] * f; -} - - -static inline void gluDiv4v_f(GLUvec4 *result, - const GLUvec4 *v1, GLfloat f) -{ - result->values[0] = v1->values[0] / f; - result->values[1] = v1->values[1] / f; - result->values[2] = v1->values[2] / f; - result->values[3] = v1->values[3] / f; -} - - -static inline void gluAdd4v_f(GLUvec4 *result, - const GLUvec4 *v1, GLfloat f) -{ - result->values[0] = v1->values[0] + f; - result->values[1] = v1->values[1] + f; - result->values[2] = v1->values[2] + f; - result->values[3] = v1->values[3] + f; -} - - -static inline void gluSub4v_f(GLUvec4 *result, - const GLUvec4 *v1, GLfloat f) -{ - result->values[0] = v1->values[0] - f; - result->values[1] = v1->values[1] - f; - result->values[2] = v1->values[2] - f; - result->values[3] = v1->values[3] - f; -} - - -static inline void gluMult4m_f(GLUmat4 *result, - const GLUmat4 *m, GLfloat f) -{ - GLUmat4 temp; - - gluMult4v_f(& temp.col[0], & m->col[0], f); - gluMult4v_f(& temp.col[1], & m->col[1], f); - gluMult4v_f(& temp.col[2], & m->col[2], f); - gluMult4v_f(& temp.col[3], & m->col[3], f); - *result = temp; -} - - -static inline void gluMult4m_4v(GLUvec4 *result, - const GLUmat4 *m, const GLUvec4 *v) -{ - GLUvec4 temp[6]; - unsigned i; - - for (i = 0; i < 4; i++) { - gluMult4v_f(& temp[i], & m->col[i], v->values[i]); - } - - gluAdd4v_4v(& temp[4], & temp[0], & temp[1]); - gluAdd4v_4v(& temp[5], & temp[2], & temp[3]); - gluAdd4v_4v(result, & temp[4], & temp[5]); -} - - -static inline void gluAdd4m_4m(GLUmat4 *result, - const GLUmat4 *m1, const GLUmat4 *m2) -{ - GLUmat4 temp; - - gluAdd4v_4v(& temp.col[0], & m1->col[0], & m2->col[0]); - gluAdd4v_4v(& temp.col[1], & m1->col[1], & m2->col[1]); - gluAdd4v_4v(& temp.col[2], & m1->col[2], & m2->col[2]); - gluAdd4v_4v(& temp.col[3], & m1->col[3], & m2->col[3]); - *result = temp; -} - -static inline void gluSub4m_4m(GLUmat4 *result, - const GLUmat4 *m1, const GLUmat4 *m2) -{ - GLUmat4 temp; - - gluSub4v_4v(& temp.col[0], & m1->col[0], & m2->col[0]); - gluSub4v_4v(& temp.col[1], & m1->col[1], & m2->col[1]); - gluSub4v_4v(& temp.col[2], & m1->col[2], & m2->col[2]); - gluSub4v_4v(& temp.col[3], & m1->col[3], & m2->col[3]); - *result = temp; -} - -static inline GLfloat gluDot4_4v(const GLUvec4 *v1, const GLUvec4 *v2) -{ - return v1->values[0] * v2->values[0] - + v1->values[1] * v2->values[1] - + v1->values[2] * v2->values[2] - + v1->values[3] * v2->values[3]; -} - - -static inline GLfloat gluDot3_4v(const GLUvec4 *v1, const GLUvec4 *v2) -{ - return v1->values[0] * v2->values[0] - + v1->values[1] * v2->values[1] - + v1->values[2] * v2->values[2]; -} - - -static inline GLfloat gluDot2_4v(const GLUvec4 *v1, const GLUvec4 *v2) -{ - return v1->values[0] * v2->values[0] - + v1->values[1] * v2->values[1]; -} - - -static inline void gluCross4v(GLUvec4 *result, - const GLUvec4 *v1, const GLUvec4 *v2) -{ - GLUvec4 temp; - - temp.values[0] = (v1->values[1] * v2->values[2]) - - (v1->values[2] * v2->values[1]); - temp.values[1] = (v1->values[2] * v2->values[0]) - - (v1->values[0] * v2->values[2]); - temp.values[2] = (v1->values[0] * v2->values[1]) - - (v1->values[1] * v2->values[0]); - temp.values[3] = 0.0; - *result = temp; -} - - -static inline void gluOuter4v(GLUmat4 *result, - const GLUvec4 *v1, const GLUvec4 *v2) -{ - GLUmat4 temp; - - gluMult4v_f(& temp.col[0], v1, v2->values[0]); - gluMult4v_f(& temp.col[1], v1, v2->values[1]); - gluMult4v_f(& temp.col[2], v1, v2->values[2]); - gluMult4v_f(& temp.col[3], v1, v2->values[3]); - *result = temp; -} - - -static inline GLfloat gluLengthSqr4v(const GLUvec4 *v) -{ - return gluDot4_4v(v, v); -} - - -static inline GLfloat gluLength4v(const GLUvec4 *v) -{ - return sqrt(gluLengthSqr4v(v)); -} - - -static inline void gluNormalize4v(GLUvec4 *result, const GLUvec4 *v) -{ - gluDiv4v_f(result, v, gluLength4v(v)); -} - - - -static inline void gluTranspose4m(GLUmat4 *result, const GLUmat4 *m) -{ - unsigned i; - unsigned j; - GLUmat4 temp; - - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - temp.col[i].values[j] = m->col[j].values[i]; - } - } - - *result = temp; -} - - -static inline void gluMult4m_4m(GLUmat4 *result, - const GLUmat4 *m1, const GLUmat4 *m2) -{ - GLUmat4 temp; - unsigned i; - - for (i = 0; i < 4; i++) { - gluMult4m_4v(& temp.col[i], m1, & m2->col[i]); - } - - *result = temp; -} - - - -static inline void gluTranslate3f(GLUmat4 *result, - GLfloat x, GLfloat y, GLfloat z) -{ - memcpy(result, & gluIdentityMatrix, sizeof(gluIdentityMatrix)); - result->col[3].values[0] = x; - result->col[3].values[1] = y; - result->col[3].values[2] = z; -} - - -#ifdef __cplusplus -static inline GLfloat gluDot4(const GLUvec4 &v1, const GLUvec4 &v2) -{ - return v1.values[0] * v2.values[0] - + v1.values[1] * v2.values[1] - + v1.values[2] * v2.values[2] - + v1.values[3] * v2.values[3]; -} - - -static inline GLfloat gluDot3(const GLUvec4 &v1, const GLUvec4 &v2) -{ - return v1.values[0] * v2.values[0] - + v1.values[1] * v2.values[1] - + v1.values[2] * v2.values[2]; -} - - -static inline GLfloat gluDot2(const GLUvec4 &v1, const GLUvec4 &v2) -{ - return v1.values[0] * v2.values[0] - + v1.values[1] * v2.values[1]; -} - - -inline GLUvec4 GLUvec4::operator+(const GLUvec4 &v) const -{ - return GLUvec4(values[0] + v.values[0], - values[1] + v.values[1], - values[2] + v.values[2], - values[3] + v.values[3]); -} - - -inline GLUvec4 GLUvec4::operator-(const GLUvec4 &v) const -{ - return GLUvec4(values[0] - v.values[0], - values[1] - v.values[1], - values[2] - v.values[2], - values[3] - v.values[3]); -} - - -inline GLUvec4 GLUvec4::operator*(const GLUvec4 &v) const -{ - return GLUvec4(values[0] * v.values[0], - values[1] * v.values[1], - values[2] * v.values[2], - values[3] * v.values[3]); -} - - -inline GLUvec4 GLUvec4::operator*(GLfloat f) const -{ - return GLUvec4(values[0] * f, - values[1] * f, - values[2] * f, - values[3] * f); -} - - -inline GLUvec4 GLUvec4::operator*(const GLUmat4 &m) const -{ - return GLUvec4(gluDot4(*this, m.col[0]), - gluDot4(*this, m.col[1]), - gluDot4(*this, m.col[2]), - gluDot4(*this, m.col[3])); -} - - -inline GLUmat4 GLUmat4::operator+(const GLUmat4 &m) const -{ - GLUmat4 temp; - - gluAdd4m_4m(& temp, this, &m); - return temp; -} - - -inline GLUmat4 GLUmat4::operator-(const GLUmat4 &m) const -{ - return GLUmat4(col[0] - m.col[0], - col[1] - m.col[1], - col[2] - m.col[2], - col[3] - m.col[3]); -} - - -inline GLUmat4 GLUmat4::operator*(GLfloat f) const -{ - GLUmat4 temp; - - gluMult4m_f(& temp, this, f); - return temp; -} - - -inline GLUvec4 GLUmat4::operator*(const GLUvec4 &v) const -{ - return (col[0] * v.values[0]) - + (col[1] * v.values[1]) - + (col[2] * v.values[2]) - + (col[3] * v.values[3]); -} - - -inline GLUmat4 GLUmat4::operator*(const GLUmat4 &m) const -{ - GLUmat4 temp; - - gluMult4m_4m(& temp, this, &m); - return temp; -} - - -#endif /* __cplusplus */ diff --git a/glamor/glu3/matrix.c b/glamor/glu3/matrix.c deleted file mode 100644 index b3d5819f7..000000000 --- a/glamor/glu3/matrix.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright © 2009 Ian D. Romanick - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include -#include "glu3.h" - -#define DEG2RAD(d) ((d) * M_PI / 180.0) - -const GLUmat4 gluIdentityMatrix = { - { - { { 1.0f, 0.0f, 0.0f, 0.0f } }, - { { 0.0f, 1.0f, 0.0f, 0.0f } }, - { { 0.0f, 0.0f, 1.0f, 0.0f } }, - { { 0.0f, 0.0f, 0.0f, 1.0f } } - } -}; - - -void gluTranslate4v(GLUmat4 *result, const GLUvec4 *t) -{ - memcpy(result, & gluIdentityMatrix, sizeof(gluIdentityMatrix)); - result->col[3] = *t; - result->col[3].values[3] = 1.0f; -} - - -void gluScale4v(GLUmat4 *result, const GLUvec4 *t) -{ - memcpy(result, & gluIdentityMatrix, sizeof(gluIdentityMatrix)); - result->col[0].values[0] = t->values[0]; - result->col[1].values[1] = t->values[1]; - result->col[2].values[2] = t->values[2]; -} - - -void gluLookAt4v(GLUmat4 *result, - const GLUvec4 *_eye, - const GLUvec4 *_center, - const GLUvec4 *_up) -{ - static const GLUvec4 col3 = { { 0.0f, 0.0f, 0.0f, 1.0f } }; - const GLUvec4 e = { - { -_eye->values[0], -_eye->values[1], -_eye->values[2], 0.0f } - }; - GLUmat4 translate; - GLUmat4 rotate; - GLUmat4 rotateT; - GLUvec4 f; - GLUvec4 s; - GLUvec4 u; - GLUvec4 center, up; - - center = *_center; - center.values[3] = 0; - up = *_up; - up.values[3] = 0; - - gluAdd4v_4v(& f, ¢er, &e); - gluNormalize4v(& f, & f); - - gluNormalize4v(& u, &up); - - gluCross4v(& s, & f, & u); - gluCross4v(& u, & s, & f); - - rotate.col[0] = s; - rotate.col[1] = u; - rotate.col[2].values[0] = -f.values[0]; - rotate.col[2].values[1] = -f.values[1]; - rotate.col[2].values[2] = -f.values[2]; - rotate.col[2].values[3] = 0.0f; - rotate.col[3] = col3; - gluTranspose4m(& rotateT, & rotate); - - gluTranslate4v(& translate, & e); - gluMult4m_4m(result, & rotateT, & translate); -} - - -void gluRotate4v(GLUmat4 *result, const GLUvec4 *_axis, GLfloat angle) -{ - GLUvec4 axis; - const float c = cos(angle); - const float s = sin(angle); - const float one_c = 1.0 - c; - - float xx; - float yy; - float zz; - - float xs; - float ys; - float zs; - - float xy; - float xz; - float yz; - - /* Only normalize the 3-component axis. A gluNormalize3v might be - * appropriate to save us some computation. - */ - axis = *_axis; - axis.values[3] = 0; - gluNormalize4v(&axis, &axis); - - xx = axis.values[0] * axis.values[0]; - yy = axis.values[1] * axis.values[1]; - zz = axis.values[2] * axis.values[2]; - - xs = axis.values[0] * s; - ys = axis.values[1] * s; - zs = axis.values[2] * s; - - xy = axis.values[0] * axis.values[1]; - xz = axis.values[0] * axis.values[2]; - yz = axis.values[1] * axis.values[2]; - - - result->col[0].values[0] = (one_c * xx) + c; - result->col[0].values[1] = (one_c * xy) + zs; - result->col[0].values[2] = (one_c * xz) - ys; - result->col[0].values[3] = 0.0; - - result->col[1].values[0] = (one_c * xy) - zs; - result->col[1].values[1] = (one_c * yy) + c; - result->col[1].values[2] = (one_c * yz) + xs; - result->col[1].values[3] = 0.0; - - - result->col[2].values[0] = (one_c * xz) + ys; - result->col[2].values[1] = (one_c * yz) - xs; - result->col[2].values[2] = (one_c * zz) + c; - result->col[2].values[3] = 0.0; - - result->col[3].values[0] = 0.0; - result->col[3].values[1] = 0.0; - result->col[3].values[2] = 0.0; - result->col[3].values[3] = 1.0; -} - - -void -gluPerspective4f(GLUmat4 *result, - GLfloat fovy, GLfloat aspect, GLfloat near, GLfloat far) -{ - 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; - - - memcpy(result, &gluIdentityMatrix, sizeof(gluIdentityMatrix)); - if ((sine == 0.0) || (dz == 0.0) || (sine_aspect == 0.0)) { - return; - } - - 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[3] = -1.0; - result->col[3].values[2] = -2.0 * near * far / dz; - result->col[3].values[3] = 0.0; -} - -void gluFrustum6f(GLUmat4 *result, - GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat near, GLfloat far) -{ - 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[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[3] = -1.0; - result->col[3].values[2] = -2.0 * near * far / (far - near); - result->col[3].values[3] = 0.0; -} - -void gluOrtho6f(GLUmat4 *result, - GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat near, GLfloat far) -{ - memcpy(result, &gluIdentityMatrix, sizeof(gluIdentityMatrix)); - - result->col[0].values[0] = 2.0f / (right - left); - result->col[3].values[0] = -(right + left) / (right - left); - - result->col[1].values[1] = 2.0f / (top - bottom); - result->col[3].values[1] = -(top + bottom) / (top - bottom); - - result->col[2].values[2] = -2.0f / (far - near); - result->col[3].values[2] = -(far + near) / (far - near); -}