Texture3dExampleComponent.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <RHI/BasicRHIComponent.h>
  10. #include <Atom/RPI.Public/Shader/ShaderResourceGroup.h>
  11. #include <Atom/RHI/BufferPool.h>
  12. #include <Atom/RHI/DrawItem.h>
  13. #include <Atom/RHI.Reflect/SamplerState.h>
  14. #include <AzCore/Component/TickBus.h>
  15. #include <Utils/ImGuiSidebar.h>
  16. namespace AtomSampleViewer
  17. {
  18. class Texture3dExampleComponent final
  19. : public BasicRHIComponent
  20. , public AZ::TickBus::Handler
  21. {
  22. public:
  23. AZ_COMPONENT(Texture3dExampleComponent, "{8E3D324C-65F8-47E1-89E8-7006308B9112}", BasicRHIComponent);
  24. static void Reflect(AZ::ReflectContext* context);
  25. Texture3dExampleComponent();
  26. ~Texture3dExampleComponent() = default;
  27. private:
  28. AZ_DISABLE_COPY(Texture3dExampleComponent);
  29. // AZ::Component
  30. void Activate() final;
  31. void Deactivate() final;
  32. // AZ::TickBus::Handler ...
  33. void OnTick(float deltaTime, AZ::ScriptTimePoint time) final;
  34. ImGuiSidebar m_imguiSidebar;
  35. AzFramework::WindowSize m_windowSize;
  36. AZ::RHI::ImageSubresourceLayout m_imageLayout;
  37. // Rendering resources
  38. AZ::RHI::Ptr<AZ::RHI::ImagePool> m_imagePool = nullptr;
  39. AZ::Data::Instance<AZ::RHI::Image> m_image = nullptr;
  40. AZ::RHI::Ptr<AZ::RHI::ImageView> m_imageView = nullptr;
  41. AZ::Data::Instance<AZ::RPI::ShaderResourceGroup> m_shaderResourceGroup = nullptr;
  42. AZ::RHI::ConstPtr<AZ::RHI::PipelineState> m_pipelineState = nullptr;
  43. AZ::RHI::GeometryView m_geometryView;
  44. // Shader Input indices
  45. AZ::RHI::ShaderInputImageIndex m_texture3dInputIndex;
  46. AZ::RHI::ShaderInputConstantIndex m_sliceIndexInputIndex;
  47. AZ::RHI::ShaderInputConstantIndex m_positionInputIndex;
  48. AZ::RHI::ShaderInputConstantIndex m_sizeInputIndex;
  49. int32_t m_sliceIndex = 0;
  50. };
  51. }