From f6721aa6eb708860a206f114108724f62ecfde4c Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 21 May 2015 15:53:16 -0700 Subject: [PATCH] moved ShapeInfoUtil to be ShapeFactory --- libraries/physics/src/PhysicalEntitySimulation.cpp | 1 - .../src/{ShapeInfoUtil.cpp => ShapeFactory.cpp} | 8 ++++---- .../physics/src/{ShapeInfoUtil.h => ShapeFactory.h} | 10 +++++----- libraries/physics/src/ShapeManager.cpp | 4 ++-- tests/physics/src/ShapeInfoTests.cpp | 10 +++++----- tests/physics/src/ShapeManagerTests.cpp | 1 - 6 files changed, 16 insertions(+), 18 deletions(-) rename libraries/physics/src/{ShapeInfoUtil.cpp => ShapeFactory.cpp} (94%) rename libraries/physics/src/{ShapeInfoUtil.h => ShapeFactory.h} (81%) diff --git a/libraries/physics/src/PhysicalEntitySimulation.cpp b/libraries/physics/src/PhysicalEntitySimulation.cpp index 94321e3c77..9c111ea623 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.cpp +++ b/libraries/physics/src/PhysicalEntitySimulation.cpp @@ -12,7 +12,6 @@ #include "PhysicalEntitySimulation.h" #include "PhysicsHelpers.h" #include "PhysicsLogging.h" -#include "ShapeInfoUtil.h" #include "ShapeManager.h" PhysicalEntitySimulation::PhysicalEntitySimulation() { diff --git a/libraries/physics/src/ShapeInfoUtil.cpp b/libraries/physics/src/ShapeFactory.cpp similarity index 94% rename from libraries/physics/src/ShapeInfoUtil.cpp rename to libraries/physics/src/ShapeFactory.cpp index 1cccd691c2..75362b72e6 100644 --- a/libraries/physics/src/ShapeInfoUtil.cpp +++ b/libraries/physics/src/ShapeFactory.cpp @@ -1,5 +1,5 @@ // -// ShapeInfoUtil.cpp +// ShapeFactory.cpp // libraries/physcis/src // // Created by Andrew Meadows 2014.12.01 @@ -11,12 +11,12 @@ #include // for MILLIMETERS_PER_METER -#include "ShapeInfoUtil.h" +#include "ShapeFactory.h" #include "BulletUtil.h" -btConvexHullShape* ShapeInfoUtil::createConvexHull(const QVector& points) { +btConvexHullShape* ShapeFactory::createConvexHull(const QVector& points) { assert(points.size() > 0); btConvexHullShape* hull = new btConvexHullShape(); @@ -57,7 +57,7 @@ btConvexHullShape* ShapeInfoUtil::createConvexHull(const QVector& poi return hull; } -btCollisionShape* ShapeInfoUtil::createShapeFromInfo(const ShapeInfo& info) { +btCollisionShape* ShapeFactory::createShapeFromInfo(const ShapeInfo& info) { btCollisionShape* shape = NULL; switch(info.getType()) { case SHAPE_TYPE_BOX: { diff --git a/libraries/physics/src/ShapeInfoUtil.h b/libraries/physics/src/ShapeFactory.h similarity index 81% rename from libraries/physics/src/ShapeInfoUtil.h rename to libraries/physics/src/ShapeFactory.h index 7284cd3550..699b8a0475 100644 --- a/libraries/physics/src/ShapeInfoUtil.h +++ b/libraries/physics/src/ShapeFactory.h @@ -1,5 +1,5 @@ // -// ShapeInfoUtil.h +// ShapeFactory.h // libraries/physcis/src // // Created by Andrew Meadows 2014.12.01 @@ -9,8 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#ifndef hifi_ShapeInfoUtil_h -#define hifi_ShapeInfoUtil_h +#ifndef hifi_ShapeFactory_h +#define hifi_ShapeFactory_h #include #include @@ -20,11 +20,11 @@ // translates between ShapeInfo and btShape // TODO: rename this to ShapeFactory -namespace ShapeInfoUtil { +namespace ShapeFactory { btConvexHullShape* createConvexHull(const QVector& points); btCollisionShape* createShapeFromInfo(const ShapeInfo& info); }; -#endif // hifi_ShapeInfoUtil_h +#endif // hifi_ShapeFactory_h diff --git a/libraries/physics/src/ShapeManager.cpp b/libraries/physics/src/ShapeManager.cpp index dd67c2c73a..7a3065dfff 100644 --- a/libraries/physics/src/ShapeManager.cpp +++ b/libraries/physics/src/ShapeManager.cpp @@ -13,7 +13,7 @@ #include -#include "ShapeInfoUtil.h" +#include "ShapeFactory.h" #include "ShapeManager.h" ShapeManager::ShapeManager() { @@ -46,7 +46,7 @@ btCollisionShape* ShapeManager::getShape(const ShapeInfo& info) { shapeRef->refCount++; return shapeRef->shape; } - btCollisionShape* shape = ShapeInfoUtil::createShapeFromInfo(info); + btCollisionShape* shape = ShapeFactory::createShapeFromInfo(info); if (shape) { ShapeReference newRef; newRef.refCount = 1; diff --git a/tests/physics/src/ShapeInfoTests.cpp b/tests/physics/src/ShapeInfoTests.cpp index ef5bd0be39..365d6d6008 100644 --- a/tests/physics/src/ShapeInfoTests.cpp +++ b/tests/physics/src/ShapeInfoTests.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include "ShapeInfoTests.h" @@ -142,7 +142,7 @@ void ShapeInfoTests::testBoxShape() { info.setBox(halfExtents); DoubleHashKey key = info.getHash(); - btCollisionShape* shape = ShapeInfoUtil::createShapeFromInfo(info); + btCollisionShape* shape = ShapeFactory::createShapeFromInfo(info); if (!shape) { std::cout << __FILE__ << ":" << __LINE__ << " ERROR: NULL Box shape" << std::endl; } @@ -168,7 +168,7 @@ void ShapeInfoTests::testSphereShape() { info.setSphere(radius); DoubleHashKey key = info.getHash(); - btCollisionShape* shape = ShapeInfoUtil::createShapeFromInfo(info); + btCollisionShape* shape = ShapeFactory::createShapeFromInfo(info); ShapeInfo otherInfo = info; DoubleHashKey otherKey = otherInfo.getHash(); @@ -192,7 +192,7 @@ void ShapeInfoTests::testCylinderShape() { info.setCylinder(radius, height); DoubleHashKey key = info.getHash(); - btCollisionShape* shape = ShapeInfoUtil::createShapeFromInfo(info); + btCollisionShape* shape = ShapeFactory::createShapeFromInfo(info); ShapeInfo otherInfo = info; DoubleHashKey otherKey = otherInfo.getHash(); @@ -217,7 +217,7 @@ void ShapeInfoTests::testCapsuleShape() { info.setCapsule(radius, height); DoubleHashKey key = info.getHash(); - btCollisionShape* shape = ShapeInfoUtil::createShapeFromInfo(info); + btCollisionShape* shape = ShapeFactory::createShapeFromInfo(info); ShapeInfo otherInfo = info; DoubleHashKey otherKey = otherInfo.getHash(); diff --git a/tests/physics/src/ShapeManagerTests.cpp b/tests/physics/src/ShapeManagerTests.cpp index d2b4ca70fa..9ac75981dd 100644 --- a/tests/physics/src/ShapeManagerTests.cpp +++ b/tests/physics/src/ShapeManagerTests.cpp @@ -10,7 +10,6 @@ // #include -#include #include #include