summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-10-27 11:51:02 +1100
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-10-27 11:51:02 +1100
commit7577b6d51c5180ec23f93cec79a5c77e54130558 (patch)
tree1b372bf5ccc89eba828ff15f87558ff695b6d75d
parente597fbb916848df1f6fbd4da04c1ab6f89a25b45 (diff)
fix compilation on mac
-rw-r--r--Makefile3
-rw-r--r--include/celeritas.h7
-rw-r--r--src/maths.c13
-rw-r--r--src/mem.c4
-rw-r--r--src/skybox.c5
5 files changed, 30 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 92afab1..4000eec 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ CC := clang
INCLUDES := -I./include -Ideps/glfw-3.3.8/include/GLFW -Ideps/stb_image
CFLAGS := -Wall -Wextra -O2 -fPIC $(INCLUDES)
# TODO(low prio): split static object files and shared object files so we can remove -fPIC from static lib builds
-LDFLAGS := -lglfw -lvulkan
+LDFLAGS := -lglfw
# Detect OS
UNAME_S := $(shell uname -s)
@@ -39,6 +39,7 @@ ifeq ($(UNAME_S),Darwin)
else
SHARED_LIB := $(BUILD_DIR)/libceleritas.so
SHARED_FLAGS := -shared
+ LDFLAGS += -lvulkan
endif
## Makefile notes
diff --git a/include/celeritas.h b/include/celeritas.h
index ef85a66..3dc3761 100644
--- a/include/celeritas.h
+++ b/include/celeritas.h
@@ -70,7 +70,7 @@ _Static_assert(sizeof(ptrdiff_t) == 8, "type ptrdiff_t should be 8 bytes");
#define GB(x) ((size_t)x * 1000 * 1000 * 1000)
// TEMP
-#define CEL_PLATFORM_LINUX
+// #define CEL_PLATFORM_LINUX
// Platform informs renderer backend (unless user overrides)
#if defined(CEL_PLATFORM_LINUX) || defined(CEL_PLATFORM_WINDOWS)
@@ -291,6 +291,10 @@ _Static_assert(alignof(vec3) == 4, "vec3 is 4 byte aligned");
_Static_assert(sizeof(vec3) == 12, "vec3 is 12 bytes so has no padding");
_Static_assert(alignof(vec4) == 4, "vec4 is 4 byte aligned");
+// vector 2 functions
+inlined vec2 vec2_create(f32 x, f32 y);
+
+// vector 3 functions
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);
@@ -303,6 +307,7 @@ inlined vec3 vec3_normalise(vec3 a);
inlined f32 vec3_dot(vec3 a, vec3 b);
inlined vec3 vec3_cross(vec3 a, vec3 b);
+// vector 4 functions
vec4 vec4_create(f32 x, f32 y, f32 z, f32 w);
// quaternion functions
diff --git a/src/maths.c b/src/maths.c
index 72b6dd3..87e9afd 100644
--- a/src/maths.c
+++ b/src/maths.c
@@ -8,6 +8,8 @@
#include <celeritas.h>
+vec2 vec2_create(f32 x, f32 y) { return (vec2){ x,y};}
+
vec3 vec3_create(f32 x, f32 y, f32 z) { return (vec3){ x, y, z }; }
vec3 vec3_add(vec3 u, vec3 v) { return (vec3){ .x = u.x + v.x, .y = u.y + v.y, .z = u.z + v.z }; }
vec3 vec3_sub(vec3 a, vec3 b) { return (vec3){ a.x - b.x, a.y - b.y, a.z - b.z }; }
@@ -29,8 +31,10 @@ vec3 vec3_cross(vec3 a, vec3 b) {
return (vec3){ .x = a.y * b.z - a.z * b.y, .y = a.z * b.x - a.x * b.z, .z = a.x * b.y - a.y * b.x };
}
+
vec4 vec4_create(f32 x, f32 y, f32 z, f32 w) { return (vec4){ x, y, z, w }; }
+
f32 quat_dot(quat a, quat b) { return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; }
quat quat_normalise(quat a) {
@@ -51,6 +55,7 @@ quat quat_from_axis_angle(vec3 axis, f32 angle, bool normalize) {
return q;
}
+
mat4 mat4_ident() {
return (mat4){
.x_axis = { 1, 0, 0, 0 },
@@ -115,6 +120,10 @@ mat4 mat4_mult(mat4 lhs, mat4 rhs) {
// return out_matrix;
}
+
+/*
+
+*/
mat4 mat4_perspective(f32 fov_radians, f32 aspect_ratio, f32 near_z, f32 far_z) {
TODO("impl mat4_perspective");
// f32 half_tan_fov = tanf(fov_radians * 0.5f);
@@ -158,3 +167,7 @@ mat4 mat4_look_at(vec3 position, vec3 target, vec3 up) {
// return out_matrix;
}
+
+transform transform_from_mat4(mat4 matrix) {
+ TODO("stuff")
+} \ No newline at end of file
diff --git a/src/mem.c b/src/mem.c
index 2649db5..84c90e6 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -1,5 +1,9 @@
#include <celeritas.h>
+fixed_arena fixed_arena_new(void *backing_buffer, size_t size, size_t alignment) {
+ TODO("")
+}
+
void_pool void_pool_create(void* storage, const char* debug_label, u64 capacity, u64 entry_size) {
size_t _memory_requirements = capacity * entry_size;
// void* backing_buf = arena_alloc(a, memory_requirements);
diff --git a/src/skybox.c b/src/skybox.c
index e69de29..12ccc37 100644
--- a/src/skybox.c
+++ b/src/skybox.c
@@ -0,0 +1,5 @@
+#include <celeritas.h>
+
+struct skybox_storage {
+ pipeline_handle skybox_pipeline;
+}; \ No newline at end of file