BsShadowRendering.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsRenderBeastPrerequisites.h"
  5. #include "BsModule.h"
  6. #include "BsMatrix4.h"
  7. #include "BsConvexVolume.h"
  8. namespace bs { namespace ct
  9. {
  10. /** @addtogroup RenderBeast
  11. * @{
  12. */
  13. // TODO - Define normal and omni vertex shaders and their params
  14. // TODO - Move renderable objects from RenderBeast into a separate object so I can pass them here?
  15. // - SceneInfo?
  16. /** Provides functionality for rendering shadow maps. */
  17. class ShadowRendering : public Module<ShadowRendering>
  18. {
  19. public:
  20. /**
  21. * Generates a frustum for a single cascade of a cascaded shadow map. Also outputs spherical bounds of the
  22. * split view frustum.
  23. *
  24. * @param[in] view View whose frustum to split.
  25. * @param[in] lightDir Direction of the light for which we're generating the shadow map.
  26. * @param[in] cascade Index of the cascade to generate the frustum for.
  27. * @param[in] numCascades Maximum number of cascades in the cascaded shadow map. Must be greater than zero.
  28. * @param[out] outBounds Spherical bounds of the split view frustum.
  29. * @return Convex volume covering the area of the split view frustum visible from the light.
  30. */
  31. static ConvexVolume getCSMSplitFrustum(const RendererView& view, const Vector3& lightDir, UINT32 cascade,
  32. UINT32 numCascades, Sphere& outBounds);
  33. /**
  34. * Finds the distance (along the view direction) of the frustum split for the specified index. Used for cascaded
  35. * shadow maps.
  36. *
  37. * @param[in] view View whose frustum to split.
  38. * @param[in] index Index of the split. 0 = near plane.
  39. * @param[in] numCascades Maximum number of cascades in the cascaded shadow map. Must be greater than zero
  40. * and greater or equal to @p index.
  41. * @return Distance to the split position along the view direction.
  42. */
  43. static float getCSMSplitDistance(const RendererView& view, UINT32 index, UINT32 numCascades);
  44. };
  45. /* @} */
  46. }}