PhysicalSkyComponentConfig.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 <AtomLyIntegration/CommonFeatures/SkyBox/PhysicalSkyComponentConfig.h>
  9. #include <AzCore/Serialization/SerializeContext.h>
  10. #include <AzCore/Serialization/EditContext.h>
  11. namespace AZ
  12. {
  13. namespace Render
  14. {
  15. void PhysicalSkyComponentConfig::Reflect(ReflectContext* context)
  16. {
  17. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  18. {
  19. serializeContext->Class<PhysicalSkyComponentConfig, ComponentConfig>()
  20. ->Version(3)
  21. ->Field("IntensityMode", &PhysicalSkyComponentConfig::m_intensityMode)
  22. ->Field("SkyIntensity", &PhysicalSkyComponentConfig::m_skyIntensity)
  23. ->Field("SunIntensity", &PhysicalSkyComponentConfig::m_sunIntensity)
  24. ->Field("Turbidity", &PhysicalSkyComponentConfig::m_turbidity)
  25. ->Field("SunRadiusFactor", &PhysicalSkyComponentConfig::m_sunRadiusFactor)
  26. ->Field("FogSettings", &PhysicalSkyComponentConfig::m_skyBoxFogSettings)
  27. ;
  28. }
  29. }
  30. const char* PhysicalSkyComponentConfig::GetIntensitySuffix() const
  31. {
  32. return PhotometricValue::GetTypeSuffix(m_intensityMode);
  33. }
  34. float PhysicalSkyComponentConfig::GetSunIntensityMin() const
  35. {
  36. switch (m_intensityMode)
  37. {
  38. case PhotometricUnit::Nit:
  39. return 0.1f;
  40. case PhotometricUnit::Ev100Luminance:
  41. return -4.0f;
  42. }
  43. return 0.0f;
  44. }
  45. float PhysicalSkyComponentConfig::GetSunIntensityMax() const
  46. {
  47. switch (m_intensityMode)
  48. {
  49. case PhotometricUnit::Nit:
  50. return 100'000.0f;
  51. case PhotometricUnit::Ev100Luminance:
  52. return 16.0f;
  53. }
  54. return 0.0f;
  55. }
  56. float PhysicalSkyComponentConfig::GetSkyIntensityMin() const
  57. {
  58. switch (m_intensityMode)
  59. {
  60. case PhotometricUnit::Nit:
  61. return 0.1f;
  62. case PhotometricUnit::Ev100Luminance:
  63. return -4.0f;
  64. }
  65. return 0.0f;
  66. }
  67. float PhysicalSkyComponentConfig::GetSkyIntensityMax() const
  68. {
  69. switch (m_intensityMode)
  70. {
  71. case PhotometricUnit::Nit:
  72. return 5000.0f;
  73. case PhotometricUnit::Ev100Luminance:
  74. return 11.0;
  75. }
  76. return 0.0f;
  77. }
  78. }
  79. }