aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/PhysXCooking/src
diff options
context:
space:
mode:
authorSheikh Dawood Abdul Ajees <[email protected]>2017-09-15 15:41:57 -0500
committerSheikh Dawood Abdul Ajees <[email protected]>2017-09-15 15:41:57 -0500
commitd1c812f1162e5fdb13c215792725b2591d7428f5 (patch)
tree407056c45c7e9320c48fca6a3697d81a061c4ea0 /PhysX_3.4/Source/PhysXCooking/src
parentPhysX 3.4, APEX 1.4 patch release @22121272 (diff)
downloadphysx-3.4-d1c812f1162e5fdb13c215792725b2591d7428f5.tar.xz
physx-3.4-d1c812f1162e5fdb13c215792725b2591d7428f5.zip
PhysX 3.4.1, APEX 1.4.1 Release @22845541v3.4.1
Diffstat (limited to 'PhysX_3.4/Source/PhysXCooking/src')
-rw-r--r--PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp9
-rw-r--r--PhysX_3.4/Source/PhysXCooking/src/convex/QuickHullConvexHullLib.cpp6
-rw-r--r--PhysX_3.4/Source/PhysXCooking/src/mesh/TriangleMeshBuilder.cpp37
3 files changed, 12 insertions, 40 deletions
diff --git a/PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp b/PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp
index fc23c0eb..fe580659 100644
--- a/PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp
+++ b/PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp
@@ -219,6 +219,15 @@ bool Cooking::cookConvexMeshInternal(const PxConvexMeshDesc& desc_, ConvexMeshBu
{
PX_ASSERT(hullLib);
+ // clean up the indices information, it could have been set by accident
+ desc.flags &= ~PxConvexFlag::e16_BIT_INDICES;
+ desc.indices.count = 0;
+ desc.indices.data = NULL;
+ desc.indices.stride = 0;
+ desc.polygons.count = 0;
+ desc.polygons.data = NULL;
+ desc.polygons.stride = 0;
+
PxConvexMeshCookingResult::Enum res = hullLib->createConvexHull();
if (res == PxConvexMeshCookingResult::eSUCCESS || res == PxConvexMeshCookingResult::ePOLYGONS_LIMIT_REACHED)
{
diff --git a/PhysX_3.4/Source/PhysXCooking/src/convex/QuickHullConvexHullLib.cpp b/PhysX_3.4/Source/PhysXCooking/src/convex/QuickHullConvexHullLib.cpp
index 881c9218..95bd314d 100644
--- a/PhysX_3.4/Source/PhysXCooking/src/convex/QuickHullConvexHullLib.cpp
+++ b/PhysX_3.4/Source/PhysXCooking/src/convex/QuickHullConvexHullLib.cpp
@@ -1407,7 +1407,7 @@ namespace local
if (dotP > maxdot_minang)
{
- if (face.area > oppFace.area)
+ if (face.area >= oppFace.area)
{
// check if we can merge the 2 faces
merge = canMergeFaces(*hedge);
@@ -2383,7 +2383,7 @@ void QuickHullConvexHullLib::fillConvexMeshDescFromQuickHull(PxConvexMeshDesc& d
// allocate out buffers
const PxU32 indicesBufferSize = sizeof(PxU32)*numIndices;
- const PxU32 verticesBufferSize = sizeof(PxVec3)*mQuickHull->mNumVertices + 1;
+ const PxU32 verticesBufferSize = sizeof(PxVec3)*(mQuickHull->mNumVertices + 1);
const PxU32 facesBufferSize = sizeof(PxHullPolygon)*numFacesOut;
const PxU32 faceTranslationTableSize = sizeof(PxU16)*numFacesOut;
const PxU32 translationTableSize = sizeof(PxU32)*mQuickHull->mNumVertices;
@@ -2503,7 +2503,7 @@ void QuickHullConvexHullLib::fillConvexMeshDescFromCroppedHull(PxConvexMeshDesc&
const PxU32 numVertices = mCropedConvexHull->getVertices().size();
const PxU32 indicesBufferSize = sizeof(PxU32)*numIndices;
const PxU32 facesBufferSize = sizeof(PxHullPolygon)*numPolygons;
- const PxU32 verticesBufferSize = sizeof(PxVec3)*numVertices + 1; // allocate additional vec3 for V4 safe load in VolumeInteration
+ const PxU32 verticesBufferSize = sizeof(PxVec3)*(numVertices + 1); // allocate additional vec3 for V4 safe load in VolumeInteration
const PxU32 bufferMemorySize = indicesBufferSize + verticesBufferSize + facesBufferSize;
mOutMemoryBuffer = reinterpret_cast<PxU8*>(PX_ALLOC_TEMP(bufferMemorySize, "ConvexMeshDesc"));
diff --git a/PhysX_3.4/Source/PhysXCooking/src/mesh/TriangleMeshBuilder.cpp b/PhysX_3.4/Source/PhysXCooking/src/mesh/TriangleMeshBuilder.cpp
index 593f69a4..47ad7996 100644
--- a/PhysX_3.4/Source/PhysXCooking/src/mesh/TriangleMeshBuilder.cpp
+++ b/PhysX_3.4/Source/PhysXCooking/src/mesh/TriangleMeshBuilder.cpp
@@ -645,7 +645,6 @@ void TriangleMeshBuilder::createGRBData()
{
const PxU32 & numTris = mMeshData.mNbTriangles;
- const PxU32 & numVerts = mMeshData.mNbVertices;
PX_ASSERT(!(mMeshData.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES));
@@ -670,37 +669,6 @@ void TriangleMeshBuilder::createGRBData()
PX_FREE(tempNormalsPerTri_prealloc);
- mMeshData.mGRB_vertValency = PX_NEW(PxU32)[numVerts];
- mMeshData.mGRB_adjVertStart = PX_NEW(PxU32)[numVerts];
-
-
- Ps::Array<GrbTrimeshCookerHelper::SortedNeighbor> pairsList;
- Ps::Array<GrbTrimeshCookerHelper::SharpEdgeRange> edgeRanges;
-
-
- mMeshData.mGRB_meshAdjVerticiesTotal = GrbTrimeshCookerHelper::buildVertexConnectionNew_p1(
- pairsList,
- edgeRanges,
-
- reinterpret_cast<uint3*>(mMeshData.mGRB_triIndices),
- reinterpret_cast<uint4 *>(mMeshData.mGRB_triAdjacencies),
- numTris,
- numVerts
- );
-
-
-
- mMeshData.mGRB_adjVertices = PX_NEW(PxU32)[mMeshData.mGRB_meshAdjVerticiesTotal];
- GrbTrimeshCookerHelper::buildVertexConnectionNew_p2(
- mMeshData.mGRB_adjVertStart,
- mMeshData.mGRB_vertValency,
- mMeshData.mGRB_adjVertices,
- pairsList,
- edgeRanges,
- numVerts
- );
-
-
}
void TriangleMeshBuilder::createGRBMidPhaseAndData(const PxU32 originalTriangleCount)
@@ -954,8 +922,6 @@ bool TriangleMeshBuilder::save(PxOutputStream& stream, bool platformMismatch, co
// GRB write -----------------------------------------------------------------
if (params.buildGPUData)
{
- writeDword(mMeshData.mGRB_meshAdjVerticiesTotal, platformMismatch, stream);
-
const PxU32* indices = reinterpret_cast<PxU32*>(mMeshData.mGRB_triIndices);
if (serialFlags & Gu::IMSF_8BIT_INDICES)
{
@@ -979,9 +945,6 @@ bool TriangleMeshBuilder::save(PxOutputStream& stream, bool platformMismatch, co
//writeIntBuffer(reinterpret_cast<PxU32 *>(mMeshData.mGRB_triIndices), mMeshData.mNbTriangles*4, platformMismatch, stream);
writeIntBuffer(reinterpret_cast<PxU32 *>(mMeshData.mGRB_triAdjacencies), mMeshData.mNbTriangles*4, platformMismatch, stream);
- writeIntBuffer(mMeshData.mGRB_vertValency, mMeshData.mNbVertices, platformMismatch, stream);
- writeIntBuffer(mMeshData.mGRB_adjVertStart, mMeshData.mNbVertices, platformMismatch, stream);
- writeIntBuffer(mMeshData.mGRB_adjVertices, mMeshData.mGRB_meshAdjVerticiesTotal, platformMismatch, stream);
writeIntBuffer(mMeshData.mGRB_faceRemap, mMeshData.mNbTriangles, platformMismatch, stream);
//Export GPU midphase structure