From 83e2dc54685acc6c6d4501abd2ad786866bf3649 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Fri, 10 Jan 2025 02:40:52 +0300 Subject: [PATCH] make vec4 and matrix types internal --- include/twn_types.h | 15 --------------- share/twn_api.json | 10 ---------- src/rendering/twn_draw_c.h | 1 + src/twn_camera_c.h | 1 + src/twn_types_c.h | 19 +++++++++++++++++++ 5 files changed, 21 insertions(+), 25 deletions(-) create mode 100644 src/twn_types_c.h diff --git a/include/twn_types.h b/include/twn_types.h index b95fb17..4985129 100644 --- a/include/twn_types.h +++ b/include/twn_types.h @@ -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 diff --git a/share/twn_api.json b/share/twn_api.json index 1d34fa2..8cac587 100644 --- a/share/twn_api.json +++ b/share/twn_api.json @@ -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" }, diff --git a/src/rendering/twn_draw_c.h b/src/rendering/twn_draw_c.h index 62860f2..2a3c74b 100644 --- a/src/rendering/twn_draw_c.h +++ b/src/rendering/twn_draw_c.h @@ -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" diff --git a/src/twn_camera_c.h b/src/twn_camera_c.h index bd2377e..96d6ad0 100644 --- a/src/twn_camera_c.h +++ b/src/twn_camera_c.h @@ -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 */ diff --git a/src/twn_types_c.h b/src/twn_types_c.h new file mode 100644 index 0000000..ba0584e --- /dev/null +++ b/src/twn_types_c.h @@ -0,0 +1,19 @@ +#ifndef TWN_TYPES_C_H +#define TWN_TYPES_C_H + +#include + +typedef struct Vec4 { + float x; + float y; + float z; + float w; +} Vec4; + + +typedef struct Matrix4 { + Vec4 row[4]; +} Matrix4; + + +#endif