diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-06-17 22:17:48 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-06-18 10:30:28 +1000 |
commit | 4b5695ce26a8f821dfac987e8e11a6ba5eeff610 (patch) | |
tree | 0cd8f80bdb0520ffcf0cd62851f72055d4ee5546 /src/renderer/immediate.c | |
parent | f1cb5bece520dba63fa77e4721909ab8f0a6c26f (diff) |
start working on a immediate mode drawing API
Diffstat (limited to 'src/renderer/immediate.c')
-rw-r--r-- | src/renderer/immediate.c | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/src/renderer/immediate.c b/src/renderer/immediate.c index e76d102..b3431fa 100644 --- a/src/renderer/immediate.c +++ b/src/renderer/immediate.c @@ -1,18 +1,50 @@ #include "immediate.h" +#include "glad/glad.h" #include "maths.h" #include "primitives.h" #include "ral_types.h" #include "render.h" +#include "render_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); +typedef struct immdraw_system { + // primitive meshes (get reused for each draw call) + mesh plane; + mesh cube; + mesh sphere; + // command lists + +} immdraw_system; - // Upload to GPU - mat4 model = mat4_translation(pos); +bool immdraw_system_init(immdraw_system* state) { + geometry_data plane_geometry = geo_create_plane(f32x2(1, 1)); + state->plane = mesh_create(&plane_geometry, true); - // Set pipeline + geometry_data cube_geometry = geo_create_cuboid(f32x3(1, 1, 1)); + state->cube = mesh_create(&cube_geometry, true); - // Draw -}
\ No newline at end of file + geometry_data sphere_geometry = geo_create_uvsphere(1.0, 48, 48); + state->sphere = mesh_create(&sphere_geometry, true); + + return true; +} + +void immdraw_plane(vec3 pos, quat rotation, f32 u_scale, f32 v_scale, vec4 colour) { + +} + +void immdraw_system_render(immdraw_system* state) { + +} + +// 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 |