Open 3D Engine NvCloth Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
NvCloth::IFabricCooker Class Referenceabstract

#include <IFabricCooker.h>

Public Member Functions

 AZ_RTTI (IFabricCooker, "{32E97A6F-A32C-42D2-8BA9-83896E57FA72}")
 
virtual AZStd::optional< FabricCookedDataCookFabric (const AZStd::vector< SimParticleFormat > &particles, const AZStd::vector< SimIndexType > &indices, const AZ::Vector3 &fabricGravity=AZ::Vector3(0.0f, 0.0f, -9.81f), bool useGeodesicTether=true)=0
 
virtual void SimplifyMesh (const AZStd::vector< SimParticleFormat > &particles, const AZStd::vector< SimIndexType > &indices, AZStd::vector< SimParticleFormat > &simplifiedParticles, AZStd::vector< SimIndexType > &simplifiedIndices, AZStd::vector< int > &remappedVertices, bool removeStaticTriangles=true)=0
 

Detailed Description

Interface to cook particles into fabric.

Note
Use AZ::Interface<IFabricCooker>::Get() to call the interface, which is available at both runtime and asset processing time (asset builders).

Member Function Documentation

◆ CookFabric()

virtual AZStd::optional< FabricCookedData > NvCloth::IFabricCooker::CookFabric ( const AZStd::vector< SimParticleFormat > &  particles,
const AZStd::vector< SimIndexType > &  indices,
const AZ::Vector3 &  fabricGravity = AZ::Vector3(0.0f, 0.0f, -9.81f),
bool  useGeodesicTether = true 
)
pure virtual

Generates fabric cooked data from particles information, this data will be used to create cloths instances. Cooking a fabric can be computationally expensive when using many particles and indices. When possible, cook at asset processing time (asset builders) to have it ready at runtime.

Parameters
particlesList of particles, which are composed of positions and inverse masses.
indicesList of triangles' indices.
fabricGravityGravity value to use to cook the fabric.
useGeodesicTetherWhether use geodesic distance (using triangle adjacencies) or vertex distance when calculating tether constraints. Using geodesic distance is more expensive during the cooking process, but it results in a more realistic cloth behavior when applying tether constraints.
Returns
The fabric cooked data or nullopt if cooking process failed.

◆ SimplifyMesh()

virtual void NvCloth::IFabricCooker::SimplifyMesh ( const AZStd::vector< SimParticleFormat > &  particles,
const AZStd::vector< SimIndexType > &  indices,
AZStd::vector< SimParticleFormat > &  simplifiedParticles,
AZStd::vector< SimIndexType > &  simplifiedIndices,
AZStd::vector< int > &  remappedVertices,
bool  removeStaticTriangles = true 
)
pure virtual

Simplifies a list of particles by welding vertices that are in the same location. Graphical meshes often have duplicated vertices for texture rendering, this is not suitable for a physically simulated mesh where the mesh topology is essential.

Parameters
particlesList of particles, which are composed of positions and inverse masses.
indicesList of triangles' indices.
simplifiedParticlesNew simplified list of particles.
simplifiedIndicesNew simplified list of triangles' indices.
remappedVerticesMapping of vertices between the mesh and the simplified mesh. A negative element means the vertex has been removed.
removeStaticTrianglesWhen true it removes triangles whose particles are all static.

The documentation for this class was generated from the following file: