TraditionalDeferredShading.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // Copyright (C) 2009-2019, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <shaders/glsl_cpp_common/Common.h>
  7. ANKI_BEGIN_NAMESPACE
  8. struct DeferredPointLightUniforms
  9. {
  10. // Use these to get the correct face UVs
  11. Vec2 m_inputTexUvScale;
  12. Vec2 m_inputTexUvOffset;
  13. Mat4 m_invViewProjMat;
  14. Vec3 m_camPos;
  15. F32 m_padding;
  16. Vec2 m_fbSize;
  17. Vec2 m_padding1;
  18. // Light props
  19. Vec3 m_position;
  20. F32 m_oneOverSquareRadius; // 1/radius^2
  21. Vec3 m_diffuseColor;
  22. F32 m_padding2;
  23. };
  24. struct DeferredSpotLightUniforms
  25. {
  26. // Use these to get the correct face UVs
  27. Vec2 m_inputTexUvScale;
  28. Vec2 m_inputTexUvOffset;
  29. Mat4 m_invViewProjMat;
  30. Vec3 m_camPos;
  31. F32 m_padding;
  32. Vec2 m_fbSize;
  33. Vec2 m_padding1;
  34. // Light props
  35. Vec3 m_position;
  36. F32 m_oneOverSquareRadius; // 1/radius^2
  37. Vec3 m_diffuseColor;
  38. F32 m_outerCos;
  39. Vec3 m_lightDir;
  40. F32 m_innerCos;
  41. };
  42. struct DeferredDirectionalLightUniforms
  43. {
  44. // Use these to get the correct face UVs
  45. Vec2 m_inputTexUvScale;
  46. Vec2 m_inputTexUvOffset;
  47. Mat4 m_invViewProjMat;
  48. Vec3 m_camPos;
  49. F32 m_padding;
  50. Vec2 m_fbSize;
  51. F32 m_near;
  52. F32 m_far;
  53. // Light props
  54. Vec3 m_diffuseColor;
  55. F32 m_padding2;
  56. Vec3 m_lightDir;
  57. F32 m_effectiveShadowDistance;
  58. Mat4 m_lightMatrix;
  59. };
  60. struct DeferredVertexUniforms
  61. {
  62. Mat4 m_mvp;
  63. };
  64. const UVec2 GBUFFER_RT0_BINDING = UVec2(0, 0);
  65. const UVec2 GBUFFER_RT1_BINDING = UVec2(0, 1);
  66. const UVec2 GBUFFER_RT2_BINDING = UVec2(0, 2);
  67. const UVec2 GBUFFER_DEPTH_BINDING = UVec2(0, 3);
  68. const UVec2 GBUFFER_SHADOW_ATLAS_BINDING = UVec2(0, 4);
  69. ANKI_END_NAMESPACE