54 lines
1.2 KiB
GLSL
54 lines
1.2 KiB
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
|
|
|
|
#define NO_SHADOW 0xFFFFFFFFu
|
|
// Must match ShadowMapPipeline::MAX_SPOT_SHADOWS
|
|
#define MAX_SPOT_SHADOWS 16
|
|
|
|
// 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;
|
|
// NO_SHADOW, or the light's slot in the shadow data of its type
|
|
uint shadowIndex;
|
|
float padding;
|
|
};
|
|
|
|
// Must match GPUSpotShadow in Light.h
|
|
struct SpotShadow {
|
|
mat4 lightViewProj;
|
|
float normalOffsetPerMeter;
|
|
};
|
|
|
|
layout (buffer_reference, std430) readonly buffer LightsBuffer {
|
|
Light data[];
|
|
};
|
|
|
|
layout (buffer_reference, std430) buffer TileLightIndicesBuffer {
|
|
uint data[];
|
|
};
|
|
|
|
#endif // LIGHTS_GLSL
|