make vec4 and matrix types internal

This commit is contained in:
veclavtalica 2025-01-10 02:40:52 +03:00
parent 951d9c76c8
commit 83e2dc5468
5 changed files with 21 additions and 25 deletions

View File

@ -22,16 +22,6 @@ typedef struct Vec3 {
} Vec3;
/* a point in some three dimension space (floating point) */
/* y goes up, x goes to the right */
typedef struct Vec4 {
float x;
float y;
float z;
float w;
} Vec4;
/* 32-bit color data */
typedef struct Color {
uint8_t r;
@ -49,10 +39,5 @@ typedef struct Rect {
float h;
} Rect;
/* TODO: remove from here? */
typedef struct Matrix4 {
Vec4 row[4];
} Matrix4;
#endif

View File

@ -239,16 +239,6 @@
"c_type": "Vec3"
},
"Vec4": {
"fields": [
{ "name": "x", "type": "float" },
{ "name": "y", "type": "float" },
{ "name": "z", "type": "float" },
{ "name": "w", "type": "float" }
],
"c_type": "Vec4"
},
"Color": {
"fields": [
{ "name": "r", "type": "uint8_t" },

View File

@ -4,6 +4,7 @@
/* TODO: structure more categorically */
#include "twn_textures_c.h"
#include "twn_types_c.h"
#include "twn_text_c.h"
#include "twn_option.h"
#include "twn_deferred_commands.h"

View File

@ -2,6 +2,7 @@
#define TWN_CAMERA_H
#include "twn_types.h"
#include "twn_types_c.h"
/* TODO: make it cached? */
/* for example, perspective matrix only needs recaluclation on FOV change */

19
src/twn_types_c.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef TWN_TYPES_C_H
#define TWN_TYPES_C_H
#include <stdint.h>
typedef struct Vec4 {
float x;
float y;
float z;
float w;
} Vec4;
typedef struct Matrix4 {
Vec4 row[4];
} Matrix4;
#endif