From 4571472425ca75573895c96f590ba12dedbed661 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 7 Nov 2021 14:38:49 +0200 Subject: [PATCH] Change max_lights to a fixed constant --- shaderlib/msp_interface.glsl | 2 +- source/effects/shadowmap.cpp | 2 +- source/materials/lighting.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shaderlib/msp_interface.glsl b/shaderlib/msp_interface.glsl index 13cd9ccf..724538ff 100644 --- a/shaderlib/msp_interface.glsl +++ b/shaderlib/msp_interface.glsl @@ -16,7 +16,7 @@ uniform CameraTransform mat4 eye_clip_matrix; }; -layout(constant_id=auto) const int max_lights = 4; +const int max_lights = 6; uniform Lighting { LightSourceParameters light_sources[max_lights]; diff --git a/source/effects/shadowmap.cpp b/source/effects/shadowmap.cpp index ddb78aeb..9aee4907 100644 --- a/source/effects/shadowmap.cpp +++ b/source/effects/shadowmap.cpp @@ -24,7 +24,7 @@ ShadowMap::ShadowMap(unsigned w, unsigned h, Renderable &c, const Lighting *l): fbo.attach(DEPTH_ATTACHMENT, depth_buf, 0); set_darkness(1.0f); - for(unsigned i=0; i<4; ++i) + for(unsigned i=0; i<6; ++i) { string base = format("shadows[%d]", i); shdata.uniform(base+".type", 0); diff --git a/source/materials/lighting.cpp b/source/materials/lighting.cpp index 6957126b..d8e54006 100644 --- a/source/materials/lighting.cpp +++ b/source/materials/lighting.cpp @@ -18,7 +18,7 @@ Lighting::Lighting() set_fog_color(Color(0.0f, 0.0f, 0.0f, 0.0f)); set_fog_density(0.0f); - for(unsigned i=0; i<7; ++i) + for(unsigned i=0; i<6; ++i) { string base = format("light_sources[%d]", i); shdata.uniform(base+".position", Vector4(0, 0, 1, 0)); -- 2.43.0