summaryrefslogtreecommitdiff
path: root/lighting.cpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2025-03-10 15:30:57 +1100
committerquou <quou@disroot.org>2025-03-10 15:31:31 +1100
commitdae6866161ca59a6b23b41ae7008411116127f76 (patch)
tree01b50cd3a661f5ab713f92cc8f9861778fd887f4 /lighting.cpp
parentd661b9edec77a6269a5f11de53699156e1aa3d05 (diff)
remove fragment shader branching on the light typeHEADmaster
Diffstat (limited to 'lighting.cpp')
-rw-r--r--lighting.cpp9
1 files changed, 5 insertions, 4 deletions
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<Sun_Light>()) {
GPU_Light gl;
Sun_Light& l = v.get<Sun_Light>();
@@ -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<Transform, Point_Light>()) {
GPU_Light gl;
Transform& t = v.get<Transform>();
@@ -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;