Implement the red windows.

This commit is contained in:
Zed A. Shaw 2026-08-30 13:17:35 -04:00
parent 11b7f4a3ed
commit f51df89054
18 changed files with 74 additions and 36 deletions

View file

@ -134,9 +134,6 @@ void Shader::apply_lighting(const Lighting& lighting) {
setInt("pointLightCount", lighting.positioned.size());
setInt("dirLightCount", lighting.directional.size());
// need +1 for the camera spot light
setInt("spotLightCount", lighting.spot.size() + 1);
for(size_t i = 0; i < lighting.directional.size(); i++) {
apply_dir_light(lighting.directional[i], i);
}
@ -145,13 +142,25 @@ void Shader::apply_lighting(const Lighting& lighting) {
apply_point_light(lighting.positioned[i], i);
}
// set the first spotlight to the camera light
apply_spot_light(lighting.camera, 0);
// set the first spotlight to the camera light if given
size_t i = 0;
for(size_t i = 0; i < lighting.spot.size(); i++) {
// need to be off by one because the camera is a spot light
apply_spot_light(lighting.spot[i], i+1);
// camera is optional, so only add if used
if(lighting.camera.on) {
apply_spot_light(lighting.camera, 0);
i++;
}
// gross but that's fine for now
for(; i < lighting.spot.size(); i++) {
// need to be off by one because the camera is a spot light
if(lighting.spot[i].on) {
apply_spot_light(lighting.spot[i], i+1);
}
}
// need +1 for the camera spot light
setInt("spotLightCount", (int)i);
}