From 93c8d40b39fe55a626e66d412450fb4cca1f993b Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Sat, 27 Apr 2024 17:07:03 +1000 Subject: scene thoughts --- src/renderer/cleanroom/immediate.c | 18 ++++++++++++++++++ src/renderer/cleanroom/immediate.h | 20 ++++++++++++++++++++ src/renderer/cleanroom/simda.h | 18 ------------------ src/renderer/cleanroom/types.h | 3 +++ 4 files changed, 41 insertions(+), 18 deletions(-) create mode 100644 src/renderer/cleanroom/immediate.c create mode 100644 src/renderer/cleanroom/immediate.h delete mode 100644 src/renderer/cleanroom/simda.h (limited to 'src/renderer/cleanroom') diff --git a/src/renderer/cleanroom/immediate.c b/src/renderer/cleanroom/immediate.c new file mode 100644 index 0000000..8e4bf7e --- /dev/null +++ b/src/renderer/cleanroom/immediate.c @@ -0,0 +1,18 @@ +#include "immediate.h" +#include "maths.h" +#include "primitives.h" +#include "render.h" +#include "types.h" + +void imm_draw_sphere(vec3 pos, f32 radius, vec4 colour) { + // Create the vertices + geometry_data geometry = geo_create_uvsphere(radius, 16, 16); + geo_set_vertex_colours(&geometry, colour); + + // Upload to GPU + mat4 model = mat4_translation(pos); + + // Set pipeline + + // Draw +} \ No newline at end of file diff --git a/src/renderer/cleanroom/immediate.h b/src/renderer/cleanroom/immediate.h new file mode 100644 index 0000000..6d93c53 --- /dev/null +++ b/src/renderer/cleanroom/immediate.h @@ -0,0 +1,20 @@ +#pragma once + +#include "geometry.h" +#include "maths_types.h" + +// 3. SIMA (simplified immediate mode api) / render.h +// - dont need to worry about uploading mesh data +// - very useful for debugging +void imm_draw_cuboid(vec3 pos, quat rotation, f32x3 extents, vec4 colour); +void imm_draw_sphere(vec3 pos, f32 radius, vec4 colour); +void imm_draw_camera_frustum(); + +// static void imm_draw_model( +// const char* model_filepath); // tracks internally whether the model is loaded + +// static void imm_draw_model(const char* model_filepath) { + // check that model is loaded + // if not loaded, load model and upload to gpu - LRU cache for models + // else submit draw call +// } \ No newline at end of file diff --git a/src/renderer/cleanroom/simda.h b/src/renderer/cleanroom/simda.h deleted file mode 100644 index d0b4794..0000000 --- a/src/renderer/cleanroom/simda.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "maths_types.h" - -// 3. SIMA (simplified immediate mode api) / render.h -// - dont need to worry about uploading mesh data -// - very useful for debugging -void imm_draw_cuboid(); -void imm_draw_sphere(vec3 pos, f32 radius, vec4 colour); -void imm_draw_camera_frustum(); -static void imm_draw_model( - const char* model_filepath); // tracks internally whether the model is loaded - -static void imm_draw_model(const char* model_filepath) { - // check that model is loaded - // if not loaded, load model and upload to gpu - LRU cache for models - // else submit draw call -} \ No newline at end of file diff --git a/src/renderer/cleanroom/types.h b/src/renderer/cleanroom/types.h index b18b5b8..7a6cfbd 100644 --- a/src/renderer/cleanroom/types.h +++ b/src/renderer/cleanroom/types.h @@ -96,8 +96,11 @@ typedef struct geometry_data { vertex_darray vertices; bool has_indices; u32_darray indices; + vec3 colour; /** Optional: set vertex colours */ } geometry_data; +void geo_set_vertex_colours(geometry_data* geo, vec4 colour); + typedef struct mesh { buffer_handle vertex_buffer; buffer_handle index_buffer; -- cgit v1.2.3-70-g09d2