mirror of
https://github.com/IllusionMan1212/cudoku.git
synced 2026-10-24 18:12:25 +00:00
finish refactor
This commit is contained in:
+5
-23
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user