From 629dc808c595d65cda74a86975ebd780113f3431 Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 9 Feb 2025 18:50:58 +1100 Subject: Properly send lights from the CPU --- model.hpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'model.hpp') diff --git a/model.hpp b/model.hpp index de9e4d0..d1b9449 100644 --- a/model.hpp +++ b/model.hpp @@ -8,6 +8,7 @@ #include struct Camera; +struct Lighting; struct Material : public Asset { float metalness, roughness, ao; @@ -29,7 +30,7 @@ struct Material : public Asset { struct Model; struct Mesh { int offset, vbo_offset, count; - int parent, mesh_binding, mvp_binding, mat_binding; + int parent, mesh_binding, mvp_binding, mat_binding, light_binding; int env_cube_binding; int mvp_binding_depth; bool world_dirty; @@ -94,11 +95,16 @@ struct Model_Instance { void init(Device* dev, Heap* h, Model* model); void destroy(Device* dev, Heap* h); void update(); - void update_cbuffers(Device* dev, const Camera& cam); + void update_cbuffers( + Device* dev, + const Lighting& lighting, + const Camera& cam + ); void render( Device* dev, Arena* a, Render_Pass& pass, + const Lighting* lighting, Texture_Id env_cubemap, Sampler_Id sampler ); @@ -115,11 +121,16 @@ struct Model_Scene { void destroy(Device* dev); void init(Arena* arena, int max_instances, Sampler_Id s); - void update(const Camera& cam, Device* dev); + void update( + const Camera& cam, + const Lighting& lighting, + Device* dev + ); void render( Device* dev, Arena* a, Render_Pass& pass, + const Lighting* lighting, Texture_Id env_cubemap, Sampler_Id sampler ); -- cgit v1.2.3-54-g00ecf