Files
Destrum/destrum/assets_src/shaders/lights.glsl
T

43 lines
980 B
GLSL

#ifndef LIGHTS_GLSL
#define LIGHTS_GLSL
#extension GL_EXT_buffer_reference : require
#define TYPE_DIRECTIONAL_LIGHT 0
#define TYPE_POINT_LIGHT 1
#define TYPE_SPOT_LIGHT 2
// Forward+ tiling, must match LightCullingPipeline::TILE_SIZE / MAX_LIGHTS_PER_TILE
#define LIGHT_TILE_SIZE 16
#define MAX_LIGHTS_PER_TILE 255
// Every tile stores its light count first, followed by MAX_LIGHTS_PER_TILE light indices
#define LIGHT_TILE_STRIDE (MAX_LIGHTS_PER_TILE + 1)
// Must match GPULight in Light.h
struct Light {
vec3 position;
float range;
vec3 color;
float intensity;
// direction the light is pointing in (directional + spot lights)
vec3 direction;
uint type;
float spotInnerCos;
float spotOuterCos;
uint castShadows;
float padding;
};
layout (buffer_reference, std430) readonly buffer LightsBuffer {
Light data[];
};
layout (buffer_reference, std430) buffer TileLightIndicesBuffer {
uint data[];
};
#endif // LIGHTS_GLSL