aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/PhysXCooking/src/convex
diff options
context:
space:
mode:
authorsschirm <[email protected]>2016-12-23 14:20:36 +0100
committersschirm <[email protected]>2016-12-23 14:56:17 +0100
commitef6937e69e8ee3f409cf9d460d5ad300a65d5924 (patch)
tree710426e8daa605551ce3f34b581897011101c30f /PhysX_3.4/Source/PhysXCooking/src/convex
parentInitial commit: (diff)
downloadphysx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.tar.xz
physx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.zip
PhysX 3.4 / APEX 1.4 release candidate @21506124
Diffstat (limited to 'PhysX_3.4/Source/PhysXCooking/src/convex')
-rw-r--r--PhysX_3.4/Source/PhysXCooking/src/convex/ConvexHullBuilder.cpp11
-rw-r--r--PhysX_3.4/Source/PhysXCooking/src/convex/ConvexHullBuilder.h2
-rw-r--r--PhysX_3.4/Source/PhysXCooking/src/convex/ConvexMeshBuilder.cpp4
-rw-r--r--PhysX_3.4/Source/PhysXCooking/src/convex/ConvexMeshBuilder.h2
4 files changed, 12 insertions, 7 deletions
diff --git a/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexHullBuilder.cpp b/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexHullBuilder.cpp
index 3b9c3ac6..c9c8c678 100644
--- a/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexHullBuilder.cpp
+++ b/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexHullBuilder.cpp
@@ -422,16 +422,21 @@ bool ConvexHullBuilder::save(PxOutputStream& stream, bool platformMismatch) cons
}
//////////////////////////////////////////////////////////////////////////
-bool ConvexHullBuilder::copy(ConvexHullData& hullData)
+bool ConvexHullBuilder::copy(ConvexHullData& hullData, PxU32& mNb)
{
// set the numbers
hullData.mNbHullVertices = mHull->mNbHullVertices;
- hullData.mNbEdges = mHull->mNbEdges;
+ PxU16 hasGRBData = PxU16(mBuildGRBData);
+ hasGRBData = PxU16(hasGRBData << 15);
+ PX_ASSERT(mHull->mNbEdges <((1 << 15) - 1));
+ hullData.mNbEdges = PxU16(mHull->mNbEdges | hasGRBData);;
hullData.mNbPolygons = Ps::to8(computeNbPolygons());
PxU32 nb = 0;
for (PxU32 i = 0; i < mHull->mNbPolygons; i++)
nb += mHullDataPolygons[i].mNbVerts;
+ mNb = nb;
+
PxU32 bytesNeeded = Gu::computeBufferSize(hullData, nb);
// allocate the memory first.
@@ -462,7 +467,7 @@ bool ConvexHullBuilder::copy(ConvexHullData& hullData)
PxMemCopy(hullData.mPolygons, mHullDataPolygons , hullData.mNbPolygons*sizeof(Gu::HullPolygonData));
PxMemCopy(dataVertexData8, mHullDataVertexData8, nb);
PxMemCopy(dataFacesByEdges8,mHullDataFacesByEdges8, PxU32(mHull->mNbEdges * 2));
- if (hullData.mNbEdges.isBitSet())
+ if (mBuildGRBData)
PxMemCopy(dataEdges, mEdges, PxU32(mHull->mNbEdges * 2) * sizeof(PxU16));
PxMemCopy(dataFacesByVertices8, mHullDataFacesByVertices8, PxU32(mHull->mNbHullVertices * 3));
return true;
diff --git a/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexHullBuilder.h b/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexHullBuilder.h
index a3d57202..a00c0506 100644
--- a/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexHullBuilder.h
+++ b/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexHullBuilder.h
@@ -60,7 +60,7 @@ namespace physx
const PxHullPolygon* hullPolygons, PxU32 gaussMapVertexLimit, bool doValidation = true, bool userPolygons = false);
bool save(PxOutputStream& stream, bool platformMismatch) const;
- bool copy(Gu::ConvexHullData& hullData);
+ bool copy(Gu::ConvexHullData& hullData, PxU32& nb);
bool createEdgeList(bool doValidation, PxU32 nbEdges, bool prepareBigHullData);
bool checkHullPolygons() const;
diff --git a/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexMeshBuilder.cpp b/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexMeshBuilder.cpp
index 5fb356c3..540d838d 100644
--- a/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexMeshBuilder.cpp
+++ b/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexMeshBuilder.cpp
@@ -154,10 +154,10 @@ bool ConvexMeshBuilder::save(PxOutputStream& stream, bool platformMismatch) cons
//////////////////////////////////////////////////////////////////////////
// instead of saving the data into stream, we copy the mesh data
// into internal Gu::ConvexMesh.
-bool ConvexMeshBuilder::copy(Gu::ConvexHullData& hullData)
+bool ConvexMeshBuilder::copy(Gu::ConvexHullData& hullData, PxU32& nb)
{
// hull builder data copy
- hullBuilder.copy(hullData);
+ hullBuilder.copy(hullData, nb);
// mass props
hullData.mAABB = mHullData.mAABB;
diff --git a/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexMeshBuilder.h b/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexMeshBuilder.h
index 57e0ca97..9d584c95 100644
--- a/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexMeshBuilder.h
+++ b/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexMeshBuilder.h
@@ -53,7 +53,7 @@ namespace physx
bool save(PxOutputStream& stream, bool platformMismatch) const;
// copy the convex mesh into internal convex mesh, which can be directly used then
- bool copy(Gu::ConvexHullData& convexData);
+ bool copy(Gu::ConvexHullData& convexData, PxU32& nb);
// loads the convex mesh from given polygons
bool loadConvexHull(const PxConvexMeshDesc&, PxU32 gaussMapVertexLimit, bool userPolygons);