feat(vector): Initialize module and add constructor

This commit is contained in:
2025-03-09 16:01:10 +01:00
committed by Loïc GUEZO
parent c5d678d58c
commit 597ec1de21
2 changed files with 24 additions and 0 deletions

10
include/math/vector3.h Normal file
View File

@@ -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

14
src/math/vector3.c Normal file
View File

@@ -0,0 +1,14 @@
#include <math/vector3.h>
#include <stdlib.h>
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;
}