瀏覽代碼

Add missing "SetProceduralGeometryMaterial" method to RayTracingFeatureProcessor (#18030)

Signed-off-by: Markus Prettner <[email protected]>
Markus Prettner 1 年之前
父節點
當前提交
ece50ceb59

+ 18 - 0
Gems/Atom/Feature/Common/Code/Source/RayTracing/RayTracingFeatureProcessor.cpp

@@ -207,6 +207,24 @@ namespace AZ
             m_proceduralGeometryInfoBufferNeedsUpdate = true;
         }
 
+        void RayTracingFeatureProcessor::SetProceduralGeometryMaterial(
+            const Uuid& uuid, const RayTracingFeatureProcessor::SubMeshMaterial& material)
+        {
+            if (!m_rayTracingEnabled)
+            {
+                return;
+            }
+
+            AZStd::unique_lock<AZStd::mutex> lock(m_mutex);
+
+            if (auto it = m_proceduralGeometryLookup.find(uuid); it != m_proceduralGeometryLookup.end())
+            {
+                ConvertMaterial(m_proceduralGeometryMaterialInfos[it->second], material);
+            }
+
+            m_materialInfoBufferNeedsUpdate = true;
+        }
+
         void RayTracingFeatureProcessor::RemoveProceduralGeometry(const Uuid& uuid)
         {
             if (!m_rayTracingEnabled)

+ 5 - 0
Gems/Atom/Feature/Common/Code/Source/RayTracing/RayTracingFeatureProcessor.h

@@ -282,6 +282,11 @@ namespace AZ
             //! used together with `GetBindlessBufferIndex()` to access per-instance geometry data.
             void SetProceduralGeometryLocalInstanceIndex(const Uuid& uuid, uint32_t localInstanceIndex);
 
+            //! Sets the material of a procedural geometry instance.
+            //! \param uuid The Uuid of the procedural geometry which must have been added with `AddProceduralGeometry` before.
+            //! \param material The material of the procedural geometry instance.
+            void SetProceduralGeometryMaterial(const Uuid& uuid, const SubMeshMaterial& material);
+
             //! Removes a procedural geometry instance from the ray tracing scene.
             //! \param uuid The Uuid of the procedrual geometry which must have been added with `AddProceduralGeometry` before.
             void RemoveProceduralGeometry(const Uuid& uuid);