From 5012d4432e762ba22ce8b250b560cef131c73076 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 17 Jul 2023 18:22:40 +0200 Subject: [PATCH] Add NvCloth for Linux --- Source/Engine/Physics/Actors/Cloth.cpp | 2 ++ .../Platforms/Linux/Binaries/ThirdParty/x64/libNvCloth.a | 3 +++ Source/ThirdParty/NvCloth/NvCloth.Build.cs | 1 + Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs | 8 ++++++++ 4 files changed, 14 insertions(+) create mode 100644 Source/Platforms/Linux/Binaries/ThirdParty/x64/libNvCloth.a diff --git a/Source/Engine/Physics/Actors/Cloth.cpp b/Source/Engine/Physics/Actors/Cloth.cpp index a7ab5fe0e..5dc53af8b 100644 --- a/Source/Engine/Physics/Actors/Cloth.cpp +++ b/Source/Engine/Physics/Actors/Cloth.cpp @@ -724,6 +724,7 @@ void Cloth::CalculateInvMasses(Array& invMasses) void Cloth::OnPreUpdate() { +#if WITH_CLOTH // Get current skinned mesh pose for the simulation of the non-kinematic vertices if (auto* animatedModel = Cast(GetParent())) { @@ -806,6 +807,7 @@ void Cloth::OnPreUpdate() PhysicsBackend::UnlockClothParticles(_cloth); } +#endif } void Cloth::OnPostUpdate() diff --git a/Source/Platforms/Linux/Binaries/ThirdParty/x64/libNvCloth.a b/Source/Platforms/Linux/Binaries/ThirdParty/x64/libNvCloth.a new file mode 100644 index 000000000..573dfb245 --- /dev/null +++ b/Source/Platforms/Linux/Binaries/ThirdParty/x64/libNvCloth.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6234ee8e0cea08be467f8d13994fee8b94dfa2ed2147460a3268dbe6cfeb87a6 +size 553518 diff --git a/Source/ThirdParty/NvCloth/NvCloth.Build.cs b/Source/ThirdParty/NvCloth/NvCloth.Build.cs index 3be1e903e..a28d619af 100644 --- a/Source/ThirdParty/NvCloth/NvCloth.Build.cs +++ b/Source/ThirdParty/NvCloth/NvCloth.Build.cs @@ -37,6 +37,7 @@ public class NvCloth : DepsModule case TargetPlatform.Android: case TargetPlatform.Mac: case TargetPlatform.iOS: + case TargetPlatform.Linux: libName = "NvCloth"; break; case TargetPlatform.Switch: diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs b/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs index b096eef24..6e565b94c 100644 --- a/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs +++ b/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs @@ -89,6 +89,9 @@ namespace Flax.Deps.Dependencies case TargetPlatform.iOS: Build(options, platform, TargetArchitecture.ARM64); break; + case TargetPlatform.Linux: + Build(options, platform, TargetArchitecture.x64); + break; } } @@ -157,6 +160,11 @@ namespace Flax.Deps.Dependencies cmakeName = "ios"; binariesPrefix = "lib"; break; + case TargetPlatform.Linux: + cmakeArgs += " -DTARGET_BUILD_PLATFORM=linux"; + cmakeName = "linux"; + binariesPrefix = "lib"; + break; default: throw new InvalidPlatformException(platform); } var cmakeFolder = Path.Combine(nvCloth, "compiler", "cmake", cmakeName);