7 #define __func__ __FUNCTION__
11 #define M_PI 3.1415926f
19 #define static_inline static __inline
21 #define static_inline static inline
24 #define static_inline static inline
30 #define snprintf c99_snprintf
37 count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
39 count = _vscprintf(format, ap);
50 count = c99_vsnprintf(str, size, format, ap);
61 #define INDEX(row,col) ((col)*4 + (row))
65 memcpy(result, A, 16*
sizeof(
float));
70 memset(result, 0, 16*
sizeof(
float));
71 result[0] = result[5] = result[10] = result[15] = 1;
79 for(r = 0; r < 4; r++)
81 for(c = 0; c < 4; c++)
84 for(i = 0; i < 4; i++)
107 static char buffer2[512];
108 static char flip = 0;
110 char*
b = (flip? buffer : buffer2);
113 snprintf(b, 512,
"%.1f %.1f %.1f %.1f\n"
114 "%.1f %.1f %.1f %.1f\n"
115 "%.1f %.1f %.1f %.1f\n"
116 "%.1f %.1f %.1f %.1f",
117 A[0], A[1], A[2], A[3],
118 A[4], A[5], A[6], A[7],
119 A[8], A[9], A[10], A[11],
120 A[12], A[13], A[14], A[15]);
127 if(target == NULL || target->
context == NULL)
138 if(target == NULL || target->
context == NULL)
151 if(target == NULL || target->
context == NULL)
164 if(target == NULL || target->
context == NULL)
181 if(target == NULL || target->
context == NULL)
199 if(target == NULL || target->
context == NULL)
227 float A[16] = {2/(right -
left), 0, 0, -(right + left)/(right -
left),
228 0, 2/(top - bottom), 0, -(top +
bottom)/(top - bottom),
229 0, 0, -2/(far - near), -(far + near)/(far - near),
232 float A[16] = { 2 / (right -
left), 0, 0, 0,
233 0, 2 / (top - bottom), 0, 0,
234 0, 0, -2 / (far - near), 0,
235 -(right + left) / (right -
left), -(top + bottom) / (top -
bottom), -(far + near) / (far - near), 1 };
242 void GPU_Frustum(
float right,
float left,
float bottom,
float top,
float near,
float far)
250 float A[16] = {2 * near / (right -
left), 0, 0, 0,
251 0, 2 * near / (top - bottom), 0, 0,
252 (right +
left) / (right - left), (top +
bottom) / (top - bottom), -(far + near) / (far - near), -1,
253 0, 0, -(2 * far * near) / (far - near), 0};
255 float A[16] = { 2 * near / (right -
left), 0, (right + left) / (right -
left), 0,
256 0, 2 * near / (top - bottom), (top +
bottom) / (top - bottom), 0,
257 0, 0, -(far + near) / (far - near), -(2 * far * near) / (far - near),
273 float A[16] = {1, 0, 0,
x,
278 float A[16] = { 1, 0, 0, 0,
295 float A[16] = { sx, 0, 0, 0,
306 float p, radians,
c,
s, c_, zc_, yc_, xzc_, xyc_, yzc_, xs, ys, zs;
309 p = 1/sqrtf(x*x + y*y + z*z);
310 x *=
p; y *=
p; z *=
p;
311 radians = degrees * (
M_PI/180);
330 float A[16] = {x*x*c_ +
c, xyc_ - zs, xzc_ + ys, 0,
331 xyc_ + zs, y*yc_ +
c, yzc_ - xs, 0,
332 xzc_ - ys, yzc_ + xs, z*zc_ +
c, 0,
335 float A[16] = { x*x*c_ +
c, xyc_ + zs, xzc_ - ys, 0,
336 xyc_ - zs, y*yc_ +
c, yzc_ + xs, 0,
337 xzc_ + ys, yzc_ - xs, z*zc_ +
c, 0,
float matrix[GPU_MATRIX_STACK_MAX][16]
void GPU_Translate(float x, float y, float z)
void GPU_Ortho(float left, float right, float bottom, float top, float near, float far)
void GPU_MatrixMode(int matrix_mode)
void GPU_MultiplyAndAssign(float *result, float *A)
GPU_MatrixStack projection_matrix
void GPU_Multiply4x4(float *result, float *A, float *B)
GPU_Target * GPU_GetContextTarget(void)
void GPU_Scale(float sx, float sy, float sz)
GLint GLint GLint GLint GLint GLint y
void GPU_MatrixCopy(float *result, const float *A)
void GPU_Rotate(float degrees, float x, float y, float z)
float * GPU_GetProjection(void)
void GPU_PushErrorCode(const char *function, GPU_ErrorEnum error, const char *details,...)
void GPU_GetModelViewProjection(float *result)
GLdouble GLdouble GLdouble b
void GPU_Frustum(float right, float left, float bottom, float top, float near, float far)
GLuint GLuint GLsizei count
void GPU_MatrixIdentity(float *result)
GPU_MatrixStack modelview_matrix
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
#define GPU_MATRIX_STACK_MAX
GLint GLint GLint GLint GLint x
GLdouble GLdouble GLdouble r
void GPU_MultMatrix(float *A)
const char * GPU_GetMatrixString(float *A)
float * GPU_GetCurrentMatrix(void)
void GPU_LoadIdentity(void)
float * GPU_GetModelView(void)