PxShape.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-2012 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 #ifndef PX_PHYSICS_NX_SHAPE 00031 #define PX_PHYSICS_NX_SHAPE 00032 00036 #include "PxPhysX.h" 00037 #include "common/PxSerialFramework.h" 00038 #include "geometry/PxGeometry.h" 00039 #include "geometry/PxGeometryHelpers.h" 00040 #include "PxSceneQueryReport.h" 00041 00042 #ifndef PX_DOXYGEN 00043 namespace physx 00044 { 00045 #endif 00046 00047 class PxBoxGeometry; 00048 class PxSphereGeometry; 00049 class PxCapsuleGeometry; 00050 class PxPlaneGeometry; 00051 class PxConvexMeshGeometry; 00052 class PxTriangleMeshGeometry; 00053 class PxHeightFieldGeometry; 00054 class PxRigidActor; 00055 struct PxFilterData; 00056 struct PxRaycastHit; 00057 struct PxSweepHit; 00058 00064 struct PxShapeFlag 00065 { 00066 enum Enum 00067 { 00078 eSIMULATION_SHAPE = (1<<0), 00079 00083 eSCENE_QUERY_SHAPE = (1<<1), 00084 00101 eTRIGGER_SHAPE = (1<<2), 00102 00108 eVISUALIZATION = (1<<3), 00109 00113 ePARTICLE_DRAIN = (1<<4), 00114 00118 eUSE_SWEPT_BOUNDS = (1<<6), 00119 }; 00120 }; 00121 00127 typedef PxFlags<PxShapeFlag::Enum,PxU8> PxShapeFlags; 00128 PX_FLAGS_OPERATORS(PxShapeFlag::Enum,PxU8); 00129 00130 00147 class PxShape : public PxSerializable 00148 { 00149 public: 00150 00161 virtual void release() = 0; 00162 00170 virtual PxGeometryType::Enum getGeometryType() const = 0; 00171 00182 virtual void setGeometry(const PxGeometry& geometry) = 0; 00183 00184 00193 virtual PxGeometryHolder getGeometry() const = 0; 00194 00195 00207 virtual bool getBoxGeometry(PxBoxGeometry& geometry) const = 0; 00208 00220 virtual bool getSphereGeometry(PxSphereGeometry& geometry) const = 0; 00221 00233 virtual bool getCapsuleGeometry(PxCapsuleGeometry& geometry) const = 0; 00234 00246 virtual bool getPlaneGeometry(PxPlaneGeometry& geometry) const = 0; 00247 00259 virtual bool getConvexMeshGeometry(PxConvexMeshGeometry& geometry) const = 0; 00260 00272 virtual bool getTriangleMeshGeometry(PxTriangleMeshGeometry& geometry) const = 0; 00273 00285 virtual bool getHeightFieldGeometry(PxHeightFieldGeometry& geometry) const = 0; 00286 00294 virtual PxRigidActor& getActor() const = 0; 00295 00303 virtual PxBounds3 getWorldBounds() const = 0; 00304 00305 /************************************************************************************************/ 00306 00310 00327 virtual void setLocalPose(const PxTransform& pose) = 0; 00328 00338 virtual PxTransform getLocalPose() const = 0; 00339 00341 /************************************************************************************************/ 00342 00346 00357 virtual void setSimulationFilterData(const PxFilterData& data) = 0; 00358 00364 virtual PxFilterData getSimulationFilterData() const = 0; 00365 00387 virtual void resetFiltering() = 0; 00388 00396 virtual void setQueryFilterData(const PxFilterData& data) = 0; 00397 00403 virtual PxFilterData getQueryFilterData() const = 0; 00404 00406 /************************************************************************************************/ 00407 00418 virtual void setMaterials(PxMaterial*const* materials, PxU32 materialCount) = 0; 00419 00429 virtual PxU32 getNbMaterials() const = 0; 00430 00444 virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize) const = 0; 00445 00461 virtual PxMaterial* getMaterialFromInternalFaceIndex(PxU32 faceIndex) const = 0; 00462 00479 virtual void setContactOffset(PxReal contactOffset) = 0; 00480 00488 virtual PxReal getContactOffset() const = 0; 00489 00505 virtual void setRestOffset(PxReal restOffset) = 0; 00506 00514 virtual PxReal getRestOffset() const = 0; 00515 00516 /************************************************************************************************/ 00517 00532 virtual void setFlag(PxShapeFlag::Enum flag, bool value) = 0; 00533 00539 virtual void setFlags( PxShapeFlags inFlags ) = 0; 00540 00548 virtual PxShapeFlags getFlags() const = 0; 00549 00562 virtual void setName(const char* name) = 0; 00563 00570 virtual const char* getName() const = 0; 00571 00572 /************************************************************************************************/ 00573 00589 virtual PxU32 raycast(const PxVec3& rayOrigin, const PxVec3& rayDir, PxReal maxDist, PxSceneQueryFlags hintFlags, 00590 PxU32 maxHits, PxRaycastHit* rayHits, bool firstHit, const PxTransform* shapePose=NULL) const = 0; 00591 00602 virtual bool overlap(const PxGeometry& otherGeom, const PxTransform& otherGeomPose, const PxTransform* shapePose=NULL) const = 0; 00603 00620 virtual bool sweep( const PxVec3& unitDir, const PxReal distance, const PxGeometry& otherGeom, const PxTransform& otherGeomPose, 00621 PxSweepHit& sweepHit, PxSceneQueryFlags hintFlags, const PxTransform* shapePose=NULL) const = 0; 00622 00623 virtual const char* getConcreteTypeName() const { return "PxShape"; } 00624 00625 /************************************************************************************************/ 00626 00627 void* userData; 00628 00629 protected: 00630 PxShape(PxRefResolver& v) : PxSerializable(v) {} 00631 PX_INLINE PxShape() : userData(NULL) {} 00632 virtual ~PxShape() {} 00633 virtual bool isKindOf(const char* name) const { return !strcmp("PxShape", name) || PxSerializable::isKindOf(name); } 00634 00635 }; 00636 00637 #ifndef PX_DOXYGEN 00638 } // namespace physx 00639 #endif 00640 00642 #endif
Copyright © 2008-2012 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com