This commit is contained in:
2025-11-28 23:13:44 +05:30
commit a3a8e79709
7360 changed files with 1156074 additions and 0 deletions

View File

@ -0,0 +1,352 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PVD_META_DATA_DEFINE_PROPERTIES_H
#define PVD_META_DATA_DEFINE_PROPERTIES_H
#if PX_SUPPORT_PVD
#include "common/PxCoreUtilityTypes.h"
#include "PvdMetaDataPropertyVisitor.h"
#include "PxPvdDataStreamHelpers.h"
#include "PxPvdDataStream.h"
namespace physx
{
namespace Vd
{
using namespace physx::shdfnd;
using namespace physx::pvdsdk;
template<typename TPropType>
struct PropertyDefinitionOp
{
void defineProperty( PvdPropertyDefinitionHelper& mHelper, NamespacedName mClassKey )
{
mHelper.createProperty( mClassKey, "", getPvdNamespacedNameForType<TPropType>(), PropertyType::Scalar );
}
};
template<>
struct PropertyDefinitionOp<const char*>
{
void defineProperty( PvdPropertyDefinitionHelper& mHelper, NamespacedName mClassKey )
{
mHelper.createProperty( mClassKey, "", getPvdNamespacedNameForType<StringHandle>(), PropertyType::Scalar );
}
};
#define DEFINE_PROPERTY_DEFINITION_OP_NOP( type ) \
template<> struct PropertyDefinitionOp<type> { void defineProperty( PvdPropertyDefinitionHelper&, NamespacedName ){} };
//NOP out these two types.
DEFINE_PROPERTY_DEFINITION_OP_NOP( PxStridedData )
DEFINE_PROPERTY_DEFINITION_OP_NOP( PxBoundedData )
#define DEFINE_PROPERTY_DEFINITION_OBJECT_REF( type ) \
template<> struct PropertyDefinitionOp<type> { \
void defineProperty( PvdPropertyDefinitionHelper& mHelper, NamespacedName mClassKey) \
{ \
mHelper.createProperty( mClassKey, "", getPvdNamespacedNameForType<ObjectRef>(), PropertyType::Scalar ); \
} \
};
DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxTriangleMesh* )
DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxBVH33TriangleMesh* )
DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxBVH34TriangleMesh* )
DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxConvexMesh* )
DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxHeightField* )
struct PvdClassInfoDefine
{
PvdPropertyDefinitionHelper& mHelper;
NamespacedName mClassKey;
PvdClassInfoDefine( PvdPropertyDefinitionHelper& info, NamespacedName inClassName )
: mHelper( info )
, mClassKey( inClassName ) { }
PvdClassInfoDefine( const PvdClassInfoDefine& other )
: mHelper( other.mHelper )
, mClassKey( other.mClassKey )
{
}
void defineProperty( NamespacedName inDtype, const char* semantic = "", PropertyType::Enum inPType = PropertyType::Scalar )
{
mHelper.createProperty( mClassKey, semantic, inDtype, inPType );
}
void pushName( const char* inName )
{
mHelper.pushName( inName );
}
void pushBracketedName( const char* inName)
{
mHelper.pushBracketedName( inName );
}
void popName()
{
mHelper.popName();
}
inline void defineNameValueDefs( const PxU32ToName* theConversions )
{
while( theConversions->mName != NULL )
{
mHelper.addNamedValue( theConversions->mName, theConversions->mValue );
++theConversions;
}
}
template<typename TAccessorType>
void simpleProperty( PxU32, TAccessorType& /*inProp */)
{
typedef typename TAccessorType::prop_type TPropertyType;
PropertyDefinitionOp<TPropertyType>().defineProperty( mHelper, mClassKey );
}
template<typename TAccessorType, typename TInfoType>
void extendedIndexedProperty( PxU32* key, const TAccessorType& inProp, TInfoType& )
{
simpleProperty(*key, inProp);
}
template<typename TDataType>
static NamespacedName getNameForEnumType()
{
size_t s = sizeof( TDataType );
switch(s)
{
case 1: return getPvdNamespacedNameForType<PxU8>();
case 2: return getPvdNamespacedNameForType<PxU16>();
case 4: return getPvdNamespacedNameForType<PxU32>();
default: return getPvdNamespacedNameForType<PxU64>();
}
}
template<typename TAccessorType>
void enumProperty( PxU32 /*key*/, TAccessorType& /*inProp*/, const PxU32ToName* inConversions )
{
typedef typename TAccessorType::prop_type TPropType;
defineNameValueDefs( inConversions );
defineProperty( getNameForEnumType<TPropType>(), "Enumeration Value" );
}
template<typename TAccessorType>
void flagsProperty( PxU32 /*key*/, const TAccessorType& /*inAccessor*/, const PxU32ToName* inConversions )
{
typedef typename TAccessorType::prop_type TPropType;
defineNameValueDefs( inConversions );
defineProperty( getNameForEnumType<TPropType>(), "Bitflag" );
}
template<typename TAccessorType, typename TInfoType>
void complexProperty( PxU32* key, const TAccessorType& inAccessor, TInfoType& inInfo )
{
PxU32 theOffset = inAccessor.mOffset;
inInfo.visitBaseProperties( makePvdPropertyFilter( *this, key, &theOffset ) );
inInfo.visitInstanceProperties( makePvdPropertyFilter( *this, key, &theOffset ) );
}
template<typename TAccessorType, typename TInfoType>
void bufferCollectionProperty( PxU32* key, const TAccessorType& inAccessor, TInfoType& inInfo )
{
complexProperty(key, inAccessor, inInfo);
}
template<PxU32 TKey, typename TObjectType, typename TPropertyType, PxU32 TEnableFlag>
void handleBuffer( const PxBufferPropertyInfo<TKey, TObjectType, const Array< TPropertyType >&, TEnableFlag>& inProp )
{
mHelper.pushName( inProp.mName );
defineProperty( getPvdNamespacedNameForType<TPropertyType>(), "", PropertyType::Array );
mHelper.popName();
}
template<PxU32 TKey, typename TObjectType, typename TCollectionType>
void handleCollection( const PxReadOnlyCollectionPropertyInfo<TKey, TObjectType, TCollectionType>& inProp )
{
mHelper.pushName( inProp.mName );
defineProperty( getPvdNamespacedNameForType<TCollectionType>(), "", PropertyType::Array );
mHelper.popName();
}
template<PxU32 TKey, typename TObjectType, typename TEnumType>
void handleCollection( const PxReadOnlyCollectionPropertyInfo<TKey, TObjectType, TEnumType>& inProp, const PxU32ToName* inConversions )
{
mHelper.pushName( inProp.mName );
defineNameValueDefs( inConversions );
defineProperty( getNameForEnumType<TEnumType>(), "Enumeration Value", PropertyType::Array );
mHelper.popName();
}
private:
PvdClassInfoDefine& operator=(const PvdClassInfoDefine&);
};
template<typename TPropType>
struct SimplePropertyValueStructOp
{
void addPropertyMessageArg( PvdPropertyDefinitionHelper& mHelper, PxU32 inOffset )
{
mHelper.addPropertyMessageArg<TPropType>( inOffset );
}
};
#define DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_OP_NOP( type ) \
template<> struct SimplePropertyValueStructOp<type> { void addPropertyMessageArg( PvdPropertyDefinitionHelper&, PxU32 ){}};
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_OP_NOP( PxStridedData )
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_OP_NOP( PxBoundedData )
#define DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( type ) \
template<> struct SimplePropertyValueStructOp<type> { \
void addPropertyMessageArg( PvdPropertyDefinitionHelper& mHelper, PxU32 inOffset ) \
{ \
mHelper.addPropertyMessageArg<VoidPtr>( inOffset ); \
} \
};
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxTriangleMesh* )
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxBVH33TriangleMesh* )
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxBVH34TriangleMesh* )
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxConvexMesh* )
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxHeightField* )
struct PvdClassInfoValueStructDefine
{
private:
PvdClassInfoValueStructDefine& operator=(const PvdClassInfoValueStructDefine&);
public:
PvdPropertyDefinitionHelper& mHelper;
PvdClassInfoValueStructDefine( PvdPropertyDefinitionHelper& info )
: mHelper( info )
{ }
PvdClassInfoValueStructDefine( const PvdClassInfoValueStructDefine& other )
: mHelper( other.mHelper )
{
}
void defineValueStructOffset( const ValueStructOffsetRecord& inProp, PxU32 inPropSize )
{
if( inProp.mHasValidOffset )
{
switch( inPropSize )
{
case 8: mHelper.addPropertyMessageArg<PxU64>( inProp.mOffset ); break;
case 4: mHelper.addPropertyMessageArg<PxU32>( inProp.mOffset ); break;
case 2: mHelper.addPropertyMessageArg<PxU16>( inProp.mOffset ); break;
default:
PX_ASSERT(1 == inPropSize);
mHelper.addPropertyMessageArg<PxU8>( inProp.mOffset ); break;
}
}
}
void pushName( const char* inName )
{
mHelper.pushName( inName );
}
void pushBracketedName( const char* inName)
{
mHelper.pushBracketedName( inName );
}
void popName()
{
mHelper.popName();
}
template<typename TAccessorType, typename TInfoType>
void bufferCollectionProperty( PxU32* /*key*/, const TAccessorType& /*inAccessor*/, TInfoType& /*inInfo*/ )
{
//complexProperty(key, inAccessor, inInfo);
}
template<typename TAccessorType>
void simpleProperty( PxU32 /*key*/, TAccessorType& inProp )
{
typedef typename TAccessorType::prop_type TPropertyType;
if ( inProp.mHasValidOffset )
{
SimplePropertyValueStructOp<TPropertyType>().addPropertyMessageArg( mHelper, inProp.mOffset );
}
}
template<typename TAccessorType>
void enumProperty( PxU32 /*key*/, TAccessorType& inAccessor, const PxU32ToName* /*inConversions */)
{
typedef typename TAccessorType::prop_type TPropType;
defineValueStructOffset( inAccessor, sizeof( TPropType ) );
}
template<typename TAccessorType>
void flagsProperty( PxU32 /*key*/, const TAccessorType& inAccessor, const PxU32ToName* /*inConversions */)
{
typedef typename TAccessorType::prop_type TPropType;
defineValueStructOffset( inAccessor, sizeof( TPropType ) );
}
template<typename TAccessorType, typename TInfoType>
void complexProperty( PxU32* key, const TAccessorType& inAccessor, TInfoType& inInfo )
{
PxU32 theOffset = inAccessor.mOffset;
inInfo.visitBaseProperties( makePvdPropertyFilter( *this, key, &theOffset ) );
inInfo.visitInstanceProperties( makePvdPropertyFilter( *this, key, &theOffset ) );
}
template<PxU32 TKey, typename TObjectType, typename TCollectionType>
void handleCollection( const PxReadOnlyCollectionPropertyInfo<TKey, TObjectType, TCollectionType>& /*prop*/ )
{
}
template<PxU32 TKey, typename TObjectType, typename TEnumType>
void handleCollection( const PxReadOnlyCollectionPropertyInfo<TKey, TObjectType, TEnumType>& /*prop*/, const PxU32ToName* /*inConversions */)
{
}
template<PxU32 TKey, typename TObjectType, typename TInfoType>
void handleCollection( const PxBufferCollectionPropertyInfo<TKey, TObjectType, TInfoType>& /*prop*/, const TInfoType& /*inInfo */)
{
}
};
}
}
#endif
#endif

View File

@ -0,0 +1,318 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_META_DATA_EXTENSIONS_H
#define PX_META_DATA_EXTENSIONS_H
#include "PxMetaDataObjects.h"
#if PX_SUPPORT_PVD
#include "PxPvdObjectModelBaseTypes.h"
namespace physx { namespace pvdsdk {
template<> PX_INLINE NamespacedName getPvdNamespacedNameForType<physx::PxMetaDataPlane>() { return getPvdNamespacedNameForType<PxVec4>(); }
template<> PX_INLINE NamespacedName getPvdNamespacedNameForType<physx::PxRigidActor*>() { return getPvdNamespacedNameForType<VoidPtr>(); }
}}
#endif
namespace physx
{
namespace Vd
{
//Additional properties that exist only in pvd land.
struct PxPvdOnlyProperties
{
enum Enum
{
FirstProp = PxPropertyInfoName::LastPxPropertyInfoName,
PxScene_Frame,
PxScene_Contacts,
PxScene_SimulateElapsedTime,
#define DEFINE_ENUM_RANGE( stem, count ) \
stem##Begin, \
stem##End = stem##Begin + count
//I can't easily add up the number of required property entries, but it is large due to the below
//geometry count squared properties. Thus I punt and allocate way more than I need right now.
DEFINE_ENUM_RANGE( PxScene_SimulationStatistics, 1000 ),
DEFINE_ENUM_RANGE( PxSceneDesc_Limits, PxPropertyInfoName::PxSceneLimits_PropertiesStop - PxPropertyInfoName::PxSceneLimits_PropertiesStart ),
DEFINE_ENUM_RANGE( PxSimulationStatistics_NumShapes, PxGeometryType::eGEOMETRY_COUNT ),
DEFINE_ENUM_RANGE( PxSimulationStatistics_NumDiscreteContactPairs, PxGeometryType::eGEOMETRY_COUNT * PxGeometryType::eGEOMETRY_COUNT ),
DEFINE_ENUM_RANGE( PxSimulationStatistics_NumModifiedContactPairs, PxGeometryType::eGEOMETRY_COUNT * PxGeometryType::eGEOMETRY_COUNT ),
DEFINE_ENUM_RANGE( PxSimulationStatistics_NumSweptIntegrationPairs, PxGeometryType::eGEOMETRY_COUNT * PxGeometryType::eGEOMETRY_COUNT ),
DEFINE_ENUM_RANGE( PxSimulationStatistics_NumTriggerPairs, PxGeometryType::eGEOMETRY_COUNT * PxGeometryType::eGEOMETRY_COUNT ),
DEFINE_ENUM_RANGE( PxRigidDynamic_SolverIterationCounts, 2 ),
DEFINE_ENUM_RANGE( PxArticulation_SolverIterationCounts, 2 ),
DEFINE_ENUM_RANGE( PxArticulationJoint_SwingLimit, 2 ),
DEFINE_ENUM_RANGE( PxArticulationJoint_TwistLimit, 2 ),
DEFINE_ENUM_RANGE( PxConvexMeshGeometry_Scale, PxPropertyInfoName::PxMeshScale_PropertiesStop - PxPropertyInfoName::PxMeshScale_PropertiesStart ),
DEFINE_ENUM_RANGE( PxTriangleMeshGeometry_Scale, PxPropertyInfoName::PxMeshScale_PropertiesStop - PxPropertyInfoName::PxMeshScale_PropertiesStart ),
LastPxPvdOnlyProperty
};
};
template<PxU32 TKey, typename TObjectType, typename TPropertyType, PxU32 TEnableFlag>
struct PxBufferPropertyInfo : PxReadOnlyPropertyInfo< TKey, TObjectType, TPropertyType >
{
typedef PxReadOnlyPropertyInfo< TKey, TObjectType, TPropertyType > TBaseType;
typedef typename TBaseType::TGetterType TGetterType;
PxBufferPropertyInfo( const char* inName, TGetterType inGetter )
: TBaseType( inName, inGetter )
{
}
bool isEnabled( PxU32 inFlags ) const { return (inFlags & TEnableFlag) > 0; }
};
#define DECLARE_BUFFER_PROPERTY( objectType, baseType, propType, propName, fieldName, flagName ) \
typedef PxBufferPropertyInfo< PxPvdOnlyProperties::baseType##_##propName, objectType, propType, flagName > T##objectType##propName##Base; \
inline propType get##propName( const objectType* inData ) { return inData->fieldName; } \
struct baseType##propName##Property : T##objectType##propName##Base \
{ \
baseType##propName##Property() : T##objectType##propName##Base( #propName, get##propName ){} \
};
template<PxU32 PropertyKey, typename TEnumType >
struct IndexerToNameMap
{
PxEnumTraits<TEnumType> Converter;
};
struct ValueStructOffsetRecord
{
mutable bool mHasValidOffset;
mutable PxU32 mOffset;
ValueStructOffsetRecord() : mHasValidOffset( false ), mOffset( 0 ) {}
void setupValueStructOffset( PxU32 inValue ) const
{
mHasValidOffset = true;
mOffset = inValue;
}
};
template<PxU32 TKey, typename TObjectType, typename TPropertyType>
struct PxPvdReadOnlyPropertyAccessor : public ValueStructOffsetRecord
{
typedef PxReadOnlyPropertyInfo<TKey,TObjectType,TPropertyType> TPropertyInfoType;
typedef TPropertyType prop_type;
const TPropertyInfoType mProperty;
PxPvdReadOnlyPropertyAccessor( const TPropertyInfoType& inProp )
: mProperty( inProp )
{
}
prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj ); }
private:
PxPvdReadOnlyPropertyAccessor& operator=(const PxPvdReadOnlyPropertyAccessor&);
};
template<PxU32 TKey, typename TObjectType, typename TPropertyType>
struct PxBufferCollectionPropertyAccessor : public ValueStructOffsetRecord
{
typedef PxBufferCollectionPropertyInfo< TKey, TObjectType, TPropertyType > TPropertyInfoType;
typedef TPropertyType prop_type;
const TPropertyInfoType& mProperty;
const char* mName;
PxBufferCollectionPropertyAccessor( const TPropertyInfoType& inProp, const char* inName )
: mProperty( inProp )
, mName( inName )
{
}
const char* name() const { return mName; }
PxU32 size( const TObjectType* inObj ) const { return mProperty.size( inObj ); }
PxU32 get( const TObjectType* inObj, prop_type* buffer, PxU32 inNumItems) const { return mProperty.get( inObj, buffer, inNumItems); }
void set( TObjectType* inObj, prop_type* inBuffer, PxU32 inNumItems ) const { mProperty.set( inObj, inBuffer, inNumItems ); }
};
template<PxU32 TKey, typename TObjectType, typename TIndexType, typename TPropertyType>
struct PxPvdIndexedPropertyAccessor : public ValueStructOffsetRecord
{
typedef PxIndexedPropertyInfo< TKey, TObjectType, TIndexType, TPropertyType > TPropertyInfoType;
typedef TPropertyType prop_type;
TIndexType mIndex;
const TPropertyInfoType& mProperty;
PxPvdIndexedPropertyAccessor( const TPropertyInfoType& inProp, PxU32 inIndex )
: mIndex( static_cast<TIndexType>( inIndex ) )
, mProperty( inProp )
{
}
prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj, mIndex ); }
void set( TObjectType* inObj, prop_type val ) const { mProperty.set( inObj, mIndex, val ); }
void operator = (PxPvdIndexedPropertyAccessor&) {}
};
template<PxU32 TKey, typename TObjectType, typename TIndexType, typename TPropertyType>
struct PxPvdExtendedIndexedPropertyAccessor : public ValueStructOffsetRecord
{
typedef PxExtendedIndexedPropertyInfo< TKey, TObjectType, TIndexType, TPropertyType > TPropertyInfoType;
typedef TPropertyType prop_type;
TIndexType mIndex;
const TPropertyInfoType& mProperty;
PxPvdExtendedIndexedPropertyAccessor( const TPropertyInfoType& inProp, PxU32 inIndex )
: mIndex( static_cast<TIndexType>( inIndex ) )
, mProperty( inProp )
{
}
PxU32 size( const TObjectType* inObj ) const { return mProperty.size( inObj ); }
prop_type get( const TObjectType* inObj, TIndexType index ) const { return mProperty.get( inObj, index ); }
void set( TObjectType* inObj, TIndexType index, prop_type val ) const { mProperty.set( inObj, index, val ); }
void operator = (PxPvdExtendedIndexedPropertyAccessor&) {}
};
template<PxU32 TKey, typename TObjectType, typename TIndexType, typename TPropertyType>
struct PxPvdFixedSizeLookupTablePropertyAccessor : public ValueStructOffsetRecord
{
typedef PxFixedSizeLookupTablePropertyInfo< TKey, TObjectType, TIndexType, TPropertyType > TPropertyInfoType;
typedef TPropertyType prop_type;
TIndexType mIndex;
const TPropertyInfoType& mProperty;
PxPvdFixedSizeLookupTablePropertyAccessor( const TPropertyInfoType& inProp, const PxU32 inIndex3 )
: mIndex( static_cast<TIndexType>( inIndex3 ) )
, mProperty( inProp )
{
}
PxU32 size( const TObjectType* inObj ) const { return mProperty.size( inObj ); }
prop_type getX( const TObjectType* inObj, const TIndexType index ) const { return mProperty.getX( inObj, index ); }
prop_type getY( const TObjectType* inObj, const TIndexType index ) const { return mProperty.getY( inObj, index ); }
void addPair( TObjectType* inObj, const PxReal x, const PxReal y ) { const_cast<TPropertyInfoType&>(mProperty).addPair( inObj, x, y ); }
void clear( TObjectType* inObj ) { const_cast<TPropertyInfoType&>(mProperty).clear( inObj ); }
void operator = (PxPvdFixedSizeLookupTablePropertyAccessor&) {}
};
template<PxU32 TKey, typename TObjectType, typename TIdx0Type, typename TIdx1Type, typename TPropertyType>
struct PxPvdDualIndexedPropertyAccessor : public ValueStructOffsetRecord
{
typedef PxDualIndexedPropertyInfo< TKey, TObjectType, TIdx0Type, TIdx1Type, TPropertyType > TPropertyInfoType;
typedef TPropertyType prop_type;
TIdx0Type mIdx0;
TIdx1Type mIdx1;
const TPropertyInfoType& mProperty;
PxPvdDualIndexedPropertyAccessor( const TPropertyInfoType& inProp, PxU32 idx0, PxU32 idx1 )
: mIdx0( static_cast<TIdx0Type>( idx0 ) )
, mIdx1( static_cast<TIdx1Type>( idx1 ) )
, mProperty( inProp )
{
}
prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj, mIdx0, mIdx1 ); }
void set( TObjectType* inObj, prop_type val ) const { mProperty.set( inObj, mIdx0, mIdx1, val ); }
private:
PxPvdDualIndexedPropertyAccessor& operator = (const PxPvdDualIndexedPropertyAccessor&);
};
template<PxU32 TKey, typename TObjectType, typename TIdx0Type, typename TIdx1Type, typename TPropertyType>
struct PxPvdExtendedDualIndexedPropertyAccessor : public ValueStructOffsetRecord
{
typedef PxExtendedDualIndexedPropertyInfo< TKey, TObjectType, TIdx0Type, TIdx1Type, TPropertyType > TPropertyInfoType;
typedef TPropertyType prop_type;
TIdx0Type mIdx0;
TIdx1Type mIdx1;
const TPropertyInfoType& mProperty;
PxPvdExtendedDualIndexedPropertyAccessor( const TPropertyInfoType& inProp, PxU32 idx0, PxU32 idx1 )
: mIdx0( static_cast<TIdx0Type>( idx0 ) )
, mIdx1( static_cast<TIdx1Type>( idx1 ) )
, mProperty( inProp )
{
}
prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj, mIdx0, mIdx1 ); }
void set( TObjectType* inObj, prop_type val ) const { mProperty.set( inObj, mIdx0, mIdx1, val ); }
private:
PxPvdExtendedDualIndexedPropertyAccessor& operator = (const PxPvdExtendedDualIndexedPropertyAccessor&);
};
template<PxU32 TKey, typename TObjType, typename TPropertyType>
struct PxPvdRangePropertyAccessor : public ValueStructOffsetRecord
{
typedef PxRangePropertyInfo<TKey, TObjType, TPropertyType> TPropertyInfoType;
typedef TPropertyType prop_type;
bool mFirstValue;
const TPropertyInfoType& mProperty;
PxPvdRangePropertyAccessor( const TPropertyInfoType& inProp, bool inFirstValue )
: mFirstValue( inFirstValue )
, mProperty( inProp )
{
}
prop_type get( const TObjType* inObj ) const {
prop_type first,second;
mProperty.get( inObj, first, second );
return mFirstValue ? first : second;
}
void set( TObjType* inObj, prop_type val ) const
{
prop_type first,second;
mProperty.get( inObj, first, second );
if ( mFirstValue ) mProperty.set( inObj, val, second );
else mProperty.set( inObj, first, val );
}
void operator = (PxPvdRangePropertyAccessor&) {}
};
template<typename TDataType>
struct IsFlagsType
{
bool FlagData;
};
template<typename TEnumType, typename TStorageType>
struct IsFlagsType<PxFlags<TEnumType, TStorageType> >
{
const PxU32ToName* FlagData;
IsFlagsType<PxFlags<TEnumType, TStorageType> > () : FlagData( PxEnumTraits<TEnumType>().NameConversion ) {}
};
template<typename TDataType>
struct PvdClassForType
{
bool Unknown;
};
}
}
#endif

View File

@ -0,0 +1,539 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_META_DATA_PROPERTY_VISITOR_H
#define PX_META_DATA_PROPERTY_VISITOR_H
#include <stdio.h>
#include "PvdMetaDataExtensions.h"
namespace physx
{
namespace Vd
{
//PVD only deals with read-only properties, indexed, and properties like this by in large.
//so we have a filter that expands properties to a level where we can get to them and expands them into
//named functions that make more sense and are easier to read than operator()
template<typename TOperatorType>
struct PvdPropertyFilter
{
private:
PvdPropertyFilter& operator=(const PvdPropertyFilter&);
public:
TOperatorType mOperator;
PxU32* mKeyOverride;
PxU32* mOffsetOverride;
PvdPropertyFilter( TOperatorType& inOperator )
: mOperator( inOperator )
, mKeyOverride( 0 )
, mOffsetOverride( 0 ) {}
PvdPropertyFilter( TOperatorType& inOperator, PxU32* inKeyOverride, PxU32* inOffsetOverride )
: mOperator( inOperator )
, mKeyOverride( inKeyOverride )
, mOffsetOverride( inOffsetOverride ) {}
PvdPropertyFilter( const PvdPropertyFilter& inOther ) : mOperator( inOther.mOperator ), mKeyOverride( inOther.mKeyOverride ), mOffsetOverride( inOther.mOffsetOverride ) {}
template<PxU32 TKey, typename TAccessorType>
void dispatchAccessor( PxU32 inKey, const TAccessorType& inAccessor, bool, bool, bool)
{
mOperator.simpleProperty(inKey, inAccessor );
}
template<PxU32 TKey, typename TAccessorType>
void dispatchAccessor( PxU32 inKey, const TAccessorType& inAccessor, bool, bool, const PxU32ToName* inConversions )
{
mOperator.flagsProperty(inKey, inAccessor, inConversions );
}
template<PxU32 TKey, typename TAccessorType>
void dispatchAccessor( PxU32 inKey, const TAccessorType& inAccessor, const PxU32ToName* inConversions, bool, bool )
{
mOperator.enumProperty( inKey, inAccessor, inConversions );
}
template<PxU32 TKey, typename TAccessorType, typename TInfoType>
void dispatchAccessor(PxU32, const TAccessorType& inAccessor, bool, const TInfoType* inInfo, bool )
{
PxU32 rangeStart = TKey;
PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride;
mOperator.complexProperty( &propIdx, inAccessor, *inInfo );
}
PxU32 getKeyValue( PxU32 inPropertyKey )
{
PxU32 retval = inPropertyKey;
if ( mKeyOverride )
{
retval = *mKeyOverride;
(*mKeyOverride)++;
}
return retval;
}
void setupValueStructOffset( const ValueStructOffsetRecord&, bool, PxU32* ) {}
void setupValueStructOffset( const ValueStructOffsetRecord& inAccessor, PxU32 inOffset, PxU32* inAdditionalOffset )
{
//This allows us to nest properties correctly.
if ( inAdditionalOffset ) inOffset += *inAdditionalOffset;
inAccessor.setupValueStructOffset( inOffset );
}
template<PxU32 TKey, typename TAccessorType>
void handleAccessor( PxU32 inKey, const TAccessorType& inAccessor )
{
typedef typename TAccessorType::prop_type TPropertyType;
dispatchAccessor<TKey>( inKey
, inAccessor
, PxEnumTraits<TPropertyType>().NameConversion
, PxClassInfoTraits<TPropertyType>().getInfo()
, IsFlagsType<TPropertyType>().FlagData );
}
template<PxU32 TKey, typename TAccessorType>
void handleAccessor( const TAccessorType& inAccessor )
{
setupValueStructOffset( inAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, mOffsetOverride );
handleAccessor<TKey>( getKeyValue( TKey ), inAccessor );
}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxReadOnlyPropertyInfo<TKey,TObjType,TPropertyType>& inProperty, PxU32 )
{
PxPvdReadOnlyPropertyAccessor< TKey, TObjType, TPropertyType > theAccessor( inProperty );
mOperator.pushName( inProperty.mName );
handleAccessor<TKey>( theAccessor );
mOperator.popName();
}
//We don't handle unbounded indexed properties
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType, typename TValueConversionType, typename TInfoType>
void indexedProperty( PxU32, const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >&, bool, TValueConversionType, const TInfoType& ) {}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void indexedProperty( PxU32, const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, const PxU32ToName* theConversions, const PxUnknownClassInfo& )
{
mOperator.pushName( inProp.mName );
PxU32 rangeStart = TKey;
PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride;
PxU32 theOffset = 0;
if ( mOffsetOverride ) theOffset = *mOffsetOverride;
while( theConversions->mName != NULL )
{
mOperator.pushBracketedName( theConversions->mName );
PxPvdIndexedPropertyAccessor<TKey, TObjType, TIndexType, TPropertyType> theAccessor( inProp, theConversions->mValue );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
handleAccessor<TKey>( propIdx, theAccessor );
mOperator.popName();
++propIdx;
++theConversions;
theOffset += sizeof( TPropertyType );
}
mOperator.popName();
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType, typename TInfoType>
void indexedProperty( PxU32, const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, const PxU32ToName* theConversions, const TInfoType& inInfo )
{
//ouch, not nice. Indexed complex property.
mOperator.pushName( inProp.mName );
PxU32 propIdx = TKey;
PxU32 theOffset = 0;
if ( mOffsetOverride ) theOffset = *mOffsetOverride;
while( theConversions->mName != NULL )
{
mOperator.pushBracketedName( theConversions->mName );
PxPvdIndexedPropertyAccessor<TKey, TObjType, TIndexType, TPropertyType> theAccessor( inProp, theConversions->mValue );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
PX_ASSERT( theAccessor.mHasValidOffset );
mOperator.complexProperty( &propIdx, theAccessor, inInfo );
mOperator.popName();
++theConversions;
theOffset += sizeof( TPropertyType );
}
mOperator.popName();
}
static char* myStrcat(const char* a,const char * b)
{
size_t len = strlen(a)+strlen(b);
char* result = new char[len+1];
strcpy(result,a);
strcat(result,b);
result[len] = 0;
return result;
}
template<PxU32 TKey, typename TObjType, typename TPropertyType, typename TInfoType>
void handleBufferCollectionProperty(PxU32 , const PxBufferCollectionPropertyInfo<TKey, TObjType, TPropertyType >& inProp, const TInfoType& inInfo)
{
//append 'Collection' to buffer properties
char* name = myStrcat(inProp.mName, "Collection");
mOperator.pushName(name);
PxU32 propIdx = TKey;
PxU32 theOffset = 0;
PxBufferCollectionPropertyAccessor<TKey, TObjType, TPropertyType> theAccessor( inProp, inProp.mName );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
mOperator.bufferCollectionProperty( &propIdx, theAccessor, inInfo );
mOperator.popName();
delete []name;
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void operator()( const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, PxU32 inIndex )
{
indexedProperty( inIndex, inProp, IndexerToNameMap<TKey,TIndexType>().Converter.NameConversion
, PxClassInfoTraits<TPropertyType>().Info );
}
template<PxU32 TKey, typename TObjType, typename TPropertyType, typename TIndexType, typename TInfoType>
void handleExtendedIndexProperty(PxU32 inIndex, const PxExtendedIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, const TInfoType& inInfo)
{
mOperator.pushName(inProp.mName);
PxU32 propIdx = TKey;
PxU32 theOffset = 0;
PxPvdExtendedIndexedPropertyAccessor<TKey, TObjType, TIndexType, TPropertyType> theAccessor( inProp, inIndex );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
mOperator.extendedIndexedProperty( &propIdx, theAccessor, inInfo );
mOperator.popName();
}
template<PxU32 TKey, typename TObjType, typename TPropertyType, typename TIndexType, typename TInfoType>
void handlePxFixedSizeLookupTableProperty( const PxU32 inIndex, const PxFixedSizeLookupTablePropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, const TInfoType& inInfo)
{
mOperator.pushName(inProp.mName);
PxU32 propIdx = TKey;
PxU32 theOffset = 0;
PxPvdFixedSizeLookupTablePropertyAccessor<TKey, TObjType, TIndexType, TPropertyType> theAccessor( inProp, inIndex );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
mOperator.PxFixedSizeLookupTableProperty( &propIdx, theAccessor, inInfo );
mOperator.popName();
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void operator()( const PxExtendedIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, PxU32 inIndex )
{
handleExtendedIndexProperty( inIndex, inProp, PxClassInfoTraits<TPropertyType>().Info );
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void operator()( const PxFixedSizeLookupTablePropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, PxU32 inIndex)
{
handlePxFixedSizeLookupTableProperty(inIndex, inProp, PxClassInfoTraits<TPropertyType>().Info);
}
//We don't handle unbounded indexed properties
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType, typename TNameConv, typename TNameConv2 >
void dualIndexedProperty( PxU32 idx, const PxDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >&, TNameConv, TNameConv2 ) { PX_UNUSED(idx); }
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
void dualIndexedProperty( PxU32 /*idx*/, const PxDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >& inProp, const PxU32ToName* c1, const PxU32ToName* c2 )
{
mOperator.pushName( inProp.mName );
PxU32 rangeStart = TKey;
PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride;
PxU32 theOffset = 0;
if ( mOffsetOverride ) theOffset = *mOffsetOverride;
while( c1->mName != NULL )
{
mOperator.pushBracketedName( c1->mName );
const PxU32ToName* c2Idx = c2;
while( c2Idx->mName != NULL )
{
mOperator.pushBracketedName( c2Idx->mName );
PxPvdDualIndexedPropertyAccessor<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType> theAccessor( inProp, c1->mValue, c2Idx->mValue );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
handleAccessor<TKey>( propIdx, theAccessor );
mOperator.popName();
++propIdx;
++c2Idx;
theOffset += sizeof( TPropertyType );
}
mOperator.popName();
++c1;
}
mOperator.popName();
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
void extendedDualIndexedProperty( PxU32 /*idx*/, const PxExtendedDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >& inProp, PxU32 id0Count, PxU32 id1Count )
{
mOperator.pushName( inProp.mName );
PxU32 rangeStart = TKey;
PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride;
PxU32 theOffset = 0;
if ( mOffsetOverride ) theOffset = *mOffsetOverride;
for(PxU32 i = 0; i < id0Count; ++i)
{
char buffer1[32] = { 0 };
sprintf( buffer1, "eId1_%u", i );
mOperator.pushBracketedName( buffer1 );
for(PxU32 j = 0; j < id1Count; ++j)
{
char buffer2[32] = { 0 };
sprintf( buffer2, "eId2_%u", j );
mOperator.pushBracketedName( buffer2 );
PxPvdExtendedDualIndexedPropertyAccessor<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType> theAccessor( inProp, i, j );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
handleAccessor<TKey>( propIdx, theAccessor );
mOperator.popName();
++propIdx;
theOffset += sizeof( TPropertyType );
}
mOperator.popName();
}
mOperator.popName();
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
void operator()( const PxDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >& inProp, PxU32 idx )
{
dualIndexedProperty( idx, inProp
, IndexerToNameMap<TKey,TIndexType>().Converter.NameConversion
, IndexerToNameMap<TKey,TIndex2Type>().Converter.NameConversion );
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
void operator()( const PxExtendedDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >& inProp, PxU32 idx )
{
extendedDualIndexedProperty( idx, inProp, inProp.mId0Count, inProp.mId1Count );
}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxRangePropertyInfo<TKey, TObjType, TPropertyType>& inProperty, PxU32 /*idx*/)
{
PxU32 rangeStart = TKey;
PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride;
PxU32 theOffset = 0;
if ( mOffsetOverride ) theOffset = *mOffsetOverride;
mOperator.pushName( inProperty.mName );
mOperator.pushName( inProperty.mArg0Name );
PxPvdRangePropertyAccessor<TKey, TObjType, TPropertyType> theAccessor( inProperty, true );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
handleAccessor<TKey>( propIdx, theAccessor );
++propIdx;
theOffset += sizeof( TPropertyType );
mOperator.popName();
mOperator.pushName( inProperty.mArg1Name );
theAccessor.mFirstValue = false;
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
handleAccessor<TKey>( propIdx, theAccessor );
mOperator.popName();
mOperator.popName();
}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxBufferCollectionPropertyInfo<TKey, TObjType, TPropertyType>& inProp, PxU32 count )
{
handleBufferCollectionProperty( count, inProp, PxClassInfoTraits<TPropertyType>().Info );
}
template<PxU32 TKey, typename TObjectType, typename TPropertyType, PxU32 TEnableFlag>
void handleBuffer( const PxBufferPropertyInfo<TKey, TObjectType, TPropertyType, TEnableFlag>& inProp )
{
mOperator.handleBuffer( inProp );
}
template<PxU32 TKey, typename TObjectType, typename TPropertyType, PxU32 TEnableFlag>
void operator()( const PxBufferPropertyInfo<TKey, TObjectType, TPropertyType, TEnableFlag>& inProp, PxU32 )
{
handleBuffer( inProp );
}
template<PxU32 TKey, typename TObjType>
void operator()( const PxReadOnlyCollectionPropertyInfo<TKey, TObjType, PxU32>& prop, PxU32 )
{
mOperator.handleCollection( prop );
}
template<PxU32 TKey, typename TObjType>
void operator()( const PxReadOnlyCollectionPropertyInfo<TKey, TObjType, PxReal>& prop, PxU32 )
{
mOperator.handleCollection( prop );
}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxWriteOnlyPropertyInfo<TKey,TObjType,TPropertyType>&, PxU32 ) {}
template<PxU32 TKey, typename TObjType, typename TCollectionType>
void operator()( const PxReadOnlyCollectionPropertyInfo<TKey, TObjType, TCollectionType>&, PxU32 ) {}
template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TFilterType>
void operator()( const PxReadOnlyFilteredCollectionPropertyInfo<TKey, TObjType, TCollectionType, TFilterType >&, PxU32 ) {}
//We don't deal with these property datatypes.
#define DEFINE_PVD_PROPERTY_NOP(datatype) \
template<PxU32 TKey, typename TObjType> \
void operator()( const PxReadOnlyPropertyInfo<TKey,TObjType,datatype>& inProperty, PxU32 ){PX_UNUSED(inProperty); }
DEFINE_PVD_PROPERTY_NOP( const void* )
DEFINE_PVD_PROPERTY_NOP( void* )
DEFINE_PVD_PROPERTY_NOP( PxSimulationFilterCallback * )
DEFINE_PVD_PROPERTY_NOP( physx::PxTaskManager * )
DEFINE_PVD_PROPERTY_NOP( PxSimulationFilterShader * )
DEFINE_PVD_PROPERTY_NOP( PxSimulationFilterShader)
DEFINE_PVD_PROPERTY_NOP( PxContactModifyCallback * )
DEFINE_PVD_PROPERTY_NOP( PxCCDContactModifyCallback * )
DEFINE_PVD_PROPERTY_NOP( PxSimulationEventCallback * )
DEFINE_PVD_PROPERTY_NOP( physx::PxCudaContextManager* )
DEFINE_PVD_PROPERTY_NOP( physx::PxCpuDispatcher * )
DEFINE_PVD_PROPERTY_NOP( PxRigidActor )
DEFINE_PVD_PROPERTY_NOP( const PxRigidActor )
DEFINE_PVD_PROPERTY_NOP( PxRigidActor& )
DEFINE_PVD_PROPERTY_NOP( const PxRigidActor& )
DEFINE_PVD_PROPERTY_NOP( PxScene* )
DEFINE_PVD_PROPERTY_NOP( PxConstraint )
DEFINE_PVD_PROPERTY_NOP( PxConstraint* )
DEFINE_PVD_PROPERTY_NOP( PxConstraint& )
DEFINE_PVD_PROPERTY_NOP( const PxConstraint& )
DEFINE_PVD_PROPERTY_NOP( PxAggregate * )
DEFINE_PVD_PROPERTY_NOP( PxArticulationBase& )
DEFINE_PVD_PROPERTY_NOP( PxArticulation& )
DEFINE_PVD_PROPERTY_NOP( PxArticulationReducedCoordinate&)
DEFINE_PVD_PROPERTY_NOP( const PxArticulationLink * )
DEFINE_PVD_PROPERTY_NOP( const PxRigidDynamic * )
DEFINE_PVD_PROPERTY_NOP( const PxRigidStatic * )
DEFINE_PVD_PROPERTY_NOP( PxArticulationJointBase * )
DEFINE_PVD_PROPERTY_NOP( PxArticulationJointReducedCoordinate * )
DEFINE_PVD_PROPERTY_NOP( PxArticulationJoint * )
DEFINE_PVD_PROPERTY_NOP( PxBroadPhaseCallback * )
DEFINE_PVD_PROPERTY_NOP( const PxBroadPhaseRegion * )
DEFINE_PVD_PROPERTY_NOP( PxU32 * )
};
template<typename TOperator>
inline PvdPropertyFilter<TOperator> makePvdPropertyFilter( TOperator inOperator )
{
return PvdPropertyFilter<TOperator>( inOperator );
}
template<typename TOperator>
inline PvdPropertyFilter<TOperator> makePvdPropertyFilter( TOperator inOperator, PxU32* inKey, PxU32* inOffset )
{
return PvdPropertyFilter<TOperator>( inOperator, inKey, inOffset );
}
template<typename TOperator, typename TFuncType>
inline void visitWithPvdFilter( TOperator inOperator, TFuncType inFuncType )
{
PX_UNUSED(inFuncType);
TFuncType( makePvdPropertyFilter( inOperator ) );
}
template<typename TObjType, typename TOperator>
inline void visitInstancePvdProperties( TOperator inOperator )
{
visitInstanceProperties<TObjType>( makePvdPropertyFilter( inOperator ) );
}
template<typename TOperator>
struct PvdAllPropertyVisitor
{
TOperator mOperator;
PvdAllPropertyVisitor( TOperator op ) : mOperator( op ) {}
template<typename TObjectType>
bool operator()( const TObjectType* ) { visitInstancePvdProperties<TObjectType>( mOperator ); return false; }
};
template<typename TOperator>
struct PvdAllInfoVisitor
{
TOperator mOperator;
PvdAllInfoVisitor( TOperator op ) : mOperator( op ) {}
template<typename TInfoType>
void operator()( TInfoType inInfo )
{
inInfo.template visitType<bool>( PvdAllPropertyVisitor<TOperator>( mOperator ) );
inInfo.visitBases( *this );
}
};
template<typename TObjType, typename TOperator>
inline void visitAllPvdProperties( TOperator inOperator )
{
visitAllProperties<TObjType>( makePvdPropertyFilter( inOperator ) );
}
template<typename TOperator>
inline void visitRigidDynamicPerFrameProperties( TOperator inOperator )
{
PvdPropertyFilter<TOperator> theFilter( inOperator );
PxRigidDynamicGeneratedInfo theInfo;
theFilter( theInfo.GlobalPose, 0 );
theFilter( theInfo.LinearVelocity, 1 );
theFilter( theInfo.AngularVelocity, 2 );
theFilter( theInfo.IsSleeping, 3 );
}
template<typename TOperator>
inline void visitArticulationLinkPerFrameProperties( TOperator inOperator )
{
PvdPropertyFilter<TOperator> theFilter( inOperator );
PxArticulationLinkGeneratedInfo theInfo;
theFilter( theInfo.GlobalPose, 0 );
theFilter( theInfo.LinearVelocity, 1 );
theFilter( theInfo.AngularVelocity, 2 );
}
}
}
#endif

View File

@ -0,0 +1,384 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be
// prepared for your edits to be quietly ignored next time the clang metadata generator is
// run. You can find the most recent version of clang metadata generator by contacting
// Chris Nuernberger <chrisn@nvidia.com> or Dilip or Adam.
// The source code for the generate was at one time checked into:
// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp
#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON
PxPhysics_PropertiesStart,
PxPhysics_TolerancesScale,
PxPhysics_TriangleMeshes,
PxPhysics_HeightFields,
PxPhysics_ConvexMeshes,
PxPhysics_BVHStructures,
PxPhysics_Scenes,
PxPhysics_Shapes,
PxPhysics_Materials,
PxPhysics_PropertiesStop,
PxMaterial_PropertiesStart,
PxMaterial_ReferenceCount,
PxMaterial_DynamicFriction,
PxMaterial_StaticFriction,
PxMaterial_Restitution,
PxMaterial_Flags,
PxMaterial_FrictionCombineMode,
PxMaterial_RestitutionCombineMode,
PxMaterial_ConcreteTypeName,
PxMaterial_UserData,
PxMaterial_PropertiesStop,
PxActor_PropertiesStart,
PxActor_Scene,
PxActor_Name,
PxActor_ActorFlags,
PxActor_DominanceGroup,
PxActor_OwnerClient,
PxActor_Aggregate,
PxActor_UserData,
PxActor_PropertiesStop,
PxRigidActor_PropertiesStart,
PxRigidActor_GlobalPose,
PxRigidActor_Shapes,
PxRigidActor_Constraints,
PxRigidActor_PropertiesStop,
PxRigidBody_PropertiesStart,
PxRigidBody_CMassLocalPose,
PxRigidBody_Mass,
PxRigidBody_InvMass,
PxRigidBody_MassSpaceInertiaTensor,
PxRigidBody_MassSpaceInvInertiaTensor,
PxRigidBody_LinearDamping,
PxRigidBody_AngularDamping,
PxRigidBody_LinearVelocity,
PxRigidBody_AngularVelocity,
PxRigidBody_MaxAngularVelocity,
PxRigidBody_MaxLinearVelocity,
PxRigidBody_RigidBodyFlags,
PxRigidBody_MinCCDAdvanceCoefficient,
PxRigidBody_MaxDepenetrationVelocity,
PxRigidBody_MaxContactImpulse,
PxRigidBody_PropertiesStop,
PxRigidDynamic_PropertiesStart,
PxRigidDynamic_IsSleeping,
PxRigidDynamic_SleepThreshold,
PxRigidDynamic_StabilizationThreshold,
PxRigidDynamic_RigidDynamicLockFlags,
PxRigidDynamic_WakeCounter,
PxRigidDynamic_SolverIterationCounts,
PxRigidDynamic_ContactReportThreshold,
PxRigidDynamic_ConcreteTypeName,
PxRigidDynamic_PropertiesStop,
PxRigidStatic_PropertiesStart,
PxRigidStatic_ConcreteTypeName,
PxRigidStatic_PropertiesStop,
PxArticulationLink_PropertiesStart,
PxArticulationLink_InboundJoint,
PxArticulationLink_InboundJointDof,
PxArticulationLink_LinkIndex,
PxArticulationLink_Children,
PxArticulationLink_ConcreteTypeName,
PxArticulationLink_PropertiesStop,
PxArticulationJointBase_PropertiesStart,
PxArticulationJointBase_ParentPose,
PxArticulationJointBase_ChildPose,
PxArticulationJointBase_PropertiesStop,
PxArticulationJoint_PropertiesStart,
PxArticulationJoint_TargetOrientation,
PxArticulationJoint_TargetVelocity,
PxArticulationJoint_DriveType,
PxArticulationJoint_Stiffness,
PxArticulationJoint_Damping,
PxArticulationJoint_InternalCompliance,
PxArticulationJoint_ExternalCompliance,
PxArticulationJoint_SwingLimit,
PxArticulationJoint_TangentialStiffness,
PxArticulationJoint_TangentialDamping,
PxArticulationJoint_SwingLimitContactDistance,
PxArticulationJoint_SwingLimitEnabled,
PxArticulationJoint_TwistLimit,
PxArticulationJoint_TwistLimitEnabled,
PxArticulationJoint_TwistLimitContactDistance,
PxArticulationJoint_ConcreteTypeName,
PxArticulationJoint_PropertiesStop,
PxArticulationJointReducedCoordinate_PropertiesStart,
PxArticulationJointReducedCoordinate_JointType,
PxArticulationJointReducedCoordinate_Motion,
PxArticulationJointReducedCoordinate_FrictionCoefficient,
PxArticulationJointReducedCoordinate_ConcreteTypeName,
PxArticulationJointReducedCoordinate_MaxJointVelocity,
PxArticulationJointReducedCoordinate_PropertiesStop,
PxArticulationBase_PropertiesStart,
PxArticulationBase_Scene,
PxArticulationBase_SolverIterationCounts,
PxArticulationBase_IsSleeping,
PxArticulationBase_SleepThreshold,
PxArticulationBase_StabilizationThreshold,
PxArticulationBase_WakeCounter,
PxArticulationBase_Links,
PxArticulationBase_Name,
PxArticulationBase_Aggregate,
PxArticulationBase_UserData,
PxArticulationBase_PropertiesStop,
PxArticulation_PropertiesStart,
PxArticulation_MaxProjectionIterations,
PxArticulation_SeparationTolerance,
PxArticulation_InternalDriveIterations,
PxArticulation_ExternalDriveIterations,
PxArticulation_PropertiesStop,
PxArticulationReducedCoordinate_PropertiesStart,
PxArticulationReducedCoordinate_ArticulationFlags,
PxArticulationReducedCoordinate_Dofs,
PxArticulationReducedCoordinate_CacheDataSize,
PxArticulationReducedCoordinate_CoefficientMatrixSize,
PxArticulationReducedCoordinate_PropertiesStop,
PxAggregate_PropertiesStart,
PxAggregate_MaxNbActors,
PxAggregate_Actors,
PxAggregate_SelfCollision,
PxAggregate_ConcreteTypeName,
PxAggregate_PropertiesStop,
PxConstraint_PropertiesStart,
PxConstraint_Scene,
PxConstraint_Actors,
PxConstraint_Flags,
PxConstraint_IsValid,
PxConstraint_BreakForce,
PxConstraint_MinResponseThreshold,
PxConstraint_ConcreteTypeName,
PxConstraint_PropertiesStop,
PxShape_PropertiesStart,
PxShape_ReferenceCount,
PxShape_GeometryType,
PxShape_Geometry,
PxShape_LocalPose,
PxShape_SimulationFilterData,
PxShape_QueryFilterData,
PxShape_Materials,
PxShape_ContactOffset,
PxShape_RestOffset,
PxShape_TorsionalPatchRadius,
PxShape_MinTorsionalPatchRadius,
PxShape_Flags,
PxShape_IsExclusive,
PxShape_Name,
PxShape_ConcreteTypeName,
PxShape_UserData,
PxShape_PropertiesStop,
PxPruningStructure_PropertiesStart,
PxPruningStructure_RigidActors,
PxPruningStructure_ConcreteTypeName,
PxPruningStructure_PropertiesStop,
PxTolerancesScale_PropertiesStart,
PxTolerancesScale_IsValid,
PxTolerancesScale_Length,
PxTolerancesScale_Speed,
PxTolerancesScale_PropertiesStop,
PxGeometry_PropertiesStart,
PxGeometry_PropertiesStop,
PxBoxGeometry_PropertiesStart,
PxBoxGeometry_HalfExtents,
PxBoxGeometry_PropertiesStop,
PxCapsuleGeometry_PropertiesStart,
PxCapsuleGeometry_Radius,
PxCapsuleGeometry_HalfHeight,
PxCapsuleGeometry_PropertiesStop,
PxMeshScale_PropertiesStart,
PxMeshScale_Scale,
PxMeshScale_Rotation,
PxMeshScale_PropertiesStop,
PxConvexMeshGeometry_PropertiesStart,
PxConvexMeshGeometry_Scale,
PxConvexMeshGeometry_ConvexMesh,
PxConvexMeshGeometry_MeshFlags,
PxConvexMeshGeometry_PropertiesStop,
PxSphereGeometry_PropertiesStart,
PxSphereGeometry_Radius,
PxSphereGeometry_PropertiesStop,
PxPlaneGeometry_PropertiesStart,
PxPlaneGeometry_PropertiesStop,
PxTriangleMeshGeometry_PropertiesStart,
PxTriangleMeshGeometry_Scale,
PxTriangleMeshGeometry_MeshFlags,
PxTriangleMeshGeometry_TriangleMesh,
PxTriangleMeshGeometry_PropertiesStop,
PxHeightFieldGeometry_PropertiesStart,
PxHeightFieldGeometry_HeightField,
PxHeightFieldGeometry_HeightScale,
PxHeightFieldGeometry_RowScale,
PxHeightFieldGeometry_ColumnScale,
PxHeightFieldGeometry_HeightFieldFlags,
PxHeightFieldGeometry_PropertiesStop,
PxHeightFieldDesc_PropertiesStart,
PxHeightFieldDesc_NbRows,
PxHeightFieldDesc_NbColumns,
PxHeightFieldDesc_Format,
PxHeightFieldDesc_Samples,
PxHeightFieldDesc_ConvexEdgeThreshold,
PxHeightFieldDesc_Flags,
PxHeightFieldDesc_PropertiesStop,
PxScene_PropertiesStart,
PxScene_Flags,
PxScene_Limits,
PxScene_Timestamp,
PxScene_Actors,
PxScene_Articulations,
PxScene_Constraints,
PxScene_Aggregates,
PxScene_CpuDispatcher,
PxScene_CudaContextManager,
PxScene_SimulationEventCallback,
PxScene_ContactModifyCallback,
PxScene_CCDContactModifyCallback,
PxScene_BroadPhaseCallback,
PxScene_FilterShaderDataSize,
PxScene_FilterShader,
PxScene_FilterCallback,
PxScene_KinematicKinematicFilteringMode,
PxScene_StaticKinematicFilteringMode,
PxScene_Gravity,
PxScene_BounceThresholdVelocity,
PxScene_CCDMaxPasses,
PxScene_FrictionOffsetThreshold,
PxScene_FrictionType,
PxScene_VisualizationCullingBox,
PxScene_StaticStructure,
PxScene_DynamicStructure,
PxScene_DynamicTreeRebuildRateHint,
PxScene_SceneQueryUpdateMode,
PxScene_SceneQueryStaticTimestamp,
PxScene_BroadPhaseType,
PxScene_BroadPhaseRegions,
PxScene_TaskManager,
PxScene_NbContactDataBlocks,
PxScene_MaxNbContactDataBlocksUsed,
PxScene_ContactReportStreamBufferSize,
PxScene_SolverBatchSize,
PxScene_SolverArticulationBatchSize,
PxScene_WakeCounterResetValue,
PxScene_UserData,
PxScene_SimulationStatistics,
PxScene_PropertiesStop,
PxSceneLimits_PropertiesStart,
PxSceneLimits_MaxNbActors,
PxSceneLimits_MaxNbBodies,
PxSceneLimits_MaxNbStaticShapes,
PxSceneLimits_MaxNbDynamicShapes,
PxSceneLimits_MaxNbAggregates,
PxSceneLimits_MaxNbConstraints,
PxSceneLimits_MaxNbRegions,
PxSceneLimits_MaxNbBroadPhaseOverlaps,
PxSceneLimits_PropertiesStop,
PxgDynamicsMemoryConfig_PropertiesStart,
PxgDynamicsMemoryConfig_ConstraintBufferCapacity,
PxgDynamicsMemoryConfig_ContactBufferCapacity,
PxgDynamicsMemoryConfig_TempBufferCapacity,
PxgDynamicsMemoryConfig_ContactStreamSize,
PxgDynamicsMemoryConfig_PatchStreamSize,
PxgDynamicsMemoryConfig_ForceStreamCapacity,
PxgDynamicsMemoryConfig_HeapCapacity,
PxgDynamicsMemoryConfig_FoundLostPairsCapacity,
PxgDynamicsMemoryConfig_PropertiesStop,
PxSceneDesc_PropertiesStart,
PxSceneDesc_ToDefault,
PxSceneDesc_Gravity,
PxSceneDesc_SimulationEventCallback,
PxSceneDesc_ContactModifyCallback,
PxSceneDesc_CcdContactModifyCallback,
PxSceneDesc_FilterShaderData,
PxSceneDesc_FilterShaderDataSize,
PxSceneDesc_FilterShader,
PxSceneDesc_FilterCallback,
PxSceneDesc_KineKineFilteringMode,
PxSceneDesc_StaticKineFilteringMode,
PxSceneDesc_BroadPhaseType,
PxSceneDesc_BroadPhaseCallback,
PxSceneDesc_Limits,
PxSceneDesc_FrictionType,
PxSceneDesc_SolverType,
PxSceneDesc_BounceThresholdVelocity,
PxSceneDesc_FrictionOffsetThreshold,
PxSceneDesc_CcdMaxSeparation,
PxSceneDesc_SolverOffsetSlop,
PxSceneDesc_Flags,
PxSceneDesc_CpuDispatcher,
PxSceneDesc_CudaContextManager,
PxSceneDesc_StaticStructure,
PxSceneDesc_DynamicStructure,
PxSceneDesc_DynamicTreeRebuildRateHint,
PxSceneDesc_SceneQueryUpdateMode,
PxSceneDesc_UserData,
PxSceneDesc_SolverBatchSize,
PxSceneDesc_SolverArticulationBatchSize,
PxSceneDesc_NbContactDataBlocks,
PxSceneDesc_MaxNbContactDataBlocks,
PxSceneDesc_MaxBiasCoefficient,
PxSceneDesc_ContactReportStreamBufferSize,
PxSceneDesc_CcdMaxPasses,
PxSceneDesc_CcdThreshold,
PxSceneDesc_WakeCounterResetValue,
PxSceneDesc_SanityBounds,
PxSceneDesc_GpuDynamicsConfig,
PxSceneDesc_GpuMaxNumPartitions,
PxSceneDesc_GpuComputeVersion,
PxSceneDesc_PropertiesStop,
PxSimulationStatistics_PropertiesStart,
PxSimulationStatistics_NbActiveConstraints,
PxSimulationStatistics_NbActiveDynamicBodies,
PxSimulationStatistics_NbActiveKinematicBodies,
PxSimulationStatistics_NbStaticBodies,
PxSimulationStatistics_NbDynamicBodies,
PxSimulationStatistics_NbKinematicBodies,
PxSimulationStatistics_NbAggregates,
PxSimulationStatistics_NbArticulations,
PxSimulationStatistics_NbAxisSolverConstraints,
PxSimulationStatistics_CompressedContactSize,
PxSimulationStatistics_RequiredContactConstraintMemory,
PxSimulationStatistics_PeakConstraintMemory,
PxSimulationStatistics_NbDiscreteContactPairsTotal,
PxSimulationStatistics_NbDiscreteContactPairsWithCacheHits,
PxSimulationStatistics_NbDiscreteContactPairsWithContacts,
PxSimulationStatistics_NbNewPairs,
PxSimulationStatistics_NbLostPairs,
PxSimulationStatistics_NbNewTouches,
PxSimulationStatistics_NbLostTouches,
PxSimulationStatistics_NbPartitions,
PxSimulationStatistics_NbBroadPhaseAdds,
PxSimulationStatistics_NbBroadPhaseRemoves,
PxSimulationStatistics_NbDiscreteContactPairs,
PxSimulationStatistics_NbModifiedContactPairs,
PxSimulationStatistics_NbCCDPairs,
PxSimulationStatistics_NbTriggerPairs,
PxSimulationStatistics_NbShapes,
PxSimulationStatistics_PropertiesStop,
#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,388 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_METADATACOMPARE_H
#define PX_METADATACOMPARE_H
#include "PxMetaDataObjects.h"
#include "PsInlineArray.h"
//Implement a basic equality comparison system based on the meta data system.
//if you implement a particular areequal specialized to exactly your type
//before including this file it will be called in preference to the completely
//generic one shown here.
//If you don't care about the failure prop name you are welcome to pass in 'null',
template<typename TBaseObjType>
bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName );
//We don't have the ability right now to handle these types.
inline bool areEqual( const PxAggregate&, const PxAggregate& ) { return true; }
inline bool areEqual( const PxSimulationFilterShader&, const PxSimulationFilterShader& ) { return true; }
inline bool areEqual( const PxSimulationFilterCallback&, const PxSimulationFilterCallback& ) { return true; }
inline bool areEqual( const PxConvexMesh&, const PxConvexMesh& ) { return true; }
inline bool areEqual( const PxTriangleMesh&, const PxTriangleMesh& ) { return true; }
inline bool areEqual( const PxBVH33TriangleMesh&, const PxBVH33TriangleMesh& ) { return true; }
inline bool areEqual( const PxBVH34TriangleMesh&, const PxBVH34TriangleMesh& ) { return true; }
inline bool areEqual( const PxHeightField&, const PxHeightField& ) { return true; }
inline bool areEqual( const void* inLhs, const void* inRhs ) { return inLhs == inRhs; }
inline bool areEqual( void* inLhs, void* inRhs ) { return inLhs == inRhs; }
//Operators are copied, so this object needs to point
//to the important data rather than reference or own it.
template<typename TBaseObjType>
struct EqualityOp
{
bool* mVal;
const TBaseObjType* mLhs;
const TBaseObjType* mRhs;
const char** mFailurePropName;
EqualityOp( bool& inVal, const TBaseObjType& inLhs, const TBaseObjType& inRhs, const char*& inFailurePropName )
: mVal( &inVal )
, mLhs( &inLhs )
, mRhs( &inRhs )
, mFailurePropName( &inFailurePropName )
{
}
bool hasFailed() { return *mVal == false; }
//Ensure failure propagates the result a ways.
void update( bool inResult, const char* inName )
{
*mVal = *mVal && inResult;
if ( hasFailed() )
*mFailurePropName = inName;
}
//ignore any properties pointering back to the scene.
template<PxU32 TKey, typename TObjType>
void operator()( const PxReadOnlyPropertyInfo<TKey, TObjType, PxScene*> & inProp, PxU32 ) {}
template<PxU32 TKey, typename TObjType>
void operator()( const PxReadOnlyPropertyInfo<TKey, TObjType, const PxScene*> & inProp, PxU32 ) {}
//ignore any properties pointering back to the impl.
template<PxU32 TKey, typename TObjType>
void operator()(const PxReadOnlyPropertyInfo<TKey, TObjType, void*> & inProp, PxU32) {}
template<PxU32 TKey, typename TObjType>
void operator()(const PxReadOnlyPropertyInfo<TKey, TObjType, const void*> & inProp, PxU32) {}
//ignore all of these properties because they just point back to the 'this' object and cause
//a stack overflow.
//Children is unnecessary and articulation points back to the source.
void operator()( const PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxArticulationLink_Children, PxArticulationLink, PxArticulationLink* >& inProp, PxU32 ) {}
void operator()( const PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxRigidActor_Constraints, PxRigidActor, PxConstraint* >& inProp, PxU32 ){}
void operator()( const PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxAggregate_Actors, PxAggregate, PxActor* >& inProp, PxU32 ) {}
template<PxU32 TKey, typename TObjType, typename TGetPropType>
void operator()( const PxBufferCollectionPropertyInfo<TKey, TObjType, TGetPropType> & inProp, PxU32 )
{
}
template<PxU32 TKey, typename TObjType, typename TGetPropType>
void operator()( const PxReadOnlyPropertyInfo<TKey, TObjType, TGetPropType> & inProp, PxU32 )
{
if ( hasFailed() ) return;
TGetPropType lhs( inProp.get( mLhs ) );
TGetPropType rhs( inProp.get( mRhs ) );
update( areEqual( lhs, rhs, NULL ), inProp.mName );
}
template<PxU32 TKey, typename TObjType, typename TPropType>
void operator()( const PxRangePropertyInfo<TKey, TObjType, TPropType> & inProp, PxU32 )
{
if ( hasFailed() ) return;
TPropType lhsl, lhsr, rhsl, rhsr;
inProp.get( mLhs, lhsl, lhsr );
inProp.get( mRhs, rhsl, rhsr );
update( areEqual( lhsl, rhsl, NULL ), inProp.mName );
update( areEqual( lhsr, rhsr, NULL ), inProp.mName );
}
//Indexed properties where we don't know the range of index types are ignored
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropType>
void compareIndex( const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropType> &, bool ) {}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropType>
void compareIndex( const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropType> &inProp, const PxU32ToName* inNames )
{
for ( const PxU32ToName* theName = inNames;
theName->mName != NULL && !hasFailed();
++theName )
{
TIndexType theIndex( static_cast<TIndexType>( theName->mValue ) );
update( areEqual( inProp.get( mLhs, theIndex ), inProp.get( mRhs, theIndex ), NULL ), inProp.mName );
}
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropType>
void operator()( const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropType> & inProp, PxU32 )
{
if ( hasFailed() ) return;
compareIndex( inProp, PxEnumTraits<TIndexType>().NameConversion );
}
template<PxU32 TKey, typename TObjType, typename TCollectionType>
void operator()( const PxReadOnlyCollectionPropertyInfo<TKey, TObjType, TCollectionType> & inProp, PxU32 )
{
if ( hasFailed() ) return;
physx::shdfnd::InlineArray<TCollectionType, 20> lhsArray;
physx::shdfnd::InlineArray<TCollectionType, 20> rhsArray;
PxU32 size = inProp.size( mLhs );
if ( size != inProp.size( mRhs ) )
update( false, inProp.mName );
else
{
lhsArray.resize( size );
rhsArray.resize( size );
inProp.get( mLhs, lhsArray.begin(), size );
inProp.get( mRhs, rhsArray.begin(), size );
for ( PxU32 idx =0; idx < size && !hasFailed(); ++idx )
update( areEqual( lhsArray[idx], rhsArray[idx], NULL ), inProp.mName );
}
}
//Filtered collections where we can't know the range of filter values are ignored.
template<PxU32 TKey, typename TObjType, typename TFilterType, typename TCollectionType>
void compare( const PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TFilterType, TCollectionType >&, bool ) {}
template<PxU32 TKey, typename TObjType, typename TFilterType, typename TCollectionType>
void compare( const PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TFilterType, TCollectionType >& inProp, const PxU32ToName* inNames )
{
//Exaustively compare all items.
physx::shdfnd::InlineArray<TCollectionType*, 20> lhsArray;
physx::shdfnd::InlineArray<TCollectionType*, 20> rhsArray;
for ( const PxU32ToName* theName = inNames;
theName->mName != NULL && !hasFailed();
++theName )
{
TFilterType theFilter( static_cast<TFilterType>( theName->mValue ) );
PxU32 size = inProp.size( mLhs, theFilter );
if ( size != inProp.size( mRhs, theFilter ) )
update( false, inProp.mName );
else
{
lhsArray.resize( size );
rhsArray.resize( size );
inProp.get( mLhs, theFilter, lhsArray.begin(), size );
inProp.get( mRhs, theFilter, rhsArray.begin(), size );
for ( PxU32 idx =0; idx < size && !hasFailed(); ++idx )
update( areEqual( lhsArray[idx], rhsArray[idx], NULL ), inProp.mName );
}
}
}
template<PxU32 TKey, typename TObjType, typename TFilterType, typename TCollectionType>
void operator()( const PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TFilterType, TCollectionType >& inProp, PxU32 )
{
if ( hasFailed() ) return;
compare( inProp, PxEnumTraits<TFilterType>().NameConversion );
}
template<typename TGeometryType, typename TPropertyType>
void compareGeometry( const TPropertyType& inProp )
{
TGeometryType lhs;
TGeometryType rhs;
bool lsuc = inProp.getGeometry( mLhs, lhs );
bool rsuc = inProp.getGeometry( mRhs, rhs );
if ( !( lsuc && rsuc ) )
update( false, inProp.mName );
else
update( areEqual( lhs, rhs, NULL ), inProp.mName );
}
void operator()( const PxShapeGeometryProperty& inProp, PxU32 )
{
if ( hasFailed() ) return;
PxGeometryType::Enum lhsType( inProp.getGeometryType( mLhs ) );
PxGeometryType::Enum rhsType( inProp.getGeometryType( mRhs ) );
if ( lhsType != rhsType )
update( false, inProp.mName );
else
{
switch( lhsType )
{
case PxGeometryType::eSPHERE: compareGeometry<PxSphereGeometry>(inProp); break;
case PxGeometryType::ePLANE: compareGeometry<PxPlaneGeometry>(inProp); break;
case PxGeometryType::eCAPSULE: compareGeometry<PxCapsuleGeometry>(inProp); break;
case PxGeometryType::eBOX: compareGeometry<PxBoxGeometry>(inProp); break;
case PxGeometryType::eCONVEXMESH: compareGeometry<PxConvexMeshGeometry>(inProp); break;
case PxGeometryType::eTRIANGLEMESH: compareGeometry<PxTriangleMeshGeometry>(inProp); break;
case PxGeometryType::eHEIGHTFIELD: compareGeometry<PxHeightFieldGeometry>(inProp); break;
default: PX_ASSERT( false ); break;
}
}
}
};
inline bool areEqual( const char* lhs, const char* rhs, const char**, const PxUnknownClassInfo& )
{
if ( lhs && rhs ) return strcmp( lhs, rhs ) == 0;
if ( lhs || rhs ) return false;
return true;
}
inline bool areEqual( PxReal inLhs, PxReal inRhs )
{
return PxAbs( inLhs - inRhs ) < 1e-5f;
}
inline bool areEqual( PxVec3& lhs, PxVec3& rhs )
{
return areEqual( lhs.x, rhs.x )
&& areEqual( lhs.y, rhs.y )
&& areEqual( lhs.z, rhs.z );
}
inline bool areEqual( const PxVec3& lhs, const PxVec3& rhs )
{
return areEqual( lhs.x, rhs.x )
&& areEqual( lhs.y, rhs.y )
&& areEqual( lhs.z, rhs.z );
}
inline bool areEqual( const PxVec4& lhs, const PxVec4& rhs )
{
return areEqual( lhs.x, rhs.x )
&& areEqual( lhs.y, rhs.y )
&& areEqual( lhs.z, rhs.z )
&& areEqual( lhs.w, rhs.w );
}
inline bool areEqual( const PxQuat& lhs, const PxQuat& rhs )
{
return areEqual( lhs.x, rhs.x )
&& areEqual( lhs.y, rhs.y )
&& areEqual( lhs.z, rhs.z )
&& areEqual( lhs.w, rhs.w );
}
inline bool areEqual( const PxTransform& lhs, const PxTransform& rhs )
{
return areEqual(lhs.p, rhs.p) && areEqual(lhs.q, rhs.q);
}
inline bool areEqual( const PxBounds3& inLhs, const PxBounds3& inRhs )
{
return areEqual(inLhs.minimum,inRhs.minimum)
&& areEqual(inLhs.maximum,inRhs.maximum);
}
inline bool areEqual( const PxMetaDataPlane& lhs, const PxMetaDataPlane& rhs )
{
return areEqual( lhs.normal.x, rhs.normal.x )
&& areEqual( lhs.normal.y, rhs.normal.y )
&& areEqual( lhs.normal.z, rhs.normal.z )
&& areEqual( lhs.distance, rhs.distance );
}
template<typename TBaseObjType>
inline bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs )
{
return lhs == rhs;
}
//If we don't know the class type, we must result in == operator
template<typename TBaseObjType>
inline bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs, const char**, const PxUnknownClassInfo& )
{
return areEqual( lhs, rhs );
}
//If we don't know the class type, we must result in == operator
template<typename TBaseObjType, typename TTraitsType>
inline bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName, const TTraitsType& )
{
const char* theFailureName = NULL;
bool result = true;
static int i = 0;
++i;
visitAllProperties<TBaseObjType>( EqualityOp<TBaseObjType>( result, lhs, rhs, theFailureName ) );
if ( outFailurePropName != NULL && theFailureName )
*outFailurePropName = theFailureName;
return result;
}
template<typename TBaseObjType>
inline bool areEqualPointerCheck( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName, int )
{
return areEqual( lhs, rhs, outFailurePropName, PxClassInfoTraits<TBaseObjType>().Info );
}
inline bool areEqualPointerCheck( const void* lhs, const void* rhs, const char**, bool )
{
return lhs == rhs;
}
inline bool areEqualPointerCheck( const char* lhs, const char* rhs, const char** outFailurePropName, bool )
{
bool bRet = true;
if ( lhs && rhs ) bRet = strcmp( lhs, rhs ) == 0;
else if ( lhs || rhs ) bRet = false;
return bRet;
}
inline bool areEqualPointerCheck( void* lhs, void* rhs, const char**, bool )
{
return lhs == rhs;
}
template<typename TBaseObjType>
inline bool areEqualPointerCheck( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName, bool )
{
if ( lhs && rhs )
return areEqual( *lhs, *rhs, outFailurePropName );
if ( lhs || rhs )
return false;
return true;
}
template < typename Tp >
struct is_pointer { static const int val = 0; };
template < typename Tp >
struct is_pointer<Tp*> { static const bool val = true; };
template<typename TBaseObjType>
inline bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName )
{
return areEqualPointerCheck( lhs, rhs, outFailurePropName, is_pointer<TBaseObjType>::val );
}
#endif

View File

@ -0,0 +1,37 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_META_DATA_CPP_PREFIX_H
#define PX_META_DATA_CPP_PREFIX_H
//Header that is only included by the clang-generated cpp files.
//Used to change compilation settings where necessary for only those files.
#endif

View File

@ -0,0 +1,669 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_METADATAOBJECTS_H
#define PX_METADATAOBJECTS_H
#include "foundation/PxMemory.h"
// include the base headers instead of the PxPhysicsAPI.h
//Geometry Library
#include "geometry/PxBoxGeometry.h"
#include "geometry/PxCapsuleGeometry.h"
#include "geometry/PxConvexMesh.h"
#include "geometry/PxConvexMeshGeometry.h"
#include "geometry/PxGeometry.h"
#include "geometry/PxGeometryHelpers.h"
#include "geometry/PxGeometryQuery.h"
#include "geometry/PxHeightField.h"
#include "geometry/PxHeightFieldDesc.h"
#include "geometry/PxHeightFieldFlag.h"
#include "geometry/PxHeightFieldGeometry.h"
#include "geometry/PxHeightFieldSample.h"
#include "geometry/PxMeshQuery.h"
#include "geometry/PxMeshScale.h"
#include "geometry/PxPlaneGeometry.h"
#include "geometry/PxSimpleTriangleMesh.h"
#include "geometry/PxSphereGeometry.h"
#include "geometry/PxTriangle.h"
#include "geometry/PxTriangleMesh.h"
#include "geometry/PxTriangleMeshGeometry.h"
// PhysX Core SDK
#include "PxActor.h"
#include "PxAggregate.h"
#include "PxArticulation.h"
#include "PxArticulationJoint.h"
#include "PxArticulationReducedCoordinate.h"
#include "PxArticulationJointReducedCoordinate.h"
#include "PxArticulationLink.h"
#include "PxBatchQuery.h"
#include "PxBatchQueryDesc.h"
#include "PxClient.h"
#include "PxConstraint.h"
#include "PxConstraintDesc.h"
#include "PxContact.h"
#include "PxContactModifyCallback.h"
#include "PxDeletionListener.h"
#include "PxFiltering.h"
#include "PxForceMode.h"
#include "PxLockedData.h"
#include "PxMaterial.h"
#include "PxPhysics.h"
#include "PxPhysicsVersion.h"
#include "PxPhysXConfig.h"
#include "PxQueryFiltering.h"
#include "PxQueryReport.h"
#include "PxRigidActor.h"
#include "PxRigidBody.h"
#include "PxRigidDynamic.h"
#include "PxRigidStatic.h"
#include "PxScene.h"
#include "PxSceneDesc.h"
#include "PxSceneLock.h"
#include "PxShape.h"
#include "PxSimulationEventCallback.h"
#include "PxSimulationStatistics.h"
#include "PxVisualizationParameter.h"
#include "PxPruningStructure.h"
/** \addtogroup physics
@{
*/
namespace physx
{
class PxArticulationLink;
class PxArticulationJoint;
class PxArticulationJointReducedCoordinate;
class PxArticulationJointBase;
struct PxPropertyInfoName
{
enum Enum
{
Unnamed = 0,
#include "PxAutoGeneratedMetaDataObjectNames.h"
LastPxPropertyInfoName
};
};
struct PxU32ToName
{
const char* mName;
PxU32 mValue;
};
struct PxPropertyInfoBase
{
const char* mName;
PxU32 mKey;
PxPropertyInfoBase( const char* n, PxU32 inKey )
: mName( n )
, mKey( inKey )
{
}
};
template<PxU32 TKey>
struct PxPropertyInfoParameterizedBase : public PxPropertyInfoBase
{
PxPropertyInfoParameterizedBase( const char* inName )
: PxPropertyInfoBase( inName, TKey ) {}
};
template<PxU32 TKey, typename TObjType, typename TPropertyType>
struct PxReadOnlyPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef TPropertyType (*TGetterType)( const TObjType* );
TGetterType mGetter;
PxReadOnlyPropertyInfo( const char* inName, TGetterType inGetter )
: PxPropertyInfoParameterizedBase<TKey>( inName )
, mGetter( inGetter ) {}
TPropertyType get( const TObjType* inObj ) const { return mGetter( inObj ); }
};
template<PxU32 TKey, typename TObjType, typename TPropertyType>
struct PxWriteOnlyPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef void(*TSetterType)( TObjType*, TPropertyType inArg );
TSetterType mSetter;
PxWriteOnlyPropertyInfo( const char* inName, TSetterType inSetter )
: PxPropertyInfoParameterizedBase<TKey>( inName )
, mSetter( inSetter ) {}
void set( TObjType* inObj, TPropertyType inArg ) const { mSetter( inObj, inArg ); }
};
//Define the property types on the auto-generated objects.
template<PxU32 TKey, typename TObjType, typename TSetPropType, typename TGetPropType>
struct PxPropertyInfo : public PxReadOnlyPropertyInfo<TKey, TObjType, TGetPropType>
{
typedef typename PxReadOnlyPropertyInfo<TKey, TObjType, TGetPropType>::TGetterType TGetterType;
typedef void(*TSetterType)( TObjType*, TSetPropType inArg );
TSetterType mSetter;
PxPropertyInfo( const char* inName, TSetterType inSetter, TGetterType inGetter )
: PxReadOnlyPropertyInfo<TKey, TObjType, TGetPropType>( inName, inGetter )
, mSetter( inSetter ) {}
void set( TObjType* inObj, TSetPropType inArg ) const { mSetter( inObj, inArg ); }
};
template<PxU32 TKey, typename TObjType, typename TPropertyType>
struct PxRangePropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef void (*TSetterType)( TObjType*,TPropertyType,TPropertyType);
typedef void (*TGetterType)( const TObjType*,TPropertyType&,TPropertyType&);
const char* mArg0Name;
const char* mArg1Name;
TSetterType mSetter;
TGetterType mGetter;
PxRangePropertyInfo( const char* name, const char* arg0Name, const char* arg1Name
, TSetterType setter, TGetterType getter )
: PxPropertyInfoParameterizedBase<TKey>( name )
, mArg0Name( arg0Name )
, mArg1Name( arg1Name )
, mSetter( setter )
, mGetter( getter )
{
}
void set( TObjType* inObj, TPropertyType arg0, TPropertyType arg1 ) const { mSetter( inObj, arg0, arg1 ); }
void get( const TObjType* inObj, TPropertyType& arg0, TPropertyType& arg1 ) const { mGetter( inObj, arg0, arg1 ); }
};
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
struct PxIndexedPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef void (*TSetterType)( TObjType*, TIndexType, TPropertyType );
typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndexType );
TSetterType mSetter;
TGetterType mGetter;
PxIndexedPropertyInfo( const char* name, TSetterType setter, TGetterType getter )
: PxPropertyInfoParameterizedBase<TKey>( name )
, mSetter( setter )
, mGetter( getter )
{
}
void set( TObjType* inObj, TIndexType inIndex, TPropertyType arg ) const { mSetter( inObj, inIndex, arg ); }
TPropertyType get( const TObjType* inObj, TIndexType inIndex ) const { return mGetter( inObj, inIndex ); }
};
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
struct PxExtendedIndexedPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef PxU32 (*TNbObjectsMember)( const TObjType* );
typedef void (*TSetterType)( TObjType*, TIndexType, TPropertyType );
typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndexType );
TSetterType mSetter;
TGetterType mGetter;
PxU32 mCount;
TNbObjectsMember mNbObjectsMember;
PxExtendedIndexedPropertyInfo( const char* name, TGetterType getter, TNbObjectsMember inNb, TSetterType setter)
: PxPropertyInfoParameterizedBase<TKey>( name )
, mSetter( setter )
, mGetter( getter )
, mNbObjectsMember( inNb )
{
}
PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); }
void set( TObjType* inObj, TIndexType inIndex, TPropertyType arg ) const { mSetter( inObj, inIndex, arg ); }
TPropertyType get( const TObjType* inObj, TIndexType inIndex ) const { return mGetter( inObj, inIndex ); }
};
template<PxU32 TKey, typename TObjType, typename TIndex1Type, typename TIndex2Type, typename TPropertyType>
struct PxDualIndexedPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef void (*TSetterType)( TObjType*, TIndex1Type, TIndex2Type, TPropertyType );
typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndex1Type, TIndex2Type );
TSetterType mSetter;
TGetterType mGetter;
PxDualIndexedPropertyInfo( const char* name, TSetterType setter, TGetterType getter )
: PxPropertyInfoParameterizedBase<TKey>( name )
, mSetter( setter )
, mGetter( getter )
{
}
void set( TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2, TPropertyType arg ) const { mSetter( inObj, inIdx1, inIdx2, arg ); }
TPropertyType get( const TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2 ) const { return mGetter( inObj, inIdx1, inIdx2 ); }
};
template<PxU32 TKey, typename TObjType, typename TIndex1Type, typename TIndex2Type, typename TPropertyType>
struct PxExtendedDualIndexedPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef void (*TSetterType)( TObjType*, TIndex1Type, TIndex2Type, TPropertyType );
typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndex1Type, TIndex2Type );
TSetterType mSetter;
TGetterType mGetter;
PxU32 mId0Count;
PxU32 mId1Count;
PxExtendedDualIndexedPropertyInfo( const char* name, TSetterType setter, TGetterType getter, PxU32 id0Count, PxU32 id1Count )
: PxPropertyInfoParameterizedBase<TKey>( name )
, mSetter( setter )
, mGetter( getter )
, mId0Count( id0Count )
, mId1Count( id1Count )
{
}
void set( TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2, TPropertyType arg ) const { mSetter( inObj, inIdx1, inIdx2, arg ); }
TPropertyType get( const TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2 ) const { return mGetter( inObj, inIdx1, inIdx2 ); }
};
template<PxU32 TKey, typename TObjType, typename TCollectionType>
struct PxBufferCollectionPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef PxU32 (*TNbObjectsMember)( const TObjType* );
typedef PxU32 (*TGetObjectsMember)( const TObjType*, TCollectionType*, PxU32 );
typedef void (*TSetObjectsMember)( TObjType*, TCollectionType*, PxU32 );
TGetObjectsMember mGetObjectsMember;
TNbObjectsMember mNbObjectsMember;
TSetObjectsMember mSetObjectsMember;
PxBufferCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TSetObjectsMember inSet )
: PxPropertyInfoParameterizedBase<TKey>( inName )
, mGetObjectsMember( inGetter )
, mNbObjectsMember( inNb )
, mSetObjectsMember( inSet )
{
}
PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); }
PxU32 get( const TObjType* inObj, TCollectionType* inBuffer, PxU32 inNumItems ) const { return mGetObjectsMember( inObj, inBuffer, inNumItems ); }
void set( TObjType* inObj, TCollectionType* inBuffer, PxU32 inNumItems ) const { mSetObjectsMember( inObj, inBuffer, inNumItems); }
};
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
struct PxFixedSizeLookupTablePropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef PxU32 (*TNbObjectsMember)( const TObjType* );
typedef PxReal (*TGetXMember)( const TObjType*, PxU32 );
typedef PxReal (*TGetYMember)( const TObjType*, PxU32 );
typedef void (*TAddPairMember)( TObjType*, PxReal, PxReal );
typedef void (*TClearMember)( TObjType* );
TGetXMember mGetXMember;
TGetYMember mGetYMember;
TNbObjectsMember mNbObjectsMember;
TAddPairMember mAddPairMember;
TClearMember mClearMember;
PxFixedSizeLookupTablePropertyInfo( const char* inName, TGetXMember inGetterX, TGetYMember inGetterY, TNbObjectsMember inNb, TAddPairMember inAddPair, TClearMember inClear )
: PxPropertyInfoParameterizedBase<TKey>( inName )
, mGetXMember( inGetterX )
, mGetYMember( inGetterY )
, mNbObjectsMember( inNb )
, mAddPairMember( inAddPair )
, mClearMember( inClear )
{
}
PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); }
PxReal getX( const TObjType* inObj, const PxU32 index ) const { return mGetXMember( inObj, index ); }
PxReal getY( const TObjType* inObj, const PxU32 index ) const { return mGetYMember( inObj, index ); }
void addPair( TObjType* inObj, const PxReal x, const PxReal y ) { mAddPairMember( inObj, x, y ); }
void clear( TObjType* inObj ) { mClearMember( inObj ); }
};
template<PxU32 TKey, typename TObjType, typename TCollectionType>
struct PxReadOnlyCollectionPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef PxU32 (*TNbObjectsMember)( const TObjType* );
typedef PxU32 (*TGetObjectsMember)( const TObjType*, TCollectionType*, PxU32 );
TGetObjectsMember mGetObjectsMember;
TNbObjectsMember mNbObjectsMember;
PxReadOnlyCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb )
: PxPropertyInfoParameterizedBase<TKey>( inName )
, mGetObjectsMember( inGetter )
, mNbObjectsMember( inNb )
{
}
PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); }
PxU32 get( const TObjType* inObj, TCollectionType* inBuffer, PxU32 inBufSize ) const { return mGetObjectsMember( inObj, inBuffer, inBufSize); }
};
template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TFilterType>
struct PxReadOnlyFilteredCollectionPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef PxU32 (*TNbObjectsMember)( const TObjType*, TFilterType );
typedef PxU32 (*TGetObjectsMember)( const TObjType*, TFilterType, TCollectionType*, PxU32 );
TGetObjectsMember mGetObjectsMember;
TNbObjectsMember mNbObjectsMember;
PxReadOnlyFilteredCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb )
: PxPropertyInfoParameterizedBase<TKey>( inName )
, mGetObjectsMember( inGetter )
, mNbObjectsMember( inNb )
{
}
PxU32 size( const TObjType* inObj, TFilterType inFilter ) const { return mNbObjectsMember( inObj, inFilter ); }
PxU32 get( const TObjType* inObj, TFilterType inFilter, TCollectionType* inBuffer, PxU32 inBufSize ) const { return mGetObjectsMember( inObj, inFilter, inBuffer, inBufSize); }
};
template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TCreateArg>
struct PxFactoryCollectionPropertyInfo : public PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >
{
typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TGetObjectsMember TGetObjectsMember;
typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TNbObjectsMember TNbObjectsMember;
typedef TCollectionType (*TCreateMember)( TObjType*, TCreateArg );
TCreateMember mCreateMember;
PxFactoryCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TCreateMember inMember )
: PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >( inName, inGetter, inNb )
, mCreateMember( inMember )
{
}
TCollectionType create( TObjType* inObj, TCreateArg inArg ) const { return mCreateMember( inObj, inArg ); }
};
template<PxU32 TKey, typename TObjType, typename TCollectionType>
struct PxCollectionPropertyInfo : public PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >
{
typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TGetObjectsMember TGetObjectsMember;
typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TNbObjectsMember TNbObjectsMember;
typedef void (*TAddMember)(TObjType*, TCollectionType&);
typedef void (*TRemoveMember)(TObjType*, TCollectionType&);
TAddMember mAddMember;
TRemoveMember mRemoveMember;
PxCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TAddMember inMember, TRemoveMember inRemoveMember )
: PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >( inName, inGetter, inNb )
, mAddMember( inMember )
, mRemoveMember( inRemoveMember )
{
}
void add( TObjType* inObj, TCollectionType& inArg ) const { mAddMember(inObj, inArg ); }
void remove( TObjType* inObj, TCollectionType& inArg ) const { mRemoveMember( inObj, inArg ); }
};
template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TFilterType>
struct PxFilteredCollectionPropertyInfo : public PxReadOnlyFilteredCollectionPropertyInfo<TKey, TObjType, TCollectionType, TFilterType>
{
typedef typename PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TCollectionType, TFilterType >::TGetObjectsMember TGetObjectsMember;
typedef typename PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TCollectionType, TFilterType >::TNbObjectsMember TNbObjectsMember;
typedef void (*TAddMember)(TObjType*, TCollectionType&);
typedef void (*TRemoveMember)(TObjType*, TCollectionType&);
TAddMember mAddMember;
TRemoveMember mRemoveMember;
PxFilteredCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TAddMember inMember, TRemoveMember inRemoveMember )
: PxReadOnlyFilteredCollectionPropertyInfo<TKey, TObjType, TCollectionType, TFilterType>( inName, inGetter, inNb )
, mAddMember( inMember )
, mRemoveMember( inRemoveMember )
{
}
void add( TObjType* inObj, TCollectionType& inArg ) const { mAddMember(inObj, inArg ); }
void remove( TObjType* inObj, TCollectionType& inArg ) const { mRemoveMember( inObj, inArg ); }
};
//create a default info class for when we can't match
//the type correctly.
struct PxUnknownClassInfo
{
static const char* getClassName() { return "__unknown_class"; }
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator )
{
return TReturnType();
}
template<typename TOperator>
void visitBases( TOperator )
{
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator, PxU32 inStartIndex = 0 ) const
{
return inStartIndex;
}
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator, PxU32 inStartIndex = 0 ) const
{
return inStartIndex;
}
};
template<typename TDataType>
struct PxClassInfoTraits
{
PxUnknownClassInfo Info;
static bool getInfo() { return false;}
};
//move the bool typedef to the global namespace.
typedef bool _Bool;
template<PxU32 TPropertyName>
struct PxPropertyToValueStructMemberMap
{
bool Offset;
};
#define DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( type, prop, valueStruct ) \
template<> struct PxPropertyToValueStructMemberMap< PxPropertyInfoName::type##_##prop > \
{ \
PxU32 Offset; \
PxPropertyToValueStructMemberMap< PxPropertyInfoName::type##_##prop >() : Offset( PX_OFFSET_OF_RT( valueStruct, prop ) ) {} \
template<typename TOperator> void visitProp( TOperator inOperator, valueStruct& inStruct ) { inOperator( inStruct.prop ); } \
};
struct PxShapeGeometryPropertyHelper
{
PX_PHYSX_CORE_API PxGeometryType::Enum getGeometryType(const PxShape* inShape) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxBoxGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxSphereGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxCapsuleGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxPlaneGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxConvexMeshGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxTriangleMeshGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxHeightFieldGeometry& geometry) const;
};
struct PxShapeGeometryProperty : public PxWriteOnlyPropertyInfo< PxPropertyInfoName::PxShape_Geometry, PxShape, const PxGeometry & >
, public PxShapeGeometryPropertyHelper
{
typedef PxWriteOnlyPropertyInfo< PxPropertyInfoName::PxShape_Geometry, PxShape, const PxGeometry & >::TSetterType TSetterType;
typedef PxGeometryHolder (*TGetterType)( const PxShape* inObj );
PxShapeGeometryProperty( const char* inName, TSetterType inSetter, TGetterType )
: PxWriteOnlyPropertyInfo< PxPropertyInfoName::PxShape_Geometry, PxShape, const PxGeometry & >( inName, inSetter )
{
}
};
struct PxShapeMaterialsPropertyHelper
{
PX_PHYSX_CORE_API void setMaterials(PxShape* inShape, PxMaterial*const* materials, PxU16 materialCount) const;
};
struct PxShapeMaterialsProperty : public PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial*>
, public PxShapeMaterialsPropertyHelper
{
typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial* >::TGetObjectsMember TGetObjectsMember;
typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial* >::TNbObjectsMember TNbObjectsMember;
PxShapeMaterialsProperty( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb )
: PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial*>( inName, inGetter, inNb )
{
}
};
typedef PxPropertyInfo<PxPropertyInfoName::PxRigidActor_GlobalPose, PxRigidActor, const PxTransform &, PxTransform > PxRigidActorGlobalPosePropertyInfo;
struct PxRigidActorShapeCollectionHelper
{
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;
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;
};
struct PxRigidActorShapeCollection : public PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape*>
, public PxRigidActorShapeCollectionHelper
{
typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape* >::TGetObjectsMember TGetObjectsMember;
typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape* >::TNbObjectsMember TNbObjectsMember;
PxRigidActorShapeCollection( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb )
: PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape*>( inName, inGetter, inNb )
{
}
};
struct PxArticulationLinkCollectionPropHelper
{
PX_PHYSX_CORE_API PxArticulationLink* createLink(PxArticulation* inArticulation, PxArticulationLink* parent, const PxTransform& pose) const;
};
struct PxArticulationReducedCoordinateLinkCollectionPropHelper
{
PX_PHYSX_CORE_API PxArticulationLink* createLink(PxArticulationReducedCoordinate* inArticulation, PxArticulationLink* parent, const PxTransform& pose) const;
};
struct PxArticulationLinkCollectionProp : public PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxArticulationBase_Links, PxArticulationBase, PxArticulationLink*>
, public PxArticulationLinkCollectionPropHelper
{
PxArticulationLinkCollectionProp( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb )
: PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxArticulationBase_Links, PxArticulationBase, PxArticulationLink*>( inName, inGetter, inNb )
{
}
};
template<typename TDataType>
struct PxEnumTraits { PxEnumTraits() : NameConversion( false ) {} bool NameConversion; };
struct NbShapesProperty : public PxIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbShapes, PxSimulationStatistics, PxGeometryType::Enum, PxU32>
{
PX_PHYSX_CORE_API NbShapesProperty();
};
struct NbDiscreteContactPairsProperty : public PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbDiscreteContactPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32>
{
PX_PHYSX_CORE_API NbDiscreteContactPairsProperty();
};
struct NbModifiedContactPairsProperty : public PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbModifiedContactPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32>
{
PX_PHYSX_CORE_API NbModifiedContactPairsProperty();
};
struct NbCCDPairsProperty : public PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbCCDPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32>
{
PX_PHYSX_CORE_API NbCCDPairsProperty();
};
struct NbTriggerPairsProperty : public PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbTriggerPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32>
{
PX_PHYSX_CORE_API NbTriggerPairsProperty();
};
struct SimulationStatisticsProperty : public PxReadOnlyPropertyInfo<PxPropertyInfoName::PxScene_SimulationStatistics, PxScene, PxSimulationStatistics>
{
PX_PHYSX_CORE_API SimulationStatisticsProperty();
};
struct PxMetaDataPlane
{
PxVec3 normal;
PxReal distance;
PxMetaDataPlane( PxVec3 n = PxVec3( 0, 0, 0 ), PxReal d = 0 )
: normal( n )
, distance( d )
{
}
};
#include "PxAutoGeneratedMetaDataObjects.h"
#undef DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP
static PxU32ToName g_physx__PxQueryFlag__EnumConversion[] = {
{ "eSTATIC", static_cast<PxU32>( PxQueryFlag::eSTATIC ) },
{ "eDYNAMIC", static_cast<PxU32>( PxQueryFlag::eDYNAMIC ) },
{ "ePREFILTER", static_cast<PxU32>( PxQueryFlag::ePREFILTER ) },
{ "ePOSTFILTER", static_cast<PxU32>( PxQueryFlag::ePOSTFILTER ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits<PxQueryFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxQueryFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
template<typename TObjType, typename TOperator>
inline PxU32 visitAllProperties( TOperator inOperator )
{
PxU32 thePropCount = PxClassInfoTraits<TObjType>().Info.visitBaseProperties( inOperator );
return PxClassInfoTraits<TObjType>().Info.visitInstanceProperties( inOperator, thePropCount );
}
template<typename TObjType, typename TOperator>
inline void visitInstanceProperties( TOperator inOperator )
{
PxClassInfoTraits<TObjType>().Info.visitInstanceProperties( inOperator, 0 );
}
}
/** @} */
#endif

View File

@ -0,0 +1,221 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_REPX_META_DATA_PROPERTY_VISITOR_H
#define PX_REPX_META_DATA_PROPERTY_VISITOR_H
#include "PvdMetaDataPropertyVisitor.h"
namespace physx {
template<PxU32 TKey, typename TObjectType,typename TSetPropType, typename TPropertyType>
struct PxRepXPropertyAccessor : public Vd::ValueStructOffsetRecord
{
typedef PxPropertyInfo<TKey,TObjectType,TSetPropType,TPropertyType> TPropertyInfoType;
typedef TPropertyType prop_type;
const TPropertyInfoType mProperty;
PxRepXPropertyAccessor( const TPropertyInfoType& inProp )
: mProperty( inProp )
{
}
prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj ); }
void set( TObjectType* inObj, prop_type val ) const { return mProperty.set( inObj, val ); }
private:
PxRepXPropertyAccessor& operator=(const PxRepXPropertyAccessor&);
};
template<typename TSetPropType, typename TPropertyType>
struct PxRepXPropertyAccessor<PxPropertyInfoName::PxRigidDynamic_WakeCounter, PxRigidDynamic, TSetPropType, TPropertyType> : public Vd::ValueStructOffsetRecord
{
typedef PxPropertyInfo<PxPropertyInfoName::PxRigidDynamic_WakeCounter,PxRigidDynamic,TSetPropType,TPropertyType> TPropertyInfoType;
typedef TPropertyType prop_type;
const TPropertyInfoType mProperty;
PxRepXPropertyAccessor( const TPropertyInfoType& inProp )
: mProperty( inProp )
{
}
prop_type get( const PxRigidDynamic* inObj ) const { return mProperty.get( inObj ); }
void set( PxRigidDynamic* inObj, prop_type val ) const
{
PX_UNUSED(val);
PxRigidBodyFlags flags = inObj->getRigidBodyFlags();
if( !(flags & PxRigidBodyFlag::eKINEMATIC) )
return mProperty.set( inObj, val );
}
private:
PxRepXPropertyAccessor& operator=(const PxRepXPropertyAccessor&);
};
typedef PxReadOnlyPropertyInfo<PxPropertyInfoName::PxArticulationLink_InboundJoint, PxArticulationLink, PxArticulationJointBase *> TIncomingJointPropType;
//RepX cares about fewer property types than PVD does,
//but I want to reuse the accessor architecture as it
//greatly simplifies clients dealing with complex datatypes
template<typename TOperatorType>
struct RepXPropertyFilter
{
RepXPropertyFilter<TOperatorType> &operator=(const RepXPropertyFilter<TOperatorType> &);
Vd::PvdPropertyFilter<TOperatorType> mFilter;
RepXPropertyFilter( TOperatorType op ) : mFilter( op ) {}
RepXPropertyFilter( const RepXPropertyFilter<TOperatorType>& other ) : mFilter( other.mFilter ) {}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxReadOnlyPropertyInfo<TKey,TObjType,TPropertyType>&, PxU32 ) {} //repx ignores read only and write only properties
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxWriteOnlyPropertyInfo<TKey,TObjType,TPropertyType>&, PxU32 ) {}
template<PxU32 TKey, typename TObjType, typename TCollectionType>
void operator()( const PxReadOnlyCollectionPropertyInfo<TKey, TObjType, TCollectionType>&, PxU32 ) {}
template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TFilterType>
void operator()( const PxReadOnlyFilteredCollectionPropertyInfo<TKey, TObjType, TCollectionType, TFilterType >&, PxU32 ) {}
//forward these properties verbatim.
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void operator()( const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, PxU32 idx )
{
mFilter( inProp, idx );
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void operator()( const PxFixedSizeLookupTablePropertyInfo<TKey, TObjType, TIndexType,TPropertyType >& inProp, PxU32 idx )
{
mFilter( inProp, idx );
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void operator()( const PxExtendedIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, PxU32 idx)
{
mFilter( inProp, idx);
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
void operator()( const PxDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >& inProp, PxU32 idx )
{
mFilter( inProp, idx );
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
void operator()( const PxExtendedDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >& inProp, PxU32 idx )
{
mFilter( inProp, idx );
}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxRangePropertyInfo<TKey, TObjType, TPropertyType>& inProp, PxU32 idx )
{
mFilter( inProp, idx );
}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxBufferCollectionPropertyInfo<TKey, TObjType, TPropertyType>& inProp, PxU32 count )
{
mFilter( inProp, count );
}
template<PxU32 TKey, typename TObjType, typename TSetPropType, typename TPropertyType>
void operator()( const PxPropertyInfo<TKey,TObjType,TSetPropType,TPropertyType>& prop, PxU32 )
{
PxRepXPropertyAccessor< TKey, TObjType, TSetPropType, TPropertyType > theAccessor( prop );
mFilter.mOperator.pushName( prop.mName );
mFilter.template handleAccessor<TKey>( theAccessor );
mFilter.mOperator.popName();
}
void operator()( const PxRigidActorGlobalPosePropertyInfo& inProp, PxU32 )
{
mFilter.mOperator.pushName( inProp.mName );
mFilter.mOperator.handleRigidActorGlobalPose( inProp );
mFilter.mOperator.popName();
}
void operator()( const PxRigidActorShapeCollection& inProp, PxU32 )
{
mFilter.mOperator.pushName( "Shapes" );
mFilter.mOperator.handleShapes( inProp );
mFilter.mOperator.popName();
}
void operator()( const PxArticulationLinkCollectionProp& inProp, PxU32 )
{
mFilter.mOperator.pushName( "Links" );
mFilter.mOperator.handleArticulationLinks( inProp );
mFilter.mOperator.popName();
}
void operator()( const PxShapeMaterialsProperty& inProp, PxU32 )
{
mFilter.mOperator.pushName( "Materials" );
mFilter.mOperator.handleShapeMaterials( inProp );
mFilter.mOperator.popName();
}
void operator()( const TIncomingJointPropType& inProp, PxU32 )
{
mFilter.mOperator.handleIncomingJoint( inProp );
}
void operator()( const PxShapeGeometryProperty& inProp, PxU32 )
{
mFilter.mOperator.handleGeometryProperty( inProp );
}
#define DEFINE_REPX_PROPERTY_NOP(datatype) \
template<PxU32 TKey, typename TObjType, typename TSetPropType> \
void operator()( const PxPropertyInfo<TKey,TObjType,TSetPropType,datatype>&, PxU32 ){}
DEFINE_REPX_PROPERTY_NOP( const void* )
DEFINE_REPX_PROPERTY_NOP( void* )
DEFINE_REPX_PROPERTY_NOP( PxSimulationFilterCallback * )
DEFINE_REPX_PROPERTY_NOP( physx::PxTaskManager * )
DEFINE_REPX_PROPERTY_NOP( PxSimulationFilterShader * )
DEFINE_REPX_PROPERTY_NOP( PxSimulationFilterShader)
DEFINE_REPX_PROPERTY_NOP( PxContactModifyCallback * )
DEFINE_REPX_PROPERTY_NOP( PxCCDContactModifyCallback * )
DEFINE_REPX_PROPERTY_NOP( PxSimulationEventCallback * )
DEFINE_REPX_PROPERTY_NOP( physx::PxCudaContextManager* )
DEFINE_REPX_PROPERTY_NOP( physx::PxCpuDispatcher * )
DEFINE_REPX_PROPERTY_NOP( PxRigidActor )
DEFINE_REPX_PROPERTY_NOP( const PxRigidActor )
DEFINE_REPX_PROPERTY_NOP( PxRigidActor& )
DEFINE_REPX_PROPERTY_NOP( const PxRigidActor& )
DEFINE_REPX_PROPERTY_NOP( PxScene* )
DEFINE_REPX_PROPERTY_NOP( PxAggregate * )
DEFINE_REPX_PROPERTY_NOP( PxArticulation& )
DEFINE_REPX_PROPERTY_NOP( PxArticulationReducedCoordinate& )
DEFINE_REPX_PROPERTY_NOP( const PxArticulationLink * )
DEFINE_REPX_PROPERTY_NOP( const PxRigidDynamic * )
DEFINE_REPX_PROPERTY_NOP( const PxRigidStatic * )
DEFINE_REPX_PROPERTY_NOP( PxStridedData ) //These are handled in a custom fasion.
};
}
#endif