2
0

ParallaxMappingExampleComponent.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0 OR MIT
  5. *
  6. */
  7. #include <ParallaxMappingExampleComponent.h>
  8. #include <Atom/Component/DebugCamera/ArcBallControllerComponent.h>
  9. #include <Atom/RPI.Public/RPISystemInterface.h>
  10. #include <Atom/RPI.Public/Scene.h>
  11. #include <Atom/RPI.Reflect/Asset/AssetUtils.h>
  12. #include <Automation/ScriptableImGui.h>
  13. #include <AzCore/Component/TransformBus.h>
  14. #include <RHI/BasicRHIComponent.h>
  15. namespace AtomSampleViewer
  16. {
  17. static const char* ParallaxEnableName = "parallax.useTexture";
  18. static const char* PdoEnableName = "parallax.pdo";
  19. static const char* ParallaxFactorName = "parallax.factor";
  20. static const char* ParallaxHeightOffsetName = "parallax.offset";
  21. static const char* ParallaxShowClippingName = "parallax.showClipping";
  22. static const char* ParallaxAlgorithmName = "parallax.algorithm";
  23. static const char* ParallaxQualityName = "parallax.quality";
  24. static const char* ParallaxUvIndexName = "parallax.textureMapUv";
  25. static const char* AmbientOcclusionUvIndexName = "occlusion.diffuseTextureMapUv";
  26. static const char* BaseColorUvIndexName = "baseColor.textureMapUv";
  27. static const char* NormalUvIndexName = "normal.textureMapUv";
  28. static const char* RoughnessUvIndexName = "roughness.textureMapUv";
  29. static const char* CenterUVName = "uv.center";
  30. static const char* TileUName = "uv.tileU";
  31. static const char* TileVName = "uv.tileV";
  32. static const char* OffsetUName = "uv.offsetU";
  33. static const char* OffsetVName = "uv.offsetV";
  34. static const char* RotationUVName = "uv.rotateDegrees";
  35. static const char* ScaleUVName = "uv.scale";
  36. // Must align with enum value in StandardPbr.materialtype
  37. static const char* ParallaxAlgorithmList[] =
  38. {
  39. "Basic", "Steep", "POM", "Relief", "ContactRefinement"
  40. };
  41. static const char* ParallaxQualityList[] =
  42. {
  43. "Low", "Medium", "High", "Ultra"
  44. };
  45. static const char* ParallaxUvSetList[] =
  46. {
  47. "UV0", "UV1"
  48. };
  49. void ParallaxMappingExampleComponent::Reflect(AZ::ReflectContext* context)
  50. {
  51. if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  52. {
  53. serializeContext->Class < ParallaxMappingExampleComponent, AZ::Component>()->Version(0);
  54. }
  55. }
  56. ParallaxMappingExampleComponent::ParallaxMappingExampleComponent()
  57. : m_imguiSidebar("@user@/ParallaxMappingExampleComponent/sidebar.xml")
  58. {
  59. }
  60. void ParallaxMappingExampleComponent::Activate()
  61. {
  62. // Asset
  63. m_planeAsset = AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::ModelAsset>("objects/plane.azmodel", AZ::RPI::AssetUtils::TraceLevel::Assert);
  64. m_boxAsset = AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::ModelAsset>("objects/cube.azmodel", AZ::RPI::AssetUtils::TraceLevel::Assert);
  65. m_parallaxMaterialAsset = AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::MaterialAsset>("testdata/materials/parallaxrock.azmaterial", AZ::RPI::AssetUtils::TraceLevel::Assert);
  66. m_defaultMaterialAsset = AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::MaterialAsset>("materials/defaultpbr.azmaterial", AZ::RPI::AssetUtils::TraceLevel::Assert);
  67. m_parallaxMaterial = AZ::RPI::Material::Create(m_parallaxMaterialAsset);
  68. m_defaultMaterial = AZ::RPI::Material::Create(m_defaultMaterialAsset);
  69. m_planeTransform = AZ::Transform::CreateUniformScale(5);
  70. m_planeHandle = LoadMesh(m_planeAsset, m_parallaxMaterial, m_planeTransform);
  71. m_boxHandle = LoadMesh(m_boxAsset, m_defaultMaterial, AZ::Transform::CreateIdentity());
  72. // Material index
  73. m_parallaxEnableIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxEnableName));
  74. m_parallaxFactorIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxFactorName));
  75. m_parallaxOffsetIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxHeightOffsetName));
  76. m_parallaxShowClippingIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxShowClippingName));
  77. m_parallaxAlgorithmIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxAlgorithmName));
  78. m_parallaxQualityIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxQualityName));
  79. m_parallaxUvIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxUvIndexName));
  80. m_pdoEnableIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(PdoEnableName));
  81. m_ambientOcclusionUvIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(AmbientOcclusionUvIndexName));
  82. m_baseColorUvIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(BaseColorUvIndexName));
  83. m_normalUvIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(NormalUvIndexName));
  84. m_roughnessUvIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(RoughnessUvIndexName));
  85. m_centerUVIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(CenterUVName));
  86. m_tileUIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(TileUName));
  87. m_tileVIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(TileVName));
  88. m_offsetUIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(OffsetUName));
  89. m_offsetVIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(OffsetVName));
  90. m_rotationUVIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(RotationUVName));
  91. m_scaleUVIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ScaleUVName));
  92. SaveCameraConfiguration();
  93. // Camera
  94. AZ::Debug::CameraControllerRequestBus::Event(
  95. GetCameraEntityId(),
  96. &AZ::Debug::CameraControllerRequestBus::Events::Enable,
  97. azrtti_typeid<AZ::Debug::ArcBallControllerComponent>());
  98. ConfigureCameraToLookDown();
  99. SetCameraConfiguration();
  100. // Light
  101. AZ::RPI::Scene* scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene().get();
  102. m_directionalLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DirectionalLightFeatureProcessorInterface>();
  103. CreateDirectionalLight();
  104. m_diskLightFeatureProcessor = scene->GetFeatureProcessor<AZ::Render::DiskLightFeatureProcessorInterface>();
  105. CreateDiskLight();
  106. m_imguiSidebar.Activate();
  107. AZ::TickBus::Handler::BusConnect();
  108. }
  109. void ParallaxMappingExampleComponent::Deactivate()
  110. {
  111. GetMeshFeatureProcessor()->ReleaseMesh(m_planeHandle);
  112. GetMeshFeatureProcessor()->ReleaseMesh(m_boxHandle);
  113. RestoreCameraConfiguration();
  114. AZ::Debug::CameraControllerRequestBus::Event(
  115. GetCameraEntityId(),
  116. &AZ::Debug::CameraControllerRequestBus::Events::Disable);
  117. m_directionalLightFeatureProcessor->ReleaseLight(m_directionalLightHandle);
  118. m_diskLightFeatureProcessor->ReleaseLight(m_diskLightHandle);
  119. m_imguiSidebar.Deactivate();
  120. AZ::TickBus::Handler::BusDisconnect();
  121. }
  122. void ParallaxMappingExampleComponent::ConfigureCameraToLookDown()
  123. {
  124. const float CameraDistance = 5.0f;
  125. const float CameraPitch = -0.8f;
  126. AZ::Debug::ArcBallControllerRequestBus::Event(GetCameraEntityId(), &AZ::Debug::ArcBallControllerRequestBus::Events::SetPitch, CameraPitch);
  127. AZ::Debug::ArcBallControllerRequestBus::Event(GetCameraEntityId(), &AZ::Debug::ArcBallControllerRequestBus::Events::SetDistance, CameraDistance);
  128. }
  129. AZ::Render::MeshFeatureProcessorInterface::MeshHandle ParallaxMappingExampleComponent::LoadMesh(
  130. AZ::Data::Asset<AZ::RPI::ModelAsset> modelAsset,
  131. AZ::Data::Instance<AZ::RPI::Material> material,
  132. AZ::Transform transform)
  133. {
  134. AZ::Render::MeshFeatureProcessorInterface::MeshHandle meshHandle = GetMeshFeatureProcessor()->AcquireMesh(AZ::Render::MeshHandleDescriptor{ modelAsset }, material);
  135. GetMeshFeatureProcessor()->SetTransform(meshHandle, transform);
  136. return meshHandle;
  137. }
  138. void ParallaxMappingExampleComponent::CreateDirectionalLight()
  139. {
  140. const AZ::Render::DirectionalLightFeatureProcessorInterface::LightHandle handle = m_directionalLightFeatureProcessor->AcquireLight();
  141. m_directionalLightFeatureProcessor->SetShadowmapSize(handle, AZ::Render::ShadowmapSize::Size2048);
  142. m_directionalLightFeatureProcessor->SetCascadeCount(handle, 4);
  143. m_directionalLightFeatureProcessor->SetShadowmapFrustumSplitSchemeRatio(handle, 0.5f);
  144. m_directionalLightFeatureProcessor->SetViewFrustumCorrectionEnabled(handle, true);
  145. m_directionalLightFeatureProcessor->SetShadowFilterMethod(handle, AZ::Render::ShadowFilterMethod::Esm);
  146. m_directionalLightFeatureProcessor->SetShadowBoundaryWidth(handle, 0.03f);
  147. m_directionalLightFeatureProcessor->SetPredictionSampleCount(handle, 8);
  148. m_directionalLightFeatureProcessor->SetFilteringSampleCount(handle, 32);
  149. m_directionalLightFeatureProcessor->SetGroundHeight(handle, 0.f);
  150. m_directionalLightHandle = handle;
  151. }
  152. void ParallaxMappingExampleComponent::CreateDiskLight()
  153. {
  154. AZ::Render::DiskLightFeatureProcessorInterface* const featureProcessor = m_diskLightFeatureProcessor;
  155. const AZ::Render::DiskLightFeatureProcessorInterface::LightHandle handle = featureProcessor->AcquireLight();
  156. featureProcessor->SetAttenuationRadius(handle, sqrtf(500.f / CutoffIntensity));
  157. featureProcessor->SetConeAngles(handle, AZ::DegToRad(22.5f) * ConeAngleInnerRatio, AZ::DegToRad(22.5f));
  158. featureProcessor->SetShadowsEnabled(handle, true);
  159. featureProcessor->SetShadowmapMaxResolution(handle, AZ::Render::ShadowmapSize::Size2048);
  160. m_diskLightHandle = handle;
  161. }
  162. void ParallaxMappingExampleComponent::OnTick(float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
  163. {
  164. if (m_lightAutoRotate)
  165. {
  166. m_lightRotationAngle = fmodf(m_lightRotationAngle + deltaTime, AZ::Constants::TwoPi);
  167. }
  168. const auto location = AZ::Vector3(
  169. 5 * sinf(m_lightRotationAngle),
  170. 5 * cosf(m_lightRotationAngle),
  171. 5);
  172. auto transform = AZ::Transform::CreateLookAt(
  173. location,
  174. AZ::Vector3::CreateZero());
  175. if (m_lightType)
  176. {
  177. AZ::Render::PhotometricColor<AZ::Render::PhotometricUnit::Lux> directionalLightColor(AZ::Color::CreateZero());
  178. AZ::Render::PhotometricColor<AZ::Render::PhotometricUnit::Candela> diskLightColor(AZ::Color::CreateOne() * 500.f);
  179. m_directionalLightFeatureProcessor->SetRgbIntensity(m_directionalLightHandle, directionalLightColor);
  180. m_diskLightFeatureProcessor->SetRgbIntensity(m_diskLightHandle, diskLightColor);
  181. }
  182. else
  183. {
  184. AZ::Render::PhotometricColor<AZ::Render::PhotometricUnit::Lux> directionalLightColor(AZ::Color::CreateOne() * 5.f);
  185. AZ::Render::PhotometricColor<AZ::Render::PhotometricUnit::Candela> diskLightColor(AZ::Color::CreateZero());
  186. m_directionalLightFeatureProcessor->SetRgbIntensity(m_directionalLightHandle, directionalLightColor);
  187. m_diskLightFeatureProcessor->SetRgbIntensity(m_diskLightHandle, diskLightColor);
  188. }
  189. m_diskLightFeatureProcessor->SetPosition(m_diskLightHandle, location);
  190. m_diskLightFeatureProcessor->SetDirection(m_diskLightHandle, transform.GetBasis(1));
  191. m_directionalLightFeatureProcessor->SetDirection(m_directionalLightHandle, transform.GetBasis(1));
  192. // Camera Configuration
  193. {
  194. Camera::Configuration config;
  195. Camera::CameraRequestBus::EventResult(
  196. config,
  197. GetCameraEntityId(),
  198. &Camera::CameraRequestBus::Events::GetCameraConfiguration);
  199. m_directionalLightFeatureProcessor->SetCameraConfiguration(
  200. m_directionalLightHandle,
  201. config);
  202. }
  203. // Camera Transform
  204. {
  205. transform = AZ::Transform::CreateIdentity();
  206. AZ::TransformBus::EventResult(
  207. transform,
  208. GetCameraEntityId(),
  209. &AZ::TransformBus::Events::GetWorldTM);
  210. m_directionalLightFeatureProcessor->SetCameraTransform(
  211. m_directionalLightHandle, transform);
  212. }
  213. // Plane Transform
  214. {
  215. m_planeTransform.SetRotation(AZ::Quaternion::CreateRotationZ(m_planeRotationAngle));
  216. GetMeshFeatureProcessor()->SetTransform(m_planeHandle, m_planeTransform);
  217. }
  218. DrawSidebar();
  219. }
  220. void ParallaxMappingExampleComponent::SetCameraConfiguration()
  221. {
  222. Camera::CameraRequestBus::Event(
  223. GetCameraEntityId(),
  224. &Camera::CameraRequestBus::Events::SetFarClipDistance,
  225. 20.f);
  226. Camera::CameraRequestBus::Event(
  227. GetCameraEntityId(),
  228. &Camera::CameraRequestBus::Events::SetFovRadians,
  229. AZ::Constants::QuarterPi);
  230. }
  231. void ParallaxMappingExampleComponent::SaveCameraConfiguration()
  232. {
  233. Camera::CameraRequestBus::EventResult(
  234. m_originalFarClipDistance,
  235. GetCameraEntityId(),
  236. &Camera::CameraRequestBus::Events::GetFarClipDistance);
  237. Camera::CameraRequestBus::EventResult(
  238. m_originalCameraFovRadians,
  239. GetCameraEntityId(),
  240. &Camera::CameraRequestBus::Events::GetFovRadians);
  241. }
  242. void ParallaxMappingExampleComponent::RestoreCameraConfiguration()
  243. {
  244. Camera::CameraRequestBus::Event(
  245. GetCameraEntityId(),
  246. &Camera::CameraRequestBus::Events::SetFarClipDistance,
  247. m_originalFarClipDistance);
  248. Camera::CameraRequestBus::Event(
  249. GetCameraEntityId(),
  250. &Camera::CameraRequestBus::Events::SetFovRadians,
  251. m_originalCameraFovRadians);
  252. }
  253. void ParallaxMappingExampleComponent::DrawSidebar()
  254. {
  255. if (m_imguiSidebar.Begin())
  256. {
  257. bool parallaxSettingChanged = false;
  258. bool planeUVChanged = false;
  259. ImGui::Spacing();
  260. {
  261. ScriptableImGui::ScopedNameContext context{ "Lighting" };
  262. ImGui::Text("Lighting");
  263. ImGui::Indent();
  264. {
  265. ScriptableImGui::RadioButton("Directional Light", &m_lightType, 0);
  266. ScriptableImGui::RadioButton("Spot Light", &m_lightType, 1);
  267. ScriptableImGui::Checkbox("Auto Rotation", &m_lightAutoRotate);
  268. ScriptableImGui::SliderAngle("Direction", &m_lightRotationAngle, 0, 360);
  269. }
  270. ImGui::Unindent();
  271. }
  272. ImGui::Separator();
  273. {
  274. ScriptableImGui::ScopedNameContext context{ "Parallax Setting" };
  275. ImGui::Text("Parallax Setting");
  276. ImGui::Indent();
  277. {
  278. if (ScriptableImGui::Checkbox("Enable Parallax", &m_parallaxEnable))
  279. {
  280. parallaxSettingChanged = true;
  281. m_parallaxMaterial->SetPropertyValue(m_parallaxEnableIndex, m_parallaxEnable);
  282. }
  283. if (m_parallaxEnable)
  284. {
  285. if (ScriptableImGui::Checkbox("Enable Pdo", &m_pdoEnable))
  286. {
  287. parallaxSettingChanged = true;
  288. m_parallaxMaterial->SetPropertyValue(m_pdoEnableIndex, m_pdoEnable);
  289. }
  290. if (ScriptableImGui::SliderFloat("Heightmap Scale", &m_parallaxFactor, 0.0f, 0.1f))
  291. {
  292. parallaxSettingChanged = true;
  293. m_parallaxMaterial->SetPropertyValue(m_parallaxFactorIndex, m_parallaxFactor);
  294. }
  295. if (ScriptableImGui::SliderFloat("Offset", &m_parallaxOffset, -0.1f, 0.1f))
  296. {
  297. parallaxSettingChanged = true;
  298. m_parallaxMaterial->SetPropertyValue(m_parallaxOffsetIndex, m_parallaxOffset);
  299. }
  300. if (ScriptableImGui::Checkbox("Show Clipping", &m_parallaxShowClipping))
  301. {
  302. parallaxSettingChanged = true;
  303. m_parallaxMaterial->SetPropertyValue(m_parallaxShowClippingIndex, m_parallaxShowClipping);
  304. }
  305. if (ScriptableImGui::Combo("Algorithm", &m_parallaxAlgorithm, ParallaxAlgorithmList, AZ_ARRAY_SIZE(ParallaxAlgorithmList)))
  306. {
  307. parallaxSettingChanged = true;
  308. m_parallaxMaterial->SetPropertyValue(m_parallaxAlgorithmIndex, static_cast<uint32_t>(m_parallaxAlgorithm));
  309. }
  310. if (ScriptableImGui::Combo("Quality", &m_parallaxQuality, ParallaxQualityList, AZ_ARRAY_SIZE(ParallaxQualityList)))
  311. {
  312. parallaxSettingChanged = true;
  313. m_parallaxMaterial->SetPropertyValue(m_parallaxQualityIndex, static_cast<uint32_t>(m_parallaxQuality));
  314. }
  315. if (ScriptableImGui::Combo("UV", &m_parallaxUv, ParallaxUvSetList, AZ_ARRAY_SIZE(ParallaxUvSetList)))
  316. {
  317. parallaxSettingChanged = true;
  318. m_parallaxMaterial->SetPropertyValue(m_parallaxUvIndex, static_cast<uint32_t>(m_parallaxUv));
  319. m_parallaxMaterial->SetPropertyValue(m_ambientOcclusionUvIndex, static_cast<uint32_t>(m_parallaxUv));
  320. m_parallaxMaterial->SetPropertyValue(m_baseColorUvIndex, static_cast<uint32_t>(m_parallaxUv));
  321. m_parallaxMaterial->SetPropertyValue(m_normalUvIndex, static_cast<uint32_t>(m_parallaxUv));
  322. m_parallaxMaterial->SetPropertyValue(m_roughnessUvIndex, static_cast<uint32_t>(m_parallaxUv));
  323. }
  324. }
  325. }
  326. ImGui::Unindent();
  327. }
  328. ImGui::Separator();
  329. {
  330. ScriptableImGui::ScopedNameContext context{ "Plane Setting" };
  331. ImGui::Text("Plane Setting");
  332. ImGui::Indent();
  333. {
  334. ScriptableImGui::SliderAngle("Rotation", &m_planeRotationAngle, 0, 360);
  335. bool centerUChanged = false;
  336. bool centerVChanged = false;
  337. bool tileUChanged = false;
  338. bool tileVChanged = false;
  339. bool offsetUChanged = false;
  340. bool offsetVChanged = false;
  341. bool rotationUVChanged = false;
  342. bool scaleChanged = false;
  343. centerUChanged = ScriptableImGui::SliderFloat("Center U", &m_planeCenterU, -1.f, 1.f);
  344. centerVChanged = ScriptableImGui::SliderFloat("Center V", &m_planeCenterV, -1.f, 1.f);
  345. if (centerUChanged || centerVChanged)
  346. {
  347. m_parallaxMaterial->SetPropertyValue(m_centerUVIndex, AZ::Vector2(m_planeCenterU, m_planeCenterV));
  348. }
  349. tileUChanged = ScriptableImGui::SliderFloat("Tile U", &m_planeTileU, 0.f, 2.f);
  350. if (tileUChanged)
  351. {
  352. m_parallaxMaterial->SetPropertyValue(m_tileUIndex, m_planeTileU);
  353. }
  354. tileVChanged = ScriptableImGui::SliderFloat("Tile V", &m_planeTileV, 0.f, 2.f);
  355. if (tileVChanged)
  356. {
  357. m_parallaxMaterial->SetPropertyValue(m_tileVIndex, m_planeTileV);
  358. }
  359. offsetUChanged = ScriptableImGui::SliderFloat("Offset U", &m_planeOffsetU, -1.f, 1.f);
  360. if (offsetUChanged)
  361. {
  362. m_parallaxMaterial->SetPropertyValue(m_offsetUIndex, m_planeOffsetU);
  363. }
  364. offsetVChanged = ScriptableImGui::SliderFloat("Offset V", &m_planeOffsetV, -1.f, 1.f);
  365. if (offsetVChanged)
  366. {
  367. m_parallaxMaterial->SetPropertyValue(m_offsetVIndex, m_planeOffsetV);
  368. }
  369. rotationUVChanged = ScriptableImGui::SliderFloat("Rotation UV", &m_planeRotateUV, -180.f, 180.f);
  370. if (rotationUVChanged)
  371. {
  372. m_parallaxMaterial->SetPropertyValue(m_rotationUVIndex, m_planeRotateUV);
  373. }
  374. scaleChanged = ScriptableImGui::SliderFloat("Scale UV", &m_planeScaleUV, 0.f, 2.f);
  375. if (scaleChanged)
  376. {
  377. m_parallaxMaterial->SetPropertyValue(m_scaleUVIndex, m_planeScaleUV);
  378. }
  379. planeUVChanged = centerUChanged || centerVChanged || tileUChanged || tileVChanged || offsetUChanged || offsetVChanged || rotationUVChanged || scaleChanged;
  380. }
  381. ImGui::Unindent();
  382. }
  383. m_imguiSidebar.End();
  384. if (parallaxSettingChanged || planeUVChanged)
  385. {
  386. m_parallaxMaterial->Compile();
  387. }
  388. }
  389. }
  390. }