diff options
author | Omniscient <omniscient.oce@gmail.com> | 2024-05-17 08:39:51 +1000 |
---|---|---|
committer | Omniscient <omniscient.oce@gmail.com> | 2024-05-17 08:39:51 +1000 |
commit | e61a2e43947cebaafe4c3725414d33e092bb6fad (patch) | |
tree | 84f2e52a1eb62ec6b1957628307f59ad39a621af /src/renderer/render.h | |
parent | 634f22e2b6d538fc5a45da2b1b23af631f6f8703 (diff) |
cube working
Diffstat (limited to 'src/renderer/render.h')
-rw-r--r-- | src/renderer/render.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/renderer/render.h b/src/renderer/render.h index 4477121..c87e5f7 100644 --- a/src/renderer/render.h +++ b/src/renderer/render.h @@ -25,6 +25,11 @@ void render_frame_draw(renderer* ren); typedef struct camera camera; void gfx_backend_draw_frame(renderer* ren, camera* camera, mat4 model, texture* tex); +typedef struct render_ctx { + mat4 view; + mat4 projection; +} render_ctx; + // frontend -- these can be called from say a loop in an example, or via FFI texture_handle texture_create(const char* debug_name, texture_desc description, const u8* data); @@ -39,10 +44,22 @@ sampler_handle sampler_create(); void shader_hot_reload(const char* filepath); // models and meshes are implemented **in terms of the above** -mesh mesh_create(geometry_data* geometry); + +/** + * @brief Creates buffers and returns a struct that holds handles to our resources + * + * @param geometry + * @param free_on_upload frees the CPU-side vertex/index data stored in geometry_data when we successfully upload + that data to the GPU-side buffer + * @return mesh + */ +mesh mesh_create(geometry_data* geometry, bool free_on_upload); + +void draw_mesh(mesh* mesh, mat4* model);//, mat4* view, mat4* proj); // TODO: material model_handle model_load(const char* debug_name, const char* filepath); +void geo_free_data(geometry_data* geo); void geo_set_vertex_colours(geometry_data* geo, vec4 colour); -vertex_description static_3d_vertex_description();
\ No newline at end of file +vertex_description static_3d_vertex_description(); |