summaryrefslogtreecommitdiff
path: root/lighting.hpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2025-03-02 17:28:07 +1100
committerquou <quou@disroot.org>2025-03-02 17:28:07 +1100
commit528c5a7ef9e3e7cadf9a2caefa3ca115b382df75 (patch)
tree4557c8cb90d182b4f82bc574d61204ff09b5f72f /lighting.hpp
parent3634e53cc68671a576754d6bb668f585f7e2c53d (diff)
Diffstat (limited to 'lighting.hpp')
-rw-r--r--lighting.hpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/lighting.hpp b/lighting.hpp
index 0d331d7..ac2d2c5 100644
--- a/lighting.hpp
+++ b/lighting.hpp
@@ -11,23 +11,32 @@ struct Model_Scene;
struct Renderer;
struct World;
+struct Caster {
+ Camera_Id reality;
+ Camera_Id jittered;
+};
+
struct Lighting {
static constexpr int max_lights = 128;
static constexpr int max_shadows = 16;
+ static constexpr int shadowmap_count = max_shadows * 2;
static constexpr int shadow_res = 2048;
- Staged_Buffer lights;
- Staged_Buffer casters;
+ Staged_Buffer gpu_lights;
+ Staged_Buffer gpu_casters;
Texture_Id shadows;
- Texture_Id shadow_slices[max_shadows];
+ Texture_Id shadow_slices[shadowmap_count];
Texture_Id ss_shadows[2];
- Texture_Id ss_shadow_slices[2][max_shadows];
+ Texture_Id ss_shadow_slices[2][shadowmap_count];
+ Texture_Id occlusion[2];
Sampler_Id shadow_sampler;
- Camera_Id cameras[max_shadows];
- int light_count, caster_count;
+ Caster casters[max_shadows];
+ Camera_Id cameras[shadowmap_count];
+ int light_count, caster_count, cam_count;
void init(Device* dev, int w, int h);
void destroy_ss(Device* dev);
void recreate(Device* dev, int w, int h);
void destroy(Device* dev, Renderer& r);
+ Camera_Id gm_cam(Renderer& r);
void update(
Device* dev,
Context& ctx,