mirror of
https://github.com/guezoloic/t3dsr.git
synced 2026-01-25 06:34:23 +00:00
feat(vector): Initialize module and add constructor
This commit is contained in:
10
include/math/vector3.h
Normal file
10
include/math/vector3.h
Normal 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
14
src/math/vector3.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user