IsCommon.glsl 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #if __VERSION__ > 430
  20. uint pointLightIndices[MAX_POINT_LIGHTS_PER_TILE];
  21. uint spotLightIndices[MAX_SPOT_LIGHTS_PER_TILE];
  22. uint spotTexLightndices[MAX_SPOT_TEX_LIGHTS_PER_TILE];
  23. #else
  24. uvec4 pointLightIndices[MAX_POINT_LIGHTS_PER_TILE / 4];
  25. uvec4 spotLightIndices[MAX_SPOT_LIGHTS_PER_TILE / 4];
  26. uvec4 spotTexLightIndices[MAX_SPOT_TEX_LIGHTS_PER_TILE / 4];
  27. #endif
  28. };
  29. // The base of all lights
  30. struct Light
  31. {
  32. vec4 posRadius; // xyz: Light pos in eye space. w: The 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. };