00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef PX_PHYSICS_NX_CLOTH
00032 #define PX_PHYSICS_NX_CLOTH
00033
00037 #include "PxPhysXConfig.h"
00038 #include "PxActor.h"
00039 #include "PxLockedData.h"
00040 #include "PxFiltering.h"
00041 #include "cloth/PxClothFabric.h"
00042 #include "cloth/PxClothTypes.h"
00043 #include "cloth/PxClothCollisionData.h"
00044
00045 #if !PX_DOXYGEN
00046 namespace physx
00047 {
00048 #endif
00049
00050 class PxScene;
00051
00058 struct PX_DEPRECATED PxClothStretchConfig
00059 {
00067 PxReal stiffness;
00068
00074 PxReal stiffnessMultiplier;
00075
00082 PxReal compressionLimit;
00083
00090 PxReal stretchLimit;
00091
00095 PX_INLINE PxClothStretchConfig( PxReal stiffness_=1.0f,
00096 PxReal stiffnessMultiplier_=1.0f, PxReal compressionLimit_=1.0f, PxReal stretchLimit_=1.0f)
00097 : stiffness(stiffness_)
00098 , stiffnessMultiplier(stiffnessMultiplier_)
00099 , compressionLimit(compressionLimit_)
00100 , stretchLimit(stretchLimit_)
00101 {}
00102 };
00103
00110 struct PX_DEPRECATED PxClothTetherConfig
00111 {
00119 PxReal stiffness;
00120
00127 PxReal stretchLimit;
00128
00132 PX_INLINE PxClothTetherConfig(PxReal stiffness_ = 1.0f, PxReal stretchLimit_ = 1.0f)
00133 : stiffness(stiffness_), stretchLimit(stretchLimit_)
00134 {}
00135 };
00136
00143 struct PX_DEPRECATED PxClothMotionConstraintConfig
00144 {
00151 PxReal scale;
00152
00159 PxReal bias;
00160
00168 PxReal stiffness;
00169
00173 PX_INLINE PxClothMotionConstraintConfig(PxReal radiiScale = 1.0f, PxReal radiiBias = 0.0f, PxReal consStiffness = 1.0f)
00174 : scale(radiiScale), bias(radiiBias), stiffness(consStiffness)
00175 {}
00176 };
00177
00194 class PX_DEPRECATED PxCloth : public PxActor
00195 {
00196 public:
00201 virtual void release() = 0;
00202
00207 virtual PxClothFabric* getFabric() const = 0;
00208
00214 virtual PxBounds3 getWorldBounds(float inflation=1.01f) const = 0;
00215
00220 virtual PxU32 getNbParticles() const = 0;
00221
00242 virtual PxClothParticleData* lockParticleData(PxDataAccessFlags flags) = 0;
00248 virtual PxClothParticleData* lockParticleData() const = 0;
00249
00260 virtual void setParticles(const PxClothParticle* currentParticles, const PxClothParticle* previousParticles) = 0;
00261
00267 virtual void setClothFlag(PxClothFlag::Enum flag, bool value) = 0;
00272 virtual void setClothFlags(PxClothFlags inFlags) = 0;
00277 virtual PxClothFlags getClothFlags() const = 0;
00278
00282
00283
00291 virtual void setTargetPose(const PxTransform& pose) = 0;
00300 virtual void setGlobalPose(const PxTransform& pose) = 0;
00305 virtual PxTransform getGlobalPose() const = 0;
00306
00314 virtual void setSolverFrequency(PxReal frequency) = 0;
00319 virtual PxReal getSolverFrequency() const = 0;
00320
00326 virtual PxReal getPreviousTimeStep() const = 0;
00327
00339 virtual void setStiffnessFrequency(PxReal frequency) = 0;
00345 virtual PxReal getStiffnessFrequency() const = 0;
00346
00354 virtual void setLinearInertiaScale(PxVec3 scale) = 0;
00359 virtual PxVec3 getLinearInertiaScale() const = 0;
00367 virtual void setAngularInertiaScale(PxVec3 scale) = 0;
00372 virtual PxVec3 getAngularInertiaScale() const = 0;
00380 virtual void setCentrifugalInertiaScale(PxVec3 scale) = 0;
00385 virtual PxVec3 getCentrifugalInertiaScale() const = 0;
00390 virtual void setInertiaScale(PxReal scale) = 0;
00391
00399 virtual void setDampingCoefficient(PxVec3 dampingCoefficient) = 0;
00404 virtual PxVec3 getDampingCoefficient() const = 0;
00405
00414 virtual void setLinearDragCoefficient(PxVec3 dragCoefficient) = 0;
00419 virtual PxVec3 getLinearDragCoefficient() const = 0;
00428 virtual void setAngularDragCoefficient(PxVec3 dragCoefficient) = 0;
00433 virtual PxVec3 getAngularDragCoefficient() const = 0;
00438 virtual void setDragCoefficient(PxReal scale) = 0;
00439
00445 virtual void setExternalAcceleration(PxVec3 acceleration) = 0;
00450 virtual PxVec3 getExternalAcceleration() const = 0;
00451
00458 virtual void setParticleAccelerations(const PxVec4* particleAccelerations) = 0;
00464 virtual bool getParticleAccelerations(PxVec4* particleAccelerationsBuffer) const = 0;
00469 virtual PxU32 getNbParticleAccelerations() const = 0;
00470
00474 virtual PxVec3 getWindVelocity() const = 0;
00478 virtual void setWindVelocity(PxVec3) = 0;
00482 virtual PxReal getWindDrag() const = 0;
00486 virtual void setWindDrag(PxReal) = 0;
00490 virtual PxReal getWindLift() const = 0;
00494 virtual void setWindLift(PxReal) = 0;
00495
00497
00501
00502
00510 virtual void setMotionConstraints(const PxClothParticleMotionConstraint* motionConstraints) = 0;
00516 virtual bool getMotionConstraints(PxClothParticleMotionConstraint* motionConstraintsBuffer) const = 0;
00521 virtual PxU32 getNbMotionConstraints() const = 0;
00526 virtual void setMotionConstraintConfig(const PxClothMotionConstraintConfig& config) = 0;
00531 virtual PxClothMotionConstraintConfig getMotionConstraintConfig() const = 0;
00532
00540 virtual void setSeparationConstraints(const PxClothParticleSeparationConstraint* separationConstraints) = 0;
00546 virtual bool getSeparationConstraints(PxClothParticleSeparationConstraint* separationConstraintsBuffer) const = 0;
00551 virtual PxU32 getNbSeparationConstraints() const = 0;
00552
00559 virtual void clearInterpolation() = 0;
00560
00566 virtual void setStretchConfig(PxClothFabricPhaseType::Enum type, const PxClothStretchConfig& config) = 0;
00572 virtual PxClothStretchConfig getStretchConfig(PxClothFabricPhaseType::Enum type) const = 0;
00577 virtual void setTetherConfig(const PxClothTetherConfig& config) = 0;
00582 virtual PxClothTetherConfig getTetherConfig() const = 0;
00583
00585
00589
00590
00596 virtual void addCollisionSphere(const PxClothCollisionSphere& sphere) = 0;
00603 virtual void removeCollisionSphere(PxU32 index) = 0;
00612 virtual void setCollisionSpheres(const PxClothCollisionSphere* spheresBuffer, PxU32 count) = 0;
00617 virtual PxU32 getNbCollisionSpheres() const = 0;
00618
00628 virtual void addCollisionCapsule(PxU32 first, PxU32 second) = 0;
00634 virtual void removeCollisionCapsule(PxU32 index) = 0;
00639 virtual PxU32 getNbCollisionCapsules() const = 0;
00640
00647 virtual void addCollisionPlane(const PxClothCollisionPlane& plane) = 0;
00655 virtual void removeCollisionPlane(PxU32 index) = 0;
00664 virtual void setCollisionPlanes(const PxClothCollisionPlane* planesBuffer, PxU32 count) = 0;
00669 virtual PxU32 getNbCollisionPlanes() const = 0;
00670
00678 virtual void addCollisionConvex(PxU32 mask) = 0;
00685 virtual void removeCollisionConvex(PxU32 index) = 0;
00690 virtual PxU32 getNbCollisionConvexes() const = 0;
00691
00697 virtual void addCollisionTriangle(const PxClothCollisionTriangle& triangle) = 0;
00703 virtual void removeCollisionTriangle(PxU32 index) = 0;
00712 virtual void setCollisionTriangles(const PxClothCollisionTriangle* trianglesBuffer, PxU32 count) = 0;
00717 virtual PxU32 getNbCollisionTriangles() const = 0;
00718
00730 virtual void getCollisionData(PxClothCollisionSphere* spheresBuffer, PxU32* capsulesBuffer,
00731 PxClothCollisionPlane* planesBuffer, PxU32* convexesBuffer, PxClothCollisionTriangle* trianglesBuffer) const = 0;
00732
00749 virtual void setVirtualParticles(PxU32 numVirtualParticles, const PxU32* indices, PxU32 numWeights, const PxVec3* weights) = 0;
00754 virtual PxU32 getNbVirtualParticles() const = 0;
00760 virtual void getVirtualParticles(PxU32* indicesBuffer) const = 0;
00765 virtual PxU32 getNbVirtualParticleWeights() const = 0;
00770 virtual void getVirtualParticleWeights(PxVec3* weightsBuffer) const = 0;
00771
00777 virtual void setFrictionCoefficient(PxReal frictionCoefficient) = 0;
00782 virtual PxReal getFrictionCoefficient() const = 0;
00783
00792 virtual void setCollisionMassScale(PxReal scalingCoefficient) = 0;
00797 virtual PxReal getCollisionMassScale() const = 0;
00798
00800
00804
00805
00811 virtual void setSelfCollisionDistance(PxReal distance) = 0;
00816 virtual PxReal getSelfCollisionDistance() const = 0;
00823 virtual void setSelfCollisionStiffness(PxReal stiffness) = 0;
00828 virtual PxReal getSelfCollisionStiffness() const = 0;
00829
00840 virtual void setSelfCollisionIndices(const PxU32* indices, PxU32 nbIndices) = 0;
00846 virtual bool getSelfCollisionIndices(PxU32* indices) const = 0;
00847
00852 virtual PxU32 getNbSelfCollisionIndices() const = 0;
00853
00865 virtual void setRestPositions(const PxVec4* restPositions) = 0;
00871 virtual bool getRestPositions(PxVec4* restPositions) const = 0;
00876 virtual PxU32 getNbRestPositions() const = 0;
00877
00879
00883
00884
00892 virtual void setSimulationFilterData(const PxFilterData& data) = 0;
00893
00899 virtual PxFilterData getSimulationFilterData() const = 0;
00900
00902
00906
00907
00915 virtual void setContactOffset(PxReal offset) = 0;
00916
00921 virtual PxReal getContactOffset() const = 0;
00922
00930 virtual void setRestOffset(PxReal offset) = 0;
00931
00936 virtual PxReal getRestOffset() const = 0;
00937
00939
00943
00944
00952 virtual void setSleepLinearVelocity(PxReal threshold) = 0;
00957 virtual PxReal getSleepLinearVelocity() const = 0;
00967 virtual void setWakeCounter(PxReal wakeCounterValue) = 0;
00973 virtual PxReal getWakeCounter() const = 0;
00980 virtual void wakeUp() = 0;
00985 virtual void putToSleep() = 0;
00991 virtual bool isSleeping() const = 0;
00992
00994
00995 virtual const char* getConcreteTypeName() const { return "PxCloth"; }
00996
00997 protected:
00998 PX_INLINE PxCloth(PxType concreteType, PxBaseFlags baseFlags) : PxActor(concreteType, baseFlags) {}
00999 PX_INLINE PxCloth(PxBaseFlags baseFlags) : PxActor(baseFlags) {}
01000 virtual ~PxCloth() {}
01001 virtual bool isKindOf(const char* name) const { return !::strcmp("PxCloth", name) || PxActor::isKindOf(name); }
01002 };
01003
01004 #if !PX_DOXYGEN
01005 }
01006 #endif
01007
01009 #endif