RayTracingDebugEditorComponent.cpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #include <Debug/RayTracingDebugEditorComponent.h>
  9. namespace AZ::Render
  10. {
  11. void RayTracingDebugEditorComponent::Reflect(ReflectContext* context)
  12. {
  13. BaseClass::Reflect(context);
  14. if (auto* serializeContext{ azrtti_cast<SerializeContext*>(context) })
  15. {
  16. // clang-format off
  17. serializeContext->Class<RayTracingDebugEditorComponent, BaseClass>()
  18. ->Version(0)
  19. ;
  20. // clang-format on
  21. if (auto* editContext{ serializeContext->GetEditContext() })
  22. {
  23. // clang-format off
  24. editContext->Class<RayTracingDebugEditorComponent>("Debug Ray Tracing", "Controls for debugging ray tracing.")
  25. ->ClassElement(Edit::ClassElements::EditorData, "")
  26. ->Attribute(Edit::Attributes::Category, "Graphics/Debugging")
  27. ->Attribute(Edit::Attributes::Icon, "Icons/Components/Component_Placeholder.svg")
  28. ->Attribute(Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Component_Placeholder.svg")
  29. ->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("Level"))
  30. ->Attribute(Edit::Attributes::AutoExpand, true)
  31. ;
  32. editContext->Class<RayTracingDebugComponentController>("RayTracingDebugComponentController", "")
  33. ->ClassElement(Edit::ClassElements::EditorData, "")
  34. ->Attribute(Edit::Attributes::AutoExpand, true)
  35. ->DataElement(Edit::UIHandlers::Default, &RayTracingDebugComponentController::m_configuration, "Configuration", "")
  36. ->Attribute(Edit::Attributes::Visibility, Edit::PropertyVisibility::ShowChildrenOnly)
  37. ;
  38. editContext->Class<RayTracingDebugComponentConfig>("RayTracingDebugComponentConfig", "")
  39. ->ClassElement(Edit::ClassElements::EditorData, "")
  40. ->DataElement(Edit::UIHandlers::CheckBox, &RayTracingDebugComponentConfig::m_enabled, "Enable Ray Tracing Debugging", "Enable Ray Tracing Debugging.")
  41. ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::EntireTree)
  42. ->DataElement(Edit::UIHandlers::ComboBox, &RayTracingDebugComponentConfig::m_debugViewMode, "View mode", "What property to output to the view")
  43. ->EnumAttribute(RayTracingDebugViewMode::InstanceIndex, "Instance Index")
  44. ->EnumAttribute(RayTracingDebugViewMode::InstanceID, "Instance ID")
  45. ->EnumAttribute(RayTracingDebugViewMode::PrimitiveIndex, "Primitive Index")
  46. ->EnumAttribute(RayTracingDebugViewMode::Barycentrics, "Barycentric Coordinates")
  47. ->EnumAttribute(RayTracingDebugViewMode::Normals, "Normals")
  48. ->EnumAttribute(RayTracingDebugViewMode::UVs, "UV Coordinates")
  49. ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
  50. ->Attribute(Edit::Attributes::Visibility, &RayTracingDebugComponentConfig::GetEnabled)
  51. ;
  52. // clang-format on
  53. }
  54. }
  55. }
  56. u32 RayTracingDebugEditorComponent::OnConfigurationChanged()
  57. {
  58. m_controller.OnConfigurationChanged();
  59. return Edit::PropertyRefreshLevels::AttributesAndValues;
  60. }
  61. } // namespace AZ::Render