stuff
This commit is contained in:
+45
-7
@@ -1,21 +1,59 @@
|
||||
#ifndef LIGHTING_CLASS
|
||||
#define LIGHTING_CLASS
|
||||
|
||||
#include "t.h"
|
||||
#include "tFunctions.h"
|
||||
#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:
|
||||
t dirlighting;
|
||||
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() {
|
||||
dirlighting.RotateToQuaternion(glm::quat({ glm::radians(90.0f),0.0f,0.0f}));
|
||||
dirlighting.TranslateTo({0.0f,0.0f,0.0f});
|
||||
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
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user