finish refactor

This commit is contained in:
2023-12-11 22:42:19 +02:00
parent 9e25f16b5a
commit 8542a7cb14
21 changed files with 1622 additions and 478 deletions
+5 -23
View File
@@ -2,26 +2,8 @@
#include "zephr_math.h"
int max(int a, int b) {
return a > b ? a : b;
}
float maxf(float a, float b) {
return a > b ? a : b;
}
float clampf(float value, float min, float max) {
if (value < min) {
return min;
} else if (value > max) {
return max;
}
return value;
}
float to_radians(float degrees) {
return degrees * (M_PI / 180.f);
return degrees * ((float)M_PI / 180.f);
}
Matrix4x4 orthographic_projection_2d(float left, float right, float bottom, float top) {
@@ -75,10 +57,10 @@ void apply_scale(Matrix4x4 *matrix, Sizef scale) {
void apply_rotation(Matrix4x4 *model, float angle) {
Matrix4x4 temp = identity();
temp.m[0][0] = cos(angle);
temp.m[0][1] = sin(angle);
temp.m[1][0] = -sin(angle);
temp.m[1][1] = cos(angle);
temp.m[0][0] = (float)cos(angle);
temp.m[0][1] = (float)sin(angle);
temp.m[1][0] = -(float)sin(angle);
temp.m[1][1] = (float)cos(angle);
mult_4x4(model, &temp);
}