1 | // |
2 | // Redistribution and use in source and binary forms, with or without |
3 | // modification, are permitted provided that the following conditions |
4 | // are met: |
5 | // * Redistributions of source code must retain the above copyright |
6 | // notice, this list of conditions and the following disclaimer. |
7 | // * Redistributions in binary form must reproduce the above copyright |
8 | // notice, this list of conditions and the following disclaimer in the |
9 | // documentation and/or other materials provided with the distribution. |
10 | // * Neither the name of NVIDIA CORPORATION nor the names of its |
11 | // contributors may be used to endorse or promote products derived |
12 | // from this software without specific prior written permission. |
13 | // |
14 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY |
15 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
16 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
17 | // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
18 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
20 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
21 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 | // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | // |
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved. |
27 | // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. |
28 | // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. |
29 | |
30 | #ifndef PX_PHYSICS_COMMON_PX_TYPEINFO |
31 | #define PX_PHYSICS_COMMON_PX_TYPEINFO |
32 | |
33 | /** \addtogroup common |
34 | @{ |
35 | */ |
36 | |
37 | #include "common/PxPhysXCommonConfig.h" |
38 | |
39 | #if !PX_DOXYGEN |
40 | namespace physx |
41 | { |
42 | #endif |
43 | |
44 | /** |
45 | \brief an enumeration of concrete classes inheriting from PxBase |
46 | |
47 | Enumeration space is reserved for future PhysX core types, PhysXExtensions, |
48 | PhysXVehicle and Custom application types. |
49 | |
50 | @see PxBase, PxTypeInfo |
51 | */ |
52 | |
53 | struct PxConcreteType |
54 | { |
55 | enum Enum |
56 | { |
57 | eUNDEFINED, |
58 | |
59 | eHEIGHTFIELD, |
60 | eCONVEX_MESH, |
61 | eTRIANGLE_MESH_BVH33, |
62 | eTRIANGLE_MESH_BVH34, |
63 | |
64 | eRIGID_DYNAMIC, |
65 | eRIGID_STATIC, |
66 | eSHAPE, |
67 | eMATERIAL, |
68 | eCONSTRAINT, |
69 | eAGGREGATE, |
70 | eARTICULATION, |
71 | eARTICULATION_REDUCED_COORDINATE, |
72 | eARTICULATION_LINK, |
73 | eARTICULATION_JOINT, |
74 | eARTICULATION_JOINT_REDUCED_COORDINATE, |
75 | ePRUNING_STRUCTURE, |
76 | eBVH_STRUCTURE, |
77 | |
78 | ePHYSX_CORE_COUNT, |
79 | eFIRST_PHYSX_EXTENSION = 256, |
80 | eFIRST_VEHICLE_EXTENSION = 512, |
81 | eFIRST_USER_EXTENSION = 1024 |
82 | }; |
83 | }; |
84 | |
85 | /** |
86 | \brief a structure containing per-type information for types inheriting from PxBase |
87 | |
88 | @see PxBase, PxConcreteType |
89 | */ |
90 | |
91 | template<typename T> struct PxTypeInfo {}; |
92 | |
93 | #define PX_DEFINE_TYPEINFO(_name, _fastType) \ |
94 | class _name; \ |
95 | template <> struct PxTypeInfo<_name> { static const char* name() { return #_name; } enum { eFastTypeId = _fastType }; }; |
96 | |
97 | /* 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. |
98 | * This implies that B has no concrete subclasses or superclasses. |
99 | */ |
100 | |
101 | PX_DEFINE_TYPEINFO(PxBase, PxConcreteType::eUNDEFINED) |
102 | PX_DEFINE_TYPEINFO(PxMaterial, PxConcreteType::eMATERIAL) |
103 | PX_DEFINE_TYPEINFO(PxConvexMesh, PxConcreteType::eCONVEX_MESH) |
104 | PX_DEFINE_TYPEINFO(PxTriangleMesh, PxConcreteType::eUNDEFINED) |
105 | PX_DEFINE_TYPEINFO(PxBVH33TriangleMesh, PxConcreteType::eTRIANGLE_MESH_BVH33) |
106 | PX_DEFINE_TYPEINFO(PxBVH34TriangleMesh, PxConcreteType::eTRIANGLE_MESH_BVH34) |
107 | PX_DEFINE_TYPEINFO(PxHeightField, PxConcreteType::eHEIGHTFIELD) |
108 | PX_DEFINE_TYPEINFO(PxActor, PxConcreteType::eUNDEFINED) |
109 | PX_DEFINE_TYPEINFO(PxRigidActor, PxConcreteType::eUNDEFINED) |
110 | PX_DEFINE_TYPEINFO(PxRigidBody, PxConcreteType::eUNDEFINED) |
111 | PX_DEFINE_TYPEINFO(PxRigidDynamic, PxConcreteType::eRIGID_DYNAMIC) |
112 | PX_DEFINE_TYPEINFO(PxRigidStatic, PxConcreteType::eRIGID_STATIC) |
113 | PX_DEFINE_TYPEINFO(PxArticulationLink, PxConcreteType::eARTICULATION_LINK) |
114 | PX_DEFINE_TYPEINFO(PxArticulationJoint, PxConcreteType::eARTICULATION_JOINT) |
115 | PX_DEFINE_TYPEINFO(PxArticulationJointReducedCoordinate, PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE) |
116 | PX_DEFINE_TYPEINFO(PxArticulation, PxConcreteType::eARTICULATION) |
117 | PX_DEFINE_TYPEINFO(PxArticulationReducedCoordinate, PxConcreteType::eARTICULATION_REDUCED_COORDINATE) |
118 | PX_DEFINE_TYPEINFO(PxAggregate, PxConcreteType::eAGGREGATE) |
119 | PX_DEFINE_TYPEINFO(PxConstraint, PxConcreteType::eCONSTRAINT) |
120 | PX_DEFINE_TYPEINFO(PxShape, PxConcreteType::eSHAPE) |
121 | PX_DEFINE_TYPEINFO(PxPruningStructure, PxConcreteType::ePRUNING_STRUCTURE) |
122 | |
123 | #if !PX_DOXYGEN |
124 | } // namespace physx |
125 | #endif |
126 | |
127 | /** @} */ |
128 | #endif |
129 | |