63 const TBaseObjType* mLhs;
64 const TBaseObjType* mRhs;
65 const char** mFailurePropName;
67 EqualityOp(
bool& inVal,
const TBaseObjType& inLhs,
const TBaseObjType& inRhs,
const char*& inFailurePropName )
71 , mFailurePropName( &inFailurePropName )
75 bool hasFailed() {
return *mVal ==
false; }
77 void update(
bool inResult,
const char* inName )
79 *mVal = *mVal && inResult;
81 *mFailurePropName = inName;
85 template<PxU32 TKey,
typename TObjType>
86 void operator()(
const PxReadOnlyPropertyInfo<TKey, TObjType, PxScene*> & inProp, PxU32 ) {}
88 template<PxU32 TKey,
typename TObjType>
89 void operator()(
const PxReadOnlyPropertyInfo<TKey, TObjType, const PxScene*> & inProp, PxU32 ) {}
92 template<PxU32 TKey,
typename TObjType>
93 void operator()(
const PxReadOnlyPropertyInfo<TKey, TObjType, void*> & inProp, PxU32) {}
95 template<PxU32 TKey,
typename TObjType>
96 void operator()(
const PxReadOnlyPropertyInfo<TKey, TObjType, const void*> & inProp, PxU32) {}
102 void operator()(
const PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxArticulationLink_Children, PxArticulationLink, PxArticulationLink* >& inProp, PxU32 ) {}
103 void operator()(
const PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxRigidActor_Constraints, PxRigidActor, PxConstraint* >& inProp, PxU32 ){}
104 void operator()(
const PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxAggregate_Actors, PxAggregate, PxActor* >& inProp, PxU32 ) {}
106 template<PxU32 TKey,
typename TObjType,
typename TGetPropType>
107 void operator()(
const PxBufferCollectionPropertyInfo<TKey, TObjType, TGetPropType> & inProp, PxU32 )
113 template<PxU32 TKey,
typename TObjType,
typename TGetPropType>
114 void operator()(
const PxReadOnlyPropertyInfo<TKey, TObjType, TGetPropType> & inProp, PxU32 )
118 TGetPropType lhs( inProp.get( mLhs ) );
119 TGetPropType rhs( inProp.get( mRhs ) );
120 update( areEqual( lhs, rhs, NULL ), inProp.mName );
123 template<PxU32 TKey,
typename TObjType,
typename TPropType>
124 void operator()(
const PxRangePropertyInfo<TKey, TObjType, TPropType> & inProp, PxU32 )
128 TPropType lhsl, lhsr, rhsl, rhsr;
129 inProp.get( mLhs, lhsl, lhsr );
130 inProp.get( mRhs, rhsl, rhsr );
131 update( areEqual( lhsl, rhsl, NULL ), inProp.mName );
132 update( areEqual( lhsr, rhsr, NULL ), inProp.mName );
136 template<PxU32 TKey,
typename TObjType,
typename TIndexType,
typename TPropType>
137 void compareIndex(
const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropType> &,
bool ) {}
139 template<PxU32 TKey,
typename TObjType,
typename TIndexType,
typename TPropType>
140 void compareIndex(
const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropType> &inProp,
const PxU32ToName* inNames )
142 for (
const PxU32ToName* theName = inNames;
143 theName->mName != NULL && !hasFailed();
146 TIndexType theIndex(
static_cast<TIndexType
>( theName->mValue ) );
147 update( areEqual( inProp.get( mLhs, theIndex ), inProp.get( mRhs, theIndex ), NULL ), inProp.mName );
151 template<PxU32 TKey,
typename TObjType,
typename TIndexType,
typename TPropType>
152 void operator()(
const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropType> & inProp, PxU32 )
156 compareIndex( inProp, PxEnumTraits<TIndexType>().NameConversion );
159 template<PxU32 TKey,
typename TObjType,
typename TCollectionType>
160 void operator()(
const PxReadOnlyCollectionPropertyInfo<TKey, TObjType, TCollectionType> & inProp, PxU32 )
166 PxU32 size = inProp.size( mLhs );
167 if ( size != inProp.size( mRhs ) )
168 update(
false, inProp.mName );
173 inProp.get( mLhs, lhsArray.
begin(), size );
174 inProp.get( mRhs, rhsArray.
begin(), size );
175 for ( PxU32 idx =0; idx < size && !hasFailed(); ++idx )
176 update( areEqual( lhsArray[idx], rhsArray[idx], NULL ), inProp.mName );
181 template<PxU32 TKey,
typename TObjType,
typename TFilterType,
typename TCollectionType>
182 void compare(
const PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TFilterType, TCollectionType >&,
bool ) {}
184 template<PxU32 TKey,
typename TObjType,
typename TFilterType,
typename TCollectionType>
185 void compare(
const PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TFilterType, TCollectionType >& inProp,
const PxU32ToName* inNames )
190 for (
const PxU32ToName* theName = inNames;
191 theName->mName != NULL && !hasFailed();
194 TFilterType theFilter(
static_cast<TFilterType
>( theName->mValue ) );
195 PxU32 size = inProp.size( mLhs, theFilter );
196 if ( size != inProp.size( mRhs, theFilter ) )
197 update(
false, inProp.mName );
202 inProp.get( mLhs, theFilter, lhsArray.
begin(), size );
203 inProp.get( mRhs, theFilter, rhsArray.
begin(), size );
204 for ( PxU32 idx =0; idx < size && !hasFailed(); ++idx )
205 update( areEqual( lhsArray[idx], rhsArray[idx], NULL ), inProp.mName );
210 template<PxU32 TKey,
typename TObjType,
typename TFilterType,
typename TCollectionType>
211 void operator()(
const PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TFilterType, TCollectionType >& inProp, PxU32 )
213 if ( hasFailed() )
return;
214 compare( inProp, PxEnumTraits<TFilterType>().NameConversion );
217 template<
typename TGeometryType,
typename TPropertyType>
218 void compareGeometry(
const TPropertyType& inProp )
222 bool lsuc = inProp.getGeometry( mLhs, lhs );
223 bool rsuc = inProp.getGeometry( mRhs, rhs );
224 if ( !( lsuc && rsuc ) )
225 update(
false, inProp.mName );
227 update( areEqual( lhs, rhs, NULL ), inProp.mName );
230 void operator()(
const PxShapeGeomProperty& inProp, PxU32 )
234 PxGeometryType::Enum lhsType( inProp.getGeometryType( mLhs ) );
235 PxGeometryType::Enum rhsType( inProp.getGeometryType( mRhs ) );
236 if ( lhsType != rhsType )
237 update(
false, inProp.mName );
242 case PxGeometryType::eSPHERE: compareGeometry<PxSphereGeometry>(inProp);
break;
243 case PxGeometryType::ePLANE: compareGeometry<PxPlaneGeometry>(inProp);
break;
244 case PxGeometryType::eCAPSULE: compareGeometry<PxCapsuleGeometry>(inProp);
break;
245 case PxGeometryType::eBOX: compareGeometry<PxBoxGeometry>(inProp);
break;
246 case PxGeometryType::eCONVEXMESH: compareGeometry<PxConvexMeshGeometry>(inProp);
break;
247 case PxGeometryType::eTETRAHEDRONMESH: compareGeometry<PxTetrahedronMeshGeometry>(inProp);
break;
248 case PxGeometryType::ePARTICLESYSTEM: compareGeometry<PxParticleSystemGeometry>(inProp);
break;
249 case PxGeometryType::eTRIANGLEMESH: compareGeometry<PxTriangleMeshGeometry>(inProp);
break;
250 case PxGeometryType::eHEIGHTFIELD: compareGeometry<PxHeightFieldGeometry>(inProp);
break;
251 default: PX_ASSERT(
false );
break;