Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/lib/src/guOrthoF.c
7857 views
1
#include "libultra_internal.h"
2
3
void guOrthoF(float m[4][4], float left, float right, float bottom, float top, float near, float far,
4
float scale) {
5
int row;
6
int col;
7
guMtxIdentF(m);
8
m[0][0] = 2 / (right - left);
9
m[1][1] = 2 / (top - bottom);
10
m[2][2] = -2 / (far - near);
11
m[3][0] = -(right + left) / (right - left);
12
m[3][1] = -(top + bottom) / (top - bottom);
13
m[3][2] = -(far + near) / (far - near);
14
m[3][3] = 1;
15
for (row = 0; row < 4; row++) {
16
for (col = 0; col < 4; col++) {
17
m[row][col] *= scale;
18
}
19
}
20
}
21
22
void guOrtho(Mtx *m, float left, float right, float bottom, float top, float near, float far,
23
float scale) {
24
float sp28[4][4];
25
guOrthoF(sp28, left, right, bottom, top, near, far, scale);
26
guMtxF2L(sp28, m);
27
}
28
29