summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-10-18 12:55:02 +1100
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-10-18 12:55:02 +1100
commitf5190745aed65b231e380fa3f25fce46d220dcbc (patch)
treef363f5c4b8e1e182609702c5a78e23da0a5b4558 /src
parentde17d20f1848774f854903dcce40cd1e33b1cad9 (diff)
removing some outdated docs files
Diffstat (limited to 'src')
-rw-r--r--src/camera.c15
-rw-r--r--src/mem.c2
-rw-r--r--src/scene.c26
3 files changed, 42 insertions, 1 deletions
diff --git a/src/camera.c b/src/camera.c
new file mode 100644
index 0000000..79f9c19
--- /dev/null
+++ b/src/camera.c
@@ -0,0 +1,15 @@
+#include <celeritas.h>
+
+mat4 camera_view_proj(camera camera, f32 lens_height, f32 lens_width, mat4* out_view, mat4* out_proj) {
+ mat4 projection_matrix = mat4_perspective(camera.fov, lens_width / lens_height, 0.1, 1000.0);
+ // TODO: store near/far on camera rather than hard-coding here.
+
+ vec3 camera_direction = vec3_add(camera.position, camera.forwards);
+ mat4 view_matrix = mat4_look_at(camera.position, camera_direction, camera.up);
+ if (out_view)
+ *out_view = view_matrix;
+ if (out_proj)
+ *out_proj = projection_matrix;
+
+ return mat4_mult(view_matrix, projection_matrix);
+} \ No newline at end of file
diff --git a/src/mem.c b/src/mem.c
index dd8acda..2649db5 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -1,7 +1,7 @@
#include <celeritas.h>
void_pool void_pool_create(void* storage, const char* debug_label, u64 capacity, u64 entry_size) {
- size_t memory_requirements = capacity * entry_size;
+ size_t _memory_requirements = capacity * entry_size;
// void* backing_buf = arena_alloc(a, memory_requirements);
assert(entry_size >= sizeof(void_pool_header)); // TODO: create my own assert with error message
diff --git a/src/scene.c b/src/scene.c
new file mode 100644
index 0000000..fa4d9b5
--- /dev/null
+++ b/src/scene.c
@@ -0,0 +1,26 @@
+/**
+ * @file scene.c
+ * @author your name (you@domain.com)
+ * @brief
+ * @version 0.1
+ * @date 2024-10-18
+ *
+ * @copyright Copyright (c) 2024
+ *
+ */
+#include <celeritas.h>
+
+// Retained mode scene tree that handles performant transform propagation, and allows systems, or other languages via bindings, to
+// manipulate rendering/scene data without *owning* said data.
+
+typedef struct scene_tree_node {
+ const char* label;
+} scene_tree_node;
+
+DEFINE_HANDLE(scene_node_handle);
+TYPED_POOL(scene_tree_node, scene_node);
+
+typedef struct render_scene_tree {
+} render_scene_tree;
+
+// What kind of operations and mutations can we perform on the tree?