PxCloth.h

Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and
00007 // any modifications thereto. Any use, reproduction, disclosure, or
00008 // distribution of this software and related documentation without an express
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 //
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved.
00027 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
00028 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.  
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 
00057 struct PxClothStretchConfig
00058 {
00066     PxReal stiffness;
00067 
00073     PxReal stiffnessMultiplier;
00074 
00081     PxReal compressionLimit;
00082 
00089     PxReal stretchLimit;
00090 
00094     PX_INLINE PxClothStretchConfig( PxReal stiffness_=1.0f, 
00095         PxReal stiffnessMultiplier_=1.0f, PxReal compressionLimit_=1.0f, PxReal stretchLimit_=1.0f) 
00096         : stiffness(stiffness_)
00097         , stiffnessMultiplier(stiffnessMultiplier_)
00098         , compressionLimit(compressionLimit_) 
00099         , stretchLimit(stretchLimit_) 
00100     {}
00101 };
00102 
00108 struct PxClothTetherConfig
00109 {
00117     PxReal stiffness;
00118 
00125     PxReal stretchLimit;
00126 
00130     PX_INLINE PxClothTetherConfig(PxReal stiffness_ = 1.0f, PxReal stretchLimit_ = 1.0f) 
00131         : stiffness(stiffness_), stretchLimit(stretchLimit_) 
00132     {}
00133 };
00134 
00140 struct PxClothMotionConstraintConfig
00141 {
00148     PxReal scale;
00149 
00156     PxReal bias;
00157 
00165     PxReal stiffness;
00166 
00170     PX_INLINE PxClothMotionConstraintConfig(PxReal radiiScale = 1.0f, PxReal radiiBias = 0.0f, PxReal consStiffness = 1.0f) 
00171         : scale(radiiScale), bias(radiiBias), stiffness(consStiffness) 
00172     {}
00173 };
00174 
00189 class PxCloth : public PxActor
00190 {
00191 public:
00196     virtual void release() = 0;
00197 
00202     virtual PxClothFabric* getFabric() const = 0;
00203 
00209     virtual PxBounds3 getWorldBounds(float inflation=1.01f) const = 0;
00210 
00215     virtual PxU32 getNbParticles() const = 0;
00216 
00237     virtual PxClothParticleData* lockParticleData(PxDataAccessFlags flags) = 0;
00243     virtual PxClothParticleData* lockParticleData() const = 0;
00244 
00255     virtual void setParticles(const PxClothParticle* currentParticles, const PxClothParticle* previousParticles) = 0;
00256 
00262     virtual void setClothFlag(PxClothFlag::Enum flag, bool value)   = 0;
00267     virtual void setClothFlags(PxClothFlags inFlags)    = 0;
00272     virtual PxClothFlags getClothFlags() const = 0;
00273 
00277 
00278 
00286     virtual void setTargetPose(const PxTransform& pose) = 0;
00295     virtual void setGlobalPose(const PxTransform& pose) = 0;
00300     virtual PxTransform getGlobalPose() const = 0;
00301 
00309     virtual void setSolverFrequency(PxReal frequency) = 0;
00314     virtual PxReal getSolverFrequency() const = 0;
00315 
00321     virtual PxReal getPreviousTimeStep() const = 0;
00322 
00334     virtual void setStiffnessFrequency(PxReal frequency) = 0;
00340     virtual PxReal getStiffnessFrequency() const = 0;
00341 
00349     virtual void setLinearInertiaScale(PxVec3 scale) = 0;
00354     virtual PxVec3 getLinearInertiaScale() const = 0;
00362     virtual void setAngularInertiaScale(PxVec3 scale) = 0;
00367     virtual PxVec3 getAngularInertiaScale() const = 0;
00375     virtual void setCentrifugalInertiaScale(PxVec3 scale) = 0;
00380     virtual PxVec3 getCentrifugalInertiaScale() const = 0;
00385     virtual void setInertiaScale(PxReal scale) = 0;
00386 
00394     virtual void setDampingCoefficient(PxVec3 dampingCoefficient) = 0;
00399     virtual PxVec3 getDampingCoefficient() const = 0;
00400 
00409     virtual void setLinearDragCoefficient(PxVec3 dragCoefficient) = 0;
00414     virtual PxVec3 getLinearDragCoefficient() const = 0;
00423     virtual void setAngularDragCoefficient(PxVec3 dragCoefficient) = 0;
00428     virtual PxVec3 getAngularDragCoefficient() const = 0;
00433     virtual void setDragCoefficient(PxReal scale) = 0;
00434 
00440     virtual void setExternalAcceleration(PxVec3 acceleration) = 0;
00445     virtual PxVec3 getExternalAcceleration() const = 0;
00446 
00453     virtual void setParticleAccelerations(const PxVec4* particleAccelerations) = 0;
00459     virtual bool getParticleAccelerations(PxVec4* particleAccelerationsBuffer) const = 0;
00464     virtual PxU32 getNbParticleAccelerations() const = 0; 
00465 
00469     virtual PxVec3 getWindVelocity() const = 0;
00473     virtual void setWindVelocity(PxVec3) = 0;
00477     virtual PxReal getWindDrag() const = 0;
00481     virtual void setWindDrag(PxReal) = 0;
00485     virtual PxReal getWindLift() const = 0;
00489     virtual void setWindLift(PxReal) = 0;
00490 
00492 
00496 
00497 
00505     virtual void setMotionConstraints(const PxClothParticleMotionConstraint* motionConstraints) = 0;
00511     virtual bool getMotionConstraints(PxClothParticleMotionConstraint* motionConstraintsBuffer) const = 0;
00516     virtual PxU32 getNbMotionConstraints() const = 0; 
00521     virtual void setMotionConstraintConfig(const PxClothMotionConstraintConfig& config) = 0;
00526     virtual PxClothMotionConstraintConfig getMotionConstraintConfig() const = 0;
00527 
00535     virtual void setSeparationConstraints(const PxClothParticleSeparationConstraint* separationConstraints) = 0;
00541     virtual bool getSeparationConstraints(PxClothParticleSeparationConstraint* separationConstraintsBuffer) const = 0;
00546     virtual PxU32 getNbSeparationConstraints() const = 0; 
00547 
00554     virtual void clearInterpolation() = 0;
00555 
00561     virtual void setStretchConfig(PxClothFabricPhaseType::Enum type, const PxClothStretchConfig& config) = 0;
00567     virtual PxClothStretchConfig getStretchConfig(PxClothFabricPhaseType::Enum type) const = 0;
00572     virtual void setTetherConfig(const PxClothTetherConfig& config) = 0;
00577     virtual PxClothTetherConfig getTetherConfig() const = 0;
00578 
00580 
00584 
00585 
00591     virtual void addCollisionSphere(const PxClothCollisionSphere& sphere) = 0;
00598     virtual void removeCollisionSphere(PxU32 index) = 0;
00607     virtual void setCollisionSpheres(const PxClothCollisionSphere* spheresBuffer, PxU32 count) = 0;
00612     virtual PxU32 getNbCollisionSpheres() const = 0;
00613 
00623     virtual void addCollisionCapsule(PxU32 first, PxU32 second) = 0;
00629     virtual void removeCollisionCapsule(PxU32 index) = 0;
00634     virtual PxU32 getNbCollisionCapsules() const = 0;
00635 
00642     virtual void addCollisionPlane(const PxClothCollisionPlane& plane) = 0;
00650     virtual void removeCollisionPlane(PxU32 index) = 0;
00659     virtual void setCollisionPlanes(const PxClothCollisionPlane* planesBuffer, PxU32 count) = 0;
00664     virtual PxU32 getNbCollisionPlanes() const = 0;
00665 
00673     virtual void addCollisionConvex(PxU32 mask) = 0;
00680     virtual void removeCollisionConvex(PxU32 index) = 0;
00685     virtual PxU32 getNbCollisionConvexes() const = 0;
00686 
00692     virtual void addCollisionTriangle(const PxClothCollisionTriangle& triangle) = 0;
00698     virtual void removeCollisionTriangle(PxU32 index) = 0;
00707     virtual void setCollisionTriangles(const PxClothCollisionTriangle* trianglesBuffer, PxU32 count) = 0;
00712     virtual PxU32 getNbCollisionTriangles() const = 0;
00713 
00725     virtual void getCollisionData(PxClothCollisionSphere* spheresBuffer, PxU32* capsulesBuffer,
00726         PxClothCollisionPlane* planesBuffer, PxU32* convexesBuffer, PxClothCollisionTriangle* trianglesBuffer) const = 0;
00727 
00744     virtual void setVirtualParticles(PxU32 numVirtualParticles, const PxU32* indices, PxU32 numWeights, const PxVec3* weights) = 0;
00749     virtual PxU32 getNbVirtualParticles() const = 0;
00755     virtual void getVirtualParticles(PxU32* indicesBuffer) const = 0;
00760     virtual PxU32 getNbVirtualParticleWeights() const = 0;
00765     virtual void getVirtualParticleWeights(PxVec3* weightsBuffer) const = 0;
00766 
00772     virtual void setFrictionCoefficient(PxReal frictionCoefficient) = 0;
00777     virtual PxReal getFrictionCoefficient() const = 0;
00778 
00787     virtual void setCollisionMassScale(PxReal scalingCoefficient) = 0;
00792     virtual PxReal getCollisionMassScale() const = 0;
00793 
00795 
00799 
00800 
00806     virtual void setSelfCollisionDistance(PxReal distance) = 0;
00811     virtual PxReal getSelfCollisionDistance() const = 0;
00818     virtual void setSelfCollisionStiffness(PxReal stiffness) = 0;
00823     virtual PxReal getSelfCollisionStiffness() const = 0;
00824 
00835     virtual void setSelfCollisionIndices(const PxU32* indices, PxU32 nbIndices) = 0;
00841     virtual bool getSelfCollisionIndices(PxU32* indices) const = 0;
00842 
00847     virtual PxU32 getNbSelfCollisionIndices() const = 0;
00848 
00860     virtual void setRestPositions(const PxVec4* restPositions) = 0;
00866     virtual bool getRestPositions(PxVec4* restPositions) const = 0;
00871     virtual PxU32 getNbRestPositions() const = 0; 
00872 
00874 
00878 
00879 
00887     virtual void setSimulationFilterData(const PxFilterData& data) = 0;
00888 
00894     virtual PxFilterData getSimulationFilterData() const = 0;
00895 
00897 
00901 
00902 
00910     virtual void setContactOffset(PxReal offset) = 0;
00911 
00916     virtual PxReal getContactOffset() const = 0;
00917 
00925     virtual void setRestOffset(PxReal offset) = 0;
00926 
00931     virtual PxReal getRestOffset() const = 0;
00932 
00934 
00938 
00939 
00947     virtual void setSleepLinearVelocity(PxReal threshold) = 0;
00952     virtual PxReal getSleepLinearVelocity() const = 0;
00962     virtual void setWakeCounter(PxReal wakeCounterValue) = 0;
00968     virtual PxReal getWakeCounter() const = 0;
00975     virtual void wakeUp() = 0;
00980     virtual void putToSleep() = 0;
00986     virtual bool isSleeping() const = 0;
00987 
00989 
00990     virtual const char* getConcreteTypeName() const { return "PxCloth"; }
00991 
00992 protected:
00993     PX_INLINE PxCloth(PxType concreteType, PxBaseFlags baseFlags) : PxActor(concreteType, baseFlags) {}
00994     PX_INLINE PxCloth(PxBaseFlags baseFlags) : PxActor(baseFlags) {}
00995     virtual ~PxCloth() {}
00996     virtual bool isKindOf(const char* name) const { return !::strcmp("PxCloth", name) || PxActor::isKindOf(name); }
00997 };
00998 
00999 #if !PX_DOXYGEN
01000 } // namespace physx
01001 #endif
01002 
01004 #endif


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