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

#include <Solver.h>

Inherits NvCloth::ISolver.

Public Member Functions

 AZ_RTTI (Solver, "{111055FC-F590-4BCD-A7B9-D96B1C44E3E8}", ISolver)
 
 Solver (const AZStd::string &name, NvSolverUniquePtr nvSolver)
 
void AddCloth (Cloth *cloth)
 
void RemoveCloth (Cloth *cloth)
 
size_t GetNumCloths () const
 
const AZStd::string & GetName () const override
 Returns name of the solver.
 
void Enable (bool value) override
 
bool IsEnabled () const override
 Returns whether the solver is enabled or not.
 
void SetUserSimulated (bool value) override
 
bool IsUserSimulated () const override
 Returns whether the solver StartSimulation and FinishSimulation functions will be called by the user or the cloth system.
 
void StartSimulation (float deltaTime) override
 
void FinishSimulation () override
 
void SetInterCollisionDistance (float distance) override
 
void SetInterCollisionStiffness (float stiffness) override
 
void SetInterCollisionIterations (AZ::u32 iterations) override
 
- Public Member Functions inherited from NvCloth::ISolver
 AZ_RTTI (ISolver, "{4077FEB2-78E3-4A8F-AA33-67446E6ECD1F}")
 
virtual const AZStd::string & GetName () const =0
 Returns name of the solver.
 
virtual void Enable (bool value)=0
 
virtual bool IsEnabled () const =0
 Returns whether the solver is enabled or not.
 
virtual void SetUserSimulated (bool value)=0
 
virtual bool IsUserSimulated () const =0
 Returns whether the solver StartSimulation and FinishSimulation functions will be called by the user or the cloth system.
 
virtual void StartSimulation (float deltaTime)=0
 
virtual void FinishSimulation ()=0
 
virtual void SetInterCollisionDistance (float distance)=0
 
virtual void SetInterCollisionStiffness (float stiffness)=0
 
virtual void SetInterCollisionIterations (AZ::u32 iterations)=0
 
void ConnectPreSimulationEventHandler (PreSimulationEvent::Handler &handler)
 Connects a handler to the PreSimulationEvent.
 
void ConnectPostSimulationEventHandler (PostSimulationEvent::Handler &handler)
 Connects a handler to the PostSimulationEvent.
 

Additional Inherited Members

- Public Types inherited from NvCloth::ISolver
using PreSimulationEvent = AZ::Event< const AZStd::string &, float >
 
using PostSimulationEvent = AZ::Event< const AZStd::string &, float >
 
- Protected Attributes inherited from NvCloth::ISolver
PreSimulationEvent m_preSimulationEvent
 
PostSimulationEvent m_postSimulationEvent
 

Detailed Description

Implementation of the ISolver interface.

When enabled, it runs the simulation on all its cloths and sends notifications before and after the simulation has been executed.

Member Function Documentation

◆ Enable()

void NvCloth::Solver::Enable ( bool  value)
overridevirtual

Enable or disable running simulation on the solver. When the solver is disabled it won't run simulation and its events will not be signaled.

Implements NvCloth::ISolver.

◆ FinishSimulation()

void NvCloth::Solver::FinishSimulation ( )
overridevirtual

Complete the simulation process. If the solver is in user-simulated mode the user is responsible for calling this function. Note: This is a blocking call that will wait for the simulation jobs to complete.

Implements NvCloth::ISolver.

◆ GetName()

const AZStd::string & NvCloth::Solver::GetName ( ) const
overridevirtual

Returns name of the solver.

Implements NvCloth::ISolver.

◆ IsEnabled()

bool NvCloth::Solver::IsEnabled ( ) const
overridevirtual

Returns whether the solver is enabled or not.

Implements NvCloth::ISolver.

◆ IsUserSimulated()

bool NvCloth::Solver::IsUserSimulated ( ) const
overridevirtual

Returns whether the solver StartSimulation and FinishSimulation functions will be called by the user or the cloth system.

Implements NvCloth::ISolver.

◆ SetInterCollisionDistance()

void NvCloth::Solver::SetInterCollisionDistance ( float  distance)
overridevirtual

Specifies the distance (meters) that cloths' particles need to be separated from each other. Inter-collision refers to collisions between different cloth instances in the solver, do not confuse with self-collision, which is available per cloth through IClothConfigurator. When distance is 0 inter-collision is disabled (default).

Note
Using inter-collision with more than 32 cloths added to the solver will cause undefined behavior.

Implements NvCloth::ISolver.

◆ SetInterCollisionIterations()

void NvCloth::Solver::SetInterCollisionIterations ( AZ::u32  iterations)
overridevirtual

Sets the number of iterations the solver will do during inter-collision. Default value is 1.

Implements NvCloth::ISolver.

◆ SetInterCollisionStiffness()

void NvCloth::Solver::SetInterCollisionStiffness ( float  stiffness)
overridevirtual

Sets the stiffness for inter-collision constraints. Stiffness range is [0.0, 1.0]. Default value is 1.0.

Implements NvCloth::ISolver.

◆ SetUserSimulated()

void NvCloth::Solver::SetUserSimulated ( bool  value)
overridevirtual

Set the solver into user-simulated mode. When the solver is user-simulated the user will be responsible to call StartSimulation and FinishSimulation functions, otherwise they will be called by the cloth system.

Implements NvCloth::ISolver.

◆ StartSimulation()

void NvCloth::Solver::StartSimulation ( float  deltaTime)
overridevirtual

Start simulation of all the cloths that are part of this solver. This will setup and start cloth simulation jobs. If the solver is in user-simulated mode the user is responsible for calling this function. Note: This is a non-blocking call.

Implements NvCloth::ISolver.


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