42 m[0+4*0] = 1;
m[0+4*1] = 0;
m[0+4*2] = 0;
m[0+4*3] = 0;
43 m[1+4*0] = 0;
m[1+4*1] = 1;
m[1+4*2] = 0;
m[1+4*3] = 0;
44 m[2+4*0] = 0;
m[2+4*1] = 0;
m[2+4*2] = 1;
m[2+4*3] = 0;
45 m[3+4*0] = 0;
m[3+4*1] = 0;
m[3+4*2] = 0;
m[3+4*3] = 1;
50 m[0+4*0] = 1;
m[0+4*1] = 0;
m[0+4*2] = 0;
m[0+4*3] = 0;
51 m[1+4*0] = 0;
m[1+4*1] = 1;
m[1+4*2] = 0;
m[1+4*3] = 0;
52 m[2+4*0] = 0;
m[2+4*1] = 0;
m[2+4*2] = 1;
m[2+4*3] = 0;
53 m[3+4*0] = 0;
m[3+4*1] = 0;
m[3+4*2] = 0;
m[3+4*3] = 1;
62#define __glPi 3.14159265358979323846
68 double sine, cotangent, deltaZ;
69 double radians = fovy / 2 *
__glPi / 180;
73 if ((deltaZ == 0) || (sine == 0) || (aspect == 0)) {
76 cotangent =
COS(radians) / sine;
79 m[0][0] = cotangent / aspect;
112 float forward[3], side[3],
up[3];
115 forward[0] = centerx - eyex;
116 forward[1] = centery - eyey;
117 forward[2] = centerz - eyez;
141 m[0][2] = -forward[0];
142 m[1][2] = -forward[1];
143 m[2][2] = -forward[2];
154 for (
i=0;
i<4;
i++) {
172 inv[0] =
m[5]*
m[10]*
m[15] -
m[5]*
m[11]*
m[14] -
m[9]*
m[6]*
m[15]
173 +
m[9]*
m[7]*
m[14] +
m[13]*
m[6]*
m[11] -
m[13]*
m[7]*
m[10];
174 inv[4] = -
m[4]*
m[10]*
m[15] +
m[4]*
m[11]*
m[14] +
m[8]*
m[6]*
m[15]
175 -
m[8]*
m[7]*
m[14] -
m[12]*
m[6]*
m[11] +
m[12]*
m[7]*
m[10];
176 inv[8] =
m[4]*
m[9]*
m[15] -
m[4]*
m[11]*
m[13] -
m[8]*
m[5]*
m[15]
177 +
m[8]*
m[7]*
m[13] +
m[12]*
m[5]*
m[11] -
m[12]*
m[7]*
m[9];
178 inv[12] = -
m[4]*
m[9]*
m[14] +
m[4]*
m[10]*
m[13] +
m[8]*
m[5]*
m[14]
179 -
m[8]*
m[6]*
m[13] -
m[12]*
m[5]*
m[10] +
m[12]*
m[6]*
m[9];
180 inv[1] = -
m[1]*
m[10]*
m[15] +
m[1]*
m[11]*
m[14] +
m[9]*
m[2]*
m[15]
181 -
m[9]*
m[3]*
m[14] -
m[13]*
m[2]*
m[11] +
m[13]*
m[3]*
m[10];
182 inv[5] =
m[0]*
m[10]*
m[15] -
m[0]*
m[11]*
m[14] -
m[8]*
m[2]*
m[15]
183 +
m[8]*
m[3]*
m[14] +
m[12]*
m[2]*
m[11] -
m[12]*
m[3]*
m[10];
184 inv[9] = -
m[0]*
m[9]*
m[15] +
m[0]*
m[11]*
m[13] +
m[8]*
m[1]*
m[15]
185 -
m[8]*
m[3]*
m[13] -
m[12]*
m[1]*
m[11] +
m[12]*
m[3]*
m[9];
186 inv[13] =
m[0]*
m[9]*
m[14] -
m[0]*
m[10]*
m[13] -
m[8]*
m[1]*
m[14]
187 +
m[8]*
m[2]*
m[13] +
m[12]*
m[1]*
m[10] -
m[12]*
m[2]*
m[9];
188 inv[2] =
m[1]*
m[6]*
m[15] -
m[1]*
m[7]*
m[14] -
m[5]*
m[2]*
m[15]
189 +
m[5]*
m[3]*
m[14] +
m[13]*
m[2]*
m[7] -
m[13]*
m[3]*
m[6];
190 inv[6] = -
m[0]*
m[6]*
m[15] +
m[0]*
m[7]*
m[14] +
m[4]*
m[2]*
m[15]
191 -
m[4]*
m[3]*
m[14] -
m[12]*
m[2]*
m[7] +
m[12]*
m[3]*
m[6];
192 inv[10] =
m[0]*
m[5]*
m[15] -
m[0]*
m[7]*
m[13] -
m[4]*
m[1]*
m[15]
193 +
m[4]*
m[3]*
m[13] +
m[12]*
m[1]*
m[7] -
m[12]*
m[3]*
m[5];
194 inv[14] = -
m[0]*
m[5]*
m[14] +
m[0]*
m[6]*
m[13] +
m[4]*
m[1]*
m[14]
195 -
m[4]*
m[2]*
m[13] -
m[12]*
m[1]*
m[6] +
m[12]*
m[2]*
m[5];
196 inv[3] = -
m[1]*
m[6]*
m[11] +
m[1]*
m[7]*
m[10] +
m[5]*
m[2]*
m[11]
197 -
m[5]*
m[3]*
m[10] -
m[9]*
m[2]*
m[7] +
m[9]*
m[3]*
m[6];
198 inv[7] =
m[0]*
m[6]*
m[11] -
m[0]*
m[7]*
m[10] -
m[4]*
m[2]*
m[11]
199 +
m[4]*
m[3]*
m[10] +
m[8]*
m[2]*
m[7] -
m[8]*
m[3]*
m[6];
200 inv[11] = -
m[0]*
m[5]*
m[11] +
m[0]*
m[7]*
m[9] +
m[4]*
m[1]*
m[11]
201 -
m[4]*
m[3]*
m[9] -
m[8]*
m[1]*
m[7] +
m[8]*
m[3]*
m[5];
202 inv[15] =
m[0]*
m[5]*
m[10] -
m[0]*
m[6]*
m[9] -
m[4]*
m[1]*
m[10]
203 +
m[4]*
m[2]*
m[9] +
m[8]*
m[1]*
m[6] -
m[8]*
m[2]*
m[5];
205 det =
m[0]*inv[0] +
m[1]*inv[4] +
m[2]*inv[8] +
m[3]*inv[12];
211 for (
i = 0;
i < 16;
i++)
212 invOut[
i] = inv[
i] * det;
222 for (
i = 0;
i < 4;
i++) {
223 for (
j = 0;
j < 4;
j++) {
237 const GLint viewport[4],
254 in[0] =
in[0] * 0.5 + 0.5;
255 in[1] =
in[1] * 0.5 + 0.5;
256 in[2] =
in[2] * 0.5 + 0.5;
259 in[0] =
in[0] * viewport[2] + viewport[0];
260 in[1] =
in[1] * viewport[3] + viewport[1];
272 const GLint viewport[4],
275 double finalMatrix[16];
288 in[0] = (
in[0] - viewport[0]) / viewport[2];
289 in[1] = (
in[1] - viewport[1]) / viewport[3];
292 in[0] =
in[0] * 2 - 1;
293 in[1] =
in[1] * 2 - 1;
294 in[2] =
in[2] * 2 - 1;
311 const GLint viewport[4],
316 double finalMatrix[16];
329 in[0] = (
in[0] - viewport[0]) / viewport[2];
330 in[1] = (
in[1] - viewport[1]) / viewport[3];
331 in[2] = (
in[2] - nearVal) / (farVal - nearVal);
334 in[0] =
in[0] * 2 - 1;
335 in[1] =
in[1] * 2 - 1;
336 in[2] =
in[2] * 2 - 1;
351 if (deltax <= 0 || deltay <= 0) {
357 (viewport[3] - 2 * (
y - viewport[1])) / deltay, 0);
358 glScalef(viewport[2] / deltax, viewport[3] / deltay, 1.0);
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
GLAPI void GLAPIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val)
GLint GLint GLint GLint GLint x
GLAPI void GLAPIENTRY glMultMatrixd(const GLdouble *m)
GLint GLint GLint GLint GLint GLint y
GLAPI void GLAPIENTRY glMultMatrixf(const GLfloat *m)
GLAPI void GLAPIENTRY glTranslated(GLdouble x, GLdouble y, GLdouble z)
GLAPI void GLAPIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z)
GLdouble GLdouble GLdouble r
GLdouble GLdouble GLdouble GLdouble GLdouble zNear
GLdouble GLdouble GLdouble GLdouble top
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
GLfloat GLfloat GLfloat v2
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
static void __gluMultMatricesd(const GLdouble a[16], const GLdouble b[16], GLdouble r[16])
static void __gluMakeIdentityf(GLfloat m[16])
static void __gluMultMatrixVecd(const GLdouble matrix[16], const GLdouble in[4], GLdouble out[4])
static void cross(float v1[3], float v2[3], float result[3])
static void normalize(float v[3])
static void __gluMakeIdentityd(GLdouble m[16])
static int __gluInvertMatrixd(const GLdouble m[16], GLdouble invOut[16])