1/*
2 * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3 *
4 * NVIDIA CORPORATION and its licensors retain all intellectual property
5 * and proprietary rights in and to this software, related documentation
6 * and any modifications thereto. Any use, reproduction, disclosure or
7 * distribution of this software and related documentation without an express
8 * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 */
10// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12
13#ifndef PX_PHYSICS_COMMON_PX_TYPEINFO
14#define PX_PHYSICS_COMMON_PX_TYPEINFO
15
16/** \addtogroup common
17@{
18*/
19
20#include "common/PxPhysXCommonConfig.h"
21
22#ifndef PX_DOXYGEN
23namespace physx
24{
25#endif
26
27/**
28\brief an enumeration of concrete classes inheriting from PxBase
29
30Enumeration space is reserved for future PhysX core types, PhysXExtensions,
31PhysXVehicle and Custom application types.
32
33@see PxBase, PxTypeInfo
34*/
35
36struct PxConcreteType
37{
38 enum Enum
39 {
40 eUNDEFINED,
41
42 eHEIGHTFIELD,
43 eCONVEX_MESH,
44 eTRIANGLE_MESH,
45 eCLOTH_FABRIC,
46
47 eRIGID_DYNAMIC,
48 eRIGID_STATIC,
49 eSHAPE,
50 eMATERIAL,
51 eCONSTRAINT,
52 eCLOTH,
53 ePARTICLE_SYSTEM,
54 ePARTICLE_FLUID,
55 eAGGREGATE,
56 eARTICULATION,
57 eARTICULATION_LINK,
58 eARTICULATION_JOINT,
59
60 ePHYSX_CORE_COUNT,
61 eFIRST_PHYSX_EXTENSION = 256,
62 eFIRST_VEHICLE_EXTENSION = 512,
63 eFIRST_USER_EXTENSION = 1024
64 };
65};
66
67/**
68\brief a structure containing per-type information for types inheriting from PxBase
69
70@see PxBase, PxConcreteType
71*/
72
73template<typename T> struct PxTypeInfo {};
74
75#define PX_DEFINE_TYPEINFO(_name, _fastType) \
76 class _name; \
77 template <> struct PxTypeInfo<_name> { static const char* name() { return #_name; } enum { eFastTypeId = _fastType }; };
78
79/* 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.
80 * This implies that B has no concrete subclasses or superclasses.
81 */
82
83PX_DEFINE_TYPEINFO(PxBase, PxConcreteType::eUNDEFINED)
84PX_DEFINE_TYPEINFO(PxMaterial, PxConcreteType::eMATERIAL)
85PX_DEFINE_TYPEINFO(PxConvexMesh, PxConcreteType::eCONVEX_MESH)
86PX_DEFINE_TYPEINFO(PxTriangleMesh, PxConcreteType::eTRIANGLE_MESH)
87PX_DEFINE_TYPEINFO(PxHeightField, PxConcreteType::eHEIGHTFIELD)
88PX_DEFINE_TYPEINFO(PxActor, PxConcreteType::eUNDEFINED)
89PX_DEFINE_TYPEINFO(PxRigidActor, PxConcreteType::eUNDEFINED)
90PX_DEFINE_TYPEINFO(PxRigidBody, PxConcreteType::eUNDEFINED)
91PX_DEFINE_TYPEINFO(PxRigidDynamic, PxConcreteType::eRIGID_DYNAMIC)
92PX_DEFINE_TYPEINFO(PxRigidStatic, PxConcreteType::eRIGID_STATIC)
93PX_DEFINE_TYPEINFO(PxArticulationLink, PxConcreteType::eARTICULATION_LINK)
94PX_DEFINE_TYPEINFO(PxArticulationJoint, PxConcreteType::eARTICULATION_JOINT)
95PX_DEFINE_TYPEINFO(PxArticulation, PxConcreteType::eARTICULATION)
96PX_DEFINE_TYPEINFO(PxAggregate, PxConcreteType::eAGGREGATE)
97PX_DEFINE_TYPEINFO(PxConstraint, PxConcreteType::eCONSTRAINT)
98PX_DEFINE_TYPEINFO(PxShape, PxConcreteType::eSHAPE)
99PX_DEFINE_TYPEINFO(PxClothFabric, PxConcreteType::eCLOTH_FABRIC)
100PX_DEFINE_TYPEINFO(PxCloth, PxConcreteType::eCLOTH)
101PX_DEFINE_TYPEINFO(PxParticleBase, PxConcreteType::eUNDEFINED)
102PX_DEFINE_TYPEINFO(PxParticleFluid, PxConcreteType::ePARTICLE_FLUID)
103PX_DEFINE_TYPEINFO(PxParticleSystem, PxConcreteType::ePARTICLE_SYSTEM)
104
105#ifndef PX_DOXYGEN
106} // namespace physx
107#endif
108
109/** @} */
110#endif
111