PxShape.h

Go to the documentation of this file.
00001 //
00002 // Redistribution and use in source and binary forms, with or without
00003 // modification, are permitted provided that the following conditions
00004 // are met:
00005 //  * Redistributions of source code must retain the above copyright
00006 //    notice, this list of conditions and the following disclaimer.
00007 //  * Redistributions in binary form must reproduce the above copyright
00008 //    notice, this list of conditions and the following disclaimer in the
00009 //    documentation and/or other materials provided with the distribution.
00010 //  * Neither the name of NVIDIA CORPORATION nor the names of its
00011 //    contributors may be used to endorse or promote products derived
00012 //    from this software without specific prior written permission.
00013 //
00014 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
00015 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017 // PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00018 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 //
00026 // Copyright (c) 2008-2018 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 "PxPhysXConfig.h"
00037 #include "common/PxBase.h"
00038 #include "geometry/PxGeometry.h"
00039 #include "geometry/PxGeometryHelpers.h"
00040 
00041 #if !PX_DOXYGEN
00042 namespace physx
00043 {
00044 #endif
00045 
00046 class PxBoxGeometry;
00047 class PxSphereGeometry;
00048 class PxCapsuleGeometry;
00049 class PxPlaneGeometry;
00050 class PxConvexMeshGeometry;
00051 class PxTriangleMeshGeometry;
00052 class PxHeightFieldGeometry;
00053 class PxRigidActor;
00054 struct PxFilterData;
00055 struct PxRaycastHit;
00056 struct PxSweepHit;
00057 
00063 struct PxShapeFlag
00064 {
00065     enum Enum
00066     {
00079         eSIMULATION_SHAPE               = (1<<0),
00080 
00084         eSCENE_QUERY_SHAPE              = (1<<1),
00085 
00108         eTRIGGER_SHAPE                  = (1<<2),
00109 
00115         eVISUALIZATION                  = (1<<3),
00116 
00120         ePARTICLE_DRAIN                 = (1<<4)
00121     };
00122 };
00123 
00129 typedef PxFlags<PxShapeFlag::Enum,PxU8> PxShapeFlags;
00130 PX_FLAGS_OPERATORS(PxShapeFlag::Enum,PxU8)
00131 
00132 
00133 
00149 class PxShape : public PxBase
00150 {
00151 public:
00152 
00163     virtual     void                    release() = 0;
00164 
00170     virtual     void                    acquireReference() = 0;
00171 
00179     virtual     PxGeometryType::Enum    getGeometryType() const = 0;
00180 
00192     virtual     void                    setGeometry(const PxGeometry& geometry) = 0;
00193 
00194 
00203     virtual     PxGeometryHolder        getGeometry() const = 0;
00204 
00205 
00217     virtual     bool                    getBoxGeometry(PxBoxGeometry& geometry) const = 0;
00218 
00230     virtual     bool                    getSphereGeometry(PxSphereGeometry& geometry) const = 0;
00231 
00243     virtual     bool                    getCapsuleGeometry(PxCapsuleGeometry& geometry) const = 0;
00244 
00256     virtual     bool                    getPlaneGeometry(PxPlaneGeometry& geometry) const = 0;
00257 
00269     virtual     bool                    getConvexMeshGeometry(PxConvexMeshGeometry& geometry) const = 0;
00270 
00282     virtual     bool                    getTriangleMeshGeometry(PxTriangleMeshGeometry& geometry) const = 0;
00283 
00295     virtual     bool                    getHeightFieldGeometry(PxHeightFieldGeometry& geometry) const = 0;
00296 
00304     virtual     PxRigidActor*           getActor() const = 0;
00305 
00306 
00307 /************************************************************************************************/
00308 
00312 
00331     virtual     void                    setLocalPose(const PxTransform& pose)       = 0;
00332 
00342     virtual     PxTransform             getLocalPose()                  const   = 0;
00343 
00345 /************************************************************************************************/
00346 
00350 
00361     virtual     void                    setSimulationFilterData(const PxFilterData& data)   = 0;
00362 
00368     virtual     PxFilterData            getSimulationFilterData()                   const   = 0;
00369 
00377     virtual     void                    setQueryFilterData(const PxFilterData& data)    = 0;
00378 
00384     virtual     PxFilterData            getQueryFilterData()                    const   = 0;
00385 
00387 /************************************************************************************************/
00388 
00399     virtual     void                    setMaterials(PxMaterial*const* materials, PxU16 materialCount)  = 0;
00400 
00410     virtual     PxU16                   getNbMaterials()        const   = 0;
00411 
00426     virtual     PxU32                   getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const   = 0;
00427     
00446     virtual     PxMaterial*             getMaterialFromInternalFaceIndex(PxU32 faceIndex) const = 0;
00447 
00464     virtual     void                    setContactOffset(PxReal contactOffset)  = 0;
00465 
00473     virtual     PxReal                  getContactOffset() const    = 0;
00474 
00490     virtual     void                    setRestOffset(PxReal restOffset)    = 0;
00491 
00499     virtual     PxReal                  getRestOffset() const   = 0;
00500 
00501 /************************************************************************************************/
00502 
00515     virtual     void                    setFlag(PxShapeFlag::Enum flag, bool value) = 0;
00516 
00522     virtual     void                    setFlags(PxShapeFlags inFlags) = 0;
00523 
00531     virtual     PxShapeFlags            getFlags() const = 0;
00532 
00538     virtual     bool                    isExclusive() const = 0;
00539 
00552     virtual     void                    setName(const char* name)       = 0;
00553 
00554 
00561     virtual     const char*             getName()           const   = 0;
00562 
00563 
00564     virtual     const char*             getConcreteTypeName() const { return "PxShape"; }
00565 
00566 /************************************************************************************************/
00567 
00568                 void*                   userData;   
00569 
00570 protected:
00571     PX_INLINE                           PxShape(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
00572     PX_INLINE                           PxShape(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {}
00573     virtual                             ~PxShape() {}
00574     virtual     bool                    isKindOf(const char* name) const { return !::strcmp("PxShape", name) || PxBase::isKindOf(name); }
00575 
00576 };
00577 
00578 #if !PX_DOXYGEN
00579 } // namespace physx
00580 #endif
00581 
00583 #endif


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