PrimaryNonRenderableVisibility.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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/Gr.h>
  7. #include <AnKi/Renderer/RendererObject.h>
  8. #include <AnKi/Shaders/Include/GpuSceneTypes.h>
  9. #include <AnKi/Renderer/Utils/Readback.h>
  10. namespace anki {
  11. /// @addtogroup renderer
  12. /// @{
  13. /// Contains some interesting visible scene components that will be used by various renderer systems.
  14. /// @memberof PrimaryNonRenderableVisibility
  15. class InterestingVisibleComponents
  16. {
  17. public:
  18. WeakArray<LightComponent*> m_shadowLights;
  19. WeakArray<ReflectionProbeComponent*> m_reflectionProbes;
  20. WeakArray<GlobalIlluminationProbeComponent*> m_globalIlluminationProbes;
  21. };
  22. /// Multiple passes for GPU visibility of non-renderable entities.
  23. class PrimaryNonRenderableVisibility : public RendererObject
  24. {
  25. public:
  26. Error init()
  27. {
  28. return Error::kNone;
  29. }
  30. void populateRenderGraph(RenderingContext& ctx);
  31. const InterestingVisibleComponents& getInterestingVisibleComponents() const
  32. {
  33. return m_runCtx.m_interestingComponents;
  34. }
  35. BufferHandle getVisibleIndicesBufferHandle(GpuSceneNonRenderableObjectType type) const
  36. {
  37. return m_runCtx.m_visibleIndicesHandles[type];
  38. }
  39. const BufferView& getVisibleIndicesBuffer(GpuSceneNonRenderableObjectType type) const
  40. {
  41. return m_runCtx.m_visibleIndicesBuffers[type];
  42. }
  43. private:
  44. Array<MultiframeReadbackToken, U32(GpuSceneNonRenderableObjectTypeWithFeedback::kCount)> m_readbacks;
  45. class
  46. {
  47. public:
  48. Array<BufferHandle, U32(GpuSceneNonRenderableObjectType::kCount)> m_visibleIndicesHandles;
  49. Array<BufferView, U32(GpuSceneNonRenderableObjectType::kCount)> m_visibleIndicesBuffers;
  50. /// Feedback from the GPU
  51. InterestingVisibleComponents m_interestingComponents;
  52. } m_runCtx;
  53. };
  54. /// @}
  55. } // end namespace anki