From a5a49df8c1946b3c94bd68146c333ca44fabbee8 Mon Sep 17 00:00:00 2001 From: Irlan Date: Mon, 22 Apr 2019 14:38:51 -0300 Subject: [PATCH] Begin pointer can change after reallocation --- include/bounce/collision/shapes/qhull.h | 8 ++++---- src/bounce/collision/shapes/qhull.cpp | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/bounce/collision/shapes/qhull.h b/include/bounce/collision/shapes/qhull.h index 42f3c66..25836de 100644 --- a/include/bounce/collision/shapes/qhull.h +++ b/include/bounce/collision/shapes/qhull.h @@ -32,13 +32,13 @@ struct b3QHull : public b3Hull b3QHull() { - vertices = hullVertices.Begin(); + vertices = nullptr; vertexCount = 0; - edges = hullEdges.Begin(); + edges = nullptr; edgeCount = 0; - faces = hullFaces.Begin(); + faces = nullptr; faceCount = 0; - planes = hullPlanes.Begin(); + planes = nullptr; centroid.SetZero(); } diff --git a/src/bounce/collision/shapes/qhull.cpp b/src/bounce/collision/shapes/qhull.cpp index b4e1541..1c5b259 100644 --- a/src/bounce/collision/shapes/qhull.cpp +++ b/src/bounce/collision/shapes/qhull.cpp @@ -338,8 +338,12 @@ void b3QHull::Set(u32 vtxStride, const void* vtxBase, u32 vtxCount, bool simplif ++iface; } + vertices = hullVertices.Begin(); vertexCount = hullVertices.Count(); + edges = hullEdges.Begin(); edgeCount = hullEdges.Count(); + faces = hullFaces.Begin(); + planes = hullPlanes.Begin(); faceCount = hullFaces.Count(); // Validate