PxTypeInfo.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_COMMON_PX_TYPEINFO
00031 #define PX_PHYSICS_COMMON_PX_TYPEINFO
00032 
00037 #include "common/PxPhysXCommonConfig.h"
00038 
00039 #if !PX_DOXYGEN
00040 namespace physx
00041 {
00042 #endif
00043 
00053 struct PxConcreteType
00054 {
00055     enum Enum
00056     {
00057         eUNDEFINED,
00058 
00059         eHEIGHTFIELD,
00060         eCONVEX_MESH,
00061         eTRIANGLE_MESH_BVH33,
00062         eTRIANGLE_MESH_BVH34,
00063         eCLOTH_FABRIC,
00064 
00065         eRIGID_DYNAMIC,
00066         eRIGID_STATIC,
00067         eSHAPE,
00068         eMATERIAL,
00069         eCONSTRAINT,
00070         eCLOTH,
00071         ePARTICLE_SYSTEM,
00072         ePARTICLE_FLUID,
00073         eAGGREGATE,
00074         eARTICULATION,
00075         eARTICULATION_LINK,
00076         eARTICULATION_JOINT,
00077         ePRUNING_STRUCTURE,
00078         
00079         ePHYSX_CORE_COUNT,
00080         eFIRST_PHYSX_EXTENSION = 256,
00081         eFIRST_VEHICLE_EXTENSION = 512,
00082         eFIRST_USER_EXTENSION = 1024
00083     };
00084 };
00085 
00092 template<typename T> struct PxTypeInfo {};
00093 
00094 #define PX_DEFINE_TYPEINFO(_name, _fastType) \
00095     class _name; \
00096     template <> struct PxTypeInfo<_name>    {   static const char* name() { return #_name;  }   enum { eFastTypeId = _fastType };   };
00097 
00098 /* the semantics of the fastType are as follows: an object A can be cast to a type B if B's fastType is defined, and A has the same fastType.
00099  * This implies that B has no concrete subclasses or superclasses.
00100  */
00101 
00102 PX_DEFINE_TYPEINFO(PxBase,              PxConcreteType::eUNDEFINED)
00103 PX_DEFINE_TYPEINFO(PxMaterial,          PxConcreteType::eMATERIAL)
00104 PX_DEFINE_TYPEINFO(PxConvexMesh,        PxConcreteType::eCONVEX_MESH)
00105 PX_DEFINE_TYPEINFO(PxTriangleMesh,      PxConcreteType::eUNDEFINED)
00106 PX_DEFINE_TYPEINFO(PxBVH33TriangleMesh, PxConcreteType::eTRIANGLE_MESH_BVH33)
00107 PX_DEFINE_TYPEINFO(PxBVH34TriangleMesh, PxConcreteType::eTRIANGLE_MESH_BVH34)
00108 PX_DEFINE_TYPEINFO(PxHeightField,       PxConcreteType::eHEIGHTFIELD)
00109 PX_DEFINE_TYPEINFO(PxActor,             PxConcreteType::eUNDEFINED)
00110 PX_DEFINE_TYPEINFO(PxRigidActor,        PxConcreteType::eUNDEFINED)
00111 PX_DEFINE_TYPEINFO(PxRigidBody,         PxConcreteType::eUNDEFINED)
00112 PX_DEFINE_TYPEINFO(PxRigidDynamic,      PxConcreteType::eRIGID_DYNAMIC)
00113 PX_DEFINE_TYPEINFO(PxRigidStatic,       PxConcreteType::eRIGID_STATIC)
00114 PX_DEFINE_TYPEINFO(PxArticulationLink,  PxConcreteType::eARTICULATION_LINK)
00115 PX_DEFINE_TYPEINFO(PxArticulationJoint, PxConcreteType::eARTICULATION_JOINT)
00116 PX_DEFINE_TYPEINFO(PxArticulation,      PxConcreteType::eARTICULATION)
00117 PX_DEFINE_TYPEINFO(PxAggregate,         PxConcreteType::eAGGREGATE)
00118 PX_DEFINE_TYPEINFO(PxConstraint,        PxConcreteType::eCONSTRAINT)
00119 PX_DEFINE_TYPEINFO(PxShape,             PxConcreteType::eSHAPE)
00120 PX_DEFINE_TYPEINFO(PxClothFabric,       PxConcreteType::eCLOTH_FABRIC)
00121 PX_DEFINE_TYPEINFO(PxCloth,             PxConcreteType::eCLOTH)
00122 PX_DEFINE_TYPEINFO(PxParticleBase,      PxConcreteType::eUNDEFINED)
00123 PX_DEFINE_TYPEINFO(PxParticleFluid,     PxConcreteType::ePARTICLE_FLUID)
00124 PX_DEFINE_TYPEINFO(PxParticleSystem,    PxConcreteType::ePARTICLE_SYSTEM)
00125 PX_DEFINE_TYPEINFO(PxPruningStructure,  PxConcreteType::ePRUNING_STRUCTURE)
00126 
00127 #if !PX_DOXYGEN
00128 } // namespace physx
00129 #endif
00130 
00132 #endif


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