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 PXV_MANAGER_H |
32 | #define PXV_MANAGER_H |
33 | |
34 | #include "foundation/PxVec3.h" |
35 | #include "foundation/PxQuat.h" |
36 | #include "foundation/PxTransform.h" |
37 | #include "foundation/PxMemory.h" |
38 | #include "PxvConfig.h" |
39 | #include "PxvGeometry.h" |
40 | |
41 | namespace physx |
42 | { |
43 | |
44 | /*! |
45 | \file |
46 | Manager interface |
47 | */ |
48 | |
49 | /************************************************************************/ |
50 | /* Managers */ |
51 | /************************************************************************/ |
52 | |
53 | class PxsContactManager; |
54 | |
55 | struct PxsRigidCore; |
56 | struct PxsShapeCore; |
57 | class PxsRigidBody; |
58 | |
59 | /*! |
60 | Type of PXD_MANAGER_CCD_MODE property |
61 | */ |
62 | enum PxvContactManagerCCDMode |
63 | { |
64 | PXD_MANAGER_CCD_NONE, |
65 | PXD_MANAGER_CCD_LINEAR |
66 | }; |
67 | |
68 | /*! |
69 | Manager descriptor |
70 | */ |
71 | struct PxvManagerDescRigidRigid |
72 | { |
73 | /*! |
74 | Manager user data |
75 | |
76 | \sa PXD_MANAGER_USER_DATA |
77 | */ |
78 | //void* userData; |
79 | |
80 | /*! |
81 | Dominance setting for one way interactions. |
82 | A dominance of 0 means the corresp. body will |
83 | not be pushable by the other body in the constraint. |
84 | \sa PXD_MANAGER_DOMINANCE0 |
85 | */ |
86 | PxU8 dominance0; |
87 | |
88 | /*! |
89 | Dominance setting for one way interactions. |
90 | A dominance of 0 means the corresp. body will |
91 | not be pushable by the other body in the constraint. |
92 | \sa PXD_MANAGER_DOMINANCE1 |
93 | */ |
94 | PxU8 dominance1; |
95 | |
96 | /*! |
97 | PxsRigidBodies |
98 | */ |
99 | PxsRigidBody* rigidBody0; |
100 | PxsRigidBody* rigidBody1; |
101 | |
102 | /*! |
103 | Shape Core structures |
104 | */ |
105 | const PxsShapeCore* shapeCore0; |
106 | const PxsShapeCore* shapeCore1; |
107 | |
108 | /*! |
109 | Body Core structures |
110 | */ |
111 | PxsRigidCore* rigidCore0; |
112 | PxsRigidCore* rigidCore1; |
113 | |
114 | /*! |
115 | Enable contact information reporting. |
116 | */ |
117 | int reportContactInfo; |
118 | |
119 | /*! |
120 | Enable contact impulse threshold reporting. |
121 | */ |
122 | int hasForceThreshold; |
123 | |
124 | /*! |
125 | Enable generated contacts to be changeable |
126 | */ |
127 | int contactChangeable; |
128 | |
129 | /*! |
130 | Disable strong friction |
131 | */ |
132 | //int disableStrongFriction; |
133 | |
134 | /*! |
135 | Contact resolution rest distance. |
136 | */ |
137 | PxReal restDistance; |
138 | |
139 | /*! |
140 | Disable contact response |
141 | */ |
142 | int disableResponse; |
143 | |
144 | /*! |
145 | Disable discrete contact generation |
146 | */ |
147 | int disableDiscreteContact; |
148 | |
149 | /*! |
150 | Disable CCD contact generation |
151 | */ |
152 | int disableCCDContact; |
153 | |
154 | /*! |
155 | Is connected to an articulation (1 - first body, 2 - second body) |
156 | */ |
157 | int hasArticulations; |
158 | |
159 | /*! |
160 | is connected to a dynamic (1 - first body, 2 - second body) |
161 | */ |
162 | int hasDynamics; |
163 | |
164 | /*! |
165 | Is the pair touching? Use when re-creating the manager with prior knowledge about touch status. |
166 | |
167 | positive: pair is touching |
168 | 0: touch state unknown (this is a new pair) |
169 | negative: pair is not touching |
170 | |
171 | Default is 0 |
172 | */ |
173 | int hasTouch; |
174 | |
175 | /*! |
176 | Identifies whether body 1 is kinematic. We can treat kinematics as statics and embed velocity into constraint |
177 | because kinematic bodies' velocities will not change |
178 | */ |
179 | bool body1Kinematic; |
180 | |
181 | /* |
182 | Index entries into the transform cache for shape 0 |
183 | */ |
184 | PxU32 transformCache0; |
185 | |
186 | /* |
187 | Index entries into the transform cache for shape 1 |
188 | */ |
189 | PxU32 transformCache1; |
190 | |
191 | PxvManagerDescRigidRigid() |
192 | { |
193 | PxMemSet(dest: this, c: 0, count: sizeof(PxvManagerDescRigidRigid)); |
194 | |
195 | dominance0 = 1u; |
196 | dominance1 = 1u; |
197 | } |
198 | }; |
199 | |
200 | |
201 | /*! |
202 | Report struct for contact manager touch reports |
203 | */ |
204 | struct PxvContactManagerTouchEvent |
205 | { |
206 | PxsContactManager* manager; // Manager handle |
207 | void* userData; // Manager userdata |
208 | }; |
209 | |
210 | } |
211 | |
212 | #endif |
213 | |
214 | |