From dae6866161ca59a6b23b41ae7008411116127f76 Mon Sep 17 00:00:00 2001 From: quou Date: Mon, 10 Mar 2025 15:30:57 +1100 Subject: remove fragment shader branching on the light type --- lighting.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lighting.cpp') diff --git a/lighting.cpp b/lighting.cpp index bf01831..b140611 100644 --- a/lighting.cpp +++ b/lighting.cpp @@ -15,9 +15,8 @@ struct GPU_Light { float brightness; v3f colour; int caster_id; - int type; float range; - int pad[2]; + int pad[3]; }; struct GPU_Caster { @@ -101,6 +100,7 @@ void Lighting::write_bufs( GPU_Light* ldst = (GPU_Light*)lptr; GPU_Caster* cdst = (GPU_Caster*)cptr; int count = 0, ccount = 0; + sun_range[0] = count; for (auto v : w.view()) { GPU_Light gl; Sun_Light& l = v.get(); @@ -108,7 +108,6 @@ void Lighting::write_bufs( print_war("Over light limit.\n"); goto cancel; } - gl.type = (int)Light::Type::sun; gl.brightness = l.brightness; gl.colour = l.colour; gl.pos = l.dir; @@ -127,6 +126,8 @@ void Lighting::write_bufs( gl.caster_id = -1; ldst[count++] = gl; } + sun_range[1] = count; + point_range[0] = count; for (auto v : w.view()) { GPU_Light gl; Transform& t = v.get(); @@ -135,7 +136,6 @@ void Lighting::write_bufs( print_war("Over light limit.\n"); goto cancel; } - gl.type = (int)Light::Type::point; gl.brightness = l.brightness; gl.colour = l.colour; gl.pos = v3f( @@ -147,6 +147,7 @@ void Lighting::write_bufs( gl.range = l.range; ldst[count++] = gl; } + point_range[1] = count; cancel: light_count = count; caster_count = ccount; -- cgit v1.2.3-54-g00ecf