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_GEOMUTILS_NX_TRIANGLEMESH
00032 #define PX_PHYSICS_GEOMUTILS_NX_TRIANGLEMESH
00033
00036 #include "foundation/PxVec3.h"
00037 #include "foundation/PxBounds3.h"
00038 #include "common/PxPhysXCommonConfig.h"
00039 #include "common/PxBase.h"
00040
00041 #if !PX_DOXYGEN
00042 namespace physx
00043 {
00044 #endif
00045
00051 #define PX_ENABLE_DYNAMIC_MESH_RTREE 1
00052
00064 struct PxMeshMidPhase
00065 {
00066 enum Enum
00067 {
00068 eBVH33 = 0,
00069 eBVH34 = 1,
00070
00071 eLAST
00072 };
00073 };
00074
00080 struct PxTriangleMeshFlag
00081 {
00082 enum Enum
00083 {
00084 e16_BIT_INDICES = (1<<1),
00085 eADJACENCY_INFO = (1<<2)
00086 };
00087 };
00088
00094 typedef PxFlags<PxTriangleMeshFlag::Enum,PxU8> PxTriangleMeshFlags;
00095 PX_FLAGS_OPERATORS(PxTriangleMeshFlag::Enum,PxU8)
00096
00097
00126 class PxTriangleMesh : public PxBase
00127 {
00128 public:
00134 virtual PxU32 getNbVertices() const = 0;
00135
00141 virtual const PxVec3* getVertices() const = 0;
00142
00143 #if PX_ENABLE_DYNAMIC_MESH_RTREE
00144
00163 virtual PxVec3* getVerticesForModification() = 0;
00164
00182 virtual PxBounds3 refitBVH() = 0;
00183 #endif // PX_ENABLE_DYNAMIC_MESH_RTREE
00184
00190 virtual PxU32 getNbTriangles() const = 0;
00191
00203 virtual const void* getTriangles() const = 0;
00204
00214 virtual PxTriangleMeshFlags getTriangleMeshFlags() const = 0;
00215
00228 virtual const PxU32* getTrianglesRemap() const = 0;
00229
00230
00236 virtual void release() = 0;
00237
00246 virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const = 0;
00247
00253 virtual PxBounds3 getLocalBounds() const = 0;
00254
00263 virtual PxU32 getReferenceCount() const = 0;
00264
00270 virtual void acquireReference() = 0;
00271
00272 protected:
00273 PX_INLINE PxTriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {}
00274 PX_INLINE PxTriangleMesh(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
00275 virtual ~PxTriangleMesh() {}
00276
00277 virtual bool isKindOf(const char* name) const { return !::strcmp("PxTriangleMesh", name) || PxBase::isKindOf(name); }
00278 };
00279
00286 class PxBVH33TriangleMesh : public PxTriangleMesh
00287 {
00288 public:
00289 protected:
00290 PX_INLINE PxBVH33TriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxTriangleMesh(concreteType, baseFlags) {}
00291 PX_INLINE PxBVH33TriangleMesh(PxBaseFlags baseFlags) : PxTriangleMesh(baseFlags) {}
00292 virtual ~PxBVH33TriangleMesh() {}
00293 virtual bool isKindOf(const char* name) const { return !::strcmp("PxBVH33TriangleMesh", name) || PxTriangleMesh::isKindOf(name); }
00294 };
00295
00302 class PxBVH34TriangleMesh : public PxTriangleMesh
00303 {
00304 public:
00305 protected:
00306 PX_INLINE PxBVH34TriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxTriangleMesh(concreteType, baseFlags) {}
00307 PX_INLINE PxBVH34TriangleMesh(PxBaseFlags baseFlags) : PxTriangleMesh(baseFlags) {}
00308 virtual ~PxBVH34TriangleMesh() {}
00309 virtual bool isKindOf(const char* name) const { return !::strcmp("PxBVH34TriangleMesh", name) || PxTriangleMesh::isKindOf(name); }
00310 };
00311
00312 #if !PX_DOXYGEN
00313 }
00314 #endif
00315
00317 #endif