quakeforge/libs/video/renderer/vulkan/shader/lighting.h
Bill Currie a626dc7ca8 [vulkan] Split the lighting pass into per-type passes
This takes care of the type punning issue by each pass using the correct
sampler type with the correct view types bound. Also, point light and
spot light shadow maps are now guaranteed to be separated (it was just
luck that they were before) and spot light maps may be significantly
smaller as their cone angle is taken into account. Lighting is quite
borked, but at least the engine is running again.
2023-08-02 19:34:26 +09:00

29 lines
803 B
C

struct LightData {
vec4 color; // .a is intensity
vec4 position; // .w = 0 -> directional, .w = 1 -> point/cone
vec4 direction; // .w = -cos(cone_angle/2) (1 for omni/dir)
vec4 attenuation;
};
#define ST_NONE 0 // no shadows
#define ST_PLANE 1 // single plane shadow map (small spotlight)
#define ST_CASCADE 2 // cascaded shadow maps
#define ST_CUBE 3 // cubemap (omni, large spotlight)
struct LightRender {
uint id_data;
uint style;
};
layout (set = 1, binding = 0) buffer LightIds {
uint lightIds[];
};
layout (set = 1, binding = 1) buffer Lights {
LightData lights[];
};
layout (set = 1, binding = 2) buffer Renderer {
LightRender renderer[];
};
layout (set = 1, binding = 3) buffer Style {
vec4 style[];
};