PxClothFabric.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_FABRIC
00032 #define PX_PHYSICS_NX_CLOTH_FABRIC
00033 
00038 #include "common/PxBase.h"
00039 
00040 #if !PX_DOXYGEN
00041 namespace physx
00042 {
00043 #endif
00044 
00049 struct PxClothFabricPhaseType
00050 {
00051     enum Enum
00052     {
00053         eINVALID,     
00054         eVERTICAL,    
00055         eHORIZONTAL,  
00056         eBENDING,     
00057         eSHEARING,    
00058         eCOUNT        // internal use only
00059     };
00060 };
00061 
00066 struct PxClothFabricPhase
00067 {
00068     PxClothFabricPhase(PxClothFabricPhaseType::Enum type = 
00069         PxClothFabricPhaseType::eINVALID, PxU32 index = 0);
00070 
00074     PxClothFabricPhaseType::Enum phaseType;
00075 
00079     PxU32 setIndex;
00080 };
00081 
00082 PX_INLINE PxClothFabricPhase::PxClothFabricPhase(
00083     PxClothFabricPhaseType::Enum type, PxU32 index)
00084     : phaseType(type)
00085     , setIndex(index)
00086 {}
00087 
00092 class PxClothFabricDesc
00093 {
00094 public:
00096     PxU32 nbParticles;
00097 
00099     PxU32 nbPhases;
00101     const PxClothFabricPhase* phases;
00102 
00104     PxU32 nbSets;
00106     const PxU32* sets;
00107 
00109     const PxU32* indices;
00111     const PxReal* restvalues;
00112 
00114     PxU32 nbTethers;
00116     const PxU32* tetherAnchors;
00118     const PxReal* tetherLengths;
00119 
00121     const PxU32* triangles;
00123     PxU32 nbTriangles;
00124 
00128     PX_INLINE PxClothFabricDesc();
00129 
00133     PX_INLINE void setToDefault();
00134 
00139     PX_INLINE bool isValid() const;
00140 };
00141 
00142 PX_INLINE PxClothFabricDesc::PxClothFabricDesc()
00143 {
00144     setToDefault();
00145 }
00146 
00147 PX_INLINE void PxClothFabricDesc::setToDefault()
00148 {
00149     memset(this, 0, sizeof(PxClothFabricDesc));
00150 }
00151 
00152 PX_INLINE bool PxClothFabricDesc::isValid() const
00153 {
00154     return nbParticles && nbPhases && phases && restvalues && nbSets 
00155         && sets && indices && (!nbTethers || (tetherAnchors && tetherLengths))
00156         && (!nbTriangles || triangles);
00157 }
00158 
00159 
00180 class PxClothFabric : public PxBase
00181 {
00182 public:
00188     virtual void release() = 0;
00189 
00194     virtual PxU32 getNbParticles() const = 0;
00195 
00200     virtual PxU32 getNbPhases() const = 0;
00201 
00206     virtual PxU32 getNbRestvalues() const = 0;
00207 
00212     virtual PxU32 getNbSets() const = 0;
00213 
00218     virtual PxU32 getNbParticleIndices() const = 0;
00219 
00224     virtual PxU32 getNbTethers() const = 0;
00225 
00236     virtual PxU32 getPhases(PxClothFabricPhase* userPhaseBuffer, PxU32 bufferSize) const = 0;
00237 
00249     virtual PxU32 getSets(PxU32* userSetBuffer, PxU32 bufferSize) const = 0;
00250 
00261     virtual PxU32 getParticleIndices(PxU32* userParticleIndexBuffer, PxU32 bufferSize) const = 0;
00262 
00276     virtual PxU32 getRestvalues(PxReal* userRestvalueBuffer, PxU32 bufferSize) const = 0;
00277 
00290     virtual PxU32 getTetherAnchors(PxU32* userAnchorBuffer, PxU32 bufferSize) const = 0;
00291 
00303     virtual PxU32 getTetherLengths(PxReal* userLengthBuffer, PxU32 bufferSize) const = 0;
00304 
00305 
00310     virtual void scaleRestlengths(PxReal scale) = 0;
00311 
00318     virtual PxU32 getReferenceCount() const = 0;
00319 
00325     virtual void acquireReference() = 0;
00326 
00327 
00328     virtual const char* getConcreteTypeName() const { return "PxClothFabric";   }
00329 
00330 protected:
00331 
00332     PX_INLINE PxClothFabric(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {}
00333     PX_INLINE PxClothFabric(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
00334     virtual ~PxClothFabric() {}
00335     virtual bool isKindOf(const char* name) const { return !::strcmp("PxClothFabric", name) || PxBase::isKindOf(name); }
00336 };
00337 
00338 #if !PX_DOXYGEN
00339 } // namespace physx
00340 #endif
00341 
00343 #endif


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