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_CONVEXMESH_GEOMETRY
00032 #define PX_PHYSICS_NX_CONVEXMESH_GEOMETRY
00033
00036 #include "geometry/PxGeometry.h"
00037 #include "geometry/PxMeshScale.h"
00038 #include "common/PxCoreUtilityTypes.h"
00039 #include "geometry/PxConvexMesh.h"
00040
00041 #if !PX_DOXYGEN
00042 namespace physx
00043 {
00044 #endif
00045
00046 class PxConvexMesh;
00047
00053 struct PxConvexMeshGeometryFlag
00054 {
00055 enum Enum
00056 {
00057 eTIGHT_BOUNDS = (1<<0)
00058 };
00059 };
00060
00066 typedef PxFlags<PxConvexMeshGeometryFlag::Enum,PxU8> PxConvexMeshGeometryFlags;
00067 PX_FLAGS_OPERATORS(PxConvexMeshGeometryFlag::Enum,PxU8)
00068
00069
00080 class PxConvexMeshGeometry : public PxGeometry
00081 {
00082 public:
00088 PX_INLINE PxConvexMeshGeometry() :
00089 PxGeometry (PxGeometryType::eCONVEXMESH),
00090 scale (PxMeshScale(1.0f)),
00091 convexMesh (NULL),
00092 meshFlags (PxConvexMeshGeometryFlag::eTIGHT_BOUNDS)
00093 {}
00094
00102 PX_INLINE PxConvexMeshGeometry( PxConvexMesh* mesh,
00103 const PxMeshScale& scaling = PxMeshScale(),
00104 PxConvexMeshGeometryFlags flags = PxConvexMeshGeometryFlag::eTIGHT_BOUNDS) :
00105 PxGeometry (PxGeometryType::eCONVEXMESH),
00106 scale (scaling),
00107 convexMesh (mesh),
00108 meshFlags (flags)
00109 {
00110 }
00111
00122 PX_INLINE bool isValid() const;
00123
00124 public:
00125 PxMeshScale scale;
00126 PxConvexMesh* convexMesh;
00127 PxConvexMeshGeometryFlags meshFlags;
00128 PxPadding<3> paddingFromFlags;
00129 };
00130
00131
00132 PX_INLINE bool PxConvexMeshGeometry::isValid() const
00133 {
00134 if(mType != PxGeometryType::eCONVEXMESH)
00135 return false;
00136 if(!scale.scale.isFinite() || !scale.rotation.isUnit())
00137 return false;
00138 if(!scale.isValidForConvexMesh())
00139 return false;
00140 if(!convexMesh)
00141 return false;
00142
00143 return true;
00144 }
00145
00146 #if !PX_DOXYGEN
00147 }
00148 #endif
00149
00151 #endif