29#ifndef PVD_META_DATA_DEFINE_PROPERTIES_H
30#define PVD_META_DATA_DEFINE_PROPERTIES_H
34#include "common/PxCoreUtilityTypes.h"
36#include "PvdMetaDataPropertyVisitor.h"
37#include "PxPvdDataStreamHelpers.h"
38#include "PxPvdDataStream.h"
44 using namespace physx::pvdsdk;
46 template<
typename TPropType>
47 struct PropertyDefinitionOp
51 mHelper.
createProperty( mClassKey,
"", getPvdNamespacedNameForType<TPropType>(), PropertyType::Scalar );
55 struct PropertyDefinitionOp<const char*>
59 mHelper.
createProperty( mClassKey,
"", getPvdNamespacedNameForType<StringHandle>(), PropertyType::Scalar );
62#define DEFINE_PROPERTY_DEFINITION_OP_NOP( type ) \
63 template<> struct PropertyDefinitionOp<type> { void defineProperty( PvdPropertyDefinitionHelper&, NamespacedName ){} };
69#define DEFINE_PROPERTY_DEFINITION_OBJECT_REF( type ) \
70 template<> struct PropertyDefinitionOp<type> { \
71 void defineProperty( PvdPropertyDefinitionHelper& mHelper, NamespacedName mClassKey) \
73 mHelper.createProperty( mClassKey, "", getPvdNamespacedNameForType<ObjectRef>(), PropertyType::Scalar ); \
85struct PvdClassInfoDefine
92 , mClassKey( inClassName ) { }
94 PvdClassInfoDefine(
const PvdClassInfoDefine& other )
95 : mHelper( other.mHelper )
96 , mClassKey( other.mClassKey )
100 void defineProperty(
NamespacedName inDtype,
const char* semantic =
"", PropertyType::Enum inPType = PropertyType::Scalar )
102 mHelper.createProperty( mClassKey, semantic, inDtype, inPType );
105 void pushName(
const char* inName )
107 mHelper.pushName( inName );
110 void pushBracketedName(
const char* inName)
112 mHelper.pushBracketedName( inName );
120 inline void defineNameValueDefs(
const PxU32ToName* theConversions )
122 while( theConversions->mName != NULL )
124 mHelper.addNamedValue( theConversions->mName, theConversions->mValue );
129 template<
typename TAccessorType>
130 void simpleProperty( PxU32, TAccessorType& )
132 typedef typename TAccessorType::prop_type TPropertyType;
133 PropertyDefinitionOp<TPropertyType>().defineProperty( mHelper, mClassKey );
136 template<
typename TAccessorType,
typename TInfoType>
137 void extendedIndexedProperty( PxU32* key,
const TAccessorType& inProp, TInfoType& )
139 simpleProperty(*key, inProp);
142 template<
typename TDataType>
145 size_t s =
sizeof( TDataType );
148 case 1:
return getPvdNamespacedNameForType<PxU8>();
149 case 2:
return getPvdNamespacedNameForType<PxU16>();
150 case 4:
return getPvdNamespacedNameForType<PxU32>();
151 default:
return getPvdNamespacedNameForType<PxU64>();
155 template<
typename TAccessorType>
156 void enumProperty( PxU32 , TAccessorType& ,
const PxU32ToName* inConversions )
158 typedef typename TAccessorType::prop_type TPropType;
159 defineNameValueDefs( inConversions );
160 defineProperty( getNameForEnumType<TPropType>(),
"Enumeration Value" );
163 template<
typename TAccessorType>
164 void flagsProperty( PxU32 ,
const TAccessorType& ,
const PxU32ToName* inConversions )
166 typedef typename TAccessorType::prop_type TPropType;
167 defineNameValueDefs( inConversions );
168 defineProperty( getNameForEnumType<TPropType>(),
"Bitflag" );
171 template<
typename TAccessorType,
typename TInfoType>
172 void complexProperty( PxU32* key,
const TAccessorType& inAccessor, TInfoType& inInfo )
174 PxU32 theOffset = inAccessor.mOffset;
175 inInfo.visitBaseProperties( makePvdPropertyFilter( *
this, key, &theOffset ) );
176 inInfo.visitInstanceProperties( makePvdPropertyFilter( *
this, key, &theOffset ) );
179 template<
typename TAccessorType,
typename TInfoType>
180 void bufferCollectionProperty( PxU32* key,
const TAccessorType& inAccessor, TInfoType& inInfo )
182 complexProperty(key, inAccessor, inInfo);
185 template<PxU32 TKey,
typename TObjectType,
typename TPropertyType, PxU32 TEnableFlag>
186 void handleBuffer(
const PxBufferPropertyInfo<TKey, TObjectType,
const PxArray< TPropertyType >&, TEnableFlag>& inProp )
188 mHelper.pushName( inProp.mName );
189 defineProperty( getPvdNamespacedNameForType<TPropertyType>(),
"", PropertyType::Array );
193 template<PxU32 TKey,
typename TObjectType,
typename TCollectionType>
196 mHelper.pushName( inProp.mName );
197 defineProperty( getPvdNamespacedNameForType<TCollectionType>(),
"", PropertyType::Array );
201 template<PxU32 TKey,
typename TObjectType,
typename TEnumType>
204 mHelper.pushName( inProp.mName );
205 defineNameValueDefs( inConversions );
206 defineProperty( getNameForEnumType<TEnumType>(),
"Enumeration Value", PropertyType::Array );
211 PvdClassInfoDefine& operator=(
const PvdClassInfoDefine&);
214template<
typename TPropType>
215struct SimplePropertyValueStructOp
219 mHelper.addPropertyMessageArg<TPropType>( inOffset );
223#define DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_OP_NOP( type ) \
224template<> struct SimplePropertyValueStructOp<type> { void addPropertyMessageArg( PvdPropertyDefinitionHelper&, PxU32 ){}};
229#define DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( type ) \
230template<> struct SimplePropertyValueStructOp<type> { \
231void addPropertyMessageArg( PvdPropertyDefinitionHelper& mHelper, PxU32 inOffset ) \
233 mHelper.addPropertyMessageArg<VoidPtr>( inOffset ); \
241DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP(
PxConvexMesh* )
242DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP(
PxHeightField* )
245struct PvdClassInfoValueStructDefine
248 PvdClassInfoValueStructDefine& operator=(
const PvdClassInfoValueStructDefine&);
257 PvdClassInfoValueStructDefine(
const PvdClassInfoValueStructDefine& other )
258 : mHelper( other.mHelper )
262 void defineValueStructOffset(
const ValueStructOffsetRecord& inProp, PxU32 inPropSize )
264 if( inProp.mHasValidOffset )
268 case 8: mHelper.addPropertyMessageArg<PxU64>( inProp.mOffset );
break;
269 case 4: mHelper.addPropertyMessageArg<PxU32>( inProp.mOffset );
break;
270 case 2: mHelper.addPropertyMessageArg<PxU16>( inProp.mOffset );
break;
272 PX_ASSERT(1 == inPropSize);
273 mHelper.addPropertyMessageArg<PxU8>( inProp.mOffset );
break;
278 void pushName(
const char* inName )
283 void pushBracketedName(
const char* inName)
293 template<
typename TAccessorType,
typename TInfoType>
294 void bufferCollectionProperty( PxU32* ,
const TAccessorType& , TInfoType& )
299 template<
typename TAccessorType>
300 void simpleProperty( PxU32 , TAccessorType& inProp )
302 typedef typename TAccessorType::prop_type TPropertyType;
303 if ( inProp.mHasValidOffset )
305 SimplePropertyValueStructOp<TPropertyType>().addPropertyMessageArg( mHelper, inProp.mOffset );
309 template<
typename TAccessorType>
310 void enumProperty( PxU32 , TAccessorType& inAccessor,
const PxU32ToName* )
312 typedef typename TAccessorType::prop_type TPropType;
313 defineValueStructOffset( inAccessor,
sizeof( TPropType ) );
316 template<
typename TAccessorType>
317 void flagsProperty( PxU32 ,
const TAccessorType& inAccessor,
const PxU32ToName* )
319 typedef typename TAccessorType::prop_type TPropType;
320 defineValueStructOffset( inAccessor,
sizeof( TPropType ) );
323 template<
typename TAccessorType,
typename TInfoType>
324 void complexProperty( PxU32* key,
const TAccessorType& inAccessor, TInfoType& inInfo )
326 PxU32 theOffset = inAccessor.mOffset;
327 inInfo.visitBaseProperties( makePvdPropertyFilter( *
this, key, &theOffset ) );
328 inInfo.visitInstanceProperties( makePvdPropertyFilter( *
this, key, &theOffset ) );
331 template<PxU32 TKey,
typename TObjectType,
typename TCollectionType>
336 template<PxU32 TKey,
typename TObjectType,
typename TEnumType>
341 template<PxU32 TKey,
typename TObjectType,
typename TInfoType>
A triangle mesh containing the PxMeshMidPhase::eBVH33 structure.
Definition PxTriangleMesh.h:308
A triangle mesh containing the PxMeshMidPhase::eBVH34 structure.
Definition PxTriangleMesh.h:324
A convex mesh.
Definition PxConvexMesh.h:83
A height field class.
Definition PxHeightField.h:84
A tetramedron mesh, also called a 'tetrahedron soup'.
Definition PxTetrahedronMesh.h:115
A triangle mesh, also called a 'polygon soup'.
Definition PxTriangleMesh.h:118
Definition PxPvdDataStreamHelpers.h:43
virtual void pushBracketedName(const char *inName, const char *leftBracket="[", const char *rightBracket="]")=0
virtual void createProperty(const NamespacedName &clsName, const char *inSemantic, const NamespacedName &dtypeName, PropertyType::Enum propType=PropertyType::Scalar)=0
virtual void pushName(const char *inName, const char *inAppendStr=".")=0
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition PxCoreUtilityTypes.h:96
Definition PxMetaDataObjects.h:298
Definition PxMetaDataObjects.h:353
Definition PxCoreUtilityTypes.h:45
Definition PxMetaDataObjects.h:124
Definition PxPvdObjectModelBaseTypes.h:188