Files
Destrum/destrum/include/destrum/Graphics/Light.h
T

60 lines
1.1 KiB
C++

#ifndef LIGHT_H
#define LIGHT_H
#include <cstdint>
#include <glm/mat4x4.hpp>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
inline constexpr std::uint32_t NO_SHADOW = 0xFFFFFFFF;
enum class LightType : std::uint32_t {
Directional = 0,
Point = 1,
Spot = 2,
};
struct Light {
LightType type{LightType::Point};
glm::vec3 position{0.0f};
glm::vec3 direction{0.0f, -1.0f, 0.0f};
glm::vec3 color{1.0f};
float intensity{1.0f};
float range{10.0f};
float innerConeAngle{0.35f};
float outerConeAngle{0.5f};
// directional and spot lights, point lights don't have shadows yet
bool castShadows{false};
};
struct GPULight {
glm::vec3 position;
float range;
glm::vec3 color;
float intensity;
glm::vec3 direction;
std::uint32_t type;
float spotInnerCos;
float spotOuterCos;
std::uint32_t shadowIndex;
float padding;
};
struct GPUSpotShadow {
glm::mat4 lightViewProj;
float normalOffsetPerMeter;
};
static_assert(sizeof(GPULight) == 64, "GPULight must match the struct in lights.glsl");
#endif //LIGHT_H