lm_common_inc.glsl 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* SET 0, static data that does not change between any call */
  2. struct Vertex {
  3. vec3 position;
  4. float normal_z;
  5. vec2 uv;
  6. vec2 normal_xy;
  7. };
  8. layout(set = 0, binding = 1, std430) restrict readonly buffer Vertices {
  9. Vertex data[];
  10. }
  11. vertices;
  12. struct Triangle {
  13. uvec3 indices;
  14. uint slice;
  15. vec3 min_bounds;
  16. uint pad0;
  17. vec3 max_bounds;
  18. uint pad1;
  19. };
  20. layout(set = 0, binding = 2, std430) restrict readonly buffer Triangles {
  21. Triangle data[];
  22. }
  23. triangles;
  24. layout(set = 0, binding = 3, std430) restrict readonly buffer GridIndices {
  25. uint data[];
  26. }
  27. grid_indices;
  28. #define LIGHT_TYPE_DIRECTIONAL 0
  29. #define LIGHT_TYPE_OMNI 1
  30. #define LIGHT_TYPE_SPOT 2
  31. struct Light {
  32. vec3 position;
  33. uint type;
  34. vec3 direction;
  35. float energy;
  36. vec3 color;
  37. float size;
  38. float range;
  39. float attenuation;
  40. float cos_spot_angle;
  41. float inv_spot_attenuation;
  42. float shadow_blur;
  43. bool static_bake;
  44. uint pad[2];
  45. };
  46. layout(set = 0, binding = 4, std430) restrict readonly buffer Lights {
  47. Light data[];
  48. }
  49. lights;
  50. struct Seam {
  51. uvec2 a;
  52. uvec2 b;
  53. };
  54. layout(set = 0, binding = 5, std430) restrict readonly buffer Seams {
  55. Seam data[];
  56. }
  57. seams;
  58. layout(set = 0, binding = 6, std430) restrict readonly buffer Probes {
  59. vec4 data[];
  60. }
  61. probe_positions;
  62. layout(set = 0, binding = 7) uniform utexture3D grid;
  63. layout(set = 0, binding = 8) uniform texture2DArray albedo_tex;
  64. layout(set = 0, binding = 9) uniform texture2DArray emission_tex;
  65. layout(set = 0, binding = 10) uniform sampler linear_sampler;
  66. // Fragment action constants
  67. const uint FA_NONE = 0;
  68. const uint FA_SMOOTHEN_POSITION = 1;