From 04db6b0ccd81d988cfe3a1d09e4eb00eeea77273 Mon Sep 17 00:00:00 2001 From: quou Date: Sat, 22 Feb 2025 17:01:35 +1100 Subject: basic shadows --- lighting.hpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'lighting.hpp') diff --git a/lighting.hpp b/lighting.hpp index 627de66..ccd08d3 100644 --- a/lighting.hpp +++ b/lighting.hpp @@ -1,31 +1,43 @@ #ifndef lighting_hpp #define lighting_hpp +#include "camera.hpp" #include "maths.hpp" #include "video.hpp" struct Arena; struct Model_Resources; struct Model_Scene; +struct Renderer; struct World; -struct Caster { - m4f vp; -}; - struct Lighting { static constexpr int max_lights = 128; static constexpr int max_shadows = 16; - static constexpr int shadow_res = 512; + static constexpr int shadow_res = 2048; Staged_Buffer lights; + Staged_Buffer casters; Texture_Id shadows; Texture_Id shadow_slices[max_shadows]; - Caster casters[max_shadows]; + Sampler_Id shadow_sampler; + Camera_Id cameras[max_shadows]; int light_count, caster_count; void init(Device* dev); - void destroy(Device* dev); - void update(Device* dev, Context& ctx, World& w); - void write_buf(void* ptr, World& w); + void destroy(Device* dev, Renderer& r); + void update( + Device* dev, + Context& ctx, + World& w, + Renderer& r, + Model_Scene& s + ); + void write_bufs( + void* lptr, + void* cptr, + World& w, + Renderer& r, + Model_Scene& s + ); }; struct Light { -- cgit v1.2.3-54-g00ecf