aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/PhysXExtensions/src
diff options
context:
space:
mode:
Diffstat (limited to 'PhysX_3.4/Source/PhysXExtensions/src')
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/ExtD6JointSolverPrep.cpp2
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/ExtDefaultCpuDispatcher.cpp2
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/ExtFixedJointSolverPrep.cpp2
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/ExtPrismaticJointSolverPrep.cpp2
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/ExtRevoluteJointSolverPrep.cpp2
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/ExtSphericalJointSolverPrep.cpp2
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX.cpp10
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX.h1
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX_MetaData.cpp123
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX_MetaData.h2
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/serialization/File/SnFile.h2
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/serialization/SnSerialUtils.cpp8
-rw-r--r--PhysX_3.4/Source/PhysXExtensions/src/serialization/Xml/SnXmlVisitorWriter.h37
13 files changed, 176 insertions, 19 deletions
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/ExtD6JointSolverPrep.cpp b/PhysX_3.4/Source/PhysXExtensions/src/ExtD6JointSolverPrep.cpp
index 2d37e1a1..632f53d4 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/ExtD6JointSolverPrep.cpp
+++ b/PhysX_3.4/Source/PhysXExtensions/src/ExtD6JointSolverPrep.cpp
@@ -68,7 +68,7 @@ namespace Ext
PxTransform cB2w = bB2w.transform(data.c2b[1]);
body0WorldOffset = cB2w.p-bA2w.p;
- ConstraintHelper g(constraints, cB2w.p-bA2w.p, cB2w.p-bB2w.p);
+ ConstraintHelper g(constraints, cA2w.p-bA2w.p, cB2w.p-bB2w.p);
if(cA2w.q.dot(cB2w.q)<0) // minimum dist quat (equiv to flipping cB2bB.q, which we don't use anywhere)
cB2w.q = -cB2w.q;
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/ExtDefaultCpuDispatcher.cpp b/PhysX_3.4/Source/PhysXExtensions/src/ExtDefaultCpuDispatcher.cpp
index 82b7b891..f19c1657 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/ExtDefaultCpuDispatcher.cpp
+++ b/PhysX_3.4/Source/PhysXExtensions/src/ExtDefaultCpuDispatcher.cpp
@@ -45,7 +45,7 @@ PxDefaultCpuDispatcher* physx::PxDefaultCpuDispatcherCreate(PxU32 numThreads, Px
return PX_NEW(Ext::DefaultCpuDispatcher)(numThreads, affinityMasks);
}
-#if !PX_PS4 && !PX_XBOXONE && !PX_NX
+#if !PX_PS4 && !PX_XBOXONE && !PX_SWITCH
void Ext::DefaultCpuDispatcher::getAffinityMasks(PxU32* affinityMasks, PxU32 threadCount)
{
for(PxU32 i=0; i < threadCount; i++)
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/ExtFixedJointSolverPrep.cpp b/PhysX_3.4/Source/PhysXExtensions/src/ExtFixedJointSolverPrep.cpp
index 162440a4..d677bee1 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/ExtFixedJointSolverPrep.cpp
+++ b/PhysX_3.4/Source/PhysXExtensions/src/ExtFixedJointSolverPrep.cpp
@@ -55,7 +55,7 @@ namespace Ext
PxVec3 bOriginInA = cA2w.transformInv(cB2w.p);
body0WorldOffset = cB2w.p-bA2w.p;
- joint::ConstraintHelper ch(constraints,cB2w.p-bA2w.p, cB2w.p-bB2w.p);
+ joint::ConstraintHelper ch(constraints,cA2w.p-bA2w.p, cB2w.p-bB2w.p);
ch.prepareLockedAxes(cA2w.q, cB2w.q, bOriginInA, 7, 7);
return ch.getCount();
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/ExtPrismaticJointSolverPrep.cpp b/PhysX_3.4/Source/PhysXExtensions/src/ExtPrismaticJointSolverPrep.cpp
index d65086e6..a5d7d633 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/ExtPrismaticJointSolverPrep.cpp
+++ b/PhysX_3.4/Source/PhysXExtensions/src/ExtPrismaticJointSolverPrep.cpp
@@ -59,7 +59,7 @@ namespace Ext
PxVec3 bOriginInA = cA2w.transformInv(cB2w.p);
body0WorldOffset = cB2w.p-bA2w.p;
- joint::ConstraintHelper ch(constraints,cB2w.p-bA2w.p, cB2w.p-bB2w.p);
+ joint::ConstraintHelper ch(constraints,cA2w.p-bA2w.p, cB2w.p-bB2w.p);
ch.prepareLockedAxes(cA2w.q, cB2w.q, bOriginInA, limitIsLocked ? 7ul : 6ul, 7ul);
if(limitEnabled && !limitIsLocked)
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/ExtRevoluteJointSolverPrep.cpp b/PhysX_3.4/Source/PhysXExtensions/src/ExtRevoluteJointSolverPrep.cpp
index eb861ccd..faca3069 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/ExtRevoluteJointSolverPrep.cpp
+++ b/PhysX_3.4/Source/PhysXExtensions/src/ExtRevoluteJointSolverPrep.cpp
@@ -61,7 +61,7 @@ namespace Ext
cB2w.q = -cB2w.q;
body0WorldOffset = cB2w.p-bA2w.p;
- Ext::joint::ConstraintHelper ch(constraints, cB2w.p - bA2w.p, cB2w.p - bB2w.p);
+ Ext::joint::ConstraintHelper ch(constraints, cA2w.p - bA2w.p, cB2w.p - bB2w.p);
ch.prepareLockedAxes(cA2w.q, cB2w.q, cA2w.transformInv(cB2w.p), 7, PxU32(limitIsLocked ? 7 : 6));
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/ExtSphericalJointSolverPrep.cpp b/PhysX_3.4/Source/PhysXExtensions/src/ExtSphericalJointSolverPrep.cpp
index 569ed3e7..6a82189d 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/ExtSphericalJointSolverPrep.cpp
+++ b/PhysX_3.4/Source/PhysXExtensions/src/ExtSphericalJointSolverPrep.cpp
@@ -58,7 +58,7 @@ namespace Ext
cB2w.q = -cB2w.q;
body0WorldOffset = cB2w.p-bA2w.p;
- joint::ConstraintHelper ch(constraints, cB2w.p - bA2w.p, cB2w.p - bB2w.p);
+ joint::ConstraintHelper ch(constraints, cA2w.p - bA2w.p, cB2w.p - bB2w.p);
if(data.jointFlags & PxSphericalJointFlag::eLIMIT_ENABLED)
{
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX.cpp b/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX.cpp
index 78dc3a78..a2b91b4c 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX.cpp
+++ b/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX.cpp
@@ -103,6 +103,16 @@ bool Sn::ConvX::setMetaData(PxInputStream& srcMetaData, PxInputStream& dstMetaDa
return true;
}
+bool Sn::ConvX::compareMetaData() const
+{
+ if (!mMetaData_Src || !mMetaData_Dst) {
+ Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__,
+ "PxBinaryConverter: metadata not defined. Call PxBinaryConverter::setMetaData first.\n");
+ return false;
+ }
+
+ return mMetaData_Src->compare(*mMetaData_Dst);
+}
bool Sn::ConvX::convert(PxInputStream& srcStream, PxU32 srcSize, PxOutputStream& targetStream)
{
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX.h b/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX.h
index 604aba0a..c30bcdda 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX.h
+++ b/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX.h
@@ -79,6 +79,7 @@ namespace Sn {
PX_FORCE_INLINE bool verboseMode() const { return mReportMode==PxConverterReportMode::eVERBOSE; }
virtual bool setMetaData(PxInputStream& srcMetaData, PxInputStream& dstMetaData);
+ virtual bool compareMetaData() const;
virtual bool convert(PxInputStream& srcStream, PxU32 srcSize, PxOutputStream& targetStream);
private:
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX_MetaData.cpp b/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX_MetaData.cpp
index cc5465db..b9cb5ce1 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX_MetaData.cpp
+++ b/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX_MetaData.cpp
@@ -496,7 +496,7 @@ bool MetaData::load(PxInputStream& inputStream, MetaDataType type)
{
if(!mEntries[i].mName)
{
- mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, "Found class: %s\n", mEntries[i].mType);
+ mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, "Found class: %s\n", mEntries[i].mType);
currentClass = addNewClass(mEntries[i].mType, mEntries[i].mSize);
if(mEntries[i].mFlags & PxMetaDataFlag::eVIRTUAL)
@@ -703,6 +703,126 @@ bool MetaData::load(PxInputStream& inputStream, MetaDataType type)
return true;
}
+namespace
+{
+ //tool functions for MetaData::compare
+
+ bool str_equal(const char* src, const char* dst)
+ {
+ if (src == dst)
+ return true;
+
+ if (src != NULL && dst != NULL)
+ return strcmp(src, dst) == 0;
+
+ return false;
+ }
+
+ const char* str_print(const char* str)
+ {
+ return str != NULL ? str : "(nullptr)";
+ }
+}
+
+#define COMPARE_METADATA_BOOL_MD(type, src, dst, field) if ((src).field != (dst).field) \
+ { mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, "%s::%s missmatch: src %s dst %s\n", #type, #field, (src).field?"true":"false", (dst).field?"true":"false"); isEquivalent = false; }
+#define COMPARE_METADATA_INT_MD(type, src, dst, field) if ((src).field != (dst).field) \
+ { mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, "%s::%s missmatch: src %d dst %d\n", #type, #field, (src).field, (dst).field); isEquivalent = false; }
+#define COMPARE_METADATA_STRING_MD(type, src, dst, field) \
+ if (!str_equal((src).field, (dst).field)) \
+ { \
+ mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, "%s::%s missmatch: src %s dst %s\n", #type, #field, str_print((src).field), str_print((dst).field)); \
+ isEquivalent = false; \
+ }
+
+bool MetaData::compare(const MetaData& dst) const
+{
+ bool isEquivalent = true;
+
+ //mType
+ COMPARE_METADATA_BOOL_MD(MetaData, *this, dst, mFlip)
+ COMPARE_METADATA_INT_MD(MetaData, *this, dst, mVersion)
+ COMPARE_METADATA_INT_MD(MetaData, *this, dst, mBinaryVersion)
+ //mBuildNumber
+ COMPARE_METADATA_INT_MD(MetaData, *this, dst, mSizeOfPtr)
+ COMPARE_METADATA_INT_MD(MetaData, *this, dst, mPlatformTag)
+ COMPARE_METADATA_INT_MD(MetaData, *this, dst, mGaussMapLimit)
+ COMPARE_METADATA_INT_MD(MetaData, *this, dst, mNbEntries)
+
+ //find classes missing in dst
+ for (PxU32 i = 0; i<mMetaClasses.size(); i++)
+ {
+ MetaClass* mcSrc = mMetaClasses[i];
+ MetaClass* mcDst = dst.getMetaClass(mcSrc->mClassName);
+
+ if (mcDst == NULL)
+ {
+ mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, "dst is missing meta class %s", mcSrc->mClassName);
+ }
+ }
+
+ //find classes missing in src
+ for (PxU32 i = 0; i<dst.mMetaClasses.size(); i++)
+ {
+ MetaClass* mcDst = dst.mMetaClasses[i];
+ MetaClass* mcSrc = getMetaClass(mcDst->mClassName);
+
+ if (mcSrc == NULL)
+ {
+ mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, "dst is missing meta class %s", mcSrc->mClassName);
+ }
+ }
+
+ //compare classes present in src and dst
+ for (PxU32 i = 0; i<mMetaClasses.size(); i++)
+ {
+ const char* className = mMetaClasses[i]->mClassName;
+ MetaClass* mcSrc = getMetaClass(className);
+ MetaClass* mcDst = dst.getMetaClass(className);
+ if (mcSrc != NULL && mcDst != NULL)
+ {
+ COMPARE_METADATA_INT_MD(MetaClass, *mcSrc, *mcDst, mCallback)
+ COMPARE_METADATA_INT_MD(MetaClass, *mcSrc, *mcDst, mMaster) //should be 0 for both anyway
+ COMPARE_METADATA_STRING_MD(MetaClass, *mcSrc, *mcDst, mClassName)
+ COMPARE_METADATA_INT_MD(MetaClass, *mcSrc, *mcDst, mSize)
+ COMPARE_METADATA_INT_MD(MetaClass, *mcSrc, *mcDst, mDepth)
+
+ COMPARE_METADATA_INT_MD(MetaClass, *mcSrc, *mcDst, mBaseClasses.size())
+ if (mcSrc->mBaseClasses.size() == mcDst->mBaseClasses.size())
+ {
+ for (PxU32 b = 0; b < mcSrc->mBaseClasses.size(); b++)
+ {
+ COMPARE_METADATA_STRING_MD(PxMetaDataEntry, mcSrc->mBaseClasses[b], mcDst->mBaseClasses[b], mName);
+ }
+ }
+
+ COMPARE_METADATA_INT_MD(MetaClass, *mcSrc, *mcDst, mFields.size())
+ if (mcSrc->mFields.size() == mcDst->mFields.size())
+ {
+ for (PxU32 f = 0; f < mcSrc->mFields.size(); f++)
+ {
+ PxMetaDataEntry srcMde = mcSrc->mFields[f];
+ PxMetaDataEntry dstMde = mcDst->mFields[f];
+
+ COMPARE_METADATA_STRING_MD(PxMetaDataEntry, srcMde, dstMde, mType)
+ COMPARE_METADATA_STRING_MD(PxMetaDataEntry, srcMde, dstMde, mName)
+ COMPARE_METADATA_INT_MD(PxMetaDataEntry, srcMde, dstMde, mOffset)
+ COMPARE_METADATA_INT_MD(PxMetaDataEntry, srcMde, dstMde, mSize)
+ COMPARE_METADATA_INT_MD(PxMetaDataEntry, srcMde, dstMde, mCount)
+ COMPARE_METADATA_INT_MD(PxMetaDataEntry, srcMde, dstMde, mOffsetSize)
+ COMPARE_METADATA_INT_MD(PxMetaDataEntry, srcMde, dstMde, mFlags)
+ COMPARE_METADATA_INT_MD(PxMetaDataEntry, srcMde, dstMde, mAlignment)
+ }
+ }
+ }
+ }
+ return isEquivalent;
+}
+
+#undef COMPARE_METADATA_BOOL_MD
+#undef COMPARE_METADATA_INT_MD
+#undef COMPARE_METADATA_STRING_MD
+
///////////////////////////////////////////////////////////////////////////////
void ConvX::releaseMetaData()
@@ -838,4 +958,3 @@ PxU64 physx::Sn::peek(int size, const char* buffer, int flags)
return PxU64(-1);
}
-
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX_MetaData.h b/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX_MetaData.h
index 4accc4a5..54d5260f 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX_MetaData.h
+++ b/PhysX_3.4/Source/PhysXExtensions/src/serialization/Binary/SnConvX_MetaData.h
@@ -146,6 +146,8 @@ namespace physx { namespace Sn {
MetaClass* getMetaClass(const char* name) const;
MetaClass* getMetaClass(PxConcreteType::Enum concreteType) const;
MetaClass* addNewClass(const char* name, int size, MetaClass* master=NULL, ConvertCallback callback=NULL);
+
+ bool compare(const MetaData& candidate) const;
private:
MetaData& operator=(const MetaData&);
Sn::ConvX& mConvX;
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/serialization/File/SnFile.h b/PhysX_3.4/Source/PhysXExtensions/src/serialization/File/SnFile.h
index 09929d20..397ab8c0 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/serialization/File/SnFile.h
+++ b/PhysX_3.4/Source/PhysXExtensions/src/serialization/File/SnFile.h
@@ -57,7 +57,7 @@ PX_INLINE PxI32 fopen_s(FILE** file, const char* name, const char* mode)
} // namespace sn
} // namespace physx
-#elif PX_UNIX_FAMILY || PX_PS4 || PX_NX
+#elif PX_UNIX_FAMILY || PX_PS4 || PX_SWITCH
#include <stdio.h>
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/serialization/SnSerialUtils.cpp b/PhysX_3.4/Source/PhysXExtensions/src/serialization/SnSerialUtils.cpp
index e478a552..8bb93ef1 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/serialization/SnSerialUtils.cpp
+++ b/PhysX_3.4/Source/PhysXExtensions/src/serialization/SnSerialUtils.cpp
@@ -69,8 +69,8 @@ const char* sBinaryPlatformNames[SN_NUM_BINARY_PLATFORMS] =
"ios",
"ios64",
"xboxone",
- "nx32",
- "nx64"
+ "switch32",
+ "switch64"
};
#define SN_NUM_BINARY_COMPATIBLE_VERSIONS 1
@@ -111,9 +111,9 @@ PxU32 getBinaryPlatformTag()
return sBinaryPlatformTags[9];
#elif PX_XBOXONE
return sBinaryPlatformTags[10];
-#elif PX_NX && !PX_A64
+#elif PX_SWITCH && !PX_A64
return sBinaryPlatformTags[11];
-#elif PX_NX && PX_A64
+#elif PX_SWITCH && PX_A64
return sBinaryPlatformTags[12];
#else
#error Unknown binary platform
diff --git a/PhysX_3.4/Source/PhysXExtensions/src/serialization/Xml/SnXmlVisitorWriter.h b/PhysX_3.4/Source/PhysXExtensions/src/serialization/Xml/SnXmlVisitorWriter.h
index e7286bc5..b59968be 100644
--- a/PhysX_3.4/Source/PhysXExtensions/src/serialization/Xml/SnXmlVisitorWriter.h
+++ b/PhysX_3.4/Source/PhysXExtensions/src/serialization/Xml/SnXmlVisitorWriter.h
@@ -85,17 +85,42 @@ namespace physx { namespace Sn {
{
writeReference( writer, inCollection, inPropName, inDatatype );
}
-#ifdef REMOVED
+
inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, const PxTriangleMesh* inDatatype )
{
- writeReference( writer, inCollection, inPropName, inDatatype );
+ if (inDatatype->getConcreteType() == PxConcreteType::eTRIANGLE_MESH_BVH33)
+ {
+ const PxBVH33TriangleMesh* dataType = inDatatype->is<PxBVH33TriangleMesh>();
+ writeReference(writer, inCollection, inPropName, dataType);
+ }
+ else if (inDatatype->getConcreteType() == PxConcreteType::eTRIANGLE_MESH_BVH34)
+ {
+ const PxBVH34TriangleMesh* dataType = inDatatype->is<PxBVH34TriangleMesh>();
+ writeReference(writer, inCollection, inPropName, dataType);
+ }
+ else
+ {
+ PX_ASSERT(0);
+ }
}
inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, PxTriangleMesh* inDatatype )
{
- writeReference( writer, inCollection, inPropName, inDatatype );
+ if (inDatatype->getConcreteType() == PxConcreteType::eTRIANGLE_MESH_BVH33)
+ {
+ PxBVH33TriangleMesh* dataType = inDatatype->is<PxBVH33TriangleMesh>();
+ writeReference(writer, inCollection, inPropName, dataType);
+ }
+ else if (inDatatype->getConcreteType() == PxConcreteType::eTRIANGLE_MESH_BVH34)
+ {
+ PxBVH34TriangleMesh* dataType = inDatatype->is<PxBVH34TriangleMesh>();
+ writeReference(writer, inCollection, inPropName, dataType);
+ }
+ else
+ {
+ PX_ASSERT(0);
+ }
}
-#endif
inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, const PxBVH33TriangleMesh* inDatatype )
{
@@ -219,7 +244,7 @@ namespace physx { namespace Sn {
, PxU32 inObjPerLine, PxStrideIterator<const TDataType>& inData, TAccessOperator inAccessOperator
, PxU32 inBufSize, const char* inPropName, PxU32 /*inStride*/, TWriteOperator inOperator )
{
-#if PX_NX
+#if PX_SWITCH
const auto *dat = &inData[0];
if (inBufSize && dat != NULL)
#else
@@ -245,7 +270,7 @@ namespace physx { namespace Sn {
, PxU32 inObjPerLine, PxStrideIterator<const TDataType>& inData, TAccessOperator /*inAccessOperator*/
, PxU32 inBufSize, const char* inPropName, const PxU32ToName* inTable)
{
-#if PX_NX
+#if PX_SWITCH
const auto *dat = &inData[0];
if (inBufSize && dat != NULL)
#else