فهرست منبع

Fix a physx cloth sim crash on linux (#17971) (#17976)

Signed-off-by: Nicholas Lawson <[email protected]>
Nicholas Lawson 1 سال پیش
والد
کامیت
8b011a9f0d
1فایلهای تغییر یافته به همراه5 افزوده شده و 2 حذف شده
  1. 5 2
      Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp

+ 5 - 2
Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp

@@ -9,6 +9,7 @@
 #include <AzCore/Interface/Interface.h>
 #include <AzCore/Console/IConsole.h>
 #include <AzCore/Math/PackedVector3.h>
+#include <AzCore/Math/PackedVector4.h>
 
 #include <AtomLyIntegration/CommonFeatures/Mesh/MeshComponentBus.h>
 #include <AtomLyIntegration/CommonFeatures/SkinnedMesh/SkinnedMeshOverrideBus.h>
@@ -552,7 +553,7 @@ namespace NvCloth
 
             MappedBuffer<AZ::PackedVector3f> destVertices(subMesh.GetSemanticBufferAssetView(positionSemantic), numVertices, AZ::RHI::Format::R32G32B32_FLOAT);
             MappedBuffer<AZ::PackedVector3f> destNormals(subMesh.GetSemanticBufferAssetView(normalSemantic), numVertices, AZ::RHI::Format::R32G32B32_FLOAT);
-            MappedBuffer<AZ::Vector4> destTangents(subMesh.GetSemanticBufferAssetView(tangentSemantic), numVertices, AZ::RHI::Format::R32G32B32A32_FLOAT);
+            MappedBuffer<AZ::PackedVector4f> destTangents(subMesh.GetSemanticBufferAssetView(tangentSemantic), numVertices, AZ::RHI::Format::R32G32B32A32_FLOAT);
             MappedBuffer<AZ::PackedVector3f> destBitangents(subMesh.GetSemanticBufferAssetView(bitangentSemantic), numVertices, AZ::RHI::Format::R32G32B32_FLOAT);
 
             auto* destVerticesBuffer = destVertices.GetBuffer();
@@ -590,7 +591,9 @@ namespace NvCloth
                 {
                     const AZ::Vector3& renderTangent = renderTangents[renderVertexIndex];
                     destTangentsBuffer[index].Set(
-                        renderTangent,
+                        renderTangent.GetX(),
+                        renderTangent.GetY(),
+                        renderTangent.GetZ(),
                         -1.0f); // Shader function ConstructTBN inverts w to change bitangent sign, but the bitangents passed are already corrected, so passing -1.0 to counteract.
                 }