AccelerationStructureBuilder.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright (C) 2009-present, 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 <AnKi/Renderer/RendererObject.h>
  7. namespace anki {
  8. /// @addtogroup renderer
  9. /// @{
  10. inline NumericCVar<F32>
  11. g_rayTracingExtendedFrustumDistanceCVar("R", "RayTracingExtendedFrustumDistance", 100.0f, 10.0f, 10000.0f,
  12. "Every object that its distance from the camera is bellow that value will take part in ray tracing");
  13. /// Build acceleration structures.
  14. class AccelerationStructureBuilder : public RendererObject
  15. {
  16. public:
  17. Error init()
  18. {
  19. return Error::kNone;
  20. }
  21. void populateRenderGraph(RenderingContext& ctx);
  22. AccelerationStructureHandle getAccelerationStructureHandle() const
  23. {
  24. return m_runCtx.m_tlasHandle;
  25. }
  26. void getVisibilityInfo(BufferHandle& handle, BufferView& buffer) const
  27. {
  28. handle = m_runCtx.m_visibilityHandle;
  29. buffer = m_runCtx.m_visibleRenderableIndicesBuff;
  30. }
  31. public:
  32. class
  33. {
  34. public:
  35. AccelerationStructurePtr m_tlas;
  36. AccelerationStructureHandle m_tlasHandle;
  37. BufferHandle m_visibilityHandle;
  38. BufferView m_visibleRenderableIndicesBuff;
  39. } m_runCtx;
  40. };
  41. /// @}
  42. } // namespace anki