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::SystemComponent Class Reference

#include <SystemComponent.h>

Inherits AZ::Component, NvCloth::IClothSystem, and AZ::TickBus::Handler.

Public Member Functions

 AZ_COMPONENT (SystemComponent, "{89DF5C48-64AC-4B8E-9E61-0D4C7A7B5491}")
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 
static void GetProvidedServices (AZ::ComponentDescriptor::DependencyArrayType &provided)
 
static void GetIncompatibleServices (AZ::ComponentDescriptor::DependencyArrayType &incompatible)
 
static void GetRequiredServices (AZ::ComponentDescriptor::DependencyArrayType &required)
 
static void InitializeNvClothLibrary ()
 
static void TearDownNvClothLibrary ()
 
static bool CheckLastClothError ()
 Returns true when there is no error reported.
 
static void ResetLastClothError ()
 Resets the last error reported by NvCloth.
 

Protected Member Functions

void Activate () override
 
void Deactivate () override
 
ISolverFindOrCreateSolver (const AZStd::string &name) override
 
void DestroySolver (ISolver *&solver) override
 
ISolverGetSolver (const AZStd::string &name) override
 
IClothCreateCloth (const AZStd::vector< SimParticleFormat > &initialParticles, const FabricCookedData &fabricCookedData) override
 
void DestroyCloth (ICloth *&cloth) override
 
IClothGetCloth (ClothId clothId) override
 
bool AddCloth (ICloth *cloth, const AZStd::string &solverName=DefaultSolverName) override
 
void RemoveCloth (ICloth *cloth) override
 
void OnTick (float deltaTime, AZ::ScriptTimePoint time) override
 
int GetTickOrder () override
 
- Protected Member Functions inherited from NvCloth::IClothSystem
 AZ_RTTI (IClothSystem, "{83C01566-D028-4BE8-BE95-0A9DFE6137CA}")
 
virtual ISolverFindOrCreateSolver (const AZStd::string &name)=0
 
virtual void DestroySolver (ISolver *&solver)=0
 
virtual ISolverGetSolver (const AZStd::string &name)=0
 
virtual IClothCreateCloth (const AZStd::vector< SimParticleFormat > &initialParticles, const FabricCookedData &fabricCookedData)=0
 
virtual void DestroyCloth (ICloth *&cloth)=0
 
virtual IClothGetCloth (ClothId clothId)=0
 
virtual bool AddCloth (ICloth *cloth, const AZStd::string &solverName=DefaultSolverName)=0
 
virtual void RemoveCloth (ICloth *cloth)=0
 

Detailed Description

Implementation of the IClothSystem interface.

This class has the responsibility to initialize and tear down NvCloth library. It owns all Solvers, Cloths and Fabrics, and it manages their creation and destruction. It's also the responsible for updating (on Physics Tick) all the solvers that are not flagged as "user simulated".

Member Function Documentation

◆ AddCloth()

bool NvCloth::SystemComponent::AddCloth ( ICloth cloth,
const AZStd::string &  solverName = DefaultSolverName 
)
overrideprotectedvirtual

Adds a cloth instance to a solver. Once a cloth is part of a solver it will be simulated and its events will be signaled. A cloth can only be added to one solver at a time, if the cloth was previously added to another solver it will be removed from it first.

Parameters
clothThe cloth instance to add to the solver.
solverNameName of the solver to add the cloth into. By default the cloth will be added to the default solver. Empty string is an invalid solver name.
Returns
Whether it successfully added cloth to the solver or not.

Implements NvCloth::IClothSystem.

◆ CreateCloth()

ICloth * NvCloth::SystemComponent::CreateCloth ( const AZStd::vector< SimParticleFormat > &  initialParticles,
const FabricCookedData fabricCookedData 
)
overrideprotectedvirtual

Creates a cloth instance from a fabric.

Parameters
initialParticlesInitial simulation positions and inverse masses for the cloth to start the simulation. They do not have to be the same positions and inverse masses used to cook the fabric.
fabricCookedDataThe fabric data used to create the cloth.
Returns
The cloth instance or nullptr if unable to create it.

Implements NvCloth::IClothSystem.

◆ DestroyCloth()

void NvCloth::SystemComponent::DestroyCloth ( ICloth *&  cloth)
overrideprotectedvirtual

Destroys the cloth instance passed as parameter. Any reference kept to the cloth will be invalid. The cloth be automatically removed from a solver, in case it's still added to one.

Parameters
clothThe cloth to be destroyed. Variable will be set to nullptr.

Implements NvCloth::IClothSystem.

◆ DestroySolver()

void NvCloth::SystemComponent::DestroySolver ( ISolver *&  solver)
overrideprotectedvirtual

Destroys the solver passed as parameter. Any reference kept to the solver will be invalid. Any cloth the solver still has will be automatically removed.

Parameters
solverThe solver to be destroyed. Variable will be set to nullptr.

Implements NvCloth::IClothSystem.

◆ FindOrCreateSolver()

ISolver * NvCloth::SystemComponent::FindOrCreateSolver ( const AZStd::string &  name)
overrideprotectedvirtual

Looks for a solver and if it cannot find it then it creates it.

Parameters
nameName the solver. Empty string is an invalid solver name.
Returns
The solver created/found or nullptr if unable to create it.

Implements NvCloth::IClothSystem.

◆ GetCloth()

ICloth * NvCloth::SystemComponent::GetCloth ( ClothId  clothId)
overrideprotectedvirtual

Returns a cloth from the system, identified by its id.

Parameters
clothIdThe cloth identifier.
Returns
The cloth found or nullptr if it doesn't exist.

Implements NvCloth::IClothSystem.

◆ GetSolver()

ISolver * NvCloth::SystemComponent::GetSolver ( const AZStd::string &  name)
overrideprotectedvirtual

Returns a solver from the system, identified by its name.

Parameters
nameName the solver. Empty string is an invalid name.
Returns
The solver found or nullptr if it doesn't exists.

Implements NvCloth::IClothSystem.

◆ RemoveCloth()

void NvCloth::SystemComponent::RemoveCloth ( ICloth cloth)
overrideprotectedvirtual

Removes a cloth instance from its solver. Once a cloth is not part of a solver it will not be simulated and its events will not be signaled. If the cloth was not previously part of any solver this function doesn't have any effect.

Parameters
clothThe cloth instance to remove from the solver.

Implements NvCloth::IClothSystem.


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