IsCommon.glsl 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Contains common structures for IS
  2. // Plane
  3. struct Plane
  4. {
  5. vec4 normalOffset;
  6. };
  7. // Contains the plane grid
  8. struct Tilegrid
  9. {
  10. Plane planesX[TILES_X_COUNT - 1];
  11. Plane planesY[TILES_Y_COUNT - 1];
  12. Plane planesNear[TILES_COUNT];
  13. Plane planesFar[TILES_COUNT];
  14. };
  15. // Representation of a tile
  16. struct Tile
  17. {
  18. uvec4 lightsCount;
  19. };
  20. struct PointLightIndices
  21. {
  22. uvec4 indices[MAX_POINT_LIGHTS_PER_TILE / 4];
  23. };
  24. struct SpotLightIndices
  25. {
  26. uvec4 indices[MAX_SPOT_LIGHTS_PER_TILE / 4];
  27. uvec4 indicesTex[MAX_SPOT_TEX_LIGHTS_PER_TILE / 4];
  28. };
  29. // The base of all lights
  30. struct Light
  31. {
  32. vec4 posRadius; // xyz: Light pos in eye space. w: The -1/radius
  33. vec4 diffuseColorShadowmapId; // xyz: diff color, w: shadowmap tex ID
  34. vec4 specularColorTexId; // xyz: spec color, w: diffuse tex ID
  35. };
  36. // Point light
  37. #define PointLight Light
  38. // Spot light
  39. struct SpotLight
  40. {
  41. Light lightBase;
  42. vec4 lightDir;
  43. vec4 outerCosInnerCos;
  44. vec4 extendPoints[4]; // The positions of the 4 camera points
  45. };
  46. // Spot light with texture
  47. struct SpotTexLight
  48. {
  49. SpotLight spotLightBase;
  50. mat4 texProjectionMat;
  51. };
  52. // A container of many lights
  53. struct Lights
  54. {
  55. uvec4 count; // x: points, z:
  56. PointLight pointLights[MAX_POINT_LIGHTS];
  57. SpotLight spotLights[MAX_SPOT_LIGHTS];
  58. SpotTexLight spotTexLights[MAX_SPOT_TEX_LIGHTS];
  59. };