Merge branch 'main' of yibble.dev:bulmanator/ld58
This commit is contained in:
@@ -1,8 +1,22 @@
|
||||
#include <math.h>
|
||||
V2f V2F(F32 x, F32 y) {
|
||||
V2f result = { x, y };
|
||||
return result;
|
||||
}
|
||||
|
||||
function V2f V2f_Scale(V2f x, F32 scale) {
|
||||
return V2F(x.x * scale, x.y * scale);
|
||||
}
|
||||
|
||||
V2f NormaliseV2F(V2f x) {
|
||||
F32 magnitude = sqrtf((x.x * x.x) + (x.y * x.y));
|
||||
if(magnitude > 0.0){
|
||||
F32 inverse = 1.0f/magnitude;
|
||||
return V2F(x.x*inverse, x.y*inverse);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
V3f V3F(F32 x, F32 y, F32 z) {
|
||||
V3f result = { x, y, z };
|
||||
return result;
|
||||
@@ -18,11 +32,6 @@ R2f R2F(V2f min, V2f max) {
|
||||
return result;
|
||||
}
|
||||
|
||||
V2f V2f_Scale(V2f x, F32 s) {
|
||||
V2f result = { x.x * s, x.y * s };
|
||||
return result;
|
||||
}
|
||||
|
||||
V3f V3f_Neg(V3f x) {
|
||||
V3f result = { -x.x, -x.y, -x.z };
|
||||
return result;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#define PI_F32 (3.14159265358979323846264338f)
|
||||
#define TAU_F32 (2.0f * PI_F32)
|
||||
|
||||
#define Abs(x) (((x) < 0 ? -(x) : (x)))
|
||||
|
||||
typedef struct Random Random;
|
||||
struct Random {
|
||||
U64 state;
|
||||
@@ -128,6 +130,9 @@ function V3f M4x4F_VMul3(Mat4x4F m, V3f v);
|
||||
function Mat4x4FInv M4x4F_Perspective(F32 fov, F32 aspect, F32 nearp, F32 farp);
|
||||
function Mat4x4FInv M4x4F_CameraView(V3f x, V3f y, V3f z, V3f p);
|
||||
|
||||
function V2f NormaliseV2F(V2f x);
|
||||
function V2f V2f_Scale(V2f x, F32 scale);
|
||||
|
||||
// Random
|
||||
|
||||
function Random Random_Seed(U64 seed);
|
||||
|
||||
@@ -34,4 +34,7 @@ struct Str8 {
|
||||
#define U32_MAX ((U32) -1)
|
||||
#define U64_MAX ((U64) -1)
|
||||
|
||||
#define F32_MAX ((F32) 3.40282346638528859811704183484516925e+038F)
|
||||
#define F64_MAX ((F64) 1.79769313486231570814527423731704357e+308L)
|
||||
|
||||
#endif // LD_CORE_TYPES_H_
|
||||
|
||||
Reference in New Issue
Block a user