From 5b0227c5c508a1eb64a7be5aafe34aeb04e7f7a9 Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Wed, 12 Sep 2018 09:39:00 +0200 Subject: [PATCH] Modifications of pull request (move private methods to public) --- src/collision/shapes/ConcaveMeshShape.cpp | 24 +-------------------- src/collision/shapes/ConcaveMeshShape.h | 26 +++++++++-------------- 2 files changed, 11 insertions(+), 39 deletions(-) diff --git a/src/collision/shapes/ConcaveMeshShape.cpp b/src/collision/shapes/ConcaveMeshShape.cpp index 631d2415..23a4bf4d 100644 --- a/src/collision/shapes/ConcaveMeshShape.cpp +++ b/src/collision/shapes/ConcaveMeshShape.cpp @@ -131,35 +131,13 @@ uint ConcaveMeshShape::getNbSubparts() const return mTriangleMesh->getNbSubparts(); } -// Return the number of triangles in a sub part +// Return the number of triangles in a sub part of the mesh uint ConcaveMeshShape::getNbTriangles(uint subPart) const { assert(mTriangleMesh->getSubpart(subPart)); return mTriangleMesh->getSubpart(subPart)->getNbTriangles(); } -// Return the triangle positions for a specific subpart and triangle index -void ConcaveMeshShape::getTriangleVertices(uint subPart, uint triangleIndex, Vector3* v1, Vector3* v2, Vector3* v3) const -{ - assert(mTriangleMesh->getSubpart(subPart)); - Vector3 outTriangleVertices[3]; - getTriangleVertices(subPart, triangleIndex, &outTriangleVertices[0]); - *v1 = outTriangleVertices[0]; - *v2 = outTriangleVertices[1]; - *v3 = outTriangleVertices[2]; -} - -// Return the triangle normals for a specific subpart and triangle index -void ConcaveMeshShape::getTriangleVerticesNormals(uint subPart, uint triangleIndex, Vector3* n1, Vector3* n2, Vector3* n3) const -{ - assert(mTriangleMesh->getSubpart(subPart)); - Vector3 outTriangleVerticesNormals[3]; - getTriangleVerticesNormals(subPart, triangleIndex, &outTriangleVerticesNormals[0]); - *n1 = outTriangleVerticesNormals[0]; - *n2 = outTriangleVerticesNormals[1]; - *n3 = outTriangleVerticesNormals[2]; -} - // Use a callback method on all triangles of the concave shape inside a given AABB void ConcaveMeshShape::testAllTriangles(TriangleCallback& callback, const AABB& localAABB) const { diff --git a/src/collision/shapes/ConcaveMeshShape.h b/src/collision/shapes/ConcaveMeshShape.h index 36f6607c..b23fd057 100644 --- a/src/collision/shapes/ConcaveMeshShape.h +++ b/src/collision/shapes/ConcaveMeshShape.h @@ -155,15 +155,6 @@ class ConcaveMeshShape : public ConcaveShape { /// Insert all the triangles into the dynamic AABB tree void initBVHTree(); - /// Return the three vertices coordinates (in the array outTriangleVertices) of a triangle - void getTriangleVertices(uint subPart, uint triangleIndex, Vector3* outTriangleVertices) const; - - /// Return the three vertex normals (in the array outVerticesNormals) of a triangle - void getTriangleVerticesNormals(uint subPart, uint triangleIndex, Vector3* outVerticesNormals) const; - - /// Return the indices of the three vertices of a given triangle in the array - void getTriangleVerticesIndices(uint subPart, uint triangleIndex, uint* outVerticesIndices) const; - /// Compute the shape Id for a given triangle of the mesh uint computeTriangleShapeId(uint subPart, uint triangleIndex) const; @@ -173,7 +164,7 @@ class ConcaveMeshShape : public ConcaveShape { ConcaveMeshShape(TriangleMesh* triangleMesh, const Vector3& scaling = Vector3(1, 1, 1)); /// Destructor - virtual ~ConcaveMeshShape() = default; + virtual ~ConcaveMeshShape() override = default; /// Deleted copy-constructor ConcaveMeshShape(const ConcaveMeshShape& shape) = delete; @@ -187,14 +178,17 @@ class ConcaveMeshShape : public ConcaveShape { /// Return the number of sub parts contained in this mesh uint getNbSubparts() const; - /// Return the number of triangles in a sub part + /// Return the number of triangles in a sub part of the mesh uint getNbTriangles(uint subPart) const; - - /// Return the triangle positions for a specific subpart and triangle index - void getTriangleVertices(uint subPart, uint triangleIndex, Vector3* v1, Vector3* v2, Vector3* v3) const; - /// Return the triangle normals for a specific subpart and triangle index - void getTriangleVerticesNormals(uint subPart, uint triangleIndex, Vector3* n1, Vector3* n2, Vector3* n3) const; + /// Return the indices of the three vertices of a given triangle in the array + void getTriangleVerticesIndices(uint subPart, uint triangleIndex, uint* outVerticesIndices) const; + + /// Return the three vertices coordinates (in the array outTriangleVertices) of a triangle + void getTriangleVertices(uint subPart, uint triangleIndex, Vector3* outTriangleVertices) const; + + /// Return the three vertex normals (in the array outVerticesNormals) of a triangle + void getTriangleVerticesNormals(uint subPart, uint triangleIndex, Vector3* outVerticesNormals) const; /// Return the local bounds of the shape in x, y and z directions. virtual void getLocalBounds(Vector3& min, Vector3& max) const override;