Blender V5.0
gpu_matrix.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2012 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10#include "gpu_matrix_private.hh"
11
12#define SUPPRESS_GENERIC_MATRIX_API
13#define USE_GPU_PY_MATRIX_API /* only so values are declared */
14#include "GPU_matrix.hh"
15#undef USE_GPU_PY_MATRIX_API
16
17#include "BLI_math_matrix.h"
18#include "BLI_math_rotation.h"
19#include "BLI_math_vector.h"
20
21#include "MEM_guardedalloc.h"
22
23using namespace blender::gpu;
24
25constexpr static int MATRIX_STACK_DEPTH = 32;
26
27using Mat4 = float[4][4];
28using Mat3 = float[3][3];
29
34
38
39 bool dirty;
40
41 /* TODO: cache of derived matrices (Normal, MVP, inverse MVP, etc)
42 * generate as needed for shaders, invalidate when original matrices change
43 *
44 * TODO: separate Model from View transform? Batches/objects have model,
45 * camera/eye has view & projection
46 */
47};
48
49#define ModelViewStack Context::get()->matrix_state->model_view_stack
50#define ModelView ModelViewStack.stack[ModelViewStack.top]
51
52#define ProjectionStack Context::get()->matrix_state->projection_stack
53#define Projection ProjectionStack.stack[ProjectionStack.top]
54
56{
57#define MATRIX_4X4_IDENTITY \
58 { \
59 {1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f, 0.0f}, \
60 {0.0f, 0.0f, 0.0f, 1.0f} \
61 }
62
63 GPUMatrixState *state = (GPUMatrixState *)MEM_mallocN(sizeof(*state), __func__);
64 const MatrixStack identity_stack = {{MATRIX_4X4_IDENTITY}, 0};
65
66 state->model_view_stack = state->projection_stack = identity_stack;
67 state->dirty = true;
68
69#undef MATRIX_4X4_IDENTITY
70
71 return state;
72}
73
78
79static void gpu_matrix_state_active_set_dirty(bool value)
80{
82 state->dirty = value;
83}
84
86{
88 state->model_view_stack.top = 0;
89 state->projection_stack.top = 0;
93}
94
95#ifdef WITH_GPU_SAFETY
96
97/* Check if matrix is numerically good */
98static void checkmat(cosnt float *m)
99{
100 const int n = 16;
101 for (int i = 0; i < n; i++) {
102# if _MSC_VER
103 BLI_assert(_finite(m[i]));
104# else
105 BLI_assert(!isinf(m[i]));
106# endif
107 }
108}
109
110# define CHECKMAT(m) checkmat((const float *)m)
111
112#else
113
114# define CHECKMAT(m)
115
116#endif
117
124
131
138
145
146void GPU_matrix_set(const float m[4][4])
147{
149 CHECKMAT(ModelView3D);
151}
152
159
160void GPU_matrix_projection_set(const float m[4][4])
161{
163 CHECKMAT(Projection3D);
165}
166
172
173void GPU_matrix_translate_2f(float x, float y)
174{
175 Mat4 m;
176 unit_m4(m);
177 m[3][0] = x;
178 m[3][1] = y;
180}
181
182void GPU_matrix_translate_2fv(const float vec[2])
183{
184 GPU_matrix_translate_2f(vec[0], vec[1]);
185}
186
187void GPU_matrix_translate_3f(float x, float y, float z)
188{
189#if 1
192#else /* above works well in early testing, below is generic version */
193 Mat4 m;
194 unit_m4(m);
195 m[3][0] = x;
196 m[3][1] = y;
197 m[3][2] = z;
199#endif
201}
202
203void GPU_matrix_translate_3fv(const float vec[3])
204{
205 GPU_matrix_translate_3f(vec[0], vec[1], vec[2]);
206}
207
208void GPU_matrix_scale_1f(float factor)
209{
210 Mat4 m;
211 scale_m4_fl(m, factor);
213}
214
215void GPU_matrix_scale_2f(float x, float y)
216{
217 Mat4 m = {{0.0f}};
218 m[0][0] = x;
219 m[1][1] = y;
220 m[2][2] = 1.0f;
221 m[3][3] = 1.0f;
223}
224
225void GPU_matrix_scale_2fv(const float vec[2])
226{
227 GPU_matrix_scale_2f(vec[0], vec[1]);
228}
229
230void GPU_matrix_scale_3f(float x, float y, float z)
231{
232 Mat4 m = {{0.0f}};
233 m[0][0] = x;
234 m[1][1] = y;
235 m[2][2] = z;
236 m[3][3] = 1.0f;
238}
239
240void GPU_matrix_scale_3fv(const float vec[3])
241{
242 GPU_matrix_scale_3f(vec[0], vec[1], vec[2]);
243}
244
245void GPU_matrix_mul(const float m[4][4])
246{
250}
251
253{
254 /* essentially RotateAxis('Z')
255 * TODO: simpler math for 2D case
256 */
258}
259
260void GPU_matrix_rotate_3f(float deg, float x, float y, float z)
261{
262 const float axis[3] = {x, y, z};
264}
265
266void GPU_matrix_rotate_3fv(float deg, const float axis[3])
267{
268 Mat4 m;
271}
272
273void GPU_matrix_rotate_axis(float deg, char axis)
274{
275 /* rotate_m4 works in place */
279}
280
281static void mat4_ortho_set(
282 float m[4][4], float left, float right, float bottom, float top, float near, float far)
283{
284 m[0][0] = 2.0f / (right - left);
285 m[1][0] = 0.0f;
286 m[2][0] = 0.0f;
287 m[3][0] = -(right + left) / (right - left);
288
289 m[0][1] = 0.0f;
290 m[1][1] = 2.0f / (top - bottom);
291 m[2][1] = 0.0f;
292 m[3][1] = -(top + bottom) / (top - bottom);
293
294 m[0][2] = 0.0f;
295 m[1][2] = 0.0f;
296 m[2][2] = -2.0f / (far - near);
297 m[3][2] = -(far + near) / (far - near);
298
299 m[0][3] = 0.0f;
300 m[1][3] = 0.0f;
301 m[2][3] = 0.0f;
302 m[3][3] = 1.0f;
303
305}
306
308 float m[4][4], float left, float right, float bottom, float top, float near, float far)
309{
310 m[0][0] = 2.0f * near / (right - left);
311 m[1][0] = 0.0f;
312 m[2][0] = (right + left) / (right - left);
313 m[3][0] = 0.0f;
314
315 m[0][1] = 0.0f;
316 m[1][1] = 2.0f * near / (top - bottom);
317 m[2][1] = (top + bottom) / (top - bottom);
318 m[3][1] = 0.0f;
319
320 m[0][2] = 0.0f;
321 m[1][2] = 0.0f;
322 m[2][2] = -(far + near) / (far - near);
323 m[3][2] = -2.0f * far * near / (far - near);
324
325 m[0][3] = 0.0f;
326 m[1][3] = 0.0f;
327 m[2][3] = -1.0f;
328 m[3][3] = 0.0f;
329
331}
332
333static void mat4_look_from_origin(float m[4][4], float lookdir[3], float camup[3])
334{
335 /* This function is loosely based on Mesa implementation.
336 *
337 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
338 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
339 *
340 * Permission is hereby granted, free of charge, to any person obtaining a
341 * copy of this software and associated documentation files (the "Software"),
342 * to deal in the Software without restriction, including without limitation
343 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
344 * and/or sell copies of the Software, and to permit persons to whom the
345 * Software is furnished to do so, subject to the following conditions:
346 *
347 * The above copyright notice including the dates of first publication and
348 * either this permission notice or a reference to
349 * http://oss.sgi.com/projects/FreeB/
350 * shall be included in all copies or substantial portions of the Software.
351 *
352 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
353 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
354 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
355 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
356 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
357 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
358 * SOFTWARE.
359 *
360 * Except as contained in this notice, the name of Silicon Graphics, Inc.
361 * shall not be used in advertising or otherwise to promote the sale, use or
362 * other dealings in this Software without prior written authorization from
363 * Silicon Graphics, Inc.
364 */
365 float side[3];
366
367 normalize_v3(lookdir);
368
369 cross_v3_v3v3(side, lookdir, camup);
370
371 normalize_v3(side);
372
373 cross_v3_v3v3(camup, side, lookdir);
374
375 m[0][0] = side[0];
376 m[1][0] = side[1];
377 m[2][0] = side[2];
378 m[3][0] = 0.0f;
379
380 m[0][1] = camup[0];
381 m[1][1] = camup[1];
382 m[2][1] = camup[2];
383 m[3][1] = 0.0f;
384
385 m[0][2] = -lookdir[0];
386 m[1][2] = -lookdir[1];
387 m[2][2] = -lookdir[2];
388 m[3][2] = 0.0f;
389
390 m[0][3] = 0.0f;
391 m[1][3] = 0.0f;
392 m[2][3] = 0.0f;
393 m[3][3] = 1.0f;
394
396}
397
398void GPU_matrix_ortho_set(float left, float right, float bottom, float top, float near, float far)
399{
400 mat4_ortho_set(Projection, left, right, bottom, top, near, far);
403}
404
405void GPU_matrix_ortho_set_z(float near, float far)
406{
408 Projection[2][2] = -2.0f / (far - near);
409 Projection[3][2] = -(far + near) / (far - near);
411}
412
413void GPU_matrix_ortho_2d_set(float left, float right, float bottom, float top)
414{
415 Mat4 m;
416 mat4_ortho_set(m, left, right, bottom, top, -1.0f, 1.0f);
417 CHECKMAT(Projection2D);
419}
420
422 float left, float right, float bottom, float top, float near, float far)
423{
424 mat4_frustum_set(Projection, left, right, bottom, top, near, far);
427}
428
429void GPU_matrix_perspective_set(float fovy, float aspect, float near, float far)
430{
431 float half_height = tanf(fovy * float(M_PI / 360.0)) * near;
432 float half_width = half_height * aspect;
433 GPU_matrix_frustum_set(-half_width, +half_width, -half_height, +half_height, near, far);
434}
435
436void GPU_matrix_look_at(float eyeX,
437 float eyeY,
438 float eyeZ,
439 float centerX,
440 float centerY,
441 float centerZ,
442 float upX,
443 float upY,
444 float upZ)
445{
446 Mat4 cm;
447 float lookdir[3];
448 float camup[3] = {upX, upY, upZ};
449
450 lookdir[0] = centerX - eyeX;
451 lookdir[1] = centerY - eyeY;
452 lookdir[2] = centerZ - eyeZ;
453
454 mat4_look_from_origin(cm, lookdir, camup);
455
456 GPU_matrix_mul(cm);
457 GPU_matrix_translate_3f(-eyeX, -eyeY, -eyeZ);
458}
459
460void GPU_matrix_project_3fv(const float world[3],
461 const float model[4][4],
462 const float proj[4][4],
463 const int view[4],
464 float r_win[3])
465{
466 float v[4];
467
468 mul_v4_m4v3(v, model, world);
469 mul_m4_v4(proj, v);
470
471 if (v[3] != 0.0f) {
472 mul_v3_fl(v, 1.0f / v[3]);
473 }
474
475 r_win[0] = view[0] + (view[2] * (v[0] + 1)) * 0.5f;
476 r_win[1] = view[1] + (view[3] * (v[1] + 1)) * 0.5f;
477 r_win[2] = (v[2] + 1) * 0.5f;
478}
479
480void GPU_matrix_project_2fv(const float world[3],
481 const float model[4][4],
482 const float proj[4][4],
483 const int view[4],
484 float r_win[2])
485{
486 float v[4];
487
488 mul_v4_m4v3(v, model, world);
489 mul_m4_v4(proj, v);
490
491 if (v[3] != 0.0f) {
492 mul_v2_fl(v, 1.0f / v[3]);
493 }
494
495 r_win[0] = view[0] + (view[2] * (v[0] + 1)) * 0.5f;
496 r_win[1] = view[1] + (view[3] * (v[1] + 1)) * 0.5f;
497}
498
499bool GPU_matrix_unproject_3fv(const float win[3],
500 const float model_inverted[4][4],
501 const float proj[4][4],
502 const int view[4],
503 float r_world[3])
504{
505 zero_v3(r_world);
506 const float in[3] = {
507 2 * ((win[0] - view[0]) / view[2]) - 1.0f,
508 2 * ((win[1] - view[1]) / view[3]) - 1.0f,
509 2 * win[2] - 1.0f,
510 };
511
525
526 float out[3];
527 const bool is_persp = proj[3][3] == 0.0f;
528 if (is_persp) {
529 out[2] = proj[3][2] / (proj[2][2] + in[2]);
530 if (isinf(out[2])) {
531 out[2] = FLT_MAX;
532 }
533 out[0] = out[2] * ((proj[2][0] + in[0]) / proj[0][0]);
534 out[1] = out[2] * ((proj[2][1] + in[1]) / proj[1][1]);
535 out[2] *= -1;
536 }
537 else {
538 out[0] = (-proj[3][0] + in[0]) / proj[0][0];
539 out[1] = (-proj[3][1] + in[1]) / proj[1][1];
540 out[2] = (-proj[3][2] + in[2]) / proj[2][2];
541 }
542
543 if (!is_finite_v3(out)) {
544 return false;
545 }
546
547 mul_v3_m4v3(r_world, model_inverted, out);
548 return true;
549}
550
551const float (*GPU_matrix_model_view_get(float m[4][4]))[4]
552{
553 if (m) {
555 return m;
556 }
557
558 return ModelView;
559}
560
561const float (*GPU_matrix_projection_get(float m[4][4]))[4]
562{
563 if (m) {
565 return m;
566 }
567
568 return Projection;
569}
570
572{
573 if (m == nullptr) {
574 static Mat4 temp;
575 m = temp;
576 }
577
579 return m;
580}
581
582const float (*GPU_matrix_normal_get(float m[3][3]))[3]
583{
584 if (m == nullptr) {
585 static Mat3 temp3;
586 m = temp3;
587 }
588
590
591 invert_m3(m);
592 transpose_m3(m);
593
594 return m;
595}
596
597const float (*GPU_matrix_normal_inverse_get(float m[3][3]))[3]
598{
599 if (m == nullptr) {
600 static Mat3 temp3;
601 m = temp3;
602 }
603
605 invert_m3(m);
606
607 return m;
608}
609
611{
612 /* set uniform values to matrix stack values
613 * call this before a draw call if desired matrices are dirty
614 * call glUseProgram before this, as glUniform expects program to be bound
615 */
619
623
624 if (MV != -1) {
626 shader, MV, 16, 1, (const float *)GPU_matrix_model_view_get(nullptr));
627 }
628 if (P != -1) {
630 shader, P, 16, 1, (const float *)GPU_matrix_projection_get(nullptr));
631 }
632 if (MVP != -1) {
634 shader, MVP, 16, 1, (const float *)GPU_matrix_model_view_projection_get(nullptr));
635 }
636 if (N != -1) {
637 GPU_shader_uniform_float_ex(shader, N, 9, 1, (const float *)GPU_matrix_normal_get(nullptr));
638 }
639 if (MV_inv != -1) {
640 Mat4 m;
642 invert_m4(m);
643 GPU_shader_uniform_float_ex(shader, MV_inv, 16, 1, (const float *)m);
644 }
645 if (P_inv != -1) {
646 Mat4 m;
648 invert_m4(m);
649 GPU_shader_uniform_float_ex(shader, P_inv, 16, 1, (const float *)m);
650 }
651
653}
654
656{
658 return state->dirty;
659}
660
661/* -------------------------------------------------------------------- */
664
665BLI_STATIC_ASSERT(GPU_PY_MATRIX_STACK_LEN + 1 == MATRIX_STACK_DEPTH, "define mismatch");
666
667/* Return int since caller is may subtract. */
668
670{
672 return int(state->model_view_stack.top);
673}
674
676{
678 return int(state->projection_stack.top);
679}
680
682
683/* -------------------------------------------------------------------- */
689
690float GPU_polygon_offset_calc(const float (*winmat)[4], float viewdist, float dist)
691{
692 /* Seems like we have a factor of 2 more offset than 2.79 for some reason. Correct for this. */
693 dist *= 0.5f;
694
695 if (winmat[3][3] > 0.5f) {
696#if 1
697 return 0.00001f * dist * viewdist; // ortho tweaking
698#else
699 static float depth_fac = 0.0f;
700 if (depth_fac == 0.0f) {
701 /* Hard-code for 24 bit precision. */
702 int depthbits = 24;
703 depth_fac = 1.0f / float((1 << depthbits) - 1);
704 }
705 ofs = (-1.0 / winmat[2][2]) * dist * depth_fac;
706
707 UNUSED_VARS(viewdist);
708#endif
709 }
710
711 /* This adjustment effectively results in reducing the Z value by 0.25%.
712 *
713 * winmat[4][3] actually evaluates to `-2 * far * near / (far - near)`,
714 * is very close to -0.2 with default clip range,
715 * and is used as the coefficient multiplied by `w / z`,
716 * thus controlling the z dependent part of the depth value.
717 */
718 return winmat[3][2] * -0.0025f * dist;
719}
720
721void GPU_polygon_offset(float viewdist, float dist)
722{
723 static float winmat[4][4], offset = 0.0f;
724
725 if (dist != 0.0f) {
726 /* hack below is to mimic polygon offset */
728
729 /* dist is from camera to center point */
730
731 float ofs = GPU_polygon_offset_calc(winmat, viewdist, dist);
732
733 winmat[3][2] -= ofs;
734 offset += ofs;
735 }
736 else {
737 winmat[3][2] += offset;
738 offset = 0.0;
739 }
740
742}
743
#define BLI_STATIC_ASSERT(a, msg)
Definition BLI_assert.h:83
#define BLI_assert(a)
Definition BLI_assert.h:46
#define DEG2RADF(_deg)
#define M_PI
void mul_v4_m4v3(float r[4], const float M[4][4], const float v[3])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void translate_m4(float mat[4][4], float Tx, float Ty, float Tz)
void scale_m4_fl(float R[4][4], float scale)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
void mul_m4_v4(const float mat[4][4], float r[4])
void rotate_m4(float mat[4][4], char axis, float angle)
bool invert_m4(float mat[4][4])
void transpose_m3(float R[3][3])
void mul_m4_m4_post(float R[4][4], const float B[4][4])
bool invert_m3(float mat[3][3])
void unit_m4(float m[4][4])
void axis_angle_to_mat4(float R[4][4], const float axis[3], float angle)
MINLINE bool is_finite_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void zero_v3(float r[3])
MINLINE float normalize_v3(float n[3])
unsigned int uint
#define UNUSED_VARS(...)
static AppView * view
#define GPU_matrix_normal_get(x)
#define GPU_matrix_model_view_get(x)
#define GPU_matrix_set(x)
#define GPU_matrix_mul(x)
#define GPU_matrix_normal_inverse_get(x)
#define GPU_matrix_projection_get(x)
#define GPU_matrix_projection_set(x)
#define GPU_matrix_model_view_projection_get(x)
@ GPU_UNIFORM_PROJECTION
@ GPU_UNIFORM_MODELVIEW
@ GPU_UNIFORM_PROJECTION_INV
@ GPU_UNIFORM_MODELVIEW_INV
@ GPU_UNIFORM_NORMAL
@ GPU_UNIFORM_MVP
int GPU_shader_get_builtin_uniform(blender::gpu::Shader *shader, int builtin)
void GPU_shader_uniform_float_ex(blender::gpu::Shader *shader, int location, int length, int array_size, const float *value)
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
static Context * get()
GPUMatrixState * matrix_state
nullptr float
uint top
void GPU_matrix_look_at(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
int GPU_matrix_stack_level_get_projection()
void GPU_matrix_reset()
Definition gpu_matrix.cc:85
GPUMatrixState * GPU_matrix_state_create()
Definition gpu_matrix.cc:55
void GPU_matrix_translate_2fv(const float vec[2])
#define MATRIX_4X4_IDENTITY
void GPU_matrix_bind(blender::gpu::Shader *shader)
void GPU_matrix_rotate_axis(float deg, char axis)
float GPU_polygon_offset_calc(const float(*winmat)[4], float viewdist, float dist)
static void mat4_frustum_set(float m[4][4], float left, float right, float bottom, float top, float near, float far)
static constexpr int MATRIX_STACK_DEPTH
Definition gpu_matrix.cc:25
void GPU_matrix_identity_projection_set()
void GPU_matrix_project_2fv(const float world[3], const float model[4][4], const float proj[4][4], const int view[4], float r_win[2])
void GPU_matrix_ortho_set(float left, float right, float bottom, float top, float near, float far)
void GPU_matrix_identity_set()
void GPU_matrix_scale_2f(float x, float y)
#define CHECKMAT(m)
void GPU_matrix_perspective_set(float fovy, float aspect, float near, float far)
void GPU_matrix_scale_2fv(const float vec[2])
void GPU_matrix_frustum_set(float left, float right, float bottom, float top, float near, float far)
void GPU_matrix_ortho_set_z(float near, float far)
void GPU_matrix_ortho_2d_set(float left, float right, float bottom, float top)
void GPU_matrix_push()
void GPU_matrix_push_projection()
float[3][3] Mat3
Definition gpu_matrix.cc:28
static void mat4_ortho_set(float m[4][4], float left, float right, float bottom, float top, float near, float far)
void GPU_matrix_scale_3fv(const float vec[3])
void GPU_matrix_scale_3f(float x, float y, float z)
int GPU_matrix_stack_level_get_model_view()
static void gpu_matrix_state_active_set_dirty(bool value)
Definition gpu_matrix.cc:79
float[4][4] Mat4
Definition gpu_matrix.cc:27
#define Projection
Definition gpu_matrix.cc:53
#define ModelView
Definition gpu_matrix.cc:50
void GPU_matrix_scale_1f(float factor)
void GPU_matrix_rotate_3fv(float deg, const float axis[3])
void GPU_matrix_rotate_2d(float deg)
void GPU_matrix_pop_projection()
void GPU_matrix_state_discard(GPUMatrixState *state)
Definition gpu_matrix.cc:74
static void mat4_look_from_origin(float m[4][4], float lookdir[3], float camup[3])
bool GPU_matrix_dirty_get()
#define ProjectionStack
Definition gpu_matrix.cc:52
#define ModelViewStack
Definition gpu_matrix.cc:49
bool GPU_matrix_unproject_3fv(const float win[3], const float model_inverted[4][4], const float proj[4][4], const int view[4], float r_world[3])
void GPU_matrix_translate_3fv(const float vec[3])
void GPU_matrix_translate_3f(float x, float y, float z)
void GPU_polygon_offset(float viewdist, float dist)
void GPU_matrix_rotate_3f(float deg, float x, float y, float z)
void GPU_matrix_pop()
void GPU_matrix_project_3fv(const float world[3], const float model[4][4], const float proj[4][4], const int view[4], float r_win[3])
void GPU_matrix_translate_2f(float x, float y)
#define in
#define out
#define isinf
void * MEM_mallocN(size_t len, const char *str)
Definition mallocn.cc:128
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
static ulong state[N]
static int left
#define N
#define tanf
#define FLT_MAX
Definition stdcycles.h:14
MatrixStack model_view_stack
Definition gpu_matrix.cc:36
MatrixStack projection_stack
Definition gpu_matrix.cc:37
Mat4 stack[MATRIX_STACK_DEPTH]
Definition gpu_matrix.cc:31
i
Definition text_draw.cc:230