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_METADATAOBJECTS_H |
31 | #define PX_METADATAOBJECTS_H |
32 | #include "foundation/PxMemory.h" |
33 | |
34 | // include the base headers instead of the PxPhysicsAPI.h |
35 | //Geometry Library |
36 | #include "geometry/PxBoxGeometry.h" |
37 | #include "geometry/PxCapsuleGeometry.h" |
38 | #include "geometry/PxConvexMesh.h" |
39 | #include "geometry/PxConvexMeshGeometry.h" |
40 | #include "geometry/PxGeometry.h" |
41 | #include "geometry/PxGeometryHelpers.h" |
42 | #include "geometry/PxGeometryQuery.h" |
43 | #include "geometry/PxHeightField.h" |
44 | #include "geometry/PxHeightFieldDesc.h" |
45 | #include "geometry/PxHeightFieldFlag.h" |
46 | #include "geometry/PxHeightFieldGeometry.h" |
47 | #include "geometry/PxHeightFieldSample.h" |
48 | #include "geometry/PxMeshQuery.h" |
49 | #include "geometry/PxMeshScale.h" |
50 | #include "geometry/PxPlaneGeometry.h" |
51 | #include "geometry/PxSimpleTriangleMesh.h" |
52 | #include "geometry/PxSphereGeometry.h" |
53 | #include "geometry/PxTriangle.h" |
54 | #include "geometry/PxTriangleMesh.h" |
55 | #include "geometry/PxTriangleMeshGeometry.h" |
56 | |
57 | // PhysX Core SDK |
58 | #include "PxActor.h" |
59 | #include "PxAggregate.h" |
60 | #include "PxArticulation.h" |
61 | #include "PxArticulationJoint.h" |
62 | #include "PxArticulationReducedCoordinate.h" |
63 | #include "PxArticulationJointReducedCoordinate.h" |
64 | #include "PxArticulationLink.h" |
65 | #include "PxBatchQuery.h" |
66 | #include "PxBatchQueryDesc.h" |
67 | #include "PxClient.h" |
68 | #include "PxConstraint.h" |
69 | #include "PxConstraintDesc.h" |
70 | #include "PxContact.h" |
71 | #include "PxContactModifyCallback.h" |
72 | #include "PxDeletionListener.h" |
73 | #include "PxFiltering.h" |
74 | #include "PxForceMode.h" |
75 | #include "PxLockedData.h" |
76 | #include "PxMaterial.h" |
77 | #include "PxPhysics.h" |
78 | #include "PxPhysicsVersion.h" |
79 | #include "PxPhysXConfig.h" |
80 | #include "PxQueryFiltering.h" |
81 | #include "PxQueryReport.h" |
82 | #include "PxRigidActor.h" |
83 | #include "PxRigidBody.h" |
84 | #include "PxRigidDynamic.h" |
85 | #include "PxRigidStatic.h" |
86 | #include "PxScene.h" |
87 | #include "PxSceneDesc.h" |
88 | #include "PxSceneLock.h" |
89 | #include "PxShape.h" |
90 | #include "PxSimulationEventCallback.h" |
91 | #include "PxSimulationStatistics.h" |
92 | #include "PxVisualizationParameter.h" |
93 | #include "PxPruningStructure.h" |
94 | |
95 | |
96 | /** \addtogroup physics |
97 | @{ |
98 | */ |
99 | |
100 | namespace physx |
101 | { |
102 | |
103 | class PxArticulationLink; |
104 | class PxArticulationJoint; |
105 | class PxArticulationJointReducedCoordinate; |
106 | class PxArticulationJointBase; |
107 | |
108 | struct PxPropertyInfoName |
109 | { |
110 | enum Enum |
111 | { |
112 | Unnamed = 0, |
113 | #include "PxAutoGeneratedMetaDataObjectNames.h" |
114 | LastPxPropertyInfoName |
115 | }; |
116 | }; |
117 | |
118 | struct PxU32ToName |
119 | { |
120 | const char* mName; |
121 | PxU32 mValue; |
122 | }; |
123 | |
124 | struct PxPropertyInfoBase |
125 | { |
126 | const char* mName; |
127 | PxU32 mKey; |
128 | PxPropertyInfoBase( const char* n, PxU32 inKey ) |
129 | : mName( n ) |
130 | , mKey( inKey ) |
131 | { |
132 | } |
133 | }; |
134 | |
135 | template<PxU32 TKey> |
136 | struct PxPropertyInfoParameterizedBase : public PxPropertyInfoBase |
137 | { |
138 | PxPropertyInfoParameterizedBase( const char* inName ) |
139 | : PxPropertyInfoBase( inName, TKey ) {} |
140 | }; |
141 | |
142 | template<PxU32 TKey, typename TObjType, typename TPropertyType> |
143 | struct PxReadOnlyPropertyInfo : public PxPropertyInfoParameterizedBase<TKey> |
144 | { |
145 | typedef TPropertyType (*TGetterType)( const TObjType* ); |
146 | TGetterType mGetter; |
147 | PxReadOnlyPropertyInfo( const char* inName, TGetterType inGetter ) |
148 | : PxPropertyInfoParameterizedBase<TKey>( inName ) |
149 | , mGetter( inGetter ) {} |
150 | TPropertyType get( const TObjType* inObj ) const { return mGetter( inObj ); } |
151 | }; |
152 | |
153 | template<PxU32 TKey, typename TObjType, typename TPropertyType> |
154 | struct PxWriteOnlyPropertyInfo : public PxPropertyInfoParameterizedBase<TKey> |
155 | { |
156 | typedef void(*TSetterType)( TObjType*, TPropertyType inArg ); |
157 | TSetterType mSetter; |
158 | PxWriteOnlyPropertyInfo( const char* inName, TSetterType inSetter ) |
159 | : PxPropertyInfoParameterizedBase<TKey>( inName ) |
160 | , mSetter( inSetter ) {} |
161 | void set( TObjType* inObj, TPropertyType inArg ) const { mSetter( inObj, inArg ); } |
162 | }; |
163 | |
164 | |
165 | //Define the property types on the auto-generated objects. |
166 | template<PxU32 TKey, typename TObjType, typename TSetPropType, typename TGetPropType> |
167 | struct PxPropertyInfo : public PxReadOnlyPropertyInfo<TKey, TObjType, TGetPropType> |
168 | { |
169 | typedef typename PxReadOnlyPropertyInfo<TKey, TObjType, TGetPropType>::TGetterType TGetterType; |
170 | typedef void(*TSetterType)( TObjType*, TSetPropType inArg ); |
171 | TSetterType mSetter; |
172 | |
173 | PxPropertyInfo( const char* inName, TSetterType inSetter, TGetterType inGetter ) |
174 | : PxReadOnlyPropertyInfo<TKey, TObjType, TGetPropType>( inName, inGetter ) |
175 | , mSetter( inSetter ) {} |
176 | void set( TObjType* inObj, TSetPropType inArg ) const { mSetter( inObj, inArg ); } |
177 | }; |
178 | |
179 | template<PxU32 TKey, typename TObjType, typename TPropertyType> |
180 | struct PxRangePropertyInfo : public PxPropertyInfoParameterizedBase<TKey> |
181 | { |
182 | typedef void (*TSetterType)( TObjType*,TPropertyType,TPropertyType); |
183 | typedef void (*TGetterType)( const TObjType*,TPropertyType&,TPropertyType&); |
184 | |
185 | const char* mArg0Name; |
186 | const char* mArg1Name; |
187 | |
188 | TSetterType mSetter; |
189 | TGetterType mGetter; |
190 | |
191 | PxRangePropertyInfo( const char* name, const char* arg0Name, const char* arg1Name |
192 | , TSetterType setter, TGetterType getter ) |
193 | : PxPropertyInfoParameterizedBase<TKey>( name ) |
194 | , mArg0Name( arg0Name ) |
195 | , mArg1Name( arg1Name ) |
196 | , mSetter( setter ) |
197 | , mGetter( getter ) |
198 | { |
199 | } |
200 | void set( TObjType* inObj, TPropertyType arg0, TPropertyType arg1 ) const { mSetter( inObj, arg0, arg1 ); } |
201 | void get( const TObjType* inObj, TPropertyType& arg0, TPropertyType& arg1 ) const { mGetter( inObj, arg0, arg1 ); } |
202 | }; |
203 | |
204 | template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType> |
205 | struct PxIndexedPropertyInfo : public PxPropertyInfoParameterizedBase<TKey> |
206 | { |
207 | typedef void (*TSetterType)( TObjType*, TIndexType, TPropertyType ); |
208 | typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndexType ); |
209 | |
210 | TSetterType mSetter; |
211 | TGetterType mGetter; |
212 | |
213 | PxIndexedPropertyInfo( const char* name, TSetterType setter, TGetterType getter ) |
214 | : PxPropertyInfoParameterizedBase<TKey>( name ) |
215 | , mSetter( setter ) |
216 | , mGetter( getter ) |
217 | { |
218 | } |
219 | void set( TObjType* inObj, TIndexType inIndex, TPropertyType arg ) const { mSetter( inObj, inIndex, arg ); } |
220 | TPropertyType get( const TObjType* inObj, TIndexType inIndex ) const { return mGetter( inObj, inIndex ); } |
221 | }; |
222 | |
223 | template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType> |
224 | struct PxExtendedIndexedPropertyInfo : public PxPropertyInfoParameterizedBase<TKey> |
225 | { |
226 | typedef PxU32 (*TNbObjectsMember)( const TObjType* ); |
227 | typedef void (*TSetterType)( TObjType*, TIndexType, TPropertyType ); |
228 | typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndexType ); |
229 | |
230 | TSetterType mSetter; |
231 | TGetterType mGetter; |
232 | PxU32 mCount; |
233 | TNbObjectsMember mNbObjectsMember; |
234 | |
235 | PxExtendedIndexedPropertyInfo( const char* name, TGetterType getter, TNbObjectsMember inNb, TSetterType setter) |
236 | : PxPropertyInfoParameterizedBase<TKey>( name ) |
237 | , mSetter( setter ) |
238 | , mGetter( getter ) |
239 | , mNbObjectsMember( inNb ) |
240 | { |
241 | } |
242 | |
243 | PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); } |
244 | void set( TObjType* inObj, TIndexType inIndex, TPropertyType arg ) const { mSetter( inObj, inIndex, arg ); } |
245 | TPropertyType get( const TObjType* inObj, TIndexType inIndex ) const { return mGetter( inObj, inIndex ); } |
246 | }; |
247 | |
248 | template<PxU32 TKey, typename TObjType, typename TIndex1Type, typename TIndex2Type, typename TPropertyType> |
249 | struct PxDualIndexedPropertyInfo : public PxPropertyInfoParameterizedBase<TKey> |
250 | { |
251 | typedef void (*TSetterType)( TObjType*, TIndex1Type, TIndex2Type, TPropertyType ); |
252 | typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndex1Type, TIndex2Type ); |
253 | |
254 | TSetterType mSetter; |
255 | TGetterType mGetter; |
256 | |
257 | PxDualIndexedPropertyInfo( const char* name, TSetterType setter, TGetterType getter ) |
258 | : PxPropertyInfoParameterizedBase<TKey>( name ) |
259 | , mSetter( setter ) |
260 | , mGetter( getter ) |
261 | { |
262 | } |
263 | void set( TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2, TPropertyType arg ) const { mSetter( inObj, inIdx1, inIdx2, arg ); } |
264 | TPropertyType get( const TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2 ) const { return mGetter( inObj, inIdx1, inIdx2 ); } |
265 | }; |
266 | |
267 | template<PxU32 TKey, typename TObjType, typename TIndex1Type, typename TIndex2Type, typename TPropertyType> |
268 | struct PxExtendedDualIndexedPropertyInfo : public PxPropertyInfoParameterizedBase<TKey> |
269 | { |
270 | typedef void (*TSetterType)( TObjType*, TIndex1Type, TIndex2Type, TPropertyType ); |
271 | typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndex1Type, TIndex2Type ); |
272 | |
273 | TSetterType mSetter; |
274 | TGetterType mGetter; |
275 | PxU32 mId0Count; |
276 | PxU32 mId1Count; |
277 | |
278 | PxExtendedDualIndexedPropertyInfo( const char* name, TSetterType setter, TGetterType getter, PxU32 id0Count, PxU32 id1Count ) |
279 | : PxPropertyInfoParameterizedBase<TKey>( name ) |
280 | , mSetter( setter ) |
281 | , mGetter( getter ) |
282 | , mId0Count( id0Count ) |
283 | , mId1Count( id1Count ) |
284 | { |
285 | } |
286 | |
287 | void set( TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2, TPropertyType arg ) const { mSetter( inObj, inIdx1, inIdx2, arg ); } |
288 | TPropertyType get( const TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2 ) const { return mGetter( inObj, inIdx1, inIdx2 ); } |
289 | }; |
290 | |
291 | template<PxU32 TKey, typename TObjType, typename TCollectionType> |
292 | struct PxBufferCollectionPropertyInfo : public PxPropertyInfoParameterizedBase<TKey> |
293 | { |
294 | typedef PxU32 (*TNbObjectsMember)( const TObjType* ); |
295 | typedef PxU32 (*TGetObjectsMember)( const TObjType*, TCollectionType*, PxU32 ); |
296 | typedef void (*TSetObjectsMember)( TObjType*, TCollectionType*, PxU32 ); |
297 | |
298 | TGetObjectsMember mGetObjectsMember; |
299 | TNbObjectsMember mNbObjectsMember; |
300 | TSetObjectsMember mSetObjectsMember; |
301 | |
302 | PxBufferCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TSetObjectsMember inSet ) |
303 | : PxPropertyInfoParameterizedBase<TKey>( inName ) |
304 | , mGetObjectsMember( inGetter ) |
305 | , mNbObjectsMember( inNb ) |
306 | , mSetObjectsMember( inSet ) |
307 | { |
308 | } |
309 | PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); } |
310 | PxU32 get( const TObjType* inObj, TCollectionType* inBuffer, PxU32 inNumItems ) const { return mGetObjectsMember( inObj, inBuffer, inNumItems ); } |
311 | void set( TObjType* inObj, TCollectionType* inBuffer, PxU32 inNumItems ) const { mSetObjectsMember( inObj, inBuffer, inNumItems); } |
312 | }; |
313 | |
314 | template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType> |
315 | struct PxFixedSizeLookupTablePropertyInfo : public PxPropertyInfoParameterizedBase<TKey> |
316 | { |
317 | typedef PxU32 (*TNbObjectsMember)( const TObjType* ); |
318 | typedef PxReal (*TGetXMember)( const TObjType*, PxU32 ); |
319 | typedef PxReal (*TGetYMember)( const TObjType*, PxU32 ); |
320 | typedef void (*TAddPairMember)( TObjType*, PxReal, PxReal ); |
321 | typedef void (*TClearMember)( TObjType* ); |
322 | |
323 | TGetXMember mGetXMember; |
324 | TGetYMember mGetYMember; |
325 | TNbObjectsMember mNbObjectsMember; |
326 | TAddPairMember mAddPairMember; |
327 | TClearMember mClearMember; |
328 | |
329 | PxFixedSizeLookupTablePropertyInfo( const char* inName, TGetXMember inGetterX, TGetYMember inGetterY, TNbObjectsMember inNb, TAddPairMember inAddPair, TClearMember inClear ) |
330 | : PxPropertyInfoParameterizedBase<TKey>( inName ) |
331 | , mGetXMember( inGetterX ) |
332 | , mGetYMember( inGetterY ) |
333 | , mNbObjectsMember( inNb ) |
334 | , mAddPairMember( inAddPair ) |
335 | , mClearMember( inClear ) |
336 | |
337 | { |
338 | } |
339 | PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); } |
340 | PxReal getX( const TObjType* inObj, const PxU32 index ) const { return mGetXMember( inObj, index ); } |
341 | PxReal getY( const TObjType* inObj, const PxU32 index ) const { return mGetYMember( inObj, index ); } |
342 | void addPair( TObjType* inObj, const PxReal x, const PxReal y ) { mAddPairMember( inObj, x, y ); } |
343 | void clear( TObjType* inObj ) { mClearMember( inObj ); } |
344 | }; |
345 | |
346 | template<PxU32 TKey, typename TObjType, typename TCollectionType> |
347 | struct PxReadOnlyCollectionPropertyInfo : public PxPropertyInfoParameterizedBase<TKey> |
348 | { |
349 | typedef PxU32 (*TNbObjectsMember)( const TObjType* ); |
350 | typedef PxU32 (*TGetObjectsMember)( const TObjType*, TCollectionType*, PxU32 ); |
351 | |
352 | TGetObjectsMember mGetObjectsMember; |
353 | TNbObjectsMember mNbObjectsMember; |
354 | |
355 | PxReadOnlyCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb ) |
356 | : PxPropertyInfoParameterizedBase<TKey>( inName ) |
357 | , mGetObjectsMember( inGetter ) |
358 | , mNbObjectsMember( inNb ) |
359 | { |
360 | } |
361 | PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); } |
362 | PxU32 get( const TObjType* inObj, TCollectionType* inBuffer, PxU32 inBufSize ) const { return mGetObjectsMember( inObj, inBuffer, inBufSize); } |
363 | }; |
364 | |
365 | |
366 | template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TFilterType> |
367 | struct PxReadOnlyFilteredCollectionPropertyInfo : public PxPropertyInfoParameterizedBase<TKey> |
368 | { |
369 | typedef PxU32 (*TNbObjectsMember)( const TObjType*, TFilterType ); |
370 | typedef PxU32 (*TGetObjectsMember)( const TObjType*, TFilterType, TCollectionType*, PxU32 ); |
371 | |
372 | TGetObjectsMember mGetObjectsMember; |
373 | TNbObjectsMember mNbObjectsMember; |
374 | |
375 | PxReadOnlyFilteredCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb ) |
376 | : PxPropertyInfoParameterizedBase<TKey>( inName ) |
377 | , mGetObjectsMember( inGetter ) |
378 | , mNbObjectsMember( inNb ) |
379 | { |
380 | } |
381 | |
382 | PxU32 size( const TObjType* inObj, TFilterType inFilter ) const { return mNbObjectsMember( inObj, inFilter ); } |
383 | PxU32 get( const TObjType* inObj, TFilterType inFilter, TCollectionType* inBuffer, PxU32 inBufSize ) const { return mGetObjectsMember( inObj, inFilter, inBuffer, inBufSize); } |
384 | }; |
385 | |
386 | template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TCreateArg> |
387 | struct PxFactoryCollectionPropertyInfo : public PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType > |
388 | { |
389 | typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TGetObjectsMember TGetObjectsMember; |
390 | typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TNbObjectsMember TNbObjectsMember; |
391 | typedef TCollectionType (*TCreateMember)( TObjType*, TCreateArg ); |
392 | |
393 | TCreateMember mCreateMember; |
394 | PxFactoryCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TCreateMember inMember ) |
395 | : PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >( inName, inGetter, inNb ) |
396 | , mCreateMember( inMember ) |
397 | { |
398 | } |
399 | TCollectionType create( TObjType* inObj, TCreateArg inArg ) const { return mCreateMember( inObj, inArg ); } |
400 | }; |
401 | |
402 | |
403 | template<PxU32 TKey, typename TObjType, typename TCollectionType> |
404 | struct PxCollectionPropertyInfo : public PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType > |
405 | { |
406 | typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TGetObjectsMember TGetObjectsMember; |
407 | typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TNbObjectsMember TNbObjectsMember; |
408 | typedef void (*TAddMember)(TObjType*, TCollectionType&); |
409 | typedef void (*TRemoveMember)(TObjType*, TCollectionType&); |
410 | |
411 | TAddMember mAddMember; |
412 | TRemoveMember mRemoveMember; |
413 | |
414 | PxCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TAddMember inMember, TRemoveMember inRemoveMember ) |
415 | : PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >( inName, inGetter, inNb ) |
416 | , mAddMember( inMember ) |
417 | , mRemoveMember( inRemoveMember ) |
418 | { |
419 | } |
420 | void add( TObjType* inObj, TCollectionType& inArg ) const { mAddMember(inObj, inArg ); } |
421 | void remove( TObjType* inObj, TCollectionType& inArg ) const { mRemoveMember( inObj, inArg ); } |
422 | }; |
423 | |
424 | template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TFilterType> |
425 | struct PxFilteredCollectionPropertyInfo : public PxReadOnlyFilteredCollectionPropertyInfo<TKey, TObjType, TCollectionType, TFilterType> |
426 | { |
427 | typedef typename PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TCollectionType, TFilterType >::TGetObjectsMember TGetObjectsMember; |
428 | typedef typename PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TCollectionType, TFilterType >::TNbObjectsMember TNbObjectsMember; |
429 | typedef void (*TAddMember)(TObjType*, TCollectionType&); |
430 | typedef void (*TRemoveMember)(TObjType*, TCollectionType&); |
431 | |
432 | TAddMember mAddMember; |
433 | TRemoveMember mRemoveMember; |
434 | |
435 | PxFilteredCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TAddMember inMember, TRemoveMember inRemoveMember ) |
436 | : PxReadOnlyFilteredCollectionPropertyInfo<TKey, TObjType, TCollectionType, TFilterType>( inName, inGetter, inNb ) |
437 | , mAddMember( inMember ) |
438 | , mRemoveMember( inRemoveMember ) |
439 | { |
440 | } |
441 | void add( TObjType* inObj, TCollectionType& inArg ) const { mAddMember(inObj, inArg ); } |
442 | void remove( TObjType* inObj, TCollectionType& inArg ) const { mRemoveMember( inObj, inArg ); } |
443 | }; |
444 | |
445 | //create a default info class for when we can't match |
446 | //the type correctly. |
447 | struct PxUnknownClassInfo |
448 | { |
449 | static const char* getClassName() { return "__unknown_class" ; } |
450 | template<typename TReturnType, typename TOperator> |
451 | TReturnType visitType( TOperator ) |
452 | { |
453 | return TReturnType(); |
454 | } |
455 | template<typename TOperator> |
456 | void visitBases( TOperator ) |
457 | { |
458 | } |
459 | template<typename TOperator> |
460 | PxU32 visitBaseProperties( TOperator, PxU32 inStartIndex = 0 ) const |
461 | { |
462 | return inStartIndex; |
463 | } |
464 | template<typename TOperator> |
465 | PxU32 visitInstanceProperties( TOperator, PxU32 inStartIndex = 0 ) const |
466 | { |
467 | return inStartIndex; |
468 | } |
469 | }; |
470 | |
471 | template<typename TDataType> |
472 | struct PxClassInfoTraits |
473 | { |
474 | PxUnknownClassInfo Info; |
475 | static bool getInfo() { return false;} |
476 | }; |
477 | |
478 | //move the bool typedef to the global namespace. |
479 | typedef bool _Bool; |
480 | |
481 | |
482 | template<PxU32 TPropertyName> |
483 | struct PxPropertyToValueStructMemberMap |
484 | { |
485 | bool Offset; |
486 | }; |
487 | |
488 | |
489 | #define DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( type, prop, valueStruct ) \ |
490 | template<> struct PxPropertyToValueStructMemberMap< PxPropertyInfoName::type##_##prop > \ |
491 | { \ |
492 | PxU32 Offset; \ |
493 | PxPropertyToValueStructMemberMap() : Offset( PX_OFFSET_OF_RT( valueStruct, prop ) ) {} \ |
494 | template<typename TOperator> void visitProp( TOperator inOperator, valueStruct& inStruct ) { inOperator( inStruct.prop ); } \ |
495 | }; |
496 | |
497 | |
498 | |
499 | struct PxShapeGeometryPropertyHelper |
500 | { |
501 | PX_PHYSX_CORE_API PxGeometryType::Enum getGeometryType(const PxShape* inShape) const; |
502 | PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxBoxGeometry& geometry) const; |
503 | PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxSphereGeometry& geometry) const; |
504 | PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxCapsuleGeometry& geometry) const; |
505 | PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxPlaneGeometry& geometry) const; |
506 | PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxConvexMeshGeometry& geometry) const; |
507 | PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxTriangleMeshGeometry& geometry) const; |
508 | PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxHeightFieldGeometry& geometry) const; |
509 | }; |
510 | |
511 | |
512 | struct PxShapeGeometryProperty : public PxWriteOnlyPropertyInfo< PxPropertyInfoName::PxShape_Geometry, PxShape, const PxGeometry & > |
513 | , public PxShapeGeometryPropertyHelper |
514 | { |
515 | typedef PxWriteOnlyPropertyInfo< PxPropertyInfoName::PxShape_Geometry, PxShape, const PxGeometry & >::TSetterType TSetterType; |
516 | typedef PxGeometryHolder (*TGetterType)( const PxShape* inObj ); |
517 | PxShapeGeometryProperty( const char* inName, TSetterType inSetter, TGetterType ) |
518 | : PxWriteOnlyPropertyInfo< PxPropertyInfoName::PxShape_Geometry, PxShape, const PxGeometry & >( inName, inSetter ) |
519 | { |
520 | } |
521 | }; |
522 | |
523 | struct PxShapeMaterialsPropertyHelper |
524 | { |
525 | PX_PHYSX_CORE_API void setMaterials(PxShape* inShape, PxMaterial*const* materials, PxU16 materialCount) const; |
526 | }; |
527 | |
528 | struct PxShapeMaterialsProperty : public PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial*> |
529 | , public PxShapeMaterialsPropertyHelper |
530 | { |
531 | typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial* >::TGetObjectsMember TGetObjectsMember; |
532 | typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial* >::TNbObjectsMember TNbObjectsMember; |
533 | PxShapeMaterialsProperty( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb ) |
534 | : PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial*>( inName, inGetter, inNb ) |
535 | { |
536 | } |
537 | }; |
538 | |
539 | typedef PxPropertyInfo<PxPropertyInfoName::PxRigidActor_GlobalPose, PxRigidActor, const PxTransform &, PxTransform > PxRigidActorGlobalPosePropertyInfo; |
540 | |
541 | struct PxRigidActorShapeCollectionHelper |
542 | { |
543 | PX_PHYSX_CORE_API PxShape* createShape(PxRigidActor* inActor, const PxGeometry& geometry, PxMaterial& material, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) const; |
544 | PX_PHYSX_CORE_API PxShape* createShape(PxRigidActor* inActor, const PxGeometry& geometry, PxMaterial *const* materials, PxU16 materialCount, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) const; |
545 | }; |
546 | |
547 | struct PxRigidActorShapeCollection : public PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape*> |
548 | , public PxRigidActorShapeCollectionHelper |
549 | { |
550 | typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape* >::TGetObjectsMember TGetObjectsMember; |
551 | typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape* >::TNbObjectsMember TNbObjectsMember; |
552 | PxRigidActorShapeCollection( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb ) |
553 | : PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape*>( inName, inGetter, inNb ) |
554 | { |
555 | } |
556 | }; |
557 | |
558 | struct PxArticulationLinkCollectionPropHelper |
559 | { |
560 | PX_PHYSX_CORE_API PxArticulationLink* createLink(PxArticulation* inArticulation, PxArticulationLink* parent, const PxTransform& pose) const; |
561 | }; |
562 | |
563 | struct PxArticulationReducedCoordinateLinkCollectionPropHelper |
564 | { |
565 | PX_PHYSX_CORE_API PxArticulationLink* createLink(PxArticulationReducedCoordinate* inArticulation, PxArticulationLink* parent, const PxTransform& pose) const; |
566 | }; |
567 | |
568 | struct PxArticulationLinkCollectionProp : public PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxArticulationBase_Links, PxArticulationBase, PxArticulationLink*> |
569 | , public PxArticulationLinkCollectionPropHelper |
570 | { |
571 | PxArticulationLinkCollectionProp( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb ) |
572 | : PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxArticulationBase_Links, PxArticulationBase, PxArticulationLink*>( inName, inGetter, inNb ) |
573 | { |
574 | } |
575 | }; |
576 | |
577 | template<typename TDataType> |
578 | struct PxEnumTraits { PxEnumTraits() : NameConversion( false ) {} bool NameConversion; }; |
579 | |
580 | struct NbShapesProperty : public PxIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbShapes, PxSimulationStatistics, PxGeometryType::Enum, PxU32> |
581 | { |
582 | PX_PHYSX_CORE_API NbShapesProperty(); |
583 | }; |
584 | |
585 | |
586 | struct NbDiscreteContactPairsProperty : public PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbDiscreteContactPairs |
587 | , PxSimulationStatistics |
588 | , PxGeometryType::Enum |
589 | , PxGeometryType::Enum |
590 | , PxU32> |
591 | { |
592 | PX_PHYSX_CORE_API NbDiscreteContactPairsProperty(); |
593 | }; |
594 | struct NbModifiedContactPairsProperty : public PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbModifiedContactPairs |
595 | , PxSimulationStatistics |
596 | , PxGeometryType::Enum |
597 | , PxGeometryType::Enum |
598 | , PxU32> |
599 | { |
600 | PX_PHYSX_CORE_API NbModifiedContactPairsProperty(); |
601 | }; |
602 | |
603 | struct NbCCDPairsProperty : public PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbCCDPairs |
604 | , PxSimulationStatistics |
605 | , PxGeometryType::Enum |
606 | , PxGeometryType::Enum |
607 | , PxU32> |
608 | { |
609 | PX_PHYSX_CORE_API NbCCDPairsProperty(); |
610 | }; |
611 | |
612 | struct NbTriggerPairsProperty : public PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbTriggerPairs |
613 | , PxSimulationStatistics |
614 | , PxGeometryType::Enum |
615 | , PxGeometryType::Enum |
616 | , PxU32> |
617 | { |
618 | PX_PHYSX_CORE_API NbTriggerPairsProperty(); |
619 | }; |
620 | |
621 | |
622 | struct SimulationStatisticsProperty : public PxReadOnlyPropertyInfo<PxPropertyInfoName::PxScene_SimulationStatistics, PxScene, PxSimulationStatistics> |
623 | { |
624 | PX_PHYSX_CORE_API SimulationStatisticsProperty(); |
625 | }; |
626 | |
627 | struct PxMetaDataPlane |
628 | { |
629 | PxVec3 normal; |
630 | PxReal distance; |
631 | PxMetaDataPlane( PxVec3 n = PxVec3( 0, 0, 0 ), PxReal d = 0 ) |
632 | : normal( n ) |
633 | , distance( d ) |
634 | { |
635 | } |
636 | }; |
637 | |
638 | #include "PxAutoGeneratedMetaDataObjects.h" |
639 | |
640 | #undef DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP |
641 | |
642 | static PxU32ToName g_physx__PxQueryFlag__EnumConversion[] = { |
643 | { .mName: "eSTATIC" , .mValue: static_cast<PxU32>( PxQueryFlag::eSTATIC ) }, |
644 | { .mName: "eDYNAMIC" , .mValue: static_cast<PxU32>( PxQueryFlag::eDYNAMIC ) }, |
645 | { .mName: "ePREFILTER" , .mValue: static_cast<PxU32>( PxQueryFlag::ePREFILTER ) }, |
646 | { .mName: "ePOSTFILTER" , .mValue: static_cast<PxU32>( PxQueryFlag::ePOSTFILTER ) }, |
647 | { NULL, .mValue: 0 } |
648 | }; |
649 | |
650 | template<> struct PxEnumTraits<PxQueryFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxQueryFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; |
651 | |
652 | |
653 | template<typename TObjType, typename TOperator> |
654 | inline PxU32 visitAllProperties( TOperator inOperator ) |
655 | { |
656 | PxU32 thePropCount = PxClassInfoTraits<TObjType>().Info.visitBaseProperties( inOperator ); |
657 | return PxClassInfoTraits<TObjType>().Info.visitInstanceProperties( inOperator, thePropCount ); |
658 | } |
659 | |
660 | template<typename TObjType, typename TOperator> |
661 | inline void visitInstanceProperties( TOperator inOperator ) |
662 | { |
663 | PxClassInfoTraits<TObjType>().Info.visitInstanceProperties( inOperator, 0 ); |
664 | } |
665 | |
666 | } |
667 | |
668 | /** @} */ |
669 | #endif |
670 | |