From 597ec1de215e7d354b4002e612c3418af1d561ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20GUEZO?= Date: Sun, 9 Mar 2025 16:01:10 +0100 Subject: [PATCH] feat(vector): Initialize module and add constructor --- include/math/vector3.h | 10 ++++++++++ src/math/vector3.c | 14 ++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 include/math/vector3.h create mode 100644 src/math/vector3.c diff --git a/include/math/vector3.h b/include/math/vector3.h new file mode 100644 index 0000000..8ad1d03 --- /dev/null +++ b/include/math/vector3.h @@ -0,0 +1,10 @@ +#ifndef VECTOR3_H +#define VECTOR3_H + +typedef struct { + float x, y, z; +} Vec3; + +Vec3* vec3(float x, float y, float z); + +#endif // VECTOR3_H \ No newline at end of file diff --git a/src/math/vector3.c b/src/math/vector3.c new file mode 100644 index 0000000..e469dd4 --- /dev/null +++ b/src/math/vector3.c @@ -0,0 +1,14 @@ +#include +#include + +Vec3* vec3(float x, float y, float z) +{ + Vec3* vec = (Vec3*)malloc(sizeof(Vec3)); + if (!vec) return NULL; + + vec->x = x; + vec->y = y; + vec->z = z; + + return vec; +} \ No newline at end of file