Files
2026-11-08 07:45:01 -05:00

60 lines
1.7 KiB
C++

#ifndef LIGHTING_CLASS
#define LIGHTING_CLASS
#include <vector>
#include "Light.h"
// Every light in the scene. Directional lights are the only ones without shadows, apart from the sun.
class Lighting {
public:
DirectionalLight sun;
std::vector<DirectionalLight*> directionalLights;
std::vector<PointLight*> pointLights;
std::vector<SpotLight*> spotLights;
std::vector<glm::mat4> shadowTileMatrices; // world to light clip space, one per used atlas tile
Lighting() {
sun.color = glm::vec3(1.0f, 0.97f, 0.92f);
sun.intensity = 3.0f;
}
DirectionalLight* AddDirectionalLight(const glm::vec3& direction, const glm::vec3& color, float intensity) {
DirectionalLight* light = new DirectionalLight();
light->direction = glm::normalize(direction);
light->color = color;
light->intensity = intensity;
directionalLights.push_back(light);
return light;
}
PointLight* AddPointLight(const glm::vec3& position, const glm::vec3& color, float intensity, float radius) {
PointLight* light = new PointLight();
light->position = position;
light->color = color;
light->intensity = intensity;
light->radius = radius;
pointLights.push_back(light);
return light;
}
SpotLight* AddSpotLight(const glm::vec3& position, const glm::vec3& direction, const glm::vec3& color,
float intensity, float radius, float innerAngle, float outerAngle) {
SpotLight* light = new SpotLight();
light->position = position;
light->direction = glm::normalize(direction);
light->color = color;
light->intensity = intensity;
light->radius = radius;
light->innerAngle = innerAngle;
light->outerAngle = outerAngle;
spotLights.push_back(light);
return light;
}
private:
};
#endif