Public Member Functions | Protected Member Functions | List of all members
PxClothFabric Class Referenceabstract

A cloth fabric is a structure that contains all the internal solver constraints of a cloth mesh. More...

#include <PxClothFabric.h>

Inheritance diagram for PxClothFabric:
Inheritance graph
[legend]
Collaboration diagram for PxClothFabric:
Collaboration graph
[legend]

Public Member Functions

virtual void release ()=0
 Release the cloth fabric. More...
 
virtual PxU32 getNbParticles () const =0
 Returns number of particles. More...
 
virtual PxU32 getNbPhases () const =0
 Returns number of phases. More...
 
virtual PxU32 getNbRestvalues () const =0
 Returns number of rest values. More...
 
virtual PxU32 getNbSets () const =0
 Returns number of sets. More...
 
virtual PxU32 getNbParticleIndices () const =0
 Get number of particle indices. More...
 
virtual PxU32 getNbTethers () const =0
 Get number of tether constraints. More...
 
virtual PxU32 getPhases (PxClothFabricPhase *userPhaseBuffer, PxU32 bufferSize) const =0
 Copies the phase array to a user specified buffer. More...
 
virtual PxU32 getSets (PxU32 *userSetBuffer, PxU32 bufferSize) const =0
 Copies the set array to a user specified buffer. More...
 
virtual PxU32 getParticleIndices (PxU32 *userParticleIndexBuffer, PxU32 bufferSize) const =0
 Copies the particle indices array to a user specified buffer. More...
 
virtual PxU32 getRestvalues (PxReal *userRestvalueBuffer, PxU32 bufferSize) const =0
 Copies the rest values array to a user specified buffer. More...
 
virtual PxU32 getTetherAnchors (PxU32 *userAnchorBuffer, PxU32 bufferSize) const =0
 Copies the tether anchors array to a user specified buffer. More...
 
virtual PxU32 getTetherLengths (PxReal *userLengthBuffer, PxU32 bufferSize) const =0
 Copies the tether lengths array to a user specified buffer. More...
 
virtual PX_DEPRECATED
PxClothFabricPhaseType::Enum 
getPhaseType (PxU32 phaseIndex) const =0
 Returns the type of a phase. More...
 
virtual void scaleRestlengths (PxReal scale)=0
 Scale all rest values of length dependent constraints. More...
 
virtual PxU32 getReferenceCount () const =0
 Reference count of the cloth instance. More...
 
virtual const char * getConcreteTypeName () const
 Returns string name of dynamic type. More...
 
- Public Member Functions inherited from PxBase
template<class T >
T * is ()
 
template<class T >
const T * is () const
 
PX_INLINE PxType getConcreteType () const
 Returns concrete type of object. More...
 
PX_INLINE void setBaseFlag (PxBaseFlag::Enum flag, bool value)
 Set PxBaseFlag. More...
 
PX_INLINE void setBaseFlags (PxBaseFlags inFlags)
 Set PxBaseFlags. More...
 
PX_INLINE PxBaseFlags getBaseFlags () const
 Returns PxBaseFlags. More...
 
virtual bool isReleasable () const
 Whether the object is subordinate. More...
 

Protected Member Functions

PX_INLINE PxClothFabric (PxType concreteType, PxBaseFlags baseFlags)
 
PX_INLINE PxClothFabric (PxBaseFlags baseFlags)
 
virtual ~PxClothFabric ()
 
virtual bool isKindOf (const char *name) const
 Returns whether a given type name matches with the type of this instance. More...
 
- Protected Member Functions inherited from PxBase
PX_INLINE PxBase (PxType concreteType, PxBaseFlags baseFlags)
 Constructor setting concrete type and base flags. More...
 
PX_INLINE PxBase (PxBaseFlags baseFlags)
 Deserialization constructor setting base flags. More...
 
virtual ~PxBase ()
 Destructor. More...
 
template<class T >
bool typeMatch () const
 

Additional Inherited Members

- Protected Attributes inherited from PxBase
PxType mConcreteType
 
PxBaseFlags mBaseFlags
 

Detailed Description

A cloth fabric is a structure that contains all the internal solver constraints of a cloth mesh.

A fabric consists of phases that represent a group of internal constraints of the same type. Each phase references an array of rest-values and a set of particle indices. The data representation for the fabric has layers of indirect indices:

Additionally, a fabric also stores the data for the tether constraints, which limit the distances between two particles. The tether constraints are stored in an array, and the index of a constraint determines which particle is affected: element i affects particle iN, where N is the number of particles. The tether anchor is the index of the other particle, and the tether length is the maximum distance that these two particles are allowed to be away from each other. A tether constraint is momentum conserving if the anchor particle has infinite mass (zero inverse weight).

See Also
The fabric structure can be created from a mesh using PxClothFabricCreate. Alternatively, the fabric data can be saved into a stream (see PxClothFabricCooker.save()) and later created from the stream using PxPhysics.createClothFabric(PxInputStream&).

Constructor & Destructor Documentation

PX_INLINE PxClothFabric::PxClothFabric ( PxType  concreteType,
PxBaseFlags  baseFlags 
)
inlineprotected
PX_INLINE PxClothFabric::PxClothFabric ( PxBaseFlags  baseFlags)
inlineprotected
virtual PxClothFabric::~PxClothFabric ( )
inlineprotectedvirtual

Member Function Documentation

virtual const char* PxClothFabric::getConcreteTypeName ( ) const
inlinevirtual

Returns string name of dynamic type.

Returns
Class name of most derived type of this object.

Reimplemented from PxBase.

virtual PxU32 PxClothFabric::getNbParticleIndices ( ) const
pure virtual

Get number of particle indices.

Returns
The size of the particle indices array.
virtual PxU32 PxClothFabric::getNbParticles ( ) const
pure virtual

Returns number of particles.

Returns
The number of particles needed when creating a PxCloth instance from the fabric.
virtual PxU32 PxClothFabric::getNbPhases ( ) const
pure virtual

Returns number of phases.

Returns
The number of solver phases.
virtual PxU32 PxClothFabric::getNbRestvalues ( ) const
pure virtual

Returns number of rest values.

Returns
The size of the rest values array.
virtual PxU32 PxClothFabric::getNbSets ( ) const
pure virtual

Returns number of sets.

Returns
The size of the set array.
virtual PxU32 PxClothFabric::getNbTethers ( ) const
pure virtual

Get number of tether constraints.

Returns
The size of the tether anchors and lengths arrays.
virtual PxU32 PxClothFabric::getParticleIndices ( PxU32 userParticleIndexBuffer,
PxU32  bufferSize 
) const
pure virtual

Copies the particle indices array to a user specified buffer.

The particle indices array determines which particles are affected by each constraint. It has the same length as getNbParticleIndices() and twice the number of constraints.

Parameters
[in]userParticleIndexBufferDestination buffer to copy the set data to.
[in]bufferSizeSize of userParticleIndexBuffer, should be at least getNbParticleIndices().
Returns
getNbParticleIndices() if the copy was successful, 0 otherwise.
Note
This function is potentially slow. Consider caching the (static) result instead of retrieving it multiple times.
virtual PxU32 PxClothFabric::getPhases ( PxClothFabricPhase userPhaseBuffer,
PxU32  bufferSize 
) const
pure virtual

Copies the phase array to a user specified buffer.

The phase array is a mapping of the phase index to the corresponding phase. The array has the same length as getNbPhases().

Parameters
[in]userPhaseBufferDestination buffer to copy the phase data to.
[in]bufferSizeSize of userPhaseBuffer, should be at least getNbPhases().
Returns
getNbPhases() if the copy was successful, 0 otherwise.
Note
This function is potentially slow. Consider caching the (static) result instead of retrieving it multiple times.
virtual PX_DEPRECATED PxClothFabricPhaseType::Enum PxClothFabric::getPhaseType ( PxU32  phaseIndex) const
pure virtual

Returns the type of a phase.

Deprecated:
Parameters
[in]phaseIndexThe index of the phase to return the type for.
Returns
The phase type as PxClothFabricPhaseType::Enum.
Note
If phase index is invalid, PxClothFabricPhaseType::eINVALID is returned.
virtual PxU32 PxClothFabric::getReferenceCount ( ) const
pure virtual

Reference count of the cloth instance.

At creation, the reference count of the fabric is 1. Every cloth instance referencing this fabric increments the count by 1. When the reference count reaches 0, and only then, the fabric gets released automatically.

See Also
PxCloth
virtual PxU32 PxClothFabric::getRestvalues ( PxReal userRestvalueBuffer,
PxU32  bufferSize 
) const
pure virtual

Copies the rest values array to a user specified buffer.

The rest values array holds the target value of the constraint in rest state, for example edge length for stretch constraints. It stores one value per constraint, so its length is half of getNbParticleIndices(), and it has the same length as getNbRestvalues(). The rest-values are stored in the order they are (indirectly) referenced by the phases.

Parameters
[in]userRestvalueBufferDestination buffer to copy the set data to.
[in]bufferSizeSize of userRestvalueBuffer, should be at least getNbRestvalues().
Returns
getNbRestvalues() if the copy was successful, 0 otherwise.
Note
This function is potentially slow. Between calling scaleRestlengths(), consider caching the result instead of retrieving it multiple times.
virtual PxU32 PxClothFabric::getSets ( PxU32 userSetBuffer,
PxU32  bufferSize 
) const
pure virtual

Copies the set array to a user specified buffer.

The set array is the inclusive prefix sum of the number of constraints per set. It has the same length as getNbSets().

Parameters
[in]userSetBufferDestination buffer to copy the set data to.
[in]bufferSizeSize of userSetBuffer, should be at least getNbSets().
Returns
getNbSets() if the copy was successful, 0 otherwise.
Note
Indices of the i-th set are stored at indices [i?2*set[i-1]:0, 2*set[i]) in the indices array.
This function is potentially slow. Consider caching the (static) result instead of retrieving it multiple times.
virtual PxU32 PxClothFabric::getTetherAnchors ( PxU32 userAnchorBuffer,
PxU32  bufferSize 
) const
pure virtual

Copies the tether anchors array to a user specified buffer.

The tether anchors array stores for each particle the index of another particle from which it cannot move further away than specified by the tether lengths array.

Parameters
[in]userAnchorBufferDestination buffer to copy the set data to.
[in]bufferSizeSize of userAnchorBuffer, should be at least getNbTethers().
Returns
getNbTethers() if the copy was successful, 0 otherwise.
Note
This function is potentially slow, consider caching the result instead of retrieving the data multiple times.
See Also
getTetherLengths, getNbTethers
virtual PxU32 PxClothFabric::getTetherLengths ( PxReal userLengthBuffer,
PxU32  bufferSize 
) const
pure virtual

Copies the tether lengths array to a user specified buffer.

The tether lengths array stores for each particle how far it is allowed to move away from the particle specified by the tether anchor array.

Parameters
[in]userLengthBufferDestination buffer to copy the set data to.
[in]bufferSizeSize of userLengthBuffer, should be at least getNbTethers().
Returns
getNbTethers() if the copy was successful, 0 otherwise.
Note
This function is potentially slow. Between calling scaleRestlengths(), consider caching the result instead of retrieving it multiple times.
See Also
getTetherAnchors, getNbTethers
virtual bool PxClothFabric::isKindOf ( const char *  superClass) const
inlineprotectedvirtual

Returns whether a given type name matches with the type of this instance.

Reimplemented from PxBase.

References PxBase::isKindOf().

virtual void PxClothFabric::release ( )
pure virtual

Release the cloth fabric.

Releases the application's reference to the cloth fabric. The fabric is destroyed when the application's reference is released and all cloth instances referencing the fabric are destroyed.

See Also
PxPhysics.createClothFabric()

Implements PxBase.

virtual void PxClothFabric::scaleRestlengths ( PxReal  scale)
pure virtual

Scale all rest values of length dependent constraints.

Parameters
[in]scaleThe scale factor to multiply each rest value with.

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


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com