RavEngine
Loading...
Searching...
No Matches
RepXMetaDataPropertyVisitor.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef PX_REPX_META_DATA_PROPERTY_VISITOR_H
30#define PX_REPX_META_DATA_PROPERTY_VISITOR_H
31#include "PvdMetaDataPropertyVisitor.h"
32
33namespace physx {
34
35 template<PxU32 TKey, typename TObjectType,typename TSetPropType, typename TPropertyType>
37 {
39 typedef TPropertyType prop_type;
40
41 const TPropertyInfoType mProperty;
43 : mProperty( inProp )
44 {
45 }
46 prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj ); }
47 void set( TObjectType* inObj, prop_type val ) const { return mProperty.set( inObj, val ); }
48
49 private:
51 };
52
53 template<typename TSetPropType, typename TPropertyType>
54 struct PxRepXPropertyAccessor<PxPropertyInfoName::PxRigidDynamic_WakeCounter, PxRigidDynamic, TSetPropType, TPropertyType> : public Vd::ValueStructOffsetRecord
55 {
57 typedef TPropertyType prop_type;
58
59 const TPropertyInfoType mProperty;
61 : mProperty( inProp )
62 {
63 }
64 prop_type get( const PxRigidDynamic* inObj ) const { return mProperty.get( inObj ); }
65 void set( PxRigidDynamic* inObj, prop_type val ) const
66 {
67 PX_UNUSED(val);
68 PxRigidBodyFlags flags = inObj->getRigidBodyFlags();
69 if( !(flags & PxRigidBodyFlag::eKINEMATIC) )
70 return mProperty.set( inObj, val );
71 }
72 private:
74 };
75
77
78
79 //RepX cares about fewer property types than PVD does,
80 //but I want to reuse the accessor architecture as it
81 //greatly simplifies clients dealing with complex datatypes
82 template<typename TOperatorType>
84 {
86
88 RepXPropertyFilter( TOperatorType op ) : mFilter( op ) {}
89 RepXPropertyFilter( const RepXPropertyFilter<TOperatorType>& other ) : mFilter( other.mFilter ) {}
90
91 template<PxU32 TKey, typename TObjType, typename TPropertyType>
92 void operator()( const PxReadOnlyPropertyInfo<TKey,TObjType,TPropertyType>&, PxU32 ) {} //repx ignores read only and write only properties
93 template<PxU32 TKey, typename TObjType, typename TPropertyType>
94 void operator()( const PxWriteOnlyPropertyInfo<TKey,TObjType,TPropertyType>&, PxU32 ) {}
95 template<PxU32 TKey, typename TObjType, typename TCollectionType>
97
98 template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TFilterType>
100 //forward these properties verbatim.
101 template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
102 void operator()( const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, PxU32 idx )
103 {
104 mFilter( inProp, idx );
105 }
106
107 template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
109 {
110 mFilter( inProp, idx );
111 }
112
113 template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
114 void operator()( const PxExtendedIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, PxU32 idx)
115 {
116 mFilter( inProp, idx);
117 }
118
119 template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
121 {
122 mFilter( inProp, idx );
123 }
124
125 template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
127 {
128 mFilter( inProp, idx );
129 }
130
131 template<PxU32 TKey, typename TObjType, typename TPropertyType>
132 void operator()( const PxRangePropertyInfo<TKey, TObjType, TPropertyType>& inProp, PxU32 idx )
133 {
134 mFilter( inProp, idx );
135 }
136
137 template<PxU32 TKey, typename TObjType, typename TPropertyType>
138 void operator()( const PxBufferCollectionPropertyInfo<TKey, TObjType, TPropertyType>& inProp, PxU32 count )
139 {
140 mFilter( inProp, count );
141 }
142
143 template<PxU32 TKey, typename TObjType, typename TSetPropType, typename TPropertyType>
144 void operator()( const PxPropertyInfo<TKey,TObjType,TSetPropType,TPropertyType>& prop, PxU32 )
145 {
147 mFilter.mOperator.pushName( prop.mName );
148 mFilter.template handleAccessor<TKey>( theAccessor );
149 mFilter.mOperator.popName();
150 }
151
152 void operator()(const PxRigidActorGlobalPosePropertyInfo& inProp, PxU32)
153 {
154 mFilter.mOperator.pushName(inProp.mName);
155 mFilter.mOperator.handleRigidActorGlobalPose(inProp);
156 mFilter.mOperator.popName();
157 }
158
159 void operator()( const PxRigidActorShapeCollection& inProp, PxU32 )
160 {
161 mFilter.mOperator.pushName( "Shapes" );
162 mFilter.mOperator.handleShapes( inProp );
163 mFilter.mOperator.popName();
164 }
165
166 void operator()( const PxArticulationLinkCollectionProp& inProp, PxU32 )
167 {
168 mFilter.mOperator.pushName( "Links" );
169 mFilter.mOperator.handleArticulationLinks( inProp );
170 mFilter.mOperator.popName();
171 }
172
173 void operator()( const PxShapeMaterialsProperty& inProp, PxU32 )
174 {
175 mFilter.mOperator.pushName( "Materials" );
176 mFilter.mOperator.handleShapeMaterials( inProp );
177 mFilter.mOperator.popName();
178 }
179
180 void operator()( const TIncomingJointPropType& inProp, PxU32 )
181 {
182 mFilter.mOperator.handleIncomingJoint( inProp );
183 }
184
185 void operator()( const PxShapeGeomProperty& inProp, PxU32 )
186 {
187 mFilter.mOperator.handleGeomProperty( inProp );
188 }
189
190#define DEFINE_REPX_PROPERTY_NOP(datatype) \
191 template<PxU32 TKey, typename TObjType, typename TSetPropType> \
192 void operator()( const PxPropertyInfo<TKey,TObjType,TSetPropType,datatype>&, PxU32 ){}
193
194 DEFINE_REPX_PROPERTY_NOP( const void* )
195 DEFINE_REPX_PROPERTY_NOP( void* )
196 DEFINE_REPX_PROPERTY_NOP( PxSimulationFilterCallback * )
197 DEFINE_REPX_PROPERTY_NOP( physx::PxTaskManager * )
198 DEFINE_REPX_PROPERTY_NOP( PxSimulationFilterShader * )
199 DEFINE_REPX_PROPERTY_NOP( PxSimulationFilterShader)
200 DEFINE_REPX_PROPERTY_NOP( PxContactModifyCallback * )
201 DEFINE_REPX_PROPERTY_NOP( PxCCDContactModifyCallback * )
202 DEFINE_REPX_PROPERTY_NOP( PxSimulationEventCallback * )
203 DEFINE_REPX_PROPERTY_NOP( physx::PxCudaContextManager* )
204 DEFINE_REPX_PROPERTY_NOP( physx::PxCpuDispatcher * )
205 DEFINE_REPX_PROPERTY_NOP( PxRigidActor )
206 DEFINE_REPX_PROPERTY_NOP( const PxRigidActor )
207 DEFINE_REPX_PROPERTY_NOP( PxRigidActor& )
208 DEFINE_REPX_PROPERTY_NOP( const PxRigidActor& )
209 DEFINE_REPX_PROPERTY_NOP( PxScene* )
210 DEFINE_REPX_PROPERTY_NOP( PxAggregate * )
211 DEFINE_REPX_PROPERTY_NOP( PxArticulationReducedCoordinate& )
212 DEFINE_REPX_PROPERTY_NOP( const PxArticulationLink * )
213 DEFINE_REPX_PROPERTY_NOP( const PxRigidDynamic * )
214 DEFINE_REPX_PROPERTY_NOP( const PxRigidStatic * )
215 DEFINE_REPX_PROPERTY_NOP( PxStridedData ) //These are handled in a custom fasion.
216 };
217}
218
219#endif
Class to aggregate actors into a single broad-phase entry.
Definition PxAggregate.h:98
A tree structure of bodies connected by joints that is treated as a unit by the dynamics solver....
Definition PxArticulationReducedCoordinate.h:448
An interface class that the user can implement in order to modify CCD contact constraints.
Definition PxContactModifyCallback.h:500
An interface class that the user can implement in order to modify contact constraints.
Definition PxContactModifyCallback.h:459
A CpuDispatcher is responsible for scheduling the execution of tasks passed to it by the SDK.
Definition PxCpuDispatcher.h:50
PxRigidActor represents a base class shared between dynamic and static rigid bodies in the physics SD...
Definition PxRigidActor.h:53
virtual PxRigidBodyFlags getRigidBodyFlags() const =0
Reads the PxRigidBody flags.
PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK.
Definition PxRigidDynamic.h:82
PxRigidStatic represents a static rigid body simulation object in the physics SDK.
Definition PxRigidStatic.h:58
A scene is a collection of bodies and constraints which can interact.
Definition PxScene.h:178
An interface class that the user can implement in order to receive simulation events.
Definition PxSimulationEventCallback.h:792
Filter callback to specify handling of collision pairs.
Definition PxFiltering.h:633
The PxTaskManager interface.
Definition PxTaskManager.h:81
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PxFilterFlags(* PxSimulationFilterShader)(PxFilterObjectAttributes attributes0, PxFilterData filterData0, PxFilterObjectAttributes attributes1, PxFilterData filterData1, PxPairFlags &pairFlags, const void *constantBlock, PxU32 constantBlockSize)
Filter method to specify how a pair of potentially colliding objects should be processed.
Definition PxFiltering.h:604
Definition PxMetaDataObjects.h:575
Definition PxMetaDataObjects.h:298
Definition PxMetaDataObjects.h:255
Definition PxMetaDataObjects.h:274
Definition PxMetaDataObjects.h:230
Definition PxMetaDataObjects.h:321
Definition PxMetaDataObjects.h:211
Definition PxMetaDataObjects.h:114
Definition PxMetaDataObjects.h:173
Definition PxMetaDataObjects.h:186
Definition PxMetaDataObjects.h:353
Definition PxMetaDataObjects.h:373
Definition PxMetaDataObjects.h:149
Definition RepXMetaDataPropertyVisitor.h:37
Definition PxMetaDataObjects.h:559
@ eKINEMATIC
Enables kinematic mode for the actor.
Definition PxRigidBody.h:74
Definition PxMetaDataObjects.h:520
Definition PxMetaDataObjects.h:540
Definition PxCoreUtilityTypes.h:45
Definition PxMetaDataObjects.h:160
Definition RepXMetaDataPropertyVisitor.h:84
Definition PvdMetaDataPropertyVisitor.h:45
Definition PvdMetaDataExtensions.h:109