diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-17 14:38:51 +1100 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-17 14:38:51 +1100 |
commit | 8b75f00918958ca174fb1e77c60d4dfb18cbc923 (patch) | |
tree | fe1cbaa6dbcc06caaaee34c0266a196a1de405a6 | |
parent | 8ce117f0b3fd4ceeb1d7058dde8793e4421ec076 (diff) |
gonna go back to snake case
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | include/celeritas.h | 47 | ||||
-rw-r--r-- | src/backend_mtl.c | 0 | ||||
-rw-r--r-- | src/maths.c | 2 | ||||
-rw-r--r-- | src/ral.c | 5 |
5 files changed, 36 insertions, 29 deletions
@@ -18,6 +18,8 @@ All third-party dependencies are licensed under their own license. - Bindgen - Targets Vulkan 1.3 for simpler code - Plugin system (?) +- We can build tools on top of this layer while maintaining high performance. The C side retains + all rendering data. Renderer Goals: @@ -32,8 +34,7 @@ Renderer Goals: #### Handy commands -* Check symbols in an 'archive' (static library) - * `nm -C build/libcore.a` -* Generate compiler_commands.json - * `xmake project -k compile_commands` - +- Check symbols in an 'archive' (static library) + - `nm -C build/libcore.a` +- Generate compiler_commands.json + - `xmake project -k compile_commands` diff --git a/include/celeritas.h b/include/celeritas.h index 2e0bd28..b7a6683 100644 --- a/include/celeritas.h +++ b/include/celeritas.h @@ -155,42 +155,43 @@ void log_output(char* module, LogLevel level, const char* msg, ...); #define TAU (2.0 * PI) /** @brief 2D Vector */ -typedef struct Vec2 { +typedef struct vec2 { f32 x, y; -} Vec2; +} vec2; /** @brief 3D Vector */ -typedef struct Vec3 { +typedef struct vec3 { f32 x, y, z; -} Vec3; +} vec3; /** @brief 4D Vector */ -typedef struct Vec4 { +typedef struct vec4 { f32 x, y, z, w; -} Vec4; +} vec4; /** @brief Quaternion */ -typedef Vec4 Quat; +typedef vec4 quat; /** @brief 4x4 Matrix */ -typedef struct Mat4 { +typedef struct mat4 { // TODO: use this format for more readable code: vec4 x_axis, y_axis, z_axis, w_axis; f32 data[16]; -} Mat4; + +} mat4; /** @brief 3D affine transformation */ -typedef struct Transform { - Vec3 position; - Quat rotation; - Vec3 scale; +typedef struct transform { + vec3 position; + quat rotation; + vec3 scale; bool is_dirty; -} Transform; +} transform; -inlined Vec3 Vec3_Create(f32 x, f32 y, f32 z); -inlined Vec3 Vec3_Add(Vec3 u, Vec3 v); -inlined Vec3 Vec3_Sub(Vec3 u, Vec3 v); -inlined Vec3 Vec3_Mult(Vec3 u, f32 s); -inlined Vec3 Vec3_Div(Vec3 u, f32 s); +inlined vec3 vec3_create(f32 x, f32 y, f32 z); +inlined vec3 vec3_add(vec3 u, vec3 v); +inlined vec3 Vec3_sub(vec3 u, vec3 v); +inlined vec3 Vec3_mult(vec3 u, f32 s); +inlined vec3 Vec3_div(vec3 u, f32 s); // --- RAL @@ -321,7 +322,7 @@ typedef struct Geometry { u32_darray* indices; } Geometry; -typedef struct Mesh { +typedef struct mesh { BufHandle vertex_buffer; BufHandle index_buffer; MaterialHandle material; @@ -329,7 +330,7 @@ typedef struct Mesh { // bool is_skinned; // false = its static // Armature armature; // bool is_uploaded; // has the data been uploaded to the GPU -} Mesh; +} mesh; // --- Render primitives @@ -345,8 +346,8 @@ Geometry Geo_CreateIcosphere(f32 radius, f32 n_subdivisions); // --- Gameplay typedef struct Camera { - Vec3 position; - Quat orientation; + vec3 position; + quat orientation; f32 fov; } Camera; diff --git a/src/backend_mtl.c b/src/backend_mtl.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/backend_mtl.c diff --git a/src/maths.c b/src/maths.c index 3ad1e2e..f12c852 100644 --- a/src/maths.c +++ b/src/maths.c @@ -1,3 +1,3 @@ #include <celeritas.h> -Vec3 Vec3_Create(f32 x, f32 y, f32 z) { return (Vec3){ x, y, z }; } +vec3 vec3_create(f32 x, f32 y, f32 z) { return (vec3){ x, y, z }; } @@ -0,0 +1,5 @@ +#ifdef GPU_VULKAN + +#elif GPU_METAL + +#endif
\ No newline at end of file |