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 | |
31 | #ifndef PXD_INIT_H |
32 | #define PXD_INIT_H |
33 | |
34 | #include "PxvConfig.h" |
35 | #include "PsBasicTemplates.h" |
36 | |
37 | namespace physx |
38 | { |
39 | |
40 | /*! |
41 | \file |
42 | PhysX Low-level, Memory management |
43 | */ |
44 | |
45 | /************************************************************************/ |
46 | /* Error Handling */ |
47 | /************************************************************************/ |
48 | |
49 | |
50 | enum PxvErrorCode |
51 | { |
52 | PXD_ERROR_NO_ERROR = 0, |
53 | PXD_ERROR_INVALID_PARAMETER, |
54 | PXD_ERROR_INVALID_PARAMETER_SIZE, |
55 | PXD_ERROR_INTERNAL_ERROR, |
56 | PXD_ERROR_NOT_IMPLEMENTED, |
57 | PXD_ERROR_NO_CONTEXT, |
58 | PXD_ERROR_NO_TASK_MANAGER, |
59 | PXD_ERROR_WARNING |
60 | }; |
61 | |
62 | class PxShape; |
63 | class PxRigidActor; |
64 | struct PxsShapeCore; |
65 | struct PxsRigidCore; |
66 | |
67 | struct PxvOffsetTable |
68 | { |
69 | PX_FORCE_INLINE PxvOffsetTable() {} |
70 | |
71 | PX_FORCE_INLINE const PxShape* convertPxsShape2Px(const PxsShapeCore* pxs) const |
72 | { |
73 | return shdfnd::pointerOffset<const PxShape*>(p: pxs, offset: pxsShapeCore2PxShape); |
74 | } |
75 | |
76 | PX_FORCE_INLINE const PxRigidActor* convertPxsRigidCore2PxRigidBody(const PxsRigidCore* pxs) const |
77 | { |
78 | return shdfnd::pointerOffset<const PxRigidActor*>(p: pxs, offset: pxsRigidCore2PxRigidBody); |
79 | } |
80 | |
81 | PX_FORCE_INLINE const PxRigidActor* convertPxsRigidCore2PxRigidStatic(const PxsRigidCore* pxs) const |
82 | { |
83 | return shdfnd::pointerOffset<const PxRigidActor*>(p: pxs, offset: pxsRigidCore2PxRigidStatic); |
84 | } |
85 | |
86 | ptrdiff_t pxsShapeCore2PxShape; |
87 | ptrdiff_t pxsRigidCore2PxRigidBody; |
88 | ptrdiff_t pxsRigidCore2PxRigidStatic; |
89 | }; |
90 | extern PxvOffsetTable gPxvOffsetTable; |
91 | |
92 | /*! |
93 | Initialize low-level implementation. |
94 | */ |
95 | |
96 | void PxvInit(const PxvOffsetTable& offsetTable); |
97 | |
98 | |
99 | /*! |
100 | Shut down low-level implementation. |
101 | */ |
102 | void PxvTerm(); |
103 | |
104 | /*! |
105 | Initialize low-level implementation. |
106 | */ |
107 | |
108 | void PxvRegisterHeightFields(); |
109 | |
110 | #if PX_SUPPORT_GPU_PHYSX |
111 | class PxPhysXGpu* PxvGetPhysXGpu(bool createIfNeeded); |
112 | #endif |
113 | |
114 | } |
115 | |
116 | #endif |
117 | |