Cleaning up NvCloth gem. Removed any reference to LmbrCentral and legacy renderer since now it uses Atom. (#154)
- Removed any usage of LmbCentral and legacy renderer from NvCloth gem. - Cloth rule can only be added to Mesh groups, not allowed in Actor groups anymore. - Removed ActorAssetHelper since actors now share the mesh model format and therefore they also use MeshAssetHelper. - Updated NvCloth gem.json file with the fields from the template. - Updated cloth chicken asset to not convert axis.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
"rules": [
|
||||
{
|
||||
"$type": "MetaDataRule",
|
||||
"metaData": "AdjustActor -actorID $(ACTORID) -name \"chicken\"\r\nActorSetCollisionMeshes -actorID $(ACTORID) -lod 0 -nodeList \"\"\r\nAdjustActor -actorID $(ACTORID) -nodesExcludedFromBounds \"\" -nodeAction \"select\"\r\nAdjustActor -actorID $(ACTORID) -nodeAction \"replace\" -attachmentNodes \"\"\r\n"
|
||||
"metaData": "AdjustActor -actorID $(ACTORID) -name \"chicken\"\nActorSetCollisionMeshes -actorID $(ACTORID) -lod 0 -nodeList \"\"\nAdjustActor -actorID $(ACTORID) -nodesExcludedFromBounds \"\" -nodeAction \"select\"\nAdjustActor -actorID $(ACTORID) -nodeAction \"replace\" -attachmentNodes \"\"\nAdjustActor -actorID $(ACTORID) -mirrorSetup \"\"\n"
|
||||
},
|
||||
{
|
||||
"$type": "ActorPhysicsSetupRule",
|
||||
@@ -50,15 +50,15 @@
|
||||
{
|
||||
"Visible": true,
|
||||
"Position": [
|
||||
-0.03810190036892891,
|
||||
0.0,
|
||||
-0.03132440149784088
|
||||
0.08189810067415238,
|
||||
-2.4586914726398847e-9,
|
||||
-0.4713243842124939
|
||||
],
|
||||
"propertyVisibilityFlags": 248
|
||||
},
|
||||
{
|
||||
"$type": "SphereShapeConfiguration",
|
||||
"Radius": 0.16069939732551576
|
||||
"Radius": 0.2406993955373764
|
||||
}
|
||||
]
|
||||
]
|
||||
@@ -82,14 +82,38 @@
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "def_c_feather2_joint",
|
||||
"shapes": [
|
||||
[
|
||||
{
|
||||
"Visible": true,
|
||||
"Position": [
|
||||
0.06151500344276428,
|
||||
0.1300000101327896,
|
||||
7.729977369308472e-8
|
||||
],
|
||||
"Rotation": [
|
||||
0.0,
|
||||
0.7071062922477722,
|
||||
0.0,
|
||||
0.7071072459220886
|
||||
],
|
||||
"propertyVisibilityFlags": 248
|
||||
},
|
||||
{
|
||||
"$type": "CapsuleShapeConfiguration",
|
||||
"Height": 0.5730299949645996,
|
||||
"Radius": 0.06151498109102249
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "CoordinateSystemRule"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -99,47 +123,94 @@
|
||||
"name": "chicken",
|
||||
"nodeSelectionList": {
|
||||
"selectedNodes": [
|
||||
{},
|
||||
"RootNode",
|
||||
"RootNode.chicken_skeleton",
|
||||
"RootNode.chicken_feet_skin",
|
||||
"RootNode.chicken_eyes_skin",
|
||||
"RootNode.chicken_body_skin",
|
||||
"RootNode.chicken_mohawk",
|
||||
"RootNode.chicken_skeleton.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint",
|
||||
"RootNode.chicken_feet_skin.SkinWeight_0",
|
||||
"RootNode.chicken_feet_skin.map1",
|
||||
"RootNode.chicken_feet_skin.chicken_body_mat",
|
||||
"RootNode.chicken_eyes_skin.SkinWeight_0",
|
||||
"RootNode.chicken_eyes_skin.uvSet1",
|
||||
"RootNode.chicken_eyes_skin.chicken_eye_mat",
|
||||
"RootNode.chicken_body_skin.SkinWeight_0",
|
||||
"RootNode.chicken_body_skin.map1",
|
||||
"RootNode.chicken_body_skin.chicken_body_mat",
|
||||
"RootNode.chicken_mohawk.SkinWeight_0",
|
||||
"RootNode.chicken_mohawk.colorSet1",
|
||||
"RootNode.chicken_mohawk.map1",
|
||||
"RootNode.chicken_mohawk.mohawkMat",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.def_l_lwrLeg_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.def_r_lwrLeg_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_l_wing1_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_r_wing1_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.def_l_lwrLeg_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.def_l_lwrLeg_joint.def_l_foot_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.def_r_lwrLeg_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.def_r_lwrLeg_joint.def_r_foot_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_tail1_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_l_wing1_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_l_wing1_joint.def_l_wing2_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_r_wing1_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_r_wing1_joint.def_r_wing2_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.def_l_lwrLeg_joint.def_l_foot_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.def_l_lwrLeg_joint.def_l_foot_joint.def_l_ball_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.def_r_lwrLeg_joint.def_r_foot_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.def_r_lwrLeg_joint.def_r_foot_joint.def_r_ball_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_tail1_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_tail1_joint.def_c_tail2_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_l_wing1_joint.def_l_wing2_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_l_wing1_joint.def_l_wing2_joint.def_l_wing_end",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_r_wing1_joint.def_r_wing2_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_r_wing1_joint.def_r_wing2_joint.def_r_wing_end",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_l_uprLeg_joint.def_l_lwrLeg_joint.def_l_foot_joint.def_l_ball_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_r_uprLeg_joint.def_r_lwrLeg_joint.def_r_foot_joint.def_r_ball_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_tail1_joint.def_c_tail2_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_mouth_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_l_wing1_joint.def_l_wing2_joint.def_l_wing_end.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_r_wing1_joint.def_r_wing2_joint.def_r_wing_end.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_mouth_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_mouth_joint.def_c_mouth_end",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.def_c_waddle2_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_mouth_joint.def_c_mouth_end.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.def_c_waddle2_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.def_c_waddle2_joint.def_c_waddle3_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint.def_c_feather4_joint",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.def_c_waddle2_joint.def_c_waddle3_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.def_c_waddle2_joint.def_c_waddle3_joint.def_c_waddle_end",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint.def_c_feather4_joint.def_c_feather_end"
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint.def_c_feather4_joint.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint.def_c_feather4_joint.def_c_feather_end",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_waddle1_joint.def_c_waddle2_joint.def_c_waddle3_joint.def_c_waddle_end.transform",
|
||||
"RootNode.chicken_skeleton.def_c_chickenRoot_joint.def_c_spine1_joint.def_c_spine2_joint.def_c_spine3_joint.def_c_spine_end.def_c_neck_joint.def_c_head_joint.def_c_feather1_joint.def_c_feather2_joint.def_c_feather3_joint.def_c_feather4_joint.def_c_feather_end.transform"
|
||||
]
|
||||
},
|
||||
"rules": {
|
||||
@@ -154,9 +225,6 @@
|
||||
{
|
||||
"$type": "MaterialRule"
|
||||
},
|
||||
{
|
||||
"$type": "CoordinateSystemRule"
|
||||
},
|
||||
{
|
||||
"$type": "ClothRule",
|
||||
"meshNodeName": "RootNode.chicken_mohawk",
|
||||
|
||||
@@ -30,8 +30,12 @@ ly_add_target(
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
3rdParty::NvCloth
|
||||
Gem::LmbrCentral
|
||||
Gem::AtomLyIntegration_CommonFeatures.Static
|
||||
# CryCommon required for 'gEnv->IsDedicated()'.
|
||||
# Because of this the module will need CrySystemEventBus to initialize gEnv
|
||||
# and tests targets will need to fake gEnv. To be removed when there is
|
||||
# an AZ replacement for asking if the game is running on a server or not.
|
||||
Legacy::CryCommon
|
||||
Gem::AtomLyIntegration_CommonFeatures.Public
|
||||
PRIVATE
|
||||
Gem::EMotionFXStaticLib
|
||||
)
|
||||
@@ -50,10 +54,9 @@ ly_add_target(
|
||||
PUBLIC
|
||||
AZ::AzCore
|
||||
PRIVATE
|
||||
Legacy::CryCommon
|
||||
Gem::NvCloth.Static
|
||||
RUNTIME_DEPENDENCIES
|
||||
Gem::LmbrCentral
|
||||
Gem::AtomLyIntegration_CommonFeatures
|
||||
)
|
||||
|
||||
if(PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
@@ -76,8 +79,6 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
Gem::NvCloth.Static
|
||||
AZ::AzToolsFramework
|
||||
AZ::SceneCore
|
||||
PRIVATE
|
||||
Gem::EMotionFXStaticLib
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
@@ -95,10 +96,9 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
NVCLOTH_EDITOR
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
Legacy::CryCommon
|
||||
Gem::NvCloth.Editor.Static
|
||||
RUNTIME_DEPENDENCIES
|
||||
Gem::LmbrCentral.Editor
|
||||
Gem::AtomLyIntegration_CommonFeatures.Editor
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -118,7 +118,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
Source
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
Legacy::CryCommon
|
||||
AZ::AzTestShared
|
||||
AZ::AzTest
|
||||
Gem::NvCloth.Static
|
||||
@@ -126,7 +125,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
Gem::EMotionFX.Tests.Static
|
||||
RUNTIME_DEPENDENCIES
|
||||
Gem::EMotionFX
|
||||
Gem::LmbrCentral
|
||||
)
|
||||
ly_add_googletest(
|
||||
NAME Gem::NvCloth.Tests
|
||||
@@ -148,7 +146,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
NVCLOTH_EDITOR
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
Legacy::CryCommon
|
||||
AZ::AzTestShared
|
||||
AZ::AzTest
|
||||
AZ::AzToolsFrameworkTestCommon
|
||||
@@ -157,7 +154,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
Gem::EMotionFX.Tests.Static
|
||||
RUNTIME_DEPENDENCIES
|
||||
Gem::EMotionFX.Editor
|
||||
Gem::LmbrCentral.Editor
|
||||
)
|
||||
ly_add_googletest(
|
||||
NAME Gem::NvCloth.Editor.Tests
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
|
||||
#include <AzFramework/Viewport/ViewportColors.h>
|
||||
#include <LmbrCentral/Geometry/GeometrySystemComponentBus.h>
|
||||
|
||||
#include <Components/ClothComponentMesh/ClothDebugDisplay.h>
|
||||
#include <Components/ClothComponentMesh/ActorClothColliders.h>
|
||||
@@ -285,29 +284,11 @@ namespace NvCloth
|
||||
AzFramework::DebugDisplayRequests& debugDisplay,
|
||||
float radius, float height,
|
||||
const AZ::Transform& transform,
|
||||
const AZ::Color& color)
|
||||
[[maybe_unused]] const AZ::Color& color)
|
||||
{
|
||||
debugDisplay.PushMatrix(transform);
|
||||
const float heightStraightSection = AZStd::max(AZ::Constants::FloatEpsilon, height - 2.0f * radius);
|
||||
|
||||
AZStd::vector<AZ::Vector3> capsuleVertexBuffer;
|
||||
AZStd::vector<AZ::u32> capsuleIndexBuffer;
|
||||
AZStd::vector<AZ::Vector3> capsuleLineBuffer;
|
||||
const AZ::u32 sides = 16;
|
||||
const AZ::u32 capSegments = 8;
|
||||
|
||||
LmbrCentral::CapsuleGeometrySystemRequestBus::Broadcast(
|
||||
&LmbrCentral::CapsuleGeometrySystemRequestBus::Events::GenerateCapsuleMesh,
|
||||
radius,
|
||||
height,
|
||||
sides, capSegments,
|
||||
capsuleVertexBuffer,
|
||||
capsuleIndexBuffer,
|
||||
capsuleLineBuffer
|
||||
);
|
||||
|
||||
debugDisplay.DrawTrianglesIndexed(capsuleVertexBuffer, capsuleIndexBuffer, color);
|
||||
debugDisplay.DrawLines(capsuleLineBuffer, AzFramework::ViewportColors::WireColor);
|
||||
|
||||
debugDisplay.PopMatrix();
|
||||
debugDisplay.SetColor(AzFramework::ViewportColors::WireColor);
|
||||
debugDisplay.DrawWireCapsule(transform.GetTranslation(), transform.GetBasisZ(), radius, heightStraightSection);
|
||||
}
|
||||
} // namespace NvCloth
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <Editor/EditorSystemComponent.h>
|
||||
#include <Components/EditorClothComponent.h>
|
||||
#include <Pipeline/SceneAPIExt/ClothRuleBehavior.h>
|
||||
#include <Pipeline/RCExt/CgfClothExporter.h>
|
||||
#endif //NVCLOTH_EDITOR
|
||||
|
||||
namespace NvCloth
|
||||
@@ -59,7 +58,6 @@ namespace NvCloth
|
||||
EditorSystemComponent::CreateDescriptor(),
|
||||
EditorClothComponent::CreateDescriptor(),
|
||||
Pipeline::ClothRuleBehavior::CreateDescriptor(),
|
||||
Pipeline::CgfClothExporter::CreateDescriptor(),
|
||||
#endif //NVCLOTH_EDITOR
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzToolsFramework/Debug/TraceContext.h>
|
||||
|
||||
#include <Cry_Geo.h> // Needed for CGFContent.h
|
||||
#include <CGFContent.h>
|
||||
#include <AzCore/Math/MathUtils.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
|
||||
#include <SceneAPI/SceneCore/Containers/Scene.h>
|
||||
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
|
||||
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshVertexColorData.h>
|
||||
#include <SceneAPI/SceneCore/DataTypes/Rules/IClothRule.h>
|
||||
|
||||
#include <RC/ResourceCompilerScene/Common/CommonExportContexts.h>
|
||||
|
||||
#include <Pipeline/RCExt/CgfClothExporter.h>
|
||||
|
||||
namespace NvCloth
|
||||
{
|
||||
namespace Pipeline
|
||||
{
|
||||
namespace
|
||||
{
|
||||
// Index for the Vertex color stream that contains the cloth inverse masses.
|
||||
const int ClothVertexBufferStreamIndex = 1;
|
||||
}
|
||||
|
||||
CgfClothExporter::CgfClothExporter()
|
||||
{
|
||||
// Binding the processing functions so when exporters call
|
||||
// SceneAPI::Events::Process<Context>() these functions will
|
||||
// get called if their Context was used.
|
||||
BindToCall(&CgfClothExporter::ProcessMeshNodeContext);
|
||||
BindToCall(&CgfClothExporter::ProcessContainerContext);
|
||||
}
|
||||
|
||||
void CgfClothExporter::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serializeContext)
|
||||
{
|
||||
serializeContext->Class<CgfClothExporter, AZ::SceneAPI::SceneCore::RCExportingComponent>()->Version(1);
|
||||
}
|
||||
}
|
||||
|
||||
AZ::SceneAPI::Events::ProcessingResult CgfClothExporter::ProcessContainerContext(AZ::RC::ContainerExportContext& context) const
|
||||
{
|
||||
if (!context.m_group.GetRuleContainerConst().ContainsRuleOfType<AZ::SceneAPI::DataTypes::IClothRule>())
|
||||
{
|
||||
return AZ::SceneAPI::Events::ProcessingResult::Ignored;
|
||||
}
|
||||
|
||||
if (context.m_phase == AZ::RC::Phase::Finalizing)
|
||||
{
|
||||
if (context.m_container.GetExportInfo()->bMergeAllNodes)
|
||||
{
|
||||
AZ_TracePrintf(AZ::SceneAPI::Utilities::ErrorWindow,
|
||||
"Mesh group '%s' has cloth rules and trying to merge all nodes.",
|
||||
context.m_group.GetName().c_str());
|
||||
return AZ::SceneAPI::Events::ProcessingResult::Failure;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the current mesh group contains a cloth rule it should not merge all the nodes.
|
||||
context.m_container.GetExportInfo()->bMergeAllNodes = false;
|
||||
}
|
||||
|
||||
return AZ::SceneAPI::Events::ProcessingResult::Success;
|
||||
}
|
||||
|
||||
AZ::SceneAPI::Events::ProcessingResult CgfClothExporter::ProcessMeshNodeContext(AZ::RC::MeshNodeExportContext& context) const
|
||||
{
|
||||
if (context.m_phase != AZ::RC::Phase::Filling)
|
||||
{
|
||||
return AZ::SceneAPI::Events::ProcessingResult::Ignored;
|
||||
}
|
||||
|
||||
AZStd::vector<AZ::Color> clothData =
|
||||
AZ::SceneAPI::DataTypes::IClothRule::FindClothData(
|
||||
context.m_scene.GetGraph(),
|
||||
context.m_nodeIndex,
|
||||
static_cast<size_t>(context.m_mesh.GetVertexCount()),
|
||||
context.m_group.GetRuleContainerConst());
|
||||
|
||||
if (!clothData.empty())
|
||||
{
|
||||
const int numVertices = context.m_mesh.GetVertexCount();
|
||||
|
||||
// Allocate and get the vertex color stream for cloth
|
||||
context.m_mesh.ReallocStream(CMesh::COLORS, ClothVertexBufferStreamIndex, numVertices);
|
||||
auto meshColorStream = context.m_mesh.GetStreamPtr<SMeshColor>(CMesh::COLORS, ClothVertexBufferStreamIndex);
|
||||
AZ_Assert(meshColorStream, "Mesh color stream is invalid");
|
||||
|
||||
for (int i = 0; i < numVertices; ++i)
|
||||
{
|
||||
const auto& clothVertexData = clothData[i];
|
||||
meshColorStream[i] = SMeshColor(
|
||||
clothVertexData.GetR8(),
|
||||
clothVertexData.GetG8(),
|
||||
clothVertexData.GetB8(),
|
||||
clothVertexData.GetA8());
|
||||
}
|
||||
}
|
||||
|
||||
return AZ::SceneAPI::Events::ProcessingResult::Success;
|
||||
}
|
||||
} // namespace Pipeline
|
||||
} // namespace NvCloth
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <SceneAPI/SceneCore/Components/RCExportingComponent.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace RC
|
||||
{
|
||||
struct MeshNodeExportContext;
|
||||
struct ContainerExportContext;
|
||||
}
|
||||
}
|
||||
|
||||
namespace NvCloth
|
||||
{
|
||||
namespace Pipeline
|
||||
{
|
||||
//! This class processes the Scene graph to export cloth data into CGF.
|
||||
class CgfClothExporter
|
||||
: public AZ::SceneAPI::SceneCore::RCExportingComponent
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(CgfClothExporter, "{3D7287BB-1109-4220-AC44-AEBA59E03FFF}", AZ::SceneAPI::SceneCore::RCExportingComponent);
|
||||
|
||||
CgfClothExporter();
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
//! Process call at CGF Container level.
|
||||
//! This function gets called once per Mesh Group from CGF Group Exporter when it's processing meshes.
|
||||
AZ::SceneAPI::Events::ProcessingResult ProcessContainerContext(AZ::RC::ContainerExportContext& context) const;
|
||||
|
||||
//! Process call at Mesh Node level.
|
||||
//! This function gets called once per Mesh Node inside a Mesh Group from CGF Group Exporter when it's processing meshes.
|
||||
AZ::SceneAPI::Events::ProcessingResult ProcessMeshNodeContext(AZ::RC::MeshNodeExportContext& context) const;
|
||||
};
|
||||
} // namespace Pipeline
|
||||
} // namespace NvCloth
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <SceneAPI/SceneCore/Containers/Utilities/Filters.h>
|
||||
|
||||
#include <SceneAPI/SceneCore/DataTypes/Groups/IMeshGroup.h>
|
||||
#include <EMotionFX/Pipeline/SceneAPIExt/Groups/IActorGroup.h>
|
||||
|
||||
#include <Pipeline/SceneAPIExt/ClothRuleBehavior.h>
|
||||
#include <Pipeline/SceneAPIExt/ClothRule.h>
|
||||
@@ -100,9 +99,8 @@ namespace NvCloth
|
||||
|
||||
bool ClothRuleBehavior::IsValidGroupType(const AZ::SceneAPI::DataTypes::ISceneNodeGroup& group) const
|
||||
{
|
||||
// Cloth rules are available in Mesh and Actor Groups
|
||||
return group.RTTI_IsTypeOf(AZ::SceneAPI::DataTypes::IMeshGroup::TYPEINFO_Uuid())
|
||||
|| group.RTTI_IsTypeOf(EMotionFX::Pipeline::Group::IActorGroup::TYPEINFO_Uuid());
|
||||
// Cloth rules are available in Mesh Groups
|
||||
return group.RTTI_IsTypeOf(AZ::SceneAPI::DataTypes::IMeshGroup::TYPEINFO_Uuid());
|
||||
}
|
||||
|
||||
bool ClothRuleBehavior::UpdateClothRules(AZ::SceneAPI::Containers::Scene& scene)
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ISystem.h>
|
||||
#include <IConsole.h>
|
||||
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
|
||||
@@ -1,229 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Integration/ActorComponentBus.h>
|
||||
|
||||
// Needed to access the Mesh information inside Actor.
|
||||
#include <EMotionFX/Source/Node.h>
|
||||
#include <EMotionFX/Source/Mesh.h>
|
||||
#include <EMotionFX/Source/SubMesh.h>
|
||||
#include <EMotionFX/Source/ActorInstance.h>
|
||||
|
||||
#include <Utils/ActorAssetHelper.h>
|
||||
|
||||
namespace NvCloth
|
||||
{
|
||||
ActorAssetHelper::ActorAssetHelper(AZ::EntityId entityId)
|
||||
: AssetHelper(entityId)
|
||||
{
|
||||
}
|
||||
|
||||
void ActorAssetHelper::GatherClothMeshNodes(MeshNodeList& meshNodes)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = nullptr;
|
||||
EMotionFX::Integration::ActorComponentRequestBus::EventResult(
|
||||
actorInstance, m_entityId, &EMotionFX::Integration::ActorComponentRequestBus::Events::GetActorInstance);
|
||||
if (!actorInstance)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const EMotionFX::Actor* actor = actorInstance->GetActor();
|
||||
if (!actor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32 numNodes = actor->GetNumNodes();
|
||||
const uint32 numLODs = actor->GetNumLODLevels();
|
||||
|
||||
for (uint32 lodLevel = 0; lodLevel < numLODs; ++lodLevel)
|
||||
{
|
||||
for (uint32 nodeIndex = 0; nodeIndex < numNodes; ++nodeIndex)
|
||||
{
|
||||
const EMotionFX::Mesh* mesh = actor->GetMesh(lodLevel, nodeIndex);
|
||||
if (!mesh)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const bool hasClothData = (mesh->FindOriginalVertexData(EMotionFX::Mesh::ATTRIB_CLOTH_DATA) != nullptr);
|
||||
if (hasClothData)
|
||||
{
|
||||
const EMotionFX::Node* node = actor->GetSkeleton()->GetNode(nodeIndex);
|
||||
AZ_Assert(node, "Invalid node %u in actor '%s'", nodeIndex, actor->GetFileNameString().c_str());
|
||||
meshNodes.push_back(node->GetNameString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ActorAssetHelper::ObtainClothMeshNodeInfo(
|
||||
const AZStd::string& meshNode,
|
||||
MeshNodeInfo& meshNodeInfo,
|
||||
MeshClothInfo& meshClothInfo)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth);
|
||||
|
||||
EMotionFX::ActorInstance* actorInstance = nullptr;
|
||||
EMotionFX::Integration::ActorComponentRequestBus::EventResult(
|
||||
actorInstance, m_entityId, &EMotionFX::Integration::ActorComponentRequestBus::Events::GetActorInstance);
|
||||
if (!actorInstance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const EMotionFX::Actor* actor = actorInstance->GetActor();
|
||||
if (!actor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint32 numNodes = actor->GetNumNodes();
|
||||
const uint32 numLODs = actor->GetNumLODLevels();
|
||||
|
||||
const EMotionFX::Mesh* emfxMesh = nullptr;
|
||||
uint32 meshFirstPrimitiveIndex = 0;
|
||||
|
||||
// Find the render data of the mesh node
|
||||
for (uint32 lodLevel = 0; lodLevel < numLODs; ++lodLevel)
|
||||
{
|
||||
meshFirstPrimitiveIndex = 0;
|
||||
|
||||
for (uint32 nodeIndex = 0; nodeIndex < numNodes; ++nodeIndex)
|
||||
{
|
||||
const EMotionFX::Mesh* mesh = actor->GetMesh(lodLevel, nodeIndex);
|
||||
if (!mesh || mesh->GetIsCollisionMesh())
|
||||
{
|
||||
// Skip invalid and collision meshes.
|
||||
continue;
|
||||
}
|
||||
|
||||
const EMotionFX::Node* node = actor->GetSkeleton()->GetNode(nodeIndex);
|
||||
if (meshNode != node->GetNameString())
|
||||
{
|
||||
// Skip. Increase the index of all primitives of the mesh we're skipping.
|
||||
meshFirstPrimitiveIndex += mesh->GetNumSubMeshes();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Mesh found, save the lod in mesh info
|
||||
meshNodeInfo.m_lodLevel = lodLevel;
|
||||
emfxMesh = mesh;
|
||||
break;
|
||||
}
|
||||
|
||||
if (emfxMesh)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool infoObtained = false;
|
||||
|
||||
if (emfxMesh)
|
||||
{
|
||||
bool dataCopied = CopyDataFromEMotionFXMesh(*emfxMesh, meshClothInfo);
|
||||
|
||||
if (dataCopied)
|
||||
{
|
||||
const uint32 numSubMeshes = emfxMesh->GetNumSubMeshes();
|
||||
for (uint32 subMeshIndex = 0; subMeshIndex < numSubMeshes; ++subMeshIndex)
|
||||
{
|
||||
const EMotionFX::SubMesh* emfxSubMesh = emfxMesh->GetSubMesh(subMeshIndex);
|
||||
|
||||
MeshNodeInfo::SubMesh subMesh;
|
||||
subMesh.m_primitiveIndex = static_cast<int>(meshFirstPrimitiveIndex + subMeshIndex);
|
||||
subMesh.m_verticesFirstIndex = emfxSubMesh->GetStartVertex();
|
||||
subMesh.m_numVertices = emfxSubMesh->GetNumVertices();
|
||||
subMesh.m_indicesFirstIndex = emfxSubMesh->GetStartIndex();
|
||||
subMesh.m_numIndices = emfxSubMesh->GetNumIndices();
|
||||
|
||||
meshNodeInfo.m_subMeshes.push_back(subMesh);
|
||||
}
|
||||
|
||||
infoObtained = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Error("ActorAssetHelper", false, "Failed to extract data from node %s in actor %s",
|
||||
meshNode.c_str(), actor->GetFileNameString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return infoObtained;
|
||||
}
|
||||
|
||||
bool ActorAssetHelper::CopyDataFromEMotionFXMesh(
|
||||
const EMotionFX::Mesh& emfxMesh,
|
||||
MeshClothInfo& meshClothInfo)
|
||||
{
|
||||
const int numVertices = emfxMesh.GetNumVertices();
|
||||
const int numIndices = emfxMesh.GetNumIndices();
|
||||
if (numVertices == 0 || numIndices == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint32* sourceIndices = emfxMesh.GetIndices();
|
||||
const AZ::Vector3* sourcePositions = static_cast<AZ::Vector3*>(emfxMesh.FindOriginalVertexData(EMotionFX::Mesh::ATTRIB_POSITIONS));
|
||||
const AZ::u32* sourceClothData = static_cast<AZ::u32*>(emfxMesh.FindOriginalVertexData(EMotionFX::Mesh::ATTRIB_CLOTH_DATA));
|
||||
const AZ::Vector2* sourceUVs = static_cast<AZ::Vector2*>(emfxMesh.FindOriginalVertexData(EMotionFX::Mesh::ATTRIB_UVCOORDS, 0)); // first UV set
|
||||
|
||||
if (!sourceIndices || !sourcePositions || !sourceClothData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const SimUVType uvZero(0.0f, 0.0f);
|
||||
|
||||
meshClothInfo.m_particles.resize_no_construct(numVertices);
|
||||
meshClothInfo.m_uvs.resize_no_construct(numVertices);
|
||||
meshClothInfo.m_motionConstraints.resize_no_construct(numVertices);
|
||||
meshClothInfo.m_backstopData.resize_no_construct(numVertices);
|
||||
for (int index = 0; index < numVertices; ++index)
|
||||
{
|
||||
AZ::Color clothVertexData;
|
||||
clothVertexData.FromU32(sourceClothData[index]);
|
||||
|
||||
const float inverseMass = clothVertexData.GetR();
|
||||
const float motionConstraint = clothVertexData.GetG();
|
||||
const float backstopRadius = clothVertexData.GetA();
|
||||
const float backstopOffset = ConvertBackstopOffset(clothVertexData.GetB());
|
||||
|
||||
meshClothInfo.m_particles[index].Set(
|
||||
sourcePositions[index],
|
||||
inverseMass);
|
||||
|
||||
meshClothInfo.m_motionConstraints[index] = motionConstraint;
|
||||
meshClothInfo.m_backstopData[index].Set(backstopOffset, backstopRadius);
|
||||
|
||||
meshClothInfo.m_uvs[index] = (sourceUVs) ? SimUVType(sourceUVs[index].GetX(), sourceUVs[index].GetY()) : uvZero;
|
||||
}
|
||||
|
||||
meshClothInfo.m_indices.resize_no_construct(numIndices);
|
||||
// Fast copy when SimIndexType is the same size as the EMFX indices type.
|
||||
if constexpr (sizeof(SimIndexType) == sizeof(uint32))
|
||||
{
|
||||
memcpy(meshClothInfo.m_indices.data(), sourceIndices, numIndices * sizeof(SimIndexType));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int index = 0; index < numIndices; ++index)
|
||||
{
|
||||
meshClothInfo.m_indices[index] = static_cast<SimIndexType>(sourceIndices[index]);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace NvCloth
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Utils/AssetHelper.h>
|
||||
|
||||
namespace EMotionFX
|
||||
{
|
||||
class Mesh;
|
||||
}
|
||||
|
||||
namespace NvCloth
|
||||
{
|
||||
//! Helper class to obtain cloth information from an Actor Asset.
|
||||
class ActorAssetHelper
|
||||
: public AssetHelper
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(ActorAssetHelper, "{3246EAC6-595F-4AFB-BA10-44EB0B824398}", AssetHelper);
|
||||
|
||||
explicit ActorAssetHelper(AZ::EntityId entityId);
|
||||
|
||||
// AssetHelper overrides ...
|
||||
void GatherClothMeshNodes(MeshNodeList& meshNodes) override;
|
||||
bool ObtainClothMeshNodeInfo(
|
||||
const AZStd::string& meshNode,
|
||||
MeshNodeInfo& meshNodeInfo,
|
||||
MeshClothInfo& meshClothInfo) override;
|
||||
bool DoesSupportSkinnedAnimation() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
bool CopyDataFromEMotionFXMesh(
|
||||
const EMotionFX::Mesh& emfxMesh,
|
||||
MeshClothInfo& meshClothInfo);
|
||||
};
|
||||
} // namespace NvCloth
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include <Utils/MeshAssetHelper.h>
|
||||
|
||||
|
||||
namespace NvCloth
|
||||
{
|
||||
const int InvalidIndex = -1;
|
||||
|
||||
@@ -88,9 +88,6 @@ namespace NvCloth
|
||||
MeshNodeInfo& meshNodeInfo,
|
||||
MeshClothInfo& meshClothInfo) = 0;
|
||||
|
||||
//! Returns whether the asset has support for skinned animation or not.
|
||||
virtual bool DoesSupportSkinnedAnimation() const = 0;
|
||||
|
||||
protected:
|
||||
static float ConvertBackstopOffset(float backstopOffset);
|
||||
|
||||
|
||||
@@ -14,17 +14,11 @@
|
||||
|
||||
#include <Utils/MeshAssetHelper.h>
|
||||
|
||||
#include <Integration/ActorComponentBus.h>
|
||||
|
||||
namespace NvCloth
|
||||
{
|
||||
MeshAssetHelper::MeshAssetHelper(AZ::EntityId entityId)
|
||||
: AssetHelper(entityId)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = nullptr;
|
||||
EMotionFX::Integration::ActorComponentRequestBus::EventResult(
|
||||
actorInstance, entityId, &EMotionFX::Integration::ActorComponentRequestBus::Events::GetActorInstance);
|
||||
m_supportSkinnedAnimation = actorInstance != nullptr;
|
||||
}
|
||||
|
||||
void MeshAssetHelper::GatherClothMeshNodes(MeshNodeList& meshNodes)
|
||||
|
||||
@@ -33,16 +33,10 @@ namespace NvCloth
|
||||
const AZStd::string& meshNode,
|
||||
MeshNodeInfo& meshNodeInfo,
|
||||
MeshClothInfo& meshClothInfo) override;
|
||||
bool DoesSupportSkinnedAnimation() const override
|
||||
{
|
||||
return m_supportSkinnedAnimation;
|
||||
}
|
||||
|
||||
private:
|
||||
bool CopyDataFromMeshes(
|
||||
const AZStd::vector<const AZ::RPI::ModelLodAsset::Mesh*>& meshes,
|
||||
MeshClothInfo& meshClothInfo);
|
||||
|
||||
bool m_supportSkinnedAnimation = false;
|
||||
};
|
||||
} // namespace NvCloth
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <Components/ClothComponentMesh/ClothComponentMesh.h>
|
||||
|
||||
#include <UnitTestHelper.h>
|
||||
#include <CryRenderMeshStub.h>
|
||||
#include <ActorHelper.h>
|
||||
#include <Integration/Components/ActorComponent.h>
|
||||
|
||||
@@ -465,14 +464,15 @@ namespace UnitTest
|
||||
AZ::ScriptTimePoint(AZStd::chrono::system_clock::now()));
|
||||
}
|
||||
|
||||
/*
|
||||
CryRenderMeshStub renderMesh(MeshVertices);
|
||||
|
||||
/*LmbrCentral::MeshModificationNotificationBus::Event(
|
||||
LmbrCentral::MeshModificationNotificationBus::Event(
|
||||
m_actorComponent->GetEntityId(),
|
||||
&LmbrCentral::MeshModificationNotificationBus::Events::ModifyMesh,
|
||||
LodLevel,
|
||||
0,
|
||||
&renderMesh);*/
|
||||
&renderMesh);
|
||||
|
||||
const AZStd::vector<NvCloth::SimParticleFormat>& clothParticles = clothComponentMesh.GetRenderData().m_particles;
|
||||
const AZStd::vector<Vec3>& renderMeshPositions = renderMesh.m_positions;
|
||||
@@ -482,5 +482,6 @@ namespace UnitTest
|
||||
{
|
||||
EXPECT_THAT(LYVec3ToAZVec3(renderMeshPositions[i]), IsCloseTolerance(clothParticles[i].GetAsVector3(), Tolerance));
|
||||
}
|
||||
*/
|
||||
}
|
||||
} // namespace UnitTest
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <IRenderer.h>
|
||||
#include <MathConversion.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
class CryRenderMeshStub
|
||||
: public IRenderMesh
|
||||
{
|
||||
public:
|
||||
explicit CryRenderMeshStub(const AZStd::vector<AZ::Vector3>& vertices)
|
||||
{
|
||||
m_positions.reserve(vertices.size());
|
||||
for (const auto& vertex : vertices)
|
||||
{
|
||||
m_positions.emplace_back(AZVec3ToLYVec3(vertex));
|
||||
}
|
||||
}
|
||||
|
||||
int GetNumVerts() const override
|
||||
{
|
||||
return static_cast<int>(m_positions.size());
|
||||
}
|
||||
|
||||
byte* GetPosPtr(int32& nStride, uint32 /*nFlags*/) override
|
||||
{
|
||||
nStride = sizeof(Vec3);
|
||||
return reinterpret_cast<byte*>(m_positions.data());
|
||||
}
|
||||
|
||||
AZStd::vector<Vec3> m_positions;
|
||||
|
||||
// ----------------------------------------
|
||||
// IRenderMesh unused functions ...
|
||||
void AddRef() override {}
|
||||
int Release() override { return 0; }
|
||||
bool CanRender() override { return false; }
|
||||
const char* GetTypeName() override { return ""; }
|
||||
const char* GetSourceName() const override { return ""; }
|
||||
int GetIndicesCount() override { return 0; }
|
||||
int GetVerticesCount() override { return 0; }
|
||||
AZ::Vertex::Format GetVertexFormat() override { return {}; }
|
||||
ERenderMeshType GetMeshType() override { return eRMT_Dynamic; }
|
||||
float GetGeometricMeanFaceArea() const override { return 0.0f; }
|
||||
bool CheckUpdate(uint32 /*nStreamMask*/) override { return false; }
|
||||
int GetStreamStride(int /*nStream*/) const override { return 0; }
|
||||
const uintptr_t GetVBStream(int /*nStream*/) const override { return 0; }
|
||||
const uintptr_t GetIBStream() const override { return 0; }
|
||||
int GetNumInds() const override { return 0; }
|
||||
const eRenderPrimitiveType GetPrimitiveType() const override { return static_cast<eRenderPrimitiveType>(0); }
|
||||
void SetSkinned(bool /*bSkinned*/ = true) override {}
|
||||
uint GetSkinningWeightCount() const override { return 0; }
|
||||
size_t SetMesh(CMesh& /*mesh*/, int /*nSecColorsSetOffset*/, uint32 /*flags*/, bool /*requiresLock*/) override { return 0; }
|
||||
void CopyTo(IRenderMesh* /*pDst*/, int /*nAppendVtx*/ = 0, bool /*bDynamic*/ = false, bool /*fullCopy*/ = true) override {}
|
||||
void SetSkinningDataVegetation(struct SMeshBoneMapping_uint8* /*pBoneMapping*/) override {}
|
||||
void SetSkinningDataCharacter(CMesh& /*mesh*/, struct SMeshBoneMapping_uint16* /*pBoneMapping*/, struct SMeshBoneMapping_uint16* /*pExtraBoneMapping*/) override {}
|
||||
IIndexedMesh* GetIndexedMesh(IIndexedMesh* /*pIdxMesh*/ = 0) override { return nullptr; }
|
||||
int GetRenderChunksCount(_smart_ptr<IMaterial> /*pMat*/, int& /*nRenderTrisCount*/) override { return 0; }
|
||||
IRenderMesh* GenerateMorphWeights() override { return nullptr; }
|
||||
IRenderMesh* GetMorphBuddy() override { return nullptr; }
|
||||
void SetMorphBuddy(IRenderMesh* /*pMorph*/) override {}
|
||||
bool UpdateVertices(const void* /*pVertBuffer*/, int /*nVertCount*/, int /*nOffset*/, int /*nStream*/, uint32 /*copyFlags*/, bool /*requiresLock*/ = true) override { return false; }
|
||||
bool UpdateIndices(const vtx_idx* /*pNewInds*/, int /*nInds*/, int /*nOffsInd*/, uint32 /*copyFlags*/, bool /*requiresLock*/ = true) override { return false; }
|
||||
void SetCustomTexID(int /*nCustomTID*/) override {}
|
||||
void SetChunk(int /*nIndex*/, CRenderChunk& /*chunk*/) override {}
|
||||
void SetChunk(_smart_ptr<IMaterial> /*pNewMat*/, int /*nFirstVertId*/, int /*nVertCount*/, int /*nFirstIndexId*/, int /*nIndexCount*/, float /*texelAreaDensity*/, const AZ::Vertex::Format& /*vertexFormat*/, int /*nMatID*/ = 0) override {}
|
||||
void SetRenderChunks(CRenderChunk* /*pChunksArray*/, int /*nCount*/, bool /*bSubObjectChunks*/) override {}
|
||||
void GenerateQTangents() override {}
|
||||
void CreateChunksSkinned() override {}
|
||||
void NextDrawSkinned() override {}
|
||||
IRenderMesh* GetVertexContainer() override { return nullptr; }
|
||||
void SetVertexContainer(IRenderMesh* /*pBuf*/) override {}
|
||||
TRenderChunkArray m_chunk;
|
||||
TRenderChunkArray& GetChunks() override { return m_chunk; }
|
||||
TRenderChunkArray& GetChunksSkinned() override { return m_chunk; }
|
||||
TRenderChunkArray& GetChunksSubObjects() override { return m_chunk; }
|
||||
void SetBBox(const Vec3& /*vBoxMin*/, const Vec3& /*vBoxMax*/) override {}
|
||||
void GetBBox(Vec3& /*vBoxMin*/, Vec3& /*vBoxMax*/) override {}
|
||||
void UpdateBBoxFromMesh() override {}
|
||||
uint32* GetPhysVertexMap() override { return nullptr; }
|
||||
bool IsEmpty() override { return false; }
|
||||
byte* GetPosPtrNoCache(int32& /*nStride*/, uint32 /*nFlags*/) override { return nullptr; }
|
||||
byte* GetColorPtr(int32& /*nStride*/, uint32 /*nFlags*/) override { return nullptr; }
|
||||
byte* GetNormPtr(int32& /*nStride*/, uint32 /*nFlags*/) override { return nullptr; }
|
||||
byte* GetUVPtrNoCache(int32& /*nStride*/, uint32 /*nFlags*/, uint32 /*uvSetIndex*/ = 0) override { return nullptr; }
|
||||
byte* GetUVPtr(int32& /*nStride*/, uint32 /*nFlags*/, uint32 /*uvSetIndex*/ = 0) override { return nullptr; }
|
||||
byte* GetTangentPtr(int32& /*nStride*/, uint32 /*nFlags*/) override { return nullptr; }
|
||||
byte* GetQTangentPtr(int32& /*nStride*/, uint32 /*nFlags*/) override { return nullptr; }
|
||||
byte* GetHWSkinPtr(int32& /*nStride*/, uint32 /*nFlags*/, bool /*remapped*/ = false) override { return nullptr; }
|
||||
byte* GetVelocityPtr(int32& /*nStride*/, uint32 /*nFlags*/) override { return nullptr; }
|
||||
void UnlockStream(int /*nStream*/) override {}
|
||||
void UnlockIndexStream() override {}
|
||||
vtx_idx* GetIndexPtr(uint32 /*nFlags*/, int32 /*nOffset*/ = 0) override { return nullptr; }
|
||||
const PodArray<std::pair<int, int> >* GetTrisForPosition(const Vec3& /*vPos*/, _smart_ptr<IMaterial> /*pMaterial*/) override { return nullptr; }
|
||||
float GetExtent(EGeomForm /*eForm*/) override { return 0.0f; }
|
||||
void GetRandomPos(PosNorm& /*ran*/, EGeomForm /*eForm*/, SSkinningData const* /*pSkinning*/ = NULL) override {}
|
||||
void Render(const struct SRendParams& /*rParams*/, CRenderObject* /*pObj*/, _smart_ptr<IMaterial> /*pMaterial*/, const SRenderingPassInfo& /*passInfo*/, bool /*bSkinned*/ = false) override {}
|
||||
void Render(CRenderObject* /*pObj*/, const SRenderingPassInfo& /*passInfo*/, const SRendItemSorter& /*rendItemSorter*/) override {}
|
||||
void AddRenderElements(_smart_ptr<IMaterial> /*pIMatInfo*/, CRenderObject* /*pObj*/, const SRenderingPassInfo& /*passInfo*/, int /*nSortId*/ = EFSLIST_GENERAL, int /*nAW*/ = 1) override {}
|
||||
void AddRE(_smart_ptr<IMaterial> /*pMaterial*/, CRenderObject* /*pObj*/, IShader* /*pEf*/, const SRenderingPassInfo& /*passInfo*/, int /*nList*/, int /*nAW*/, const SRendItemSorter& /*rendItemSorter*/) override {}
|
||||
void SetREUserData(float* /*pfCustomData*/, float /*fFogScale*/ = 0, float /*fAlpha*/ = 1) override {}
|
||||
void DebugDraw(const struct SGeometryDebugDrawInfo& /*info*/, uint32 /*nVisibleChunksMask*/ = ~0, float /*fExtrdueScale*/ = 0.01f) override {}
|
||||
size_t GetMemoryUsage(ICrySizer* /*pSizer*/, EMemoryUsageArgument /*nType*/) const override { return 0; }
|
||||
void GetMemoryUsage(ICrySizer* /*pSizer*/) const override {}
|
||||
int GetAllocatedBytes(bool /*bVideoMem*/) const override { return 0; }
|
||||
float GetAverageTrisNumPerChunk(_smart_ptr<IMaterial> /*pMat*/) override { return 0.0f; }
|
||||
int GetTextureMemoryUsage(const _smart_ptr<IMaterial> /*pMaterial*/, ICrySizer* /*pSizer*/ = NULL, bool /*bStreamedIn*/ = true) const override { return 0; }
|
||||
void KeepSysMesh(bool /*keep*/) override {}
|
||||
void UnKeepSysMesh() override {}
|
||||
void SetMeshLod(int /*nLod*/) override {}
|
||||
void LockForThreadAccess() override {}
|
||||
void UnLockForThreadAccess() override {}
|
||||
volatile int* SetAsyncUpdateState(void) override { return nullptr; }
|
||||
void CreateRemappedBoneIndicesPair(const DynArray<JointIdType>& /*arrRemapTable*/, const uint /*pairGuid*/) override {}
|
||||
void ReleaseRemappedBoneIndicesPair(const uint /*pairGuid*/) override {}
|
||||
void OffsetPosition(const Vec3& /*delta*/) override {}
|
||||
};
|
||||
} // namespace UnitTest
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <Editor/EditorSystemComponent.h>
|
||||
#include <Components/EditorClothComponent.h>
|
||||
#include <Pipeline/SceneAPIExt/ClothRuleBehavior.h>
|
||||
#include <Pipeline/RCExt/CgfClothExporter.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
@@ -80,7 +79,6 @@ namespace UnitTest
|
||||
NvCloth::EditorSystemComponent::CreateDescriptor(),
|
||||
NvCloth::EditorClothComponent::CreateDescriptor(),
|
||||
NvCloth::Pipeline::ClothRuleBehavior::CreateDescriptor(),
|
||||
NvCloth::Pipeline::CgfClothExporter::CreateDescriptor(),
|
||||
});
|
||||
|
||||
AddRequiredComponents({
|
||||
|
||||
@@ -108,7 +108,6 @@ namespace UnitTest
|
||||
|
||||
EXPECT_TRUE(assetHelper.get() != nullptr);
|
||||
EXPECT_TRUE(azrtti_cast<NvCloth::MeshAssetHelper*>(assetHelper.get()) != nullptr);
|
||||
EXPECT_FALSE(assetHelper->DoesSupportSkinnedAnimation());
|
||||
}
|
||||
|
||||
TEST_F(NvClothMeshAssetHelper, MeshAssetHelper_CreateAssetHelperWithActor_ReturnsValidMeshAssetHelper)
|
||||
@@ -124,21 +123,6 @@ namespace UnitTest
|
||||
|
||||
EXPECT_TRUE(assetHelper.get() != nullptr);
|
||||
EXPECT_TRUE(azrtti_cast<NvCloth::MeshAssetHelper*>(assetHelper.get()) != nullptr);
|
||||
EXPECT_TRUE(assetHelper->DoesSupportSkinnedAnimation());
|
||||
}
|
||||
|
||||
TEST_F(NvClothMeshAssetHelper, MeshAssetHelper_DoesSupportSkinnedAnimation_ReturnsTrue)
|
||||
{
|
||||
{
|
||||
auto actor = AZStd::make_unique<ActorHelper>("actor_test");
|
||||
actor->FinishSetup();
|
||||
|
||||
m_actorComponent->SetActorAsset(CreateAssetFromActor(AZStd::move(actor)));
|
||||
}
|
||||
|
||||
AZStd::unique_ptr<NvCloth::AssetHelper> assetHelper = NvCloth::AssetHelper::CreateAssetHelper(m_actorComponent->GetEntityId());
|
||||
|
||||
EXPECT_TRUE(assetHelper->DoesSupportSkinnedAnimation());
|
||||
}
|
||||
|
||||
TEST_F(NvClothMeshAssetHelper, MeshAssetHelper_GatherClothMeshNodesWithEmptyActor_ReturnsEmptyInfo)
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#
|
||||
|
||||
set(FILES
|
||||
Source/Pipeline/RCExt/CgfClothExporter.h
|
||||
Source/Pipeline/RCExt/CgfClothExporter.cpp
|
||||
Source/Pipeline/SceneAPIExt/ClothRule.h
|
||||
Source/Pipeline/SceneAPIExt/ClothRule.cpp
|
||||
Source/Pipeline/SceneAPIExt/ClothRuleBehavior.h
|
||||
|
||||
@@ -51,6 +51,4 @@ set(FILES
|
||||
Source/Utils/AssetHelper.cpp
|
||||
Source/Utils/MeshAssetHelper.cpp
|
||||
Source/Utils/MeshAssetHelper.h
|
||||
Source/Utils/ActorAssetHelper.cpp
|
||||
Source/Utils/ActorAssetHelper.h
|
||||
)
|
||||
|
||||
@@ -18,7 +18,6 @@ set(FILES
|
||||
Tests/ActorHelper.cpp
|
||||
Tests/TriangleInputHelper.h
|
||||
Tests/TriangleInputHelper.cpp
|
||||
Tests/CryRenderMeshStub.h
|
||||
Tests/System/ClothSystemTest.cpp
|
||||
Tests/System/ClothTest.cpp
|
||||
Tests/System/FabricCookerTest.cpp
|
||||
|
||||
+5
-42
@@ -1,45 +1,8 @@
|
||||
{
|
||||
"gem_name": "NvCloth",
|
||||
"GemFormatVersion": 4,
|
||||
"Uuid": "6ab53783d9f54c9e97a15ad729e7c182",
|
||||
"Name": "NvCloth",
|
||||
"DisplayName": "NVIDIA Cloth [PREVIEW]",
|
||||
"Version": "0.1.0",
|
||||
"LinkType": "Dynamic",
|
||||
"Summary": "Provides the functionality needed to add cloth simulation.",
|
||||
"Tags": ["Physics"],
|
||||
"IconPath": "preview.png",
|
||||
"Modules": [
|
||||
{
|
||||
"Type": "GameModule"
|
||||
},
|
||||
{
|
||||
"Name": "Editor",
|
||||
"Type": "EditorModule",
|
||||
"Extends": "GameModule"
|
||||
}
|
||||
],
|
||||
"Dependencies": [
|
||||
{
|
||||
"Uuid": "ff06785f7145416b9d46fde39098cb0c",
|
||||
"VersionConstraints": [
|
||||
"~>0.1"
|
||||
],
|
||||
"_comment": "LmbrCentral"
|
||||
},
|
||||
{
|
||||
"Uuid": "4e981f3b17394f5d84d674fff0f54f4f",
|
||||
"VersionConstraints": [
|
||||
"~>0.1"
|
||||
],
|
||||
"_comment": "AtomLyIntegration_CommonFeatures"
|
||||
},
|
||||
{
|
||||
"Uuid": "044a63ea67d04479aa5daf62ded9d9ca",
|
||||
"VersionConstraints": [
|
||||
"~>0.1"
|
||||
],
|
||||
"_comment": "EMotionFX"
|
||||
}
|
||||
]
|
||||
"display_name": "NVIDIA Cloth [PREVIEW]",
|
||||
"summary": "Provides the functionality needed to add cloth simulation.",
|
||||
"canonical_tags": ["Gem"],
|
||||
"user_tags": ["Physics"],
|
||||
"icon_path": "preview.png"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user