cluster_data_inc.glsl 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #define CLUSTER_COUNTER_SHIFT 20
  2. #define CLUSTER_POINTER_MASK ((1 << CLUSTER_COUNTER_SHIFT) - 1)
  3. #define CLUSTER_COUNTER_MASK 0xfff
  4. struct LightData { //this structure needs to be as packed as possible
  5. vec3 position;
  6. float inv_radius;
  7. vec3 direction;
  8. float size;
  9. vec3 color;
  10. float attenuation;
  11. float cone_attenuation;
  12. float cone_angle;
  13. float specular_amount;
  14. bool shadow_enabled;
  15. vec4 atlas_rect; // rect in the shadow atlas
  16. mat4 shadow_matrix;
  17. float shadow_bias;
  18. float shadow_normal_bias;
  19. float transmittance_bias;
  20. float soft_shadow_size; // for spot, it's the size in uv coordinates of the light, for omni it's the span angle
  21. float soft_shadow_scale; // scales the shadow kernel for blurrier shadows
  22. uint mask;
  23. float shadow_volumetric_fog_fade;
  24. uint pad;
  25. vec4 projector_rect; //projector rect in srgb decal atlas
  26. };
  27. #define REFLECTION_AMBIENT_DISABLED 0
  28. #define REFLECTION_AMBIENT_ENVIRONMENT 1
  29. #define REFLECTION_AMBIENT_COLOR 2
  30. struct ReflectionData {
  31. vec3 box_extents;
  32. float index;
  33. vec3 box_offset;
  34. uint mask;
  35. vec3 ambient; // ambient color
  36. float intensity;
  37. bool exterior;
  38. bool box_project;
  39. uint ambient_mode;
  40. uint pad;
  41. //0-8 is intensity,8-9 is ambient, mode
  42. mat4 local_matrix; // up to here for spot and omni, rest is for directional
  43. // notes: for ambientblend, use distance to edge to blend between already existing global environment
  44. };
  45. struct DirectionalLightData {
  46. vec3 direction;
  47. float energy;
  48. vec3 color;
  49. float size;
  50. float specular;
  51. uint mask;
  52. float softshadow_angle;
  53. float soft_shadow_scale;
  54. bool blend_splits;
  55. bool shadow_enabled;
  56. float fade_from;
  57. float fade_to;
  58. uvec3 pad;
  59. float shadow_volumetric_fog_fade;
  60. vec4 shadow_bias;
  61. vec4 shadow_normal_bias;
  62. vec4 shadow_transmittance_bias;
  63. vec4 shadow_z_range;
  64. vec4 shadow_range_begin;
  65. vec4 shadow_split_offsets;
  66. mat4 shadow_matrix1;
  67. mat4 shadow_matrix2;
  68. mat4 shadow_matrix3;
  69. mat4 shadow_matrix4;
  70. vec4 shadow_color1;
  71. vec4 shadow_color2;
  72. vec4 shadow_color3;
  73. vec4 shadow_color4;
  74. vec2 uv_scale1;
  75. vec2 uv_scale2;
  76. vec2 uv_scale3;
  77. vec2 uv_scale4;
  78. };
  79. struct DecalData {
  80. mat4 xform; //to decal transform
  81. vec3 inv_extents;
  82. float albedo_mix;
  83. vec4 albedo_rect;
  84. vec4 normal_rect;
  85. vec4 orm_rect;
  86. vec4 emission_rect;
  87. vec4 modulate;
  88. float emission_energy;
  89. uint mask;
  90. float upper_fade;
  91. float lower_fade;
  92. mat3x4 normal_xform;
  93. vec3 normal;
  94. float normal_fade;
  95. };