summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-10-26 23:37:45 +1100
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-10-26 23:37:45 +1100
commit3946ae807a2de00b3c810f986f60ba9cc32bc1a7 (patch)
tree54430a2793682e2da26b5c5e292a4bc968fd68a7
parent90125f6809d6c2a9e4d72b6c3846c8b378d32261 (diff)
some more docs
-rw-r--r--include/celeritas.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/include/celeritas.h b/include/celeritas.h
index 94d08fb..62b3fc3 100644
--- a/include/celeritas.h
+++ b/include/celeritas.h
@@ -117,7 +117,30 @@ void _cel_push_error(int error_code);
// --- Memory facilities: Allocators, helpers
-// TODO: Arenas
+/** @brief Fixed-size arena allocator */
+typedef struct fixed_arena {
+ void* storage;
+ size_t size;
+ size_t alignment;
+ int index;
+} fixed_arena;
+
+/** @brief Create a new fixed arena with the provided storage. */
+fixed_arena fixed_arena_new(void* backing_buffer, size_t size, size_t alignment);
+
+/**
+ * @brief Allocates memory on the arena.
+ *
+ * @param arena
+ * @param size Number of bytes to reserve
+ * @return Pointer to the allocated memory or NULL if there's not enough space
+ */
+void* fixed_arena_alloc(fixed_arena* arena, size_t size);
+
+/** @brief Clear the arena thereby resetting the index to the start. */
+void fixed_arena_clear(fixed_arena* a);
+
+// TODO: grow arena
// Pool
typedef struct void_pool_header void_pool_header; // TODO: change name of this
@@ -143,6 +166,7 @@ void* void_pool_alloc(void_pool* pool, u32* out_raw_handle);
void void_pool_dealloc(void_pool* pool, u32 raw_handle);
u32 void_pool_insert(void_pool* pool, void* item);
+// Create a pool of objects with type `T`
#define TYPED_POOL(T, Name) \
typedef struct Name##_pool { \
void_pool inner; \
@@ -520,6 +544,8 @@ typedef struct geometry {
} geometry;
typedef u32 joint_idx;
+
+/** @brief Bone hierarchy for a mesh */
typedef struct armature {
} armature;
@@ -555,6 +581,17 @@ void geo_scale_xyz(geometry* geo, vec3 scale_xyz);
// --- Renderer
+/**
+ * @brief Reference renderer you can use to draw beautiful 3D worlds.
+ * @details Implements a Forward+ renderer on top of the RAL (Render Abstraction Layer) provided in celeritas-core.
+
+ */
+typedef struct renderer {
+ /* PBR pipeline */
+ pipeline_handle pbr_pipeline;
+ /* CSM pipeline */
+} renderer;
+
// void renderer_init(renderer* rend);
// void renderer_shutdown(renderer* rend);