diff --git a/ephysics/collision/CollisionDetection.cpp b/ephysics/collision/CollisionDetection.cpp index 8cc9d1d..6cb0058 100644 --- a/ephysics/collision/CollisionDetection.cpp +++ b/ephysics/collision/CollisionDetection.cpp @@ -168,7 +168,7 @@ void CollisionDetection::computeNarrowPhase() { (shape1->getCollisionCategoryBits() & shape2->getCollideWithMaskBits()) == 0) || !m_broadPhaseAlgorithm.testOverlappingShapes(shape1, shape2)) { - std::map::iterator itToRemove = it; + etk::Map::iterator itToRemove = it; ++it; // TODO : Remove all the contact manifold of the overlapping pair from the contact manifolds list of the two bodies involved @@ -271,7 +271,7 @@ void CollisionDetection::computeNarrowPhaseBetweenShapes(CollisionCallback* call (shape1->getCollisionCategoryBits() & shape2->getCollideWithMaskBits()) == 0) || !m_broadPhaseAlgorithm.testOverlappingShapes(shape1, shape2)) { - std::map::iterator itToRemove = it; + etk::Map::iterator itToRemove = it; ++it; // TODO : Remove all the contact manifold of the overlapping pair from the contact manifolds list of the two bodies involved @@ -357,7 +357,7 @@ void CollisionDetection::broadPhaseNotifyOverlappingPair(ProxyShape* shape1, Pro assert(newPair != NULL); #ifndef NDEBUG - std::pair::iterator, bool> check = + etk::Pair::iterator, bool> check = #endif m_overlappingPairs.insert(make_pair(pairID, newPair)); assert(check.second); @@ -371,11 +371,11 @@ void CollisionDetection::broadPhaseNotifyOverlappingPair(ProxyShape* shape1, Pro void CollisionDetection::removeProxyCollisionShape(ProxyShape* proxyShape) { // Remove all the overlapping pairs involving this proxy shape - std::map::iterator it; + etk::Map::iterator it; for (it = m_overlappingPairs.begin(); it != m_overlappingPairs.end(); ) { if (it->second->getShape1()->m_broadPhaseID == proxyShape->m_broadPhaseID|| it->second->getShape2()->m_broadPhaseID == proxyShape->m_broadPhaseID) { - std::map::iterator itToRemove = it; + etk::Map::iterator itToRemove = it; ++it; // TODO : Remove all the contact manifold of the overlapping pair from the contact manifolds list of the two bodies involved @@ -431,7 +431,7 @@ void CollisionDetection::createContact(OverlappingPair* overlappingPair, void CollisionDetection::addAllContactManifoldsToBodies() { // For each overlapping pairs in contact during the narrow-phase - std::map::iterator it; + etk::Map::iterator it; for (it = m_contactOverlappingPairs.begin(); it != m_contactOverlappingPairs.end(); ++it) { // Add all the contact manifolds of the pair int32_to the list of contact manifolds @@ -479,7 +479,7 @@ void CollisionDetection::addContactManifoldToBody(OverlappingPair* pair) { void CollisionDetection::clearContactPoints() { // For each overlapping pair - std::map::iterator it; + etk::Map::iterator it; for (it = m_overlappingPairs.begin(); it != m_overlappingPairs.end(); ++it) { it->second->clearContactPoints(); } diff --git a/ephysics/collision/CollisionDetection.hpp b/ephysics/collision/CollisionDetection.hpp index e5ea6b2..8922a68 100644 --- a/ephysics/collision/CollisionDetection.hpp +++ b/ephysics/collision/CollisionDetection.hpp @@ -12,8 +12,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -51,8 +51,8 @@ namespace ephysics { NarrowPhaseAlgorithm* m_collisionMatrix[NB_COLLISION_SHAPE_TYPES][NB_COLLISION_SHAPE_TYPES]; //!< Collision detection matrix (algorithms to use) MemoryAllocator& m_memoryAllocator; //!< Reference to the memory allocator CollisionWorld* m_world; //!< Pointer to the physics world - std::map m_overlappingPairs; //!< Broad-phase overlapping pairs - std::map m_contactOverlappingPairs; //!< Overlapping pairs in contact (during the current Narrow-phase collision detection) + etk::Map m_overlappingPairs; //!< Broad-phase overlapping pairs + etk::Map m_contactOverlappingPairs; //!< Overlapping pairs in contact (during the current Narrow-phase collision detection) BroadPhaseAlgorithm m_broadPhaseAlgorithm; //!< Broad-phase algorithm // TODO : Delete this GJKAlgorithm m_narrowPhaseGJKAlgorithm; //!< Narrow-phase GJK algorithm diff --git a/ephysics/collision/ContactManifold.hpp b/ephysics/collision/ContactManifold.hpp index fb81bb9..23d0b49 100644 --- a/ephysics/collision/ContactManifold.hpp +++ b/ephysics/collision/ContactManifold.hpp @@ -5,7 +5,7 @@ */ #pragma once -#include +#include #include #include #include diff --git a/ephysics/collision/TriangleMesh.hpp b/ephysics/collision/TriangleMesh.hpp index d3bef35..12f0ba2 100644 --- a/ephysics/collision/TriangleMesh.hpp +++ b/ephysics/collision/TriangleMesh.hpp @@ -4,7 +4,7 @@ * @license BSD 3 clauses (see license file) */ #pragma once -#include +#include #include #include @@ -18,7 +18,7 @@ namespace ephysics { */ class TriangleMesh { protected: - std::vector m_triangleArrays; //!< All the triangle arrays of the mesh (one triangle array per part) + etk::Vector m_triangleArrays; //!< All the triangle arrays of the mesh (one triangle array per part) public: /** * @brief Constructor @@ -32,7 +32,7 @@ namespace ephysics { * @brief Add a subpart of the mesh */ void addSubpart(TriangleVertexArray* _triangleVertexArray) { - m_triangleArrays.push_back(_triangleVertexArray ); + m_triangleArrays.pushBack(_triangleVertexArray ); } /** * @brief Get a pointer to a given subpart (triangle vertex array) of the mesh diff --git a/ephysics/collision/TriangleVertexArray.cpp b/ephysics/collision/TriangleVertexArray.cpp index 0ee569b..b6a3972 100644 --- a/ephysics/collision/TriangleVertexArray.cpp +++ b/ephysics/collision/TriangleVertexArray.cpp @@ -8,7 +8,7 @@ #include -ephysics::TriangleVertexArray::TriangleVertexArray(const std::vector& _vertices, std::vector _triangles): +ephysics::TriangleVertexArray::TriangleVertexArray(const etk::Vector& _vertices, etk::Vector _triangles): m_vertices(_vertices), m_triangles(_triangles) { @@ -22,11 +22,11 @@ size_t ephysics::TriangleVertexArray::getNbTriangles() const { return m_triangles.size()/3; } -const std::vector& ephysics::TriangleVertexArray::getVertices() const { +const etk::Vector& ephysics::TriangleVertexArray::getVertices() const { return m_vertices; } -const std::vector& ephysics::TriangleVertexArray::getIndices() const{ +const etk::Vector& ephysics::TriangleVertexArray::getIndices() const{ return m_triangles; } diff --git a/ephysics/collision/TriangleVertexArray.hpp b/ephysics/collision/TriangleVertexArray.hpp index 282f2a0..7eb1b0f 100644 --- a/ephysics/collision/TriangleVertexArray.hpp +++ b/ephysics/collision/TriangleVertexArray.hpp @@ -27,16 +27,16 @@ namespace ephysics { */ class TriangleVertexArray { protected: - std::vector m_vertices; //!< Vertice list - std::vector m_triangles; //!< List of triangle (3 pos for each triangle) + etk::Vector m_vertices; //!< Vertice list + etk::Vector m_triangles; //!< List of triangle (3 pos for each triangle) public: /** * @brief Constructor * @param[in] _vertices List Of all vertices * @param[in] _triangles List of all linked points */ - TriangleVertexArray(const std::vector& _vertices, - std::vector _triangles); + TriangleVertexArray(const etk::Vector& _vertices, + etk::Vector _triangles); /** * @brief Get the number of vertices * @return Number of vertices @@ -51,12 +51,12 @@ namespace ephysics { * @brief Get The table of the vertices * @return reference on the vertices */ - const std::vector& getVertices() const; + const etk::Vector& getVertices() const; /** * @brief Get The table of the triangle indice * @return reference on the triangle indice */ - const std::vector& getIndices() const; + const etk::Vector& getIndices() const; /** * @brief Get a triangle at the specific ID * @return Buffer of 3 points diff --git a/ephysics/collision/broadphase/BroadPhaseAlgorithm.cpp b/ephysics/collision/broadphase/BroadPhaseAlgorithm.cpp index e5c5513..87f884c 100644 --- a/ephysics/collision/broadphase/BroadPhaseAlgorithm.cpp +++ b/ephysics/collision/broadphase/BroadPhaseAlgorithm.cpp @@ -225,8 +225,8 @@ void BroadPhaseAlgorithm::notifyOverlappingNodes(int32_t node1ID, int32_t node2I } // Add the new potential pair int32_to the array of potential overlapping pairs - m_potentialPairs[m_numberPotentialPairs].collisionShape1ID = std::min(node1ID, node2ID); - m_potentialPairs[m_numberPotentialPairs].collisionShape2ID = std::max(node1ID, node2ID); + m_potentialPairs[m_numberPotentialPairs].collisionShape1ID = etk::min(node1ID, node2ID); + m_potentialPairs[m_numberPotentialPairs].collisionShape2ID = etk::max(node1ID, node2ID); m_numberPotentialPairs++; } diff --git a/ephysics/collision/broadphase/BroadPhaseAlgorithm.hpp b/ephysics/collision/broadphase/BroadPhaseAlgorithm.hpp index fecd6bc..7c056de 100644 --- a/ephysics/collision/broadphase/BroadPhaseAlgorithm.hpp +++ b/ephysics/collision/broadphase/BroadPhaseAlgorithm.hpp @@ -5,7 +5,7 @@ */ #pragma once -#include +#include #include #include #include diff --git a/ephysics/collision/broadphase/DynamicAABBTree.cpp b/ephysics/collision/broadphase/DynamicAABBTree.cpp index 7f5ba0a..5df6859 100644 --- a/ephysics/collision/broadphase/DynamicAABBTree.cpp +++ b/ephysics/collision/broadphase/DynamicAABBTree.cpp @@ -314,7 +314,7 @@ void DynamicAABBTree::insertLeafNode(int32_t _nodeID) { assert(rightChild != TreeNode::NULL_TREE_NODE); // Recompute the height of the node in the tree - m_nodes[currentNodeID].height = std::max(m_nodes[leftChild].height, + m_nodes[currentNodeID].height = etk::max(m_nodes[leftChild].height, m_nodes[rightChild].height) + 1; assert(m_nodes[currentNodeID].height > 0); @@ -380,7 +380,7 @@ void DynamicAABBTree::removeLeafNode(int32_t _nodeID) { // Recompute the AABB and the height of the current node m_nodes[currentNodeID].aabb.mergeTwoAABBs(m_nodes[leftChildID].aabb, m_nodes[rightChildID].aabb); - m_nodes[currentNodeID].height = std::max(m_nodes[leftChildID].height, + m_nodes[currentNodeID].height = etk::max(m_nodes[leftChildID].height, m_nodes[rightChildID].height) + 1; assert(m_nodes[currentNodeID].height > 0); @@ -468,8 +468,8 @@ int32_t DynamicAABBTree::balanceSubTreeAtNode(int32_t _nodeID) { nodeC->aabb.mergeTwoAABBs(nodeA->aabb, nodeF->aabb); // Recompute the height of node A and C - nodeA->height = std::max(nodeB->height, nodeG->height) + 1; - nodeC->height = std::max(nodeA->height, nodeF->height) + 1; + nodeA->height = etk::max(nodeB->height, nodeG->height) + 1; + nodeC->height = etk::max(nodeA->height, nodeF->height) + 1; assert(nodeA->height > 0); assert(nodeC->height > 0); } @@ -483,8 +483,8 @@ int32_t DynamicAABBTree::balanceSubTreeAtNode(int32_t _nodeID) { nodeC->aabb.mergeTwoAABBs(nodeA->aabb, nodeG->aabb); // Recompute the height of node A and C - nodeA->height = std::max(nodeB->height, nodeF->height) + 1; - nodeC->height = std::max(nodeA->height, nodeG->height) + 1; + nodeA->height = etk::max(nodeB->height, nodeF->height) + 1; + nodeC->height = etk::max(nodeA->height, nodeG->height) + 1; assert(nodeA->height > 0); assert(nodeC->height > 0); } @@ -538,8 +538,8 @@ int32_t DynamicAABBTree::balanceSubTreeAtNode(int32_t _nodeID) { nodeB->aabb.mergeTwoAABBs(nodeA->aabb, nodeF->aabb); // Recompute the height of node A and B - nodeA->height = std::max(nodeC->height, nodeG->height) + 1; - nodeB->height = std::max(nodeA->height, nodeF->height) + 1; + nodeA->height = etk::max(nodeC->height, nodeG->height) + 1; + nodeB->height = etk::max(nodeA->height, nodeF->height) + 1; assert(nodeA->height > 0); assert(nodeB->height > 0); } @@ -553,8 +553,8 @@ int32_t DynamicAABBTree::balanceSubTreeAtNode(int32_t _nodeID) { nodeB->aabb.mergeTwoAABBs(nodeA->aabb, nodeG->aabb); // Recompute the height of node A and B - nodeA->height = std::max(nodeC->height, nodeF->height) + 1; - nodeB->height = std::max(nodeA->height, nodeG->height) + 1; + nodeA->height = etk::max(nodeC->height, nodeF->height) + 1; + nodeB->height = etk::max(nodeA->height, nodeG->height) + 1; assert(nodeA->height > 0); assert(nodeB->height > 0); } @@ -781,7 +781,7 @@ void DynamicAABBTree::checkNode(int32_t _nodeID) const { assert(m_nodes[rightChild].parentID == _nodeID); // Check the height of node - int32_t height = 1 + std::max(m_nodes[leftChild].height, m_nodes[rightChild].height); + int32_t height = 1 + etk::max(m_nodes[leftChild].height, m_nodes[rightChild].height); assert(m_nodes[_nodeID].height == height); // Check the AABB of the node @@ -816,7 +816,7 @@ int32_t DynamicAABBTree::computeHeight(int32_t _nodeID) { int32_t rightHeight = computeHeight(node->children[1]); // Return the height of the node - return 1 + std::max(leftHeight, rightHeight); + return 1 + etk::max(leftHeight, rightHeight); } #endif diff --git a/ephysics/collision/narrowphase/ConcaveVsConvexAlgorithm.cpp b/ephysics/collision/narrowphase/ConcaveVsConvexAlgorithm.cpp index 7e805a0..886a0e3 100644 --- a/ephysics/collision/narrowphase/ConcaveVsConvexAlgorithm.cpp +++ b/ephysics/collision/narrowphase/ConcaveVsConvexAlgorithm.cpp @@ -63,7 +63,7 @@ void ConcaveVsConvexAlgorithm::testCollision(const CollisionShapeInfo& shape1Inf // If smooth mesh collision is enabled for the concave mesh if (concaveShape->getIsSmoothMeshCollisionEnabled()) { - std::vector contactPoints; + etk::Vector contactPoints; SmoothCollisionNarrowPhaseCallback smoothNarrowPhaseCallback(contactPoints); @@ -116,7 +116,7 @@ void ConvexVsTriangleCallback::testTriangle(const vec3* trianglePoints) { // by Pierre Terdiman (http://www.codercorner.com/MeshContacts.pdf). This is used to avoid the collision // issue with some int32_ternal edges. void ConcaveVsConvexAlgorithm::processSmoothMeshCollision(OverlappingPair* overlappingPair, - std::vector contactPoints, + etk::Vector contactPoints, NarrowPhaseCallback* narrowPhaseCallback) { // Set with the triangle vertices already processed to void further contacts with same triangle @@ -126,7 +126,7 @@ void ConcaveVsConvexAlgorithm::processSmoothMeshCollision(OverlappingPair* overl std::sort(contactPoints.begin(), contactPoints.end(), ContactsDepthCompare()); // For each contact point (from smaller penetration depth to larger) - std::vector::const_iterator it; + etk::Vector::const_iterator it; for (it = contactPoints.begin(); it != contactPoints.end(); ++it) { const SmoothMeshContactInfo info = *it; @@ -268,5 +268,5 @@ void SmoothCollisionNarrowPhaseCallback::notifyContact(OverlappingPair* overlapp // Add the narrow-phase contact int32_to the list of contact to process for // smooth mesh collision - m_contactPoints.push_back(smoothContactInfo); + m_contactPoints.pushBack(smoothContactInfo); } diff --git a/ephysics/collision/narrowphase/ConcaveVsConvexAlgorithm.hpp b/ephysics/collision/narrowphase/ConcaveVsConvexAlgorithm.hpp index d1c1cb4..338b87e 100644 --- a/ephysics/collision/narrowphase/ConcaveVsConvexAlgorithm.hpp +++ b/ephysics/collision/narrowphase/ConcaveVsConvexAlgorithm.hpp @@ -94,10 +94,10 @@ namespace ephysics { */ class SmoothCollisionNarrowPhaseCallback : public NarrowPhaseCallback { private: - std::vector& m_contactPoints; + etk::Vector& m_contactPoints; public: // Constructor - SmoothCollisionNarrowPhaseCallback(std::vector& _contactPoints): + SmoothCollisionNarrowPhaseCallback(etk::Vector& _contactPoints): m_contactPoints(_contactPoints) { } @@ -119,11 +119,11 @@ namespace ephysics { ConcaveVsConvexAlgorithm& operator=(const ConcaveVsConvexAlgorithm& _algorithm); /// Process the concave triangle mesh collision using the smooth mesh collision algorithm void processSmoothMeshCollision(OverlappingPair* _overlappingPair, - std::vector _contactPoints, + etk::Vector _contactPoints, NarrowPhaseCallback* _narrowPhaseCallback); /// Add a triangle vertex int32_to the set of processed triangles void addProcessedVertex(std::unordered_multimap& _processTriangleVertices, const vec3& _vertex) { - _processTriangleVertices.insert(std::make_pair(int32_t(_vertex.x() * _vertex.y() * _vertex.z()), _vertex)); + _processTriangleVertices.insert(etk::makePair(int32_t(_vertex.x() * _vertex.y() * _vertex.z()), _vertex)); } /// Return true if the vertex is in the set of already processed vertices bool hasVertexBeenProcessed(const std::unordered_multimap& _processTriangleVertices, diff --git a/ephysics/collision/narrowphase/EPA/EPAAlgorithm.cpp b/ephysics/collision/narrowphase/EPA/EPAAlgorithm.cpp index d3b5fac..754cc65 100644 --- a/ephysics/collision/narrowphase/EPA/EPAAlgorithm.cpp +++ b/ephysics/collision/narrowphase/EPA/EPAAlgorithm.cpp @@ -377,7 +377,7 @@ void EPAAlgorithm::computePenetrationDepthAndContactPoints(const Simplex& simple // Compute the error float error = wDotv - triangle->getDistSquare(); - if (error <= std::max(tolerance, REL_ERROR_SQUARE * wDotv) || + if (error <= etk::max(tolerance, REL_ERROR_SQUARE * wDotv) || points[indexNewVertex] == points[(*triangle)[0]] || points[indexNewVertex] == points[(*triangle)[1]] || points[indexNewVertex] == points[(*triangle)[2]]) { diff --git a/ephysics/collision/narrowphase/GJK/Simplex.hpp b/ephysics/collision/narrowphase/GJK/Simplex.hpp index 5c3ae8b..0368882 100644 --- a/ephysics/collision/narrowphase/GJK/Simplex.hpp +++ b/ephysics/collision/narrowphase/GJK/Simplex.hpp @@ -7,7 +7,7 @@ // Libraries #include -#include +#include /// ReactPhysics3D namespace namespace ephysics { diff --git a/ephysics/collision/shapes/AABB.cpp b/ephysics/collision/shapes/AABB.cpp index ffa4eeb..280cfba 100644 --- a/ephysics/collision/shapes/AABB.cpp +++ b/ephysics/collision/shapes/AABB.cpp @@ -32,21 +32,21 @@ AABB::AABB(const AABB& _aabb): } void AABB::mergeWithAABB(const AABB& _aabb) { - m_minCoordinates.setX(std::min(m_minCoordinates.x(), _aabb.m_minCoordinates.x())); - m_minCoordinates.setY(std::min(m_minCoordinates.y(), _aabb.m_minCoordinates.y())); - m_minCoordinates.setZ(std::min(m_minCoordinates.z(), _aabb.m_minCoordinates.z())); - m_maxCoordinates.setX(std::max(m_maxCoordinates.x(), _aabb.m_maxCoordinates.x())); - m_maxCoordinates.setY(std::max(m_maxCoordinates.y(), _aabb.m_maxCoordinates.y())); - m_maxCoordinates.setZ(std::max(m_maxCoordinates.z(), _aabb.m_maxCoordinates.z())); + m_minCoordinates.setX(etk::min(m_minCoordinates.x(), _aabb.m_minCoordinates.x())); + m_minCoordinates.setY(etk::min(m_minCoordinates.y(), _aabb.m_minCoordinates.y())); + m_minCoordinates.setZ(etk::min(m_minCoordinates.z(), _aabb.m_minCoordinates.z())); + m_maxCoordinates.setX(etk::max(m_maxCoordinates.x(), _aabb.m_maxCoordinates.x())); + m_maxCoordinates.setY(etk::max(m_maxCoordinates.y(), _aabb.m_maxCoordinates.y())); + m_maxCoordinates.setZ(etk::max(m_maxCoordinates.z(), _aabb.m_maxCoordinates.z())); } void AABB::mergeTwoAABBs(const AABB& _aabb1, const AABB& _aabb2) { - m_minCoordinates.setX(std::min(_aabb1.m_minCoordinates.x(), _aabb2.m_minCoordinates.x())); - m_minCoordinates.setY(std::min(_aabb1.m_minCoordinates.y(), _aabb2.m_minCoordinates.y())); - m_minCoordinates.setZ(std::min(_aabb1.m_minCoordinates.z(), _aabb2.m_minCoordinates.z())); - m_maxCoordinates.setX(std::max(_aabb1.m_maxCoordinates.x(), _aabb2.m_maxCoordinates.x())); - m_maxCoordinates.setY(std::max(_aabb1.m_maxCoordinates.y(), _aabb2.m_maxCoordinates.y())); - m_maxCoordinates.setZ(std::max(_aabb1.m_maxCoordinates.z(), _aabb2.m_maxCoordinates.z())); + m_minCoordinates.setX(etk::min(_aabb1.m_minCoordinates.x(), _aabb2.m_minCoordinates.x())); + m_minCoordinates.setY(etk::min(_aabb1.m_minCoordinates.y(), _aabb2.m_minCoordinates.y())); + m_minCoordinates.setZ(etk::min(_aabb1.m_minCoordinates.z(), _aabb2.m_minCoordinates.z())); + m_maxCoordinates.setX(etk::max(_aabb1.m_maxCoordinates.x(), _aabb2.m_maxCoordinates.x())); + m_maxCoordinates.setY(etk::max(_aabb1.m_maxCoordinates.y(), _aabb2.m_maxCoordinates.y())); + m_maxCoordinates.setZ(etk::max(_aabb1.m_maxCoordinates.z(), _aabb2.m_maxCoordinates.z())); } bool AABB::contains(const AABB& _aabb) const { diff --git a/ephysics/collision/shapes/BoxShape.cpp b/ephysics/collision/shapes/BoxShape.cpp index c8973d7..cd78311 100644 --- a/ephysics/collision/shapes/BoxShape.cpp +++ b/ephysics/collision/shapes/BoxShape.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include using namespace ephysics; @@ -83,7 +83,7 @@ bool BoxShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, ProxyShape* pro tMin = t1; normalDirection = currentNormal; } - tMax = std::min(tMax, t2); + tMax = etk::min(tMax, t2); // If tMin is larger than the maximum raycasting fraction, we return no hit if (tMin > ray.maxFraction) return false; diff --git a/ephysics/collision/shapes/ConcaveMeshShape.cpp b/ephysics/collision/shapes/ConcaveMeshShape.cpp index 461e20b..f55c933 100644 --- a/ephysics/collision/shapes/ConcaveMeshShape.cpp +++ b/ephysics/collision/shapes/ConcaveMeshShape.cpp @@ -74,12 +74,12 @@ bool ConcaveMeshShape::raycast(const Ray& _ray, RaycastInfo& _raycastInfo, Proxy float ConcaveMeshRaycastCallback::raycastBroadPhaseShape(int32_t _nodeId, const Ray& _ray) { // Add the id of the hit AABB node int32_to - m_hitAABBNodes.push_back(_nodeId); + m_hitAABBNodes.pushBack(_nodeId); return _ray.maxFraction; } void ConcaveMeshRaycastCallback::raycastTriangles() { - std::vector::const_iterator it; + etk::Vector::const_iterator it; float smallestHitFraction = m_ray.maxFraction; for (it = m_hitAABBNodes.begin(); it != m_hitAABBNodes.end(); ++it) { // Get the node data (triangle index and mesh subpart index) diff --git a/ephysics/collision/shapes/ConcaveMeshShape.hpp b/ephysics/collision/shapes/ConcaveMeshShape.hpp index 96ccf7a..996b888 100644 --- a/ephysics/collision/shapes/ConcaveMeshShape.hpp +++ b/ephysics/collision/shapes/ConcaveMeshShape.hpp @@ -35,7 +35,7 @@ namespace ephysics { class ConcaveMeshRaycastCallback : public DynamicAABBTreeRaycastCallback { private : - std::vector m_hitAABBNodes; + etk::Vector m_hitAABBNodes; const DynamicAABBTree& m_dynamicAABBTree; const ConcaveMeshShape& m_concaveMeshShape; ProxyShape* m_proxyShape; diff --git a/ephysics/collision/shapes/ConvexMeshShape.cpp b/ephysics/collision/shapes/ConvexMeshShape.cpp index 3efa5e9..a669306 100644 --- a/ephysics/collision/shapes/ConvexMeshShape.cpp +++ b/ephysics/collision/shapes/ConvexMeshShape.cpp @@ -30,7 +30,7 @@ ConvexMeshShape::ConvexMeshShape(const float* arrayVertices, uint32_t nbVertices // Copy all the vertices int32_to the int32_ternal array for (uint32_t i=0; igetVertices()) { - m_vertices.push_back(it*m_scaling); + m_vertices.pushBack(it*m_scaling); } // If we need to use the edges information of the mesh if (m_isEdgesInformationUsed) { @@ -256,7 +256,7 @@ void ConvexMeshShape::computeLocalInertiaTensor(etk::Matrix3x3& tensor, float ma void ConvexMeshShape::addVertex(const vec3& vertex) { // Add the vertex in to vertices array - m_vertices.push_back(vertex); + m_vertices.pushBack(vertex); m_numberVertices++; // Update the bounds of the mesh @@ -292,12 +292,12 @@ void ConvexMeshShape::addEdge(uint32_t v1, uint32_t v2) { // If the entry for vertex v1 does not exist in the adjacency list if (m_edgesAdjacencyList.count(v1) == 0) { - m_edgesAdjacencyList.insert(std::make_pair(v1, std::set())); + m_edgesAdjacencyList.insert(etk::makePair(v1, std::set())); } // If the entry for vertex v2 does not exist in the adjacency list if (m_edgesAdjacencyList.count(v2) == 0) { - m_edgesAdjacencyList.insert(std::make_pair(v2, std::set())); + m_edgesAdjacencyList.insert(etk::makePair(v2, std::set())); } // Add the edge in the adjacency list diff --git a/ephysics/collision/shapes/ConvexMeshShape.hpp b/ephysics/collision/shapes/ConvexMeshShape.hpp index aa178e5..2a663f1 100644 --- a/ephysics/collision/shapes/ConvexMeshShape.hpp +++ b/ephysics/collision/shapes/ConvexMeshShape.hpp @@ -10,9 +10,9 @@ #include #include #include -#include +#include #include -#include +#include namespace ephysics { class CollisionWorld; @@ -33,12 +33,12 @@ namespace ephysics { */ class ConvexMeshShape : public ConvexShape { protected : - std::vector m_vertices; //!< Array with the vertices of the mesh + etk::Vector m_vertices; //!< Array with the vertices of the mesh uint32_t m_numberVertices; //!< Number of vertices in the mesh vec3 m_minBounds; //!< Mesh minimum bounds in the three local x, y and z directions vec3 m_maxBounds; //!< Mesh maximum bounds in the three local x, y and z directions bool m_isEdgesInformationUsed; //!< True if the shape contains the edges of the convex mesh in order to make the collision detection faster - std::map > m_edgesAdjacencyList; //!< Adjacency list representing the edges of the mesh + etk::Map > m_edgesAdjacencyList; //!< Adjacency list representing the edges of the mesh /// Private copy-constructor ConvexMeshShape(const ConvexMeshShape& _shape); /// Private assignment operator diff --git a/ephysics/configuration.hpp b/ephysics/configuration.hpp index 1a484b1..c68b624 100644 --- a/ephysics/configuration.hpp +++ b/ephysics/configuration.hpp @@ -15,7 +15,7 @@ namespace ephysics { // ------------------- Type definitions ------------------- // typedef uint64_t bodyindex; - typedef std::pair bodyindexpair; + typedef etk::Pair bodyindexpair; // ------------------- Enumerations ------------------- // diff --git a/ephysics/constraint/HingeJoint.cpp b/ephysics/constraint/HingeJoint.cpp index 838c1e9..10d1386 100644 --- a/ephysics/constraint/HingeJoint.cpp +++ b/ephysics/constraint/HingeJoint.cpp @@ -313,7 +313,7 @@ void HingeJoint::solveVelocityConstraint(const ConstraintSolverData& constraintS // Compute the Lagrange multiplier lambda for the lower limit constraint float deltaLambdaLower = m_inverseMassMatrixLimitMotor * (-JvLowerLimit -m_bLowerLimit); float lambdaTemp = m_impulseLowerLimit; - m_impulseLowerLimit = std::max(m_impulseLowerLimit + deltaLambdaLower, 0.0f); + m_impulseLowerLimit = etk::max(m_impulseLowerLimit + deltaLambdaLower, 0.0f); deltaLambdaLower = m_impulseLowerLimit - lambdaTemp; // Compute the impulse P=J^T * lambda for the lower limit constraint of body 1 @@ -338,7 +338,7 @@ void HingeJoint::solveVelocityConstraint(const ConstraintSolverData& constraintS // Compute the Lagrange multiplier lambda for the upper limit constraint float deltaLambdaUpper = m_inverseMassMatrixLimitMotor * (-JvUpperLimit -m_bUpperLimit); float lambdaTemp = m_impulseUpperLimit; - m_impulseUpperLimit = std::max(m_impulseUpperLimit + deltaLambdaUpper, 0.0f); + m_impulseUpperLimit = etk::max(m_impulseUpperLimit + deltaLambdaUpper, 0.0f); deltaLambdaUpper = m_impulseUpperLimit - lambdaTemp; // Compute the impulse P=J^T * lambda for the upper limit constraint of body 1 diff --git a/ephysics/constraint/SliderJoint.cpp b/ephysics/constraint/SliderJoint.cpp index a372490..10ddcda 100644 --- a/ephysics/constraint/SliderJoint.cpp +++ b/ephysics/constraint/SliderJoint.cpp @@ -330,7 +330,7 @@ void SliderJoint::solveVelocityConstraint(const ConstraintSolverData& constraint // Compute the Lagrange multiplier lambda for the lower limit constraint float deltaLambdaLower = m_inverseMassMatrixLimit * (-JvLowerLimit -m_bLowerLimit); float lambdaTemp = m_impulseLowerLimit; - m_impulseLowerLimit = std::max(m_impulseLowerLimit + deltaLambdaLower, 0.0f); + m_impulseLowerLimit = etk::max(m_impulseLowerLimit + deltaLambdaLower, 0.0f); deltaLambdaLower = m_impulseLowerLimit - lambdaTemp; // Compute the impulse P=J^T * lambda for the lower limit constraint of body 1 @@ -360,7 +360,7 @@ void SliderJoint::solveVelocityConstraint(const ConstraintSolverData& constraint // Compute the Lagrange multiplier lambda for the upper limit constraint float deltaLambdaUpper = m_inverseMassMatrixLimit * (-JvUpperLimit -m_bUpperLimit); float lambdaTemp = m_impulseUpperLimit; - m_impulseUpperLimit = std::max(m_impulseUpperLimit + deltaLambdaUpper, 0.0f); + m_impulseUpperLimit = etk::max(m_impulseUpperLimit + deltaLambdaUpper, 0.0f); deltaLambdaUpper = m_impulseUpperLimit - lambdaTemp; // Compute the impulse P=J^T * lambda for the upper limit constraint of body 1 diff --git a/ephysics/engine/CollisionWorld.cpp b/ephysics/engine/CollisionWorld.cpp index 3201af5..e58d9c4 100644 --- a/ephysics/engine/CollisionWorld.cpp +++ b/ephysics/engine/CollisionWorld.cpp @@ -69,7 +69,7 @@ void CollisionWorld::destroyCollisionBody(CollisionBody* collisionBody) { collisionBody->removeAllCollisionShapes(); // Add the body ID to the list of free IDs - m_freeBodiesIDs.push_back(collisionBody->getID()); + m_freeBodiesIDs.pushBack(collisionBody->getID()); // Call the destructor of the collision body collisionBody->~CollisionBody(); @@ -88,7 +88,7 @@ bodyindex CollisionWorld::computeNextAvailableBodyID() { bodyindex bodyID; if (!m_freeBodiesIDs.empty()) { bodyID = m_freeBodiesIDs.back(); - m_freeBodiesIDs.pop_back(); + m_freeBodiesIDs.popBack(); } else { bodyID = m_currentBodyID; diff --git a/ephysics/engine/CollisionWorld.hpp b/ephysics/engine/CollisionWorld.hpp index cdb558b..ca86205 100644 --- a/ephysics/engine/CollisionWorld.hpp +++ b/ephysics/engine/CollisionWorld.hpp @@ -5,7 +5,7 @@ */ #pragma once -#include +#include #include #include #include @@ -32,7 +32,7 @@ namespace ephysics { CollisionDetection m_collisionDetection; //!< Reference to the collision detection std::set m_bodies; //!< All the bodies (rigid and soft) of the world bodyindex m_currentBodyID; //!< Current body ID - std::vector m_freeBodiesIDs; //!< List of free ID for rigid bodies + etk::Vector m_freeBodiesIDs; //!< List of free ID for rigid bodies MemoryAllocator m_memoryAllocator; //!< Memory allocator EventListener* m_eventListener; //!< Pointer to an event listener object /// Private copy-constructor diff --git a/ephysics/engine/ConstraintSolver.cpp b/ephysics/engine/ConstraintSolver.cpp index 570bd5b..ad49460 100644 --- a/ephysics/engine/ConstraintSolver.cpp +++ b/ephysics/engine/ConstraintSolver.cpp @@ -9,7 +9,7 @@ using namespace ephysics; -ConstraintSolver::ConstraintSolver(const std::map& _mapBodyToVelocityIndex): +ConstraintSolver::ConstraintSolver(const etk::Map& _mapBodyToVelocityIndex): m_mapBodyToConstrainedVelocityIndex(_mapBodyToVelocityIndex), m_isWarmStartingActive(true), m_constraintSolverData(_mapBodyToVelocityIndex) { diff --git a/ephysics/engine/ConstraintSolver.hpp b/ephysics/engine/ConstraintSolver.hpp index 2875730..df74c08 100644 --- a/ephysics/engine/ConstraintSolver.hpp +++ b/ephysics/engine/ConstraintSolver.hpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include namespace ephysics { @@ -24,10 +24,10 @@ namespace ephysics { vec3* angularVelocities; //!< Array with the bodies angular velocities vec3* positions; //!< Reference to the bodies positions etk::Quaternion* orientations; //!< Reference to the bodies orientations - const std::map& mapBodyToConstrainedVelocityIndex; //!< Reference to the map that associates rigid body to their index in the constrained velocities array + const etk::Map& mapBodyToConstrainedVelocityIndex; //!< Reference to the map that associates rigid body to their index in the constrained velocities array bool isWarmStartingActive; //!< True if warm starting of the solver is active /// Constructor - ConstraintSolverData(const std::map& refMapBodyToConstrainedVelocityIndex) + ConstraintSolverData(const etk::Map& refMapBodyToConstrainedVelocityIndex) :linearVelocities(NULL), angularVelocities(NULL), positions(NULL), orientations(NULL), mapBodyToConstrainedVelocityIndex(refMapBodyToConstrainedVelocityIndex){ @@ -105,13 +105,13 @@ namespace ephysics { */ class ConstraintSolver { private : - const std::map& m_mapBodyToConstrainedVelocityIndex; //!< Reference to the map that associates rigid body to their index in the constrained velocities array + const etk::Map& m_mapBodyToConstrainedVelocityIndex; //!< Reference to the map that associates rigid body to their index in the constrained velocities array float m_timeStep; //!< Current time step bool m_isWarmStartingActive; //!< True if the warm starting of the solver is active ConstraintSolverData m_constraintSolverData; //!< Constraint solver data used to initialize and solve the constraints public : /// Constructor - ConstraintSolver(const std::map& _mapBodyToVelocityIndex); + ConstraintSolver(const etk::Map& _mapBodyToVelocityIndex); /// Initialize the constraint solver for a given island void initializeForIsland(float _dt, Island* _island); /// Solve the constraints diff --git a/ephysics/engine/ContactSolver.cpp b/ephysics/engine/ContactSolver.cpp index 4be9a42..1199ea3 100644 --- a/ephysics/engine/ContactSolver.cpp +++ b/ephysics/engine/ContactSolver.cpp @@ -20,7 +20,7 @@ const float ContactSolver::BETA_SPLIT_IMPULSE = float(0.2); const float ContactSolver::SLOP= float(0.01); // Constructor -ContactSolver::ContactSolver(const std::map& mapBodyToVelocityIndex) +ContactSolver::ContactSolver(const etk::Map& mapBodyToVelocityIndex) :m_splitLinearVelocities(nullptr), m_splitAngularVelocities(nullptr), m_contactConstraints(nullptr), m_linearVelocities(nullptr), m_angularVelocities(nullptr), m_mapBodyToConstrainedVelocityIndex(mapBodyToVelocityIndex), @@ -534,7 +534,7 @@ void ContactSolver::solve() { deltaLambda = - (Jv + b) * contactPoint.inversePenetrationMass; } lambdaTemp = contactPoint.penetrationImpulse; - contactPoint.penetrationImpulse = std::max(contactPoint.penetrationImpulse + + contactPoint.penetrationImpulse = etk::max(contactPoint.penetrationImpulse + deltaLambda, 0.0f); deltaLambda = contactPoint.penetrationImpulse - lambdaTemp; @@ -561,7 +561,7 @@ void ContactSolver::solve() { float deltaLambdaSplit = - (JvSplit + biasPenetrationDepth) * contactPoint.inversePenetrationMass; float lambdaTempSplit = contactPoint.penetrationSplitImpulse; - contactPoint.penetrationSplitImpulse = std::max( + contactPoint.penetrationSplitImpulse = etk::max( contactPoint.penetrationSplitImpulse + deltaLambdaSplit, 0.0f); deltaLambda = contactPoint.penetrationSplitImpulse - lambdaTempSplit; @@ -588,8 +588,8 @@ void ContactSolver::solve() { float frictionLimit = contactManifold.frictionCoefficient * contactPoint.penetrationImpulse; lambdaTemp = contactPoint.friction1Impulse; - contactPoint.friction1Impulse = std::max(-frictionLimit, - std::min(contactPoint.friction1Impulse + contactPoint.friction1Impulse = etk::max(-frictionLimit, + etk::min(contactPoint.friction1Impulse + deltaLambda, frictionLimit)); deltaLambda = contactPoint.friction1Impulse - lambdaTemp; @@ -612,8 +612,8 @@ void ContactSolver::solve() { frictionLimit = contactManifold.frictionCoefficient * contactPoint.penetrationImpulse; lambdaTemp = contactPoint.friction2Impulse; - contactPoint.friction2Impulse = std::max(-frictionLimit, - std::min(contactPoint.friction2Impulse + contactPoint.friction2Impulse = etk::max(-frictionLimit, + etk::min(contactPoint.friction2Impulse + deltaLambda, frictionLimit)); deltaLambda = contactPoint.friction2Impulse - lambdaTemp; @@ -663,8 +663,8 @@ void ContactSolver::solve() { float deltaLambda = -Jv * contactManifold.inverseFriction1Mass; float frictionLimit = contactManifold.frictionCoefficient * sum_penetrationImpulse; lambdaTemp = contactManifold.friction1Impulse; - contactManifold.friction1Impulse = std::max(-frictionLimit, - std::min(contactManifold.friction1Impulse + + contactManifold.friction1Impulse = etk::max(-frictionLimit, + etk::min(contactManifold.friction1Impulse + deltaLambda, frictionLimit)); deltaLambda = contactManifold.friction1Impulse - lambdaTemp; @@ -690,8 +690,8 @@ void ContactSolver::solve() { deltaLambda = -Jv * contactManifold.inverseFriction2Mass; frictionLimit = contactManifold.frictionCoefficient * sum_penetrationImpulse; lambdaTemp = contactManifold.friction2Impulse; - contactManifold.friction2Impulse = std::max(-frictionLimit, - std::min(contactManifold.friction2Impulse + + contactManifold.friction2Impulse = etk::max(-frictionLimit, + etk::min(contactManifold.friction2Impulse + deltaLambda, frictionLimit)); deltaLambda = contactManifold.friction2Impulse - lambdaTemp; @@ -715,8 +715,8 @@ void ContactSolver::solve() { deltaLambda = -Jv * (contactManifold.inverseTwistFrictionMass); frictionLimit = contactManifold.frictionCoefficient * sum_penetrationImpulse; lambdaTemp = contactManifold.frictionTwistImpulse; - contactManifold.frictionTwistImpulse = std::max(-frictionLimit, - std::min(contactManifold.frictionTwistImpulse + contactManifold.frictionTwistImpulse = etk::max(-frictionLimit, + etk::min(contactManifold.frictionTwistImpulse + deltaLambda, frictionLimit)); deltaLambda = contactManifold.frictionTwistImpulse - lambdaTemp; diff --git a/ephysics/engine/ContactSolver.hpp b/ephysics/engine/ContactSolver.hpp index b0715c0..d785db8 100644 --- a/ephysics/engine/ContactSolver.hpp +++ b/ephysics/engine/ContactSolver.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include namespace ephysics { @@ -168,7 +168,7 @@ namespace ephysics { uint32_t m_numberContactManifolds; //!< Number of contact constraints vec3* m_linearVelocities; //!< Array of linear velocities vec3* m_angularVelocities; //!< Array of angular velocities - const std::map& m_mapBodyToConstrainedVelocityIndex; //!< Reference to the map of rigid body to their index in the constrained velocities array + const etk::Map& m_mapBodyToConstrainedVelocityIndex; //!< Reference to the map of rigid body to their index in the constrained velocities array bool m_isWarmStartingActive; //!< True if the warm starting of the solver is active bool m_isSplitImpulseActive; //!< True if the split impulse position correction is active bool m_isSolveFrictionAtContactManifoldCenterActive; //!< True if we solve 3 friction constraints at the contact manifold center only instead of 2 friction constraints at each contact point @@ -208,7 +208,7 @@ namespace ephysics { const ContactPointSolver& contactPoint) const; public: /// Constructor - ContactSolver(const std::map& mapBodyToVelocityIndex); + ContactSolver(const etk::Map& mapBodyToVelocityIndex); /// Destructor virtual ~ContactSolver(); /// Initialize the constraint solver for a given island diff --git a/ephysics/engine/DynamicsWorld.cpp b/ephysics/engine/DynamicsWorld.cpp index ff749e1..3a78683 100644 --- a/ephysics/engine/DynamicsWorld.cpp +++ b/ephysics/engine/DynamicsWorld.cpp @@ -267,7 +267,7 @@ void DynamicsWorld::initVelocityArrays() { for (it = m_rigidBodies.begin(); it != m_rigidBodies.end(); ++it) { // Add the body int32_to the map - m_mapBodyToConstrainedVelocityIndex.insert(std::make_pair(*it, indexBody)); + m_mapBodyToConstrainedVelocityIndex.insert(etk::makePair(*it, indexBody)); indexBody++; } } @@ -457,7 +457,7 @@ void DynamicsWorld::destroyRigidBody(RigidBody* rigidBody) { rigidBody->removeAllCollisionShapes(); // Add the body ID to the list of free IDs - m_freeBodiesIDs.push_back(rigidBody->getID()); + m_freeBodiesIDs.pushBack(rigidBody->getID()); // Destroy all the joints in which the rigid body to be destroyed is involved JointListElement* element; @@ -960,12 +960,12 @@ void DynamicsWorld::testCollision(CollisionCallback* callback) { } /// Return the list of all contacts of the world -std::vector DynamicsWorld::getContactsList() const { +etk::Vector DynamicsWorld::getContactsList() const { - std::vector contactManifolds; + etk::Vector contactManifolds; // For each currently overlapping pair of bodies - std::map::const_iterator it; + etk::Map::const_iterator it; for (it = m_collisionDetection.m_overlappingPairs.begin(); it != m_collisionDetection.m_overlappingPairs.end(); ++it) { @@ -978,7 +978,7 @@ std::vector DynamicsWorld::getContactsList() const { ContactManifold* manifold = manifoldSet.getContactManifold(i); // Get the contact manifold - contactManifolds.push_back(manifold); + contactManifolds.pushBack(manifold); } } diff --git a/ephysics/engine/DynamicsWorld.hpp b/ephysics/engine/DynamicsWorld.hpp index f414de8..eba16e2 100644 --- a/ephysics/engine/DynamicsWorld.hpp +++ b/ephysics/engine/DynamicsWorld.hpp @@ -37,7 +37,7 @@ namespace ephysics { vec3* m_splitAngularVelocities; //!< Split angular velocities for the position contact solver (split impulse) vec3* m_constrainedPositions; //!< Array of constrained rigid bodies position (for position error correction) etk::Quaternion* m_constrainedOrientations; //!< Array of constrained rigid bodies orientation (for position error correction) - std::map m_mapBodyToConstrainedVelocityIndex; //!< Map body to their index in the constrained velocities array + etk::Map m_mapBodyToConstrainedVelocityIndex; //!< Map body to their index in the constrained velocities array uint32_t m_numberIslands; //!< Number of islands in the world uint32_t m_numberIslandsCapacity; //!< Current allocated capacity for the islands Island** m_islands; //!< Array with all the islands of awaken bodies @@ -155,7 +155,7 @@ namespace ephysics { /// Test and report collisions between all shapes of the world virtual void testCollision(CollisionCallback* _callback) override; /// Return the list of all contacts of the world - std::vector getContactsList() const; + etk::Vector getContactsList() const; friend class RigidBody; }; diff --git a/ephysics/engine/OverlappingPair.cpp b/ephysics/engine/OverlappingPair.cpp index 9ca4d12..9b2cff5 100644 --- a/ephysics/engine/OverlappingPair.cpp +++ b/ephysics/engine/OverlappingPair.cpp @@ -64,8 +64,8 @@ overlappingpairid OverlappingPair::computeID(ProxyShape* _shape1, ProxyShape* _s // Construct the pair of body index overlappingpairid pairID = _shape1->m_broadPhaseID < _shape2->m_broadPhaseID ? - std::make_pair(_shape1->m_broadPhaseID, _shape2->m_broadPhaseID) : - std::make_pair(_shape2->m_broadPhaseID, _shape1->m_broadPhaseID); + etk::makePair(_shape1->m_broadPhaseID, _shape2->m_broadPhaseID) : + etk::makePair(_shape2->m_broadPhaseID, _shape1->m_broadPhaseID); assert(pairID.first != pairID.second); return pairID; } @@ -76,8 +76,8 @@ bodyindexpair OverlappingPair::computeBodiesIndexPair(CollisionBody* _body1, // Construct the pair of body index bodyindexpair indexPair = _body1->getID() < _body2->getID() ? - std::make_pair(_body1->getID(), _body2->getID()) : - std::make_pair(_body2->getID(), _body1->getID()); + etk::makePair(_body1->getID(), _body2->getID()) : + etk::makePair(_body2->getID(), _body1->getID()); assert(indexPair.first != indexPair.second); return indexPair; } diff --git a/ephysics/engine/OverlappingPair.hpp b/ephysics/engine/OverlappingPair.hpp index 13c047d..4bcfad8 100644 --- a/ephysics/engine/OverlappingPair.hpp +++ b/ephysics/engine/OverlappingPair.hpp @@ -10,7 +10,7 @@ namespace ephysics { // Type for the overlapping pair ID - typedef std::pair overlappingpairid; + typedef etk::Pair overlappingpairid; /** * @brief This class represents a pair of two proxy collision shapes that are overlapping * during the broad-phase collision detection. It is created when diff --git a/ephysics/engine/Profiler.cpp b/ephysics/engine/Profiler.cpp index b111c2e..4f1495e 100644 --- a/ephysics/engine/Profiler.cpp +++ b/ephysics/engine/Profiler.cpp @@ -171,7 +171,7 @@ void Profiler::reset() { } // Print32_t the report of the profiler in a given output stream -void Profiler::print32_tReport(std::ostream& outputStream) { +void Profiler::print32_tReport(etk::Stream& outputStream) { ProfileNodeIterator* iterator = Profiler::getIterator(); // Recursively print32_t the report of each node of the profiler tree @@ -184,7 +184,7 @@ void Profiler::print32_tReport(std::ostream& outputStream) { // Recursively print32_t the report of a given node of the profiler tree void Profiler::print32_tRecursiveNodeReport(ProfileNodeIterator* iterator, int32_t spacing, - std::ostream& outputStream) { + etk::Stream& outputStream) { iterator->first(); // If we are at the end of a branch in the profiler tree diff --git a/ephysics/engine/Profiler.hpp b/ephysics/engine/Profiler.hpp index c22004f..63a8a3f 100644 --- a/ephysics/engine/Profiler.hpp +++ b/ephysics/engine/Profiler.hpp @@ -99,7 +99,7 @@ namespace ephysics { private: static void print32_tRecursiveNodeReport(ProfileNodeIterator* iterator, int32_t spacing, - std::ostream& outputStream); + etk::Stream& outputStream); public : /// Method called when we want to start profiling a block of code. static void startProfilingBlock(const char *name); @@ -117,7 +117,7 @@ namespace ephysics { /// Return an iterator over the profiler tree starting at the root static ProfileNodeIterator* getIterator(); /// Print32_t the report of the profiler in a given output stream - static void print32_tReport(std::ostream& outputStream); + static void print32_tReport(etk::Stream& outputStream); /// Destroy a previously allocated iterator static void destroyIterator(ProfileNodeIterator* iterator); /// Destroy the profiler (release the memory) diff --git a/ephysics/mathematics/mathematics.hpp b/ephysics/mathematics/mathematics.hpp index 0a4566b..25df364 100644 --- a/ephysics/mathematics/mathematics.hpp +++ b/ephysics/mathematics/mathematics.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ephysics/mathematics/mathematics_functions.hpp b/ephysics/mathematics/mathematics_functions.hpp index 8b98198..77891fe 100644 --- a/ephysics/mathematics/mathematics_functions.hpp +++ b/ephysics/mathematics/mathematics_functions.hpp @@ -28,24 +28,24 @@ inline bool approxEqual(float a, float b, float epsilon = MACHINE_EPSILON) { /// two others values "lowerLimit" and "upperLimit" inline int32_t clamp(int32_t value, int32_t lowerLimit, int32_t upperLimit) { assert(lowerLimit <= upperLimit); - return std::min(std::max(value, lowerLimit), upperLimit); + return etk::min(etk::max(value, lowerLimit), upperLimit); } /// Function that returns the result of the "value" clamped by /// two others values "lowerLimit" and "upperLimit" inline float clamp(float value, float lowerLimit, float upperLimit) { assert(lowerLimit <= upperLimit); - return std::min(std::max(value, lowerLimit), upperLimit); + return etk::min(etk::max(value, lowerLimit), upperLimit); } /// Return the minimum value among three values inline float min3(float a, float b, float c) { - return std::min(std::min(a, b), c); + return etk::min(etk::min(a, b), c); } /// Return the maximum value among three values inline float max3(float a, float b, float c) { - return std::max(std::max(a, b), c); + return etk::max(etk::max(a, b), c); } /// Return true if two values have the same sign diff --git a/test/Test.cpp b/test/Test.cpp index d6fd01c..6facae0 100644 --- a/test/Test.cpp +++ b/test/Test.cpp @@ -31,7 +31,7 @@ using namespace ephysics; /// Constructor -Test::Test(const std::string& name, std::ostream* stream) +Test::Test(const etk::String& name, etk::Stream* stream) : m_name(name), mNbPassedTests(0), mNbFailedTests(0), mOutputStream(stream) { } @@ -43,7 +43,7 @@ Test::~Test() { // Called to test a boolean condition. // This method should not be called directly in your test but you should call test() instead (macro) -void Test::applyTest(bool condition, const std::string& testText, +void Test::applyTest(bool condition, const etk::String& testText, const char* filename, long lineNumber) { // If the boolean condition is true @@ -61,7 +61,7 @@ void Test::applyTest(bool condition, const std::string& testText, // Called when a test has failed. // This method should not be called directly in your test buy you should call fail() instead (macro) -void Test::applyFail(const std::string& testText, const char* filename, long lineNumber) { +void Test::applyFail(const etk::String& testText, const char* filename, long lineNumber) { if (mOutputStream) { diff --git a/test/Test.hpp b/test/Test.hpp index aae8e81..9cdcd09 100644 --- a/test/Test.hpp +++ b/test/Test.hpp @@ -27,7 +27,7 @@ #define TEST_H // Libraries -#include +#include #include #include @@ -51,7 +51,7 @@ class Test { // ---------- Attributes ---------- // /// Name of the test - std::string m_name; + etk::String m_name; /// Number of tests that passed long mNbPassedTests; @@ -60,7 +60,7 @@ class Test { long mNbFailedTests; /// Output stream - std::ostream* mOutputStream; + etk::Stream* mOutputStream; // ---------- Methods ---------- // @@ -77,20 +77,20 @@ class Test { /// Called to test a boolean condition. /// This method should not be called directly in your test but you should /// call test() instead (macro) - void applyTest(bool condition, const std::string& testText, + void applyTest(bool condition, const etk::String& testText, const char* filename, long lineNumber); /// Called when a test has failed. /// This method should not be called directly in your test buy you should /// call fail() instead (macro) - void applyFail(const std::string& testText, const char* filename, long lineNumber); + void applyFail(const etk::String& testText, const char* filename, long lineNumber); public : // ---------- Methods ---------- // /// Constructor - Test(const std::string& name, std::ostream* stream = &std::cout); + Test(const etk::String& name, etk::Stream* stream = &std::cout); /// Destructor virtual ~Test(); @@ -102,10 +102,10 @@ class Test { long getNbFailedTests() const; /// Return the output stream - const std::ostream* getOutputStream() const; + const etk::Stream* getOutputStream() const; /// Set the output stream - void setOutputStream(std::ostream *stream); + void setOutputStream(etk::Stream *stream); /// Run the unit test virtual void run() = 0; @@ -142,12 +142,12 @@ inline long Test::getNbFailedTests() const { } // Return the output stream -inline const std::ostream* Test::getOutputStream() const { +inline const etk::Stream* Test::getOutputStream() const { return mOutputStream; } // Set the output stream -inline void Test::setOutputStream(std::ostream* stream) { +inline void Test::setOutputStream(etk::Stream* stream) { mOutputStream = stream; } diff --git a/test/TestSuite.cpp b/test/TestSuite.cpp index 181169e..962c059 100644 --- a/test/TestSuite.cpp +++ b/test/TestSuite.cpp @@ -29,7 +29,7 @@ using namespace ephysics; // Constructor -TestSuite::TestSuite(const std::string& name, std::ostream* outputStream) +TestSuite::TestSuite(const etk::String& name, etk::Stream* outputStream) : m_name(name), mOutputStream(outputStream) { } @@ -69,7 +69,7 @@ void TestSuite::addTest(Test* test) { } // Add the test to the suite - mTests.push_back(test); + mTests.pushBack(test); // Reset the added test test->reset(); diff --git a/test/TestSuite.hpp b/test/TestSuite.hpp index 621f1f5..25dcf98 100644 --- a/test/TestSuite.hpp +++ b/test/TestSuite.hpp @@ -28,7 +28,7 @@ // Libraries #include -#include +#include #include /// Reactphysics3D namespace @@ -48,13 +48,13 @@ class TestSuite { // ---------- Attributes ---------- // /// Name of the test suite - std::string m_name; + etk::String m_name; /// Output stream - std::ostream* mOutputStream; + etk::Stream* mOutputStream; /// All the tests of the test suite - std::vector mTests; + etk::Vector mTests; // ---------- Methods ---------- // @@ -72,10 +72,10 @@ class TestSuite { // ---------- Methods ---------- // /// Constructor - TestSuite(const std::string& name, std::ostream* outputStream = &std::cout); + TestSuite(const etk::String& name, etk::Stream* outputStream = &std::cout); /// Return the name of the test suite - std::string getName() const; + etk::String getName() const; /// Return the number of passed tests long getNbPassedTests() const; @@ -84,10 +84,10 @@ class TestSuite { long getNbFailedTests() const; /// Return the output stream - const std::ostream* getOutputStream() const; + const etk::Stream* getOutputStream() const; /// Set the output stream - void setOutputStream(std::ostream* outputStream); + void setOutputStream(etk::Stream* outputStream); /// Add a unit test in the test suite void addTest(Test* test); @@ -107,17 +107,17 @@ class TestSuite { }; // Return the name of the test suite -inline std::string TestSuite::getName() const { +inline etk::String TestSuite::getName() const { return m_name; } // Return the output stream -inline const std::ostream* TestSuite::getOutputStream() const { +inline const etk::Stream* TestSuite::getOutputStream() const { return mOutputStream; } // Set the output stream -inline void TestSuite::setOutputStream(std::ostream* outputStream) { +inline void TestSuite::setOutputStream(etk::Stream* outputStream) { mOutputStream = outputStream; } diff --git a/test/tests/collision/TestAABB.hpp b/test/tests/collision/TestAABB.hpp index 3b17472..f424d99 100644 --- a/test/tests/collision/TestAABB.hpp +++ b/test/tests/collision/TestAABB.hpp @@ -53,7 +53,7 @@ class TestAABB : public Test { // ---------- Methods ---------- // /// Constructor - TestAABB(const std::string& name) : Test(name) { + TestAABB(const etk::String& name) : Test(name) { m_AABB1.setMin(vec3(-10, -10, -10)); m_AABB1.setMax(vec3(10, 10, 10)); diff --git a/test/tests/collision/TestCollisionWorld.hpp b/test/tests/collision/TestCollisionWorld.hpp index 61c0d40..05c2452 100644 --- a/test/tests/collision/TestCollisionWorld.hpp +++ b/test/tests/collision/TestCollisionWorld.hpp @@ -133,7 +133,7 @@ class TestCollisionWorld : public Test { // ---------- Methods ---------- // /// Constructor - TestCollisionWorld(const std::string& name) : Test(name) { + TestCollisionWorld(const etk::String& name) : Test(name) { // Create the world m_world = new CollisionWorld(); diff --git a/test/tests/collision/TestDynamicAABBTree.hpp b/test/tests/collision/TestDynamicAABBTree.hpp index 3dce95b..26d54b1 100644 --- a/test/tests/collision/TestDynamicAABBTree.hpp +++ b/test/tests/collision/TestDynamicAABBTree.hpp @@ -29,7 +29,7 @@ // Libraries #include #include -#include +#include /// Reactphysics3D namespace namespace ephysics { @@ -38,12 +38,12 @@ class OverlapCallback : public DynamicAABBTreeOverlapCallback { public : - std::vector mOverlapNodes; + etk::Vector mOverlapNodes; // Called when a overlapping node has been found during the call to // DynamicAABBTree:reportAllShapesOverlappingWithAABB() virtual void notifyOverlappingNode(int32_t nodeId) { - mOverlapNodes.push_back(nodeId); + mOverlapNodes.pushBack(nodeId); } void reset() { @@ -59,11 +59,11 @@ class DynamicTreeRaycastCallback : public DynamicAABBTreeRaycastCallback { public: - std::vector mHitNodes; + etk::Vector mHitNodes; // Called when the AABB of a leaf node is hit by a ray virtual float raycastBroadPhaseShape(int32_t nodeId, const Ray& ray) { - mHitNodes.push_back(nodeId); + mHitNodes.pushBack(nodeId); return 1.0; } @@ -96,7 +96,7 @@ class TestDynamicAABBTree : public Test { // ---------- Methods ---------- // /// Constructor - TestDynamicAABBTree(const std::string& name): Test(name) { + TestDynamicAABBTree(const etk::String& name): Test(name) { } diff --git a/test/tests/collision/TestPointInside.hpp b/test/tests/collision/TestPointInside.hpp index 4712701..679ce2b 100644 --- a/test/tests/collision/TestPointInside.hpp +++ b/test/tests/collision/TestPointInside.hpp @@ -90,7 +90,7 @@ class TestPointInside : public Test { // ---------- Methods ---------- // /// Constructor - TestPointInside(const std::string& name) : Test(name) { + TestPointInside(const etk::String& name) : Test(name) { // Create the world m_world = new CollisionWorld(); diff --git a/test/tests/collision/TestRaycast.hpp b/test/tests/collision/TestRaycast.hpp index b3a9147..ae90244 100644 --- a/test/tests/collision/TestRaycast.hpp +++ b/test/tests/collision/TestRaycast.hpp @@ -155,8 +155,8 @@ class TestRaycast : public Test { // Triangle meshes TriangleMesh mConcaveTriangleMesh; - std::vector mConcaveMeshVertices; - std::vector mConcaveMeshIndices; + etk::Vector mConcaveMeshVertices; + etk::Vector mConcaveMeshIndices; TriangleVertexArray* mConcaveMeshVertexArray; float m_heightFieldData[100]; @@ -165,7 +165,7 @@ class TestRaycast : public Test { // ---------- Methods ---------- // /// Constructor - TestRaycast(const std::string& name) : Test(name) { + TestRaycast(const etk::String& name) : Test(name) { epsilon = float(0.0001); @@ -267,27 +267,27 @@ class TestRaycast : public Test { mCompoundSphereProxyShape = mCompoundBody->addCollisionShape(mSphereShape, shapeTransform2); // Concave Mesh shape - mConcaveMeshVertices.push_back(vec3(-2, -3, -4)); - mConcaveMeshVertices.push_back(vec3(2, -3, -4)); - mConcaveMeshVertices.push_back(vec3(2, -3, 4)); - mConcaveMeshVertices.push_back(vec3(-2, -3, 4)); - mConcaveMeshVertices.push_back(vec3(-2, 3, -4)); - mConcaveMeshVertices.push_back(vec3(2, 3, -4)); - mConcaveMeshVertices.push_back(vec3(2, 3, 4)); - mConcaveMeshVertices.push_back(vec3(-2, 3, 4)); + mConcaveMeshVertices.pushBack(vec3(-2, -3, -4)); + mConcaveMeshVertices.pushBack(vec3(2, -3, -4)); + mConcaveMeshVertices.pushBack(vec3(2, -3, 4)); + mConcaveMeshVertices.pushBack(vec3(-2, -3, 4)); + mConcaveMeshVertices.pushBack(vec3(-2, 3, -4)); + mConcaveMeshVertices.pushBack(vec3(2, 3, -4)); + mConcaveMeshVertices.pushBack(vec3(2, 3, 4)); + mConcaveMeshVertices.pushBack(vec3(-2, 3, 4)); - mConcaveMeshIndices.push_back(0); mConcaveMeshIndices.push_back(1); mConcaveMeshIndices.push_back(2); - mConcaveMeshIndices.push_back(0); mConcaveMeshIndices.push_back(2); mConcaveMeshIndices.push_back(3); - mConcaveMeshIndices.push_back(1); mConcaveMeshIndices.push_back(5); mConcaveMeshIndices.push_back(2); - mConcaveMeshIndices.push_back(2); mConcaveMeshIndices.push_back(5); mConcaveMeshIndices.push_back(6); - mConcaveMeshIndices.push_back(2); mConcaveMeshIndices.push_back(7); mConcaveMeshIndices.push_back(3); - mConcaveMeshIndices.push_back(2); mConcaveMeshIndices.push_back(6); mConcaveMeshIndices.push_back(7); - mConcaveMeshIndices.push_back(0); mConcaveMeshIndices.push_back(3); mConcaveMeshIndices.push_back(4); - mConcaveMeshIndices.push_back(3); mConcaveMeshIndices.push_back(7); mConcaveMeshIndices.push_back(4); - mConcaveMeshIndices.push_back(0); mConcaveMeshIndices.push_back(4); mConcaveMeshIndices.push_back(1); - mConcaveMeshIndices.push_back(1); mConcaveMeshIndices.push_back(4); mConcaveMeshIndices.push_back(5); - mConcaveMeshIndices.push_back(5); mConcaveMeshIndices.push_back(7); mConcaveMeshIndices.push_back(6); - mConcaveMeshIndices.push_back(4); mConcaveMeshIndices.push_back(7); mConcaveMeshIndices.push_back(5); + mConcaveMeshIndices.pushBack(0); mConcaveMeshIndices.pushBack(1); mConcaveMeshIndices.push_back(2); + mConcaveMeshIndices.pushBack(0); mConcaveMeshIndices.pushBack(2); mConcaveMeshIndices.push_back(3); + mConcaveMeshIndices.pushBack(1); mConcaveMeshIndices.pushBack(5); mConcaveMeshIndices.push_back(2); + mConcaveMeshIndices.pushBack(2); mConcaveMeshIndices.pushBack(5); mConcaveMeshIndices.push_back(6); + mConcaveMeshIndices.pushBack(2); mConcaveMeshIndices.pushBack(7); mConcaveMeshIndices.push_back(3); + mConcaveMeshIndices.pushBack(2); mConcaveMeshIndices.pushBack(6); mConcaveMeshIndices.push_back(7); + mConcaveMeshIndices.pushBack(0); mConcaveMeshIndices.pushBack(3); mConcaveMeshIndices.push_back(4); + mConcaveMeshIndices.pushBack(3); mConcaveMeshIndices.pushBack(7); mConcaveMeshIndices.push_back(4); + mConcaveMeshIndices.pushBack(0); mConcaveMeshIndices.pushBack(4); mConcaveMeshIndices.push_back(1); + mConcaveMeshIndices.pushBack(1); mConcaveMeshIndices.pushBack(4); mConcaveMeshIndices.push_back(5); + mConcaveMeshIndices.pushBack(5); mConcaveMeshIndices.pushBack(7); mConcaveMeshIndices.push_back(6); + mConcaveMeshIndices.pushBack(4); mConcaveMeshIndices.pushBack(7); mConcaveMeshIndices.push_back(5); TriangleVertexArray::VertexDataType vertexType = sizeof(float) == 4 ? TriangleVertexArray::VERTEX_FLOAT_TYPE : TriangleVertexArray::VERTEX_DOUBLE_TYPE; mConcaveMeshVertexArray = diff --git a/test/tests/mathematics/TestMathematicsFunctions.hpp b/test/tests/mathematics/TestMathematicsFunctions.hpp index 8faf17a..e133655 100644 --- a/test/tests/mathematics/TestMathematicsFunctions.hpp +++ b/test/tests/mathematics/TestMathematicsFunctions.hpp @@ -50,7 +50,7 @@ class TestMathematicsFunctions : public Test { // ---------- Methods ---------- // /// Constructor - TestMathematicsFunctions(const std::string& name): Test(name) {} + TestMathematicsFunctions(const etk::String& name): Test(name) {} /// Run the tests void run() { diff --git a/test/tests/mathematics/TestMatrix2x2.h b/test/tests/mathematics/TestMatrix2x2.h index 26febd7..893ad60 100644 --- a/test/tests/mathematics/TestMatrix2x2.h +++ b/test/tests/mathematics/TestMatrix2x2.h @@ -54,7 +54,7 @@ class Testetk::Matrix2x2 : public Test { // ---------- Methods ---------- // /// Constructor - Testetk::Matrix2x2(const std::string& name) + Testetk::Matrix2x2(const etk::String& name) : Test(name), mIdentity(etk::Matrix2x2::identity()), mMatrix1(2, 24, -4, 5) { } diff --git a/test/tests/mathematics/TestMatrix3x3.h b/test/tests/mathematics/TestMatrix3x3.h index 3000e2b..5c8541e 100644 --- a/test/tests/mathematics/TestMatrix3x3.h +++ b/test/tests/mathematics/TestMatrix3x3.h @@ -54,7 +54,7 @@ class Testetk::Matrix3x3 : public Test { // ---------- Methods ---------- // /// Constructor - Testetk::Matrix3x3(const std::string& name) + Testetk::Matrix3x3(const etk::String& name) : Test(name), mIdentity(etk::Matrix3x3::identity()), mMatrix1(2, 24, 4, 5, -6, 234, -15, 11, 66) { diff --git a/test/tests/mathematics/TestQuaternion.h b/test/tests/mathematics/TestQuaternion.h index a0b029d..365f50c 100644 --- a/test/tests/mathematics/TestQuaternion.h +++ b/test/tests/mathematics/TestQuaternion.h @@ -54,7 +54,7 @@ class Testetk::Quaternion : public Test { // ---------- Methods ---------- // /// Constructor - Testetk::Quaternion(const std::string& name) : Test(name), mIdentity(Quaternion::identity()) { + Testetk::Quaternion(const etk::String& name) : Test(name), mIdentity(Quaternion::identity()) { float sinA = sin(float(PI/8.0)); float cosA = cos(float(PI/8.0)); diff --git a/test/tests/mathematics/TestTransform.h b/test/tests/mathematics/TestTransform.h index ba0fd6f..f07a426 100644 --- a/test/tests/mathematics/TestTransform.h +++ b/test/tests/mathematics/TestTransform.h @@ -57,7 +57,7 @@ class Testetk::Transform3D : public Test { // ---------- Methods ---------- // /// Constructor - Testetk::Transform3D(const std::string& name) : Test(name) { + Testetk::Transform3D(const etk::String& name) : Test(name) { mIdentityetk::Transform3D.setToIdentity(); diff --git a/test/tests/mathematics/TestVector2.h b/test/tests/mathematics/TestVector2.h index 4109725..659af6a 100644 --- a/test/tests/mathematics/TestVector2.h +++ b/test/tests/mathematics/TestVector2.h @@ -54,7 +54,7 @@ class Testvec2 : public Test { // ---------- Methods ---------- // /// Constructor - Testvec2(const std::string& name) : Test(name), mVectorZero(0, 0), mvec34(3, 4) {} + Testvec2(const etk::String& name) : Test(name), mVectorZero(0, 0), mvec34(3, 4) {} /// Run the tests void run() { diff --git a/test/tests/mathematics/TestVector3.h b/test/tests/mathematics/TestVector3.h index 589854e..48ba465 100644 --- a/test/tests/mathematics/TestVector3.h +++ b/test/tests/mathematics/TestVector3.h @@ -54,7 +54,7 @@ class Testvec3 : public Test { // ---------- Methods ---------- // /// Constructor - Testvec3(const std::string& name): Test(name),mVectorZero(0, 0, 0),mvec345(3, 4, 5) {} + Testvec3(const etk::String& name): Test(name),mVectorZero(0, 0, 0),mvec345(3, 4, 5) {} /// Run the tests void run() { diff --git a/tools/testbed/common/Capsule.cpp b/tools/testbed/common/Capsule.cpp index 3d41b18..a556c48 100644 --- a/tools/testbed/common/Capsule.cpp +++ b/tools/testbed/common/Capsule.cpp @@ -36,7 +36,7 @@ int32_t Capsule::totalNbCapsules = 0; // Constructor Capsule::Capsule(float radius, float height, const openglframework::vec3& position, ephysics::CollisionWorld* world, - const std::string& meshFolderPath) + const etk::String& meshFolderPath) : openglframework::Mesh(), mRadius(radius), mHeight(height) { // Load the mesh from a file @@ -85,7 +85,7 @@ Capsule::Capsule(float radius, float height, const openglframework::vec3& positi // Constructor Capsule::Capsule(float radius, float height, const openglframework::vec3& position, float mass, ephysics::DynamicsWorld* dynamicsWorld, - const std::string& meshFolderPath) + const etk::String& meshFolderPath) : openglframework::Mesh(), mRadius(radius), mHeight(height) { // Load the mesh from a file diff --git a/tools/testbed/common/Capsule.h b/tools/testbed/common/Capsule.h index 65a66d2..b241e99 100644 --- a/tools/testbed/common/Capsule.h +++ b/tools/testbed/common/Capsule.h @@ -83,12 +83,12 @@ class Capsule : public openglframework::Mesh, public PhysicsObject { /// Constructor Capsule(float radius, float height, const openglframework::vec3& position, - ephysics::CollisionWorld* world, const std::string& meshFolderPath); + ephysics::CollisionWorld* world, const etk::String& meshFolderPath); /// Constructor Capsule(float radius, float height, const openglframework::vec3& position, float mass, ephysics::DynamicsWorld* dynamicsWorld, - const std::string& meshFolderPath); + const etk::String& meshFolderPath); /// Destructor ~Capsule(); diff --git a/tools/testbed/common/ConcaveMesh.cpp b/tools/testbed/common/ConcaveMesh.cpp index 7e7b172..4bb04fd 100644 --- a/tools/testbed/common/ConcaveMesh.cpp +++ b/tools/testbed/common/ConcaveMesh.cpp @@ -29,7 +29,7 @@ // Constructor ConcaveMesh::ConcaveMesh(const openglframework::vec3 &position, ephysics::CollisionWorld* world, - const std::string& meshPath) + const etk::String& meshPath) : openglframework::Mesh(), mVBOVertices(GL_ARRAY_BUFFER), mVBONormals(GL_ARRAY_BUFFER), mVBOTextureCoords(GL_ARRAY_BUFFER), mVBOIndices(GL_ELEMENT_ARRAY_BUFFER) { @@ -86,7 +86,7 @@ ConcaveMesh::ConcaveMesh(const openglframework::vec3 &position, // Constructor ConcaveMesh::ConcaveMesh(const openglframework::vec3 &position, float mass, ephysics::DynamicsWorld* dynamicsWorld, - const std::string& meshPath) + const etk::String& meshPath) : openglframework::Mesh(), mVBOVertices(GL_ARRAY_BUFFER), mVBONormals(GL_ARRAY_BUFFER), mVBOTextureCoords(GL_ARRAY_BUFFER), mVBOIndices(GL_ELEMENT_ARRAY_BUFFER) { diff --git a/tools/testbed/common/ConcaveMesh.h b/tools/testbed/common/ConcaveMesh.h index efd397e..83835be 100644 --- a/tools/testbed/common/ConcaveMesh.h +++ b/tools/testbed/common/ConcaveMesh.h @@ -77,11 +77,11 @@ class ConcaveMesh : public openglframework::Mesh, public PhysicsObject { /// Constructor ConcaveMesh(const openglframework::vec3& position, - ephysics::CollisionWorld* world, const std::string& meshPath); + ephysics::CollisionWorld* world, const etk::String& meshPath); /// Constructor ConcaveMesh(const openglframework::vec3& position, float mass, - ephysics::DynamicsWorld* dynamicsWorld, const std::string& meshPath); + ephysics::DynamicsWorld* dynamicsWorld, const etk::String& meshPath); /// Destructor ~ConcaveMesh(); diff --git a/tools/testbed/common/Cone.cpp b/tools/testbed/common/Cone.cpp index 74d5283..b5d26b4 100644 --- a/tools/testbed/common/Cone.cpp +++ b/tools/testbed/common/Cone.cpp @@ -36,7 +36,7 @@ int32_t Cone::totalNbCones = 0; // Constructor Cone::Cone(float radius, float height, const openglframework::vec3 &position, ephysics::CollisionWorld* world, - const std::string& meshFolderPath) + const etk::String& meshFolderPath) : openglframework::Mesh(), mRadius(radius), mHeight(height) { // Load the mesh from a file @@ -84,7 +84,7 @@ Cone::Cone(float radius, float height, const openglframework::vec3 &position, // Constructor Cone::Cone(float radius, float height, const openglframework::vec3 &position, float mass, ephysics::DynamicsWorld* dynamicsWorld, - const std::string& meshFolderPath) + const etk::String& meshFolderPath) : openglframework::Mesh(), mRadius(radius), mHeight(height) { // Load the mesh from a file diff --git a/tools/testbed/common/Cone.h b/tools/testbed/common/Cone.h index 98e4b65..38055c5 100644 --- a/tools/testbed/common/Cone.h +++ b/tools/testbed/common/Cone.h @@ -83,11 +83,11 @@ class Cone : public openglframework::Mesh, public PhysicsObject { /// Constructor Cone(float radius, float height, const openglframework::vec3& position, - ephysics::CollisionWorld* world, const std::string& meshFolderPath); + ephysics::CollisionWorld* world, const etk::String& meshFolderPath); /// Constructor Cone(float radius, float height, const openglframework::vec3& position, - float mass, ephysics::DynamicsWorld* dynamicsWorld, const std::string& meshFolderPath); + float mass, ephysics::DynamicsWorld* dynamicsWorld, const etk::String& meshFolderPath); /// Destructor ~Cone(); diff --git a/tools/testbed/common/ConvexMesh.cpp b/tools/testbed/common/ConvexMesh.cpp index 805ae75..9e775e8 100644 --- a/tools/testbed/common/ConvexMesh.cpp +++ b/tools/testbed/common/ConvexMesh.cpp @@ -29,7 +29,7 @@ // Constructor ConvexMesh::ConvexMesh(const openglframework::vec3 &position, ephysics::CollisionWorld* world, - const std::string& meshPath) + const etk::String& meshPath) : openglframework::Mesh(), mVBOVertices(GL_ARRAY_BUFFER), mVBONormals(GL_ARRAY_BUFFER), mVBOTextureCoords(GL_ARRAY_BUFFER), mVBOIndices(GL_ELEMENT_ARRAY_BUFFER) { @@ -80,7 +80,7 @@ ConvexMesh::ConvexMesh(const openglframework::vec3 &position, // Constructor ConvexMesh::ConvexMesh(const openglframework::vec3 &position, float mass, ephysics::DynamicsWorld* dynamicsWorld, - const std::string& meshPath) + const etk::String& meshPath) : openglframework::Mesh(), mVBOVertices(GL_ARRAY_BUFFER), mVBONormals(GL_ARRAY_BUFFER), mVBOTextureCoords(GL_ARRAY_BUFFER), mVBOIndices(GL_ELEMENT_ARRAY_BUFFER) { diff --git a/tools/testbed/common/ConvexMesh.h b/tools/testbed/common/ConvexMesh.h index 4e20b60..295ea07 100644 --- a/tools/testbed/common/ConvexMesh.h +++ b/tools/testbed/common/ConvexMesh.h @@ -76,11 +76,11 @@ class ConvexMesh : public openglframework::Mesh, public PhysicsObject { /// Constructor ConvexMesh(const openglframework::vec3& position, - ephysics::CollisionWorld* world, const std::string& meshPath); + ephysics::CollisionWorld* world, const etk::String& meshPath); /// Constructor ConvexMesh(const openglframework::vec3& position, float mass, - ephysics::DynamicsWorld* dynamicsWorld, const std::string& meshPath); + ephysics::DynamicsWorld* dynamicsWorld, const etk::String& meshPath); /// Destructor ~ConvexMesh(); diff --git a/tools/testbed/common/Cylinder.cpp b/tools/testbed/common/Cylinder.cpp index 4ef72a7..dd13eae 100644 --- a/tools/testbed/common/Cylinder.cpp +++ b/tools/testbed/common/Cylinder.cpp @@ -36,7 +36,7 @@ int32_t Cylinder::totalNbCylinders = 0; // Constructor Cylinder::Cylinder(float radius, float height, const openglframework::vec3& position, ephysics::CollisionWorld* world, - const std::string& meshFolderPath) + const etk::String& meshFolderPath) : openglframework::Mesh(), mRadius(radius), mHeight(height) { // Load the mesh from a file @@ -84,7 +84,7 @@ Cylinder::Cylinder(float radius, float height, const openglframework::vec3& posi // Constructor Cylinder::Cylinder(float radius, float height, const openglframework::vec3& position, float mass, ephysics::DynamicsWorld* dynamicsWorld, - const std::string& meshFolderPath) + const etk::String& meshFolderPath) : openglframework::Mesh(), mRadius(radius), mHeight(height) { // Load the mesh from a file diff --git a/tools/testbed/common/Cylinder.h b/tools/testbed/common/Cylinder.h index 191ea00..4453505 100644 --- a/tools/testbed/common/Cylinder.h +++ b/tools/testbed/common/Cylinder.h @@ -83,11 +83,11 @@ class Cylinder : public openglframework::Mesh, public PhysicsObject { /// Constructor Cylinder(float radius, float height, const openglframework::vec3& position, - ephysics::CollisionWorld* world, const std::string &meshFolderPath); + ephysics::CollisionWorld* world, const etk::String &meshFolderPath); /// Constructor Cylinder(float radius, float height, const openglframework::vec3& position, - float mass, ephysics::DynamicsWorld* dynamicsWorld, const std::string &meshFolderPath); + float mass, ephysics::DynamicsWorld* dynamicsWorld, const etk::String &meshFolderPath); /// Destructor ~Cylinder(); diff --git a/tools/testbed/common/Dumbbell.cpp b/tools/testbed/common/Dumbbell.cpp index e21f3bb..87c4199 100644 --- a/tools/testbed/common/Dumbbell.cpp +++ b/tools/testbed/common/Dumbbell.cpp @@ -35,7 +35,7 @@ int32_t Dumbbell::totalNbDumbbells = 0; // Constructor Dumbbell::Dumbbell(const openglframework::vec3 &position, - ephysics::DynamicsWorld* dynamicsWorld, const std::string& meshFolderPath) + ephysics::DynamicsWorld* dynamicsWorld, const etk::String& meshFolderPath) : openglframework::Mesh() { // Load the mesh from a file @@ -106,7 +106,7 @@ Dumbbell::Dumbbell(const openglframework::vec3 &position, // Constructor Dumbbell::Dumbbell(const openglframework::vec3 &position, - ephysics::CollisionWorld* world, const std::string& meshFolderPath) + ephysics::CollisionWorld* world, const etk::String& meshFolderPath) : openglframework::Mesh() { // Load the mesh from a file diff --git a/tools/testbed/common/Dumbbell.h b/tools/testbed/common/Dumbbell.h index 4a15ff9..291ff93 100644 --- a/tools/testbed/common/Dumbbell.h +++ b/tools/testbed/common/Dumbbell.h @@ -83,11 +83,11 @@ class Dumbbell : public openglframework::Mesh, public PhysicsObject { /// Constructor Dumbbell(const openglframework::vec3& position, ephysics::DynamicsWorld* dynamicsWorld, - const std::string& meshFolderPath); + const etk::String& meshFolderPath); /// Constructor Dumbbell(const openglframework::vec3& position, ephysics::CollisionWorld* world, - const std::string& meshFolderPath); + const etk::String& meshFolderPath); /// Destructor diff --git a/tools/testbed/common/HeightField.cpp b/tools/testbed/common/HeightField.cpp index 35fc953..3379275 100644 --- a/tools/testbed/common/HeightField.cpp +++ b/tools/testbed/common/HeightField.cpp @@ -224,7 +224,7 @@ void HeightField::generateHeightField() { // Generate the graphics mesh to render the height field void HeightField::generateGraphicsMesh() { - std::vector indices; + etk::Vector indices; int32_t vertexId = 0; for (int32_t i=0; i(getNbVertices(), vec3(0, 0, 0)); + mTangents = etk::Vector(getNbVertices(), vec3(0, 0, 0)); // For each face for (uint32_t i=0; i::const_iterator it(m_vertices.begin()); + etk::Vector::const_iterator it(m_vertices.begin()); // For each vertex of the mesh for (; it != m_vertices.end(); ++it) { diff --git a/tools/testbed/opengl-framework/src/Mesh.h b/tools/testbed/opengl-framework/src/Mesh.h index c62551c..da651a2 100644 --- a/tools/testbed/opengl-framework/src/Mesh.h +++ b/tools/testbed/opengl-framework/src/Mesh.h @@ -27,9 +27,9 @@ #define MESH_H // Libraries -#include -#include -#include +#include +#include +#include #include #include #include @@ -49,25 +49,25 @@ class Mesh : public Object3D { // -------------------- Attributes -------------------- // // A triplet of vertex indices for each triangle - std::vector > mIndices; + etk::Vector > mIndices; // Vertices coordinates (local space) - std::vector m_vertices; + etk::Vector m_vertices; // Normals coordinates - std::vector mNormals; + etk::Vector mNormals; // Tangents coordinates - std::vector mTangents; + etk::Vector mTangents; // Color for each vertex - std::vector mColors; + etk::Vector mColors; // UV texture coordinates - std::vector mUVs; + etk::Vector mUVs; // Textures of the mesh (one for each part of the mesh) - std::map mTextures; + etk::Map mTextures; public: @@ -104,28 +104,28 @@ class Mesh : public Object3D { uint32_t getNbParts() const; // Return a reference to the vertices - const std::vector& getVertices() const; + const etk::Vector& getVertices() const; // Set the vertices of the mesh - void setVertices(std::vector& vertices); + void setVertices(etk::Vector& vertices); // Return a reference to the normals - const std::vector& getNormals() const; + const etk::Vector& getNormals() const; // set the normals of the mesh - void setNormals(std::vector& normals); + void setNormals(etk::Vector& normals); // Return a reference to the UVs - const std::vector& getUVs() const; + const etk::Vector& getUVs() const; // Set the UV texture coordinates of the mesh - void setUVs(std::vector& uvs); + void setUVs(etk::Vector& uvs); // Return a reference to the vertex indices - const std::vector& getIndices(uint32_t part = 0) const; + const etk::Vector& getIndices(uint32_t part = 0) const; // Set the vertices indices of the mesh - void setIndices(std::vector >& indices); + void setIndices(etk::Vector >& indices); // Return the coordinates of a given vertex const vec3& getVertex(uint32_t i) const; @@ -218,42 +218,42 @@ inline uint32_t Mesh::getNbParts() const { } // Return a reference to the vertices -inline const std::vector& Mesh::getVertices() const { +inline const etk::Vector& Mesh::getVertices() const { return m_vertices; } // Set the vertices of the mesh -inline void Mesh::setVertices(std::vector& vertices) { +inline void Mesh::setVertices(etk::Vector& vertices) { m_vertices = vertices; } // Return a reference to the normals -inline const std::vector& Mesh::getNormals() const { +inline const etk::Vector& Mesh::getNormals() const { return mNormals; } // set the normals of the mesh -inline void Mesh::setNormals(std::vector& normals) { +inline void Mesh::setNormals(etk::Vector& normals) { mNormals = normals; } // Return a reference to the UVs -inline const std::vector& Mesh::getUVs() const { +inline const etk::Vector& Mesh::getUVs() const { return mUVs; } // Set the UV texture coordinates of the mesh -inline void Mesh::setUVs(std::vector& uvs) { +inline void Mesh::setUVs(etk::Vector& uvs) { mUVs = uvs; } // Return a reference to the vertex indices -inline const std::vector& Mesh::getIndices(uint32_t part) const { +inline const etk::Vector& Mesh::getIndices(uint32_t part) const { return mIndices[part]; } // Set the vertices indices of the mesh -inline void Mesh::setIndices(std::vector >& indices) { +inline void Mesh::setIndices(etk::Vector >& indices) { mIndices = indices; } @@ -295,7 +295,7 @@ inline void Mesh::setVertexColor(uint32_t i, const Color& color) { if (mColors.size() != m_vertices.size()) { // Create the color array with the same size - mColors = std::vector(m_vertices.size()); + mColors = etk::Vector(m_vertices.size()); } mColors[i] = color; @@ -309,7 +309,7 @@ inline void Mesh::setColorToAllVertices(const Color& color) { if (mColors.size() != m_vertices.size()) { // Create the color array with the same size - mColors = std::vector(m_vertices.size()); + mColors = etk::Vector(m_vertices.size()); } for (size_t v=0; v #include #include -#include +#include #include using namespace openglframework; @@ -41,7 +41,7 @@ MeshReaderWriter::MeshReaderWriter() { } // Load a mesh from a file and returns true if the mesh has been sucessfully loaded -void MeshReaderWriter::loadMeshFromFile(const std::string& filename, Mesh& meshToCreate) { +void MeshReaderWriter::loadMeshFromFile(const etk::String& filename, Mesh& meshToCreate) { // Get the extension of the file uint32_t startPosExtension = filename.find_last_of("."); @@ -62,7 +62,7 @@ void MeshReaderWriter::loadMeshFromFile(const std::string& filename, Mesh& meshT } // Write a mesh to a file -void MeshReaderWriter::writeMeshToFile(const std::string& filename, const Mesh& meshToWrite) { +void MeshReaderWriter::writeMeshToFile(const etk::String& filename, const Mesh& meshToWrite) { // Get the extension of the file uint32_t startPosExtension = filename.find_last_of("."); @@ -97,20 +97,20 @@ void MeshReaderWriter::loadOBJFile(const string &filename, Mesh& meshToCreate) { throw runtime_error(errorMessage); } - std::string buffer; + etk::String buffer; string line, tmp; int32_t id1, id2, id3, id4; int32_t nId1, nId2, nId3, nId4; int32_t tId1, tId2, tId3, tId4; float v1, v2, v3; size_t found1, found2; - std::vector isQuad; - std::vector vertices; - std::vector normals; - std::vector uvs; - std::vector verticesIndices; - std::vector normalsIndices; - std::vector uvsIndices; + etk::Vector isQuad; + etk::Vector vertices; + etk::Vector normals; + etk::Vector uvs; + etk::Vector verticesIndices; + etk::Vector normalsIndices; + etk::Vector uvsIndices; // ---------- Collect the data from the file ---------- // @@ -118,7 +118,7 @@ void MeshReaderWriter::loadOBJFile(const string &filename, Mesh& meshToCreate) { while(std::getline(meshFile, buffer)) { std::istringstream lineStream(buffer); - std::string word; + etk::String word; lineStream >> word; std::transform(word.begin(), word.end(), word.begin(), ::tolower); if(word == "usemtl") { // Material definition @@ -128,15 +128,15 @@ void MeshReaderWriter::loadOBJFile(const string &filename, Mesh& meshToCreate) { } else if(word == "v") { // Vertex position sscanf(buffer.c_str(), "%*s %f %f %f", &v1, &v2, &v3); - vertices.push_back(vec3(v1, v2, v3)); + vertices.pushBack(vec3(v1, v2, v3)); } else if(word == "vt") { // Vertex texture coordinate sscanf(buffer.c_str(), "%*s %f %f", &v1, &v2); - uvs.push_back(vec2(v1,v2)); + uvs.pushBack(vec2(v1,v2)); } else if(word == "vn") { // Vertex normal sscanf(buffer.c_str(), "%*s %f %f %f", &v1, &v2, &v3); - normals.push_back(vec3(v1 ,v2, v3)); + normals.pushBack(vec3(v1 ,v2, v3)); } else if (word == "f") { // Face line = buffer; @@ -166,10 +166,10 @@ void MeshReaderWriter::loadOBJFile(const string &filename, Mesh& meshToCreate) { if(found2 == string::npos) { int32_t n = sscanf(buffer.c_str(), "%*s %d/%d %d/%d %d/%d %d/%d", &id1, &tId1, &id2, &tId2, &id3, &tId3, &id4, &tId4); if (n == 8) isFaceQuad = true; - uvsIndices.push_back(tId1-1); - uvsIndices.push_back(tId2-1); - uvsIndices.push_back(tId3-1); - if (isFaceQuad) uvsIndices.push_back(tId4-1); + uvsIndices.pushBack(tId1-1); + uvsIndices.pushBack(tId2-1); + uvsIndices.pushBack(tId3-1); + if (isFaceQuad) uvsIndices.pushBack(tId4-1); } else { tmp = line.substr(found1+1); @@ -184,22 +184,22 @@ void MeshReaderWriter::loadOBJFile(const string &filename, Mesh& meshToCreate) { else { int32_t n = sscanf(buffer.c_str(), "%*s %d/%d/%d %d/%d/%d %d/%d/%d %d/%d/%d", &id1, &tId1, &nId1, &id2, &tId2, &nId2, &id3, &tId3, &nId3, &id4, &tId4, &nId4); if (n == 12) isFaceQuad = true; - uvsIndices.push_back(tId1-1); - uvsIndices.push_back(tId2-1); - uvsIndices.push_back(tId3-1); - if (isFaceQuad) uvsIndices.push_back(tId4-1); + uvsIndices.pushBack(tId1-1); + uvsIndices.pushBack(tId2-1); + uvsIndices.pushBack(tId3-1); + if (isFaceQuad) uvsIndices.pushBack(tId4-1); } - normalsIndices.push_back(nId1-1); - normalsIndices.push_back(nId2-1); - normalsIndices.push_back(nId3-1); - if (isFaceQuad) normalsIndices.push_back(nId4-1); + normalsIndices.pushBack(nId1-1); + normalsIndices.pushBack(nId2-1); + normalsIndices.pushBack(nId3-1); + if (isFaceQuad) normalsIndices.pushBack(nId4-1); } } - verticesIndices.push_back(id1-1); - verticesIndices.push_back(id2-1); - verticesIndices.push_back(id3-1); - if (isFaceQuad) verticesIndices.push_back((id4-1)); - isQuad.push_back(isFaceQuad); + verticesIndices.pushBack(id1-1); + verticesIndices.pushBack(id2-1); + verticesIndices.pushBack(id3-1); + if (isFaceQuad) verticesIndices.pushBack((id4-1)); + isQuad.pushBack(isFaceQuad); } } @@ -214,7 +214,7 @@ void MeshReaderWriter::loadOBJFile(const string &filename, Mesh& meshToCreate) { meshToCreate.destroy(); // Mesh data - vector > meshIndices; + vector > meshIndices; vector meshNormals; if (!normals.empty()) meshNormals = vector(vertices.size(), vec3(0, 0, 0)); vector meshUVs; @@ -225,7 +225,7 @@ void MeshReaderWriter::loadOBJFile(const string &filename, Mesh& meshToCreate) { // Fill in the vertex indices // We also triangulate each quad face - meshIndices.push_back(std::vector()); + meshIndices.pushBack(etk::Vector()); for(size_t i = 0, j = 0; i < verticesIndices.size(); j++) { // Get the current vertex IDs @@ -251,9 +251,9 @@ void MeshReaderWriter::loadOBJFile(const string &filename, Mesh& meshToCreate) { if (!isQuad[j]) { // Add the vertex indices - meshIndices[meshPart].push_back(i1); - meshIndices[meshPart].push_back(i2); - meshIndices[meshPart].push_back(i3); + meshIndices[meshPart].pushBack(i1); + meshIndices[meshPart].pushBack(i2); + meshIndices[meshPart].pushBack(i3); i+=3; } @@ -272,20 +272,20 @@ void MeshReaderWriter::loadOBJFile(const string &filename, Mesh& meshToCreate) { float a1 = v13.dot(v12); float a2 = v13.dot(v14); if((a1 >= 0 && a2 <= 0) || (a1 <= 0 && a2 >= 0)) { - meshIndices[meshPart].push_back(i1); - meshIndices[meshPart].push_back(i2); - meshIndices[meshPart].push_back(i3); - meshIndices[meshPart].push_back(i1); - meshIndices[meshPart].push_back(i3); - meshIndices[meshPart].push_back(i4); + meshIndices[meshPart].pushBack(i1); + meshIndices[meshPart].pushBack(i2); + meshIndices[meshPart].pushBack(i3); + meshIndices[meshPart].pushBack(i1); + meshIndices[meshPart].pushBack(i3); + meshIndices[meshPart].pushBack(i4); } else { - meshIndices[meshPart].push_back(i1); - meshIndices[meshPart].push_back(i2); - meshIndices[meshPart].push_back(i4); - meshIndices[meshPart].push_back(i2); - meshIndices[meshPart].push_back(i3); - meshIndices[meshPart].push_back(i4); + meshIndices[meshPart].pushBack(i1); + meshIndices[meshPart].pushBack(i2); + meshIndices[meshPart].pushBack(i4); + meshIndices[meshPart].pushBack(i2); + meshIndices[meshPart].pushBack(i3); + meshIndices[meshPart].pushBack(i4); } // Add the vertex normal @@ -313,13 +313,13 @@ void MeshReaderWriter::loadOBJFile(const string &filename, Mesh& meshToCreate) { } // Store a mesh int32_to a OBJ file -void MeshReaderWriter::writeOBJFile(const std::string& filename, const Mesh& meshToWrite) { +void MeshReaderWriter::writeOBJFile(const etk::String& filename, const Mesh& meshToWrite) { std::ofstream file(filename.c_str()); // Geth the mesh data - const std::vector& vertices = meshToWrite.getVertices(); - const std::vector& normals = meshToWrite.getNormals(); - const std::vector& uvs = meshToWrite.getUVs(); + const etk::Vector& vertices = meshToWrite.getVertices(); + const etk::Vector& normals = meshToWrite.getNormals(); + const etk::Vector& uvs = meshToWrite.getUVs(); // If we can open the file if (file.is_open()) { @@ -363,7 +363,7 @@ void MeshReaderWriter::writeOBJFile(const std::string& filename, const Mesh& mes for (uint32_t p=0; p& indices = meshToWrite.getIndices(p); + const etk::Vector& indices = meshToWrite.getIndices(p); // For each index of the part for (uint32_t i=0; i +#include #include #include @@ -47,20 +47,20 @@ class MeshReaderWriter { MeshReaderWriter(); // Load an OBJ file with a triangular or quad mesh - static void loadOBJFile(const std::string& filename, Mesh& meshToCreate); + static void loadOBJFile(const etk::String& filename, Mesh& meshToCreate); // Store a mesh int32_to a OBJ file - static void writeOBJFile(const std::string& filename, const Mesh &meshToWrite); + static void writeOBJFile(const etk::String& filename, const Mesh &meshToWrite); public : // -------------------- Methods -------------------- // // Read a mesh from a file - static void loadMeshFromFile(const std::string& filename, Mesh& meshToCreate); + static void loadMeshFromFile(const etk::String& filename, Mesh& meshToCreate); // Write a mesh to a file - static void writeMeshToFile(const std::string& filename, const Mesh& meshToWrite); + static void writeMeshToFile(const etk::String& filename, const Mesh& meshToWrite); }; // Class VertexMergingData diff --git a/tools/testbed/opengl-framework/src/Shader.cpp b/tools/testbed/opengl-framework/src/Shader.cpp index 82ee4a9..e8ade9c 100644 --- a/tools/testbed/opengl-framework/src/Shader.cpp +++ b/tools/testbed/opengl-framework/src/Shader.cpp @@ -39,7 +39,7 @@ Shader::Shader() : mProgramObjectID(0) { } // Constructor with arguments -Shader::Shader(const std::string vertexShaderFilename, const std::string fragmentShaderFilename) +Shader::Shader(const etk::String vertexShaderFilename, const etk::String fragmentShaderFilename) : mProgramObjectID(0) { // Create the shader @@ -52,8 +52,8 @@ Shader::~Shader() { } // Create the shader -bool Shader::create(const std::string vertexShaderFilename, - const std::string fragmentShaderFilename) { +bool Shader::create(const etk::String vertexShaderFilename, + const etk::String fragmentShaderFilename) { // Set the shader filenames mFilenameVertexShader = vertexShaderFilename; diff --git a/tools/testbed/opengl-framework/src/Shader.h b/tools/testbed/opengl-framework/src/Shader.h index 5d348fe..740b54f 100644 --- a/tools/testbed/opengl-framework/src/Shader.h +++ b/tools/testbed/opengl-framework/src/Shader.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -51,7 +51,7 @@ class Shader { GLuint32_t mProgramObjectID; // Filenames of the vertex and fragment shaders - std::string mFilenameVertexShader, mFilenameFragmentShader; + etk::String mFilenameVertexShader, mFilenameFragmentShader; public : @@ -61,14 +61,14 @@ class Shader { Shader(); // Constructor with arguments - Shader(const std::string vertexShaderFilename, const std::string fragmentShaderFilename); + Shader(const etk::String vertexShaderFilename, const etk::String fragmentShaderFilename); // Destructor ~Shader(); // Create the shader - bool create(const std::string vertexShaderFilename, - const std::string fragmentShaderFilename); + bool create(const etk::String vertexShaderFilename, + const etk::String fragmentShaderFilename); // Clear the shader void destroy(); @@ -80,57 +80,57 @@ class Shader { void unbind() const; // Return the location of a uniform variable inside a shader program - GLint32_t getUniformLocation(const std::string& variableName, bool errorIfMissing = true) const; + GLint32_t getUniformLocation(const etk::String& variableName, bool errorIfMissing = true) const; // Return the location of an attribute variable inside a shader program - GLint32_t getAttribLocation(const std::string& variableName, bool errorIfMissing = true) const; + GLint32_t getAttribLocation(const etk::String& variableName, bool errorIfMissing = true) const; // Set a float uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) - void setFloatUniform(const std::string& variableName, float value, bool errorIfMissing = true) const; + void setFloatUniform(const etk::String& variableName, float value, bool errorIfMissing = true) const; // Set an int32_t uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) - void setIntUniform(const std::string& variableName, int32_t value, bool errorIfMissing = true) const; + void setIntUniform(const etk::String& variableName, int32_t value, bool errorIfMissing = true) const; // Set a vector 2 uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) - void setvec2Uniform(const std::string& variableName, const vec2& v, bool errorIfMissing = true) const; + void setvec2Uniform(const etk::String& variableName, const vec2& v, bool errorIfMissing = true) const; // Set a vector 3 uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) - void setvec3Uniform(const std::string& variableName, const vec3& v, bool errorIfMissing = true) const; + void setvec3Uniform(const etk::String& variableName, const vec3& v, bool errorIfMissing = true) const; // Set a vector 4 uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) - void setVector4Uniform(const std::string& variableName, const Vector4 &v, bool errorIfMissing = true) const; + void setVector4Uniform(const etk::String& variableName, const Vector4 &v, bool errorIfMissing = true) const; // Set a 3x3 matrix uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) - void setetk::Matrix3x3Uniform(const std::string& variableName, const float* matrix, + void setetk::Matrix3x3Uniform(const etk::String& variableName, const float* matrix, bool transpose = false, bool errorIfMissing = true) const; // Set a 3x3 matrix uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) - void setetk::Matrix3x3Uniform(const std::string& variableName, const Matrix3& matrix, bool errorIfMissing = true) const; + void setetk::Matrix3x3Uniform(const etk::String& variableName, const Matrix3& matrix, bool errorIfMissing = true) const; // Set a 4x4 matrix uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) - void setMatrix4x4Uniform(const std::string& variableName, const float* matrix, + void setMatrix4x4Uniform(const etk::String& variableName, const float* matrix, bool transpose = false, bool errorIfMissing = true) const; // Set a 4x4 matrix uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) - void setMatrix4x4Uniform(const std::string& variableName, const Matrix4& matrix, bool errorIfMissing = true) const; + void setMatrix4x4Uniform(const etk::String& variableName, const Matrix4& matrix, bool errorIfMissing = true) const; // Return the shader object program ID GLuint32_t getProgramObjectId() const; @@ -152,7 +152,7 @@ inline void Shader::unbind() const { } // Return the location of a uniform variable inside a shader program -inline GLint32_t Shader::getUniformLocation(const std::string& variableName, bool errorIfMissing) const { +inline GLint32_t Shader::getUniformLocation(const etk::String& variableName, bool errorIfMissing) const { assert(mProgramObjectID != 0); GLint32_t location = glGetUniformLocation(mProgramObjectID, variableName.c_str()); if (location == -1 && errorIfMissing) { @@ -166,7 +166,7 @@ inline GLint32_t Shader::getUniformLocation(const std::string& variableName, boo } // Return the location of an attribute variable inside a shader program -inline GLint32_t Shader::getAttribLocation(const std::string& variableName, bool errorIfMissing) const { +inline GLint32_t Shader::getAttribLocation(const etk::String& variableName, bool errorIfMissing) const { assert(mProgramObjectID != 0); GLint32_t location = glGetAttribLocation(mProgramObjectID, variableName.c_str()); if (location == -1 && errorIfMissing) { @@ -190,7 +190,7 @@ inline void Shader::destroy() { // Set a float uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) -inline void Shader::setFloatUniform(const std::string& variableName, float value, bool errorIfMissing) const { +inline void Shader::setFloatUniform(const etk::String& variableName, float value, bool errorIfMissing) const { assert(mProgramObjectID != 0); GLint32_t location = getUniformLocation(variableName, errorIfMissing); if (location != -1) { @@ -201,7 +201,7 @@ inline void Shader::setFloatUniform(const std::string& variableName, float value // Set an int32_t uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) -inline void Shader::setIntUniform(const std::string& variableName, int32_t value, bool errorIfMissing) const { +inline void Shader::setIntUniform(const etk::String& variableName, int32_t value, bool errorIfMissing) const { assert(mProgramObjectID != 0); GLint32_t location = getUniformLocation(variableName, errorIfMissing); if (location != -1) { @@ -212,7 +212,7 @@ inline void Shader::setIntUniform(const std::string& variableName, int32_t value // Set a vector 2 uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) -inline void Shader::setvec2Uniform(const std::string& variableName, const vec2& v, bool errorIfMissing) const { +inline void Shader::setvec2Uniform(const etk::String& variableName, const vec2& v, bool errorIfMissing) const { assert(mProgramObjectID != 0); GLint32_t location = getUniformLocation(variableName, errorIfMissing); if (location != -1) { @@ -223,7 +223,7 @@ inline void Shader::setvec2Uniform(const std::string& variableName, const vec2& // Set a vector 3 uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) -inline void Shader::setvec3Uniform(const std::string& variableName, const vec3 &v, bool errorIfMissing) const { +inline void Shader::setvec3Uniform(const etk::String& variableName, const vec3 &v, bool errorIfMissing) const { assert(mProgramObjectID != 0); GLint32_t location = getUniformLocation(variableName, errorIfMissing); if (location != -1) { @@ -234,7 +234,7 @@ inline void Shader::setvec3Uniform(const std::string& variableName, const vec3 & // Set a vector 4 uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) -inline void Shader::setVector4Uniform(const std::string& variableName, const Vector4& v, bool errorIfMissing) const { +inline void Shader::setVector4Uniform(const etk::String& variableName, const Vector4& v, bool errorIfMissing) const { assert(mProgramObjectID != 0); GLint32_t location = getUniformLocation(variableName, errorIfMissing); if (location != -1) { @@ -245,7 +245,7 @@ inline void Shader::setVector4Uniform(const std::string& variableName, const Vec // Set a 4x4 matrix uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) -inline void Shader::setetk::Matrix3x3Uniform(const std::string& variableName, const float* matrix, +inline void Shader::setetk::Matrix3x3Uniform(const etk::String& variableName, const float* matrix, bool transpose, bool errorIfMissing) const { assert(mProgramObjectID != 0); GLint32_t location = getUniformLocation(variableName, errorIfMissing); @@ -257,7 +257,7 @@ inline void Shader::setetk::Matrix3x3Uniform(const std::string& variableName, co // Set a 3x3 matrix uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) -inline void Shader::setetk::Matrix3x3Uniform(const std::string& variableName, const Matrix3& matrix, bool errorIfMissing) const { +inline void Shader::setetk::Matrix3x3Uniform(const etk::String& variableName, const Matrix3& matrix, bool errorIfMissing) const { assert(mProgramObjectID != 0); GLfloat mat[9]; for (int32_t i=0; i<3; i++) { @@ -274,7 +274,7 @@ inline void Shader::setetk::Matrix3x3Uniform(const std::string& variableName, co // Set a 4x4 matrix uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) -inline void Shader::setMatrix4x4Uniform(const std::string& variableName, const float* matrix, +inline void Shader::setMatrix4x4Uniform(const etk::String& variableName, const float* matrix, bool transpose, bool errorIfMissing) const { assert(mProgramObjectID != 0); GLint32_t location = getUniformLocation(variableName, errorIfMissing); @@ -286,7 +286,7 @@ inline void Shader::setMatrix4x4Uniform(const std::string& variableName, const f // Set a 4x4 matrix uniform value to this shader (be careful if the uniform is not // used in the shader, the compiler will remove it, then when you will try // to set it, an assert will occur) -inline void Shader::setMatrix4x4Uniform(const std::string& variableName, const Matrix4& matrix, bool errorIfMissing) const { +inline void Shader::setMatrix4x4Uniform(const etk::String& variableName, const Matrix4& matrix, bool errorIfMissing) const { assert(mProgramObjectID != 0); GLfloat mat[16]; for (int32_t i=0; i<4; i++) { diff --git a/tools/testbed/opengl-framework/src/Texture2D.cpp b/tools/testbed/opengl-framework/src/Texture2D.cpp index a9d568e..c273e2a 100644 --- a/tools/testbed/opengl-framework/src/Texture2D.cpp +++ b/tools/testbed/opengl-framework/src/Texture2D.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include // Namespaces using namespace openglframework; diff --git a/tools/testbed/opengl-framework/src/Texture2D.h b/tools/testbed/opengl-framework/src/Texture2D.h index b025936..b0b0d25 100644 --- a/tools/testbed/opengl-framework/src/Texture2D.h +++ b/tools/testbed/opengl-framework/src/Texture2D.h @@ -27,7 +27,7 @@ #define TEXTURE2D_H // Libraries -#include +#include #include #include #include diff --git a/tools/testbed/opengl-framework/src/TextureReaderWriter.cpp b/tools/testbed/opengl-framework/src/TextureReaderWriter.cpp index 69012ba..f661087 100644 --- a/tools/testbed/opengl-framework/src/TextureReaderWriter.cpp +++ b/tools/testbed/opengl-framework/src/TextureReaderWriter.cpp @@ -25,7 +25,7 @@ // Librairies #include -#include +#include #ifdef USE_JPEG_TEXTURE #include #include @@ -60,7 +60,7 @@ typedef struct { #pragma pack(pop) // Load a texture from a file -void TextureReaderWriter::loadTextureFromFile(const std::string& filename, +void TextureReaderWriter::loadTextureFromFile(const etk::String& filename, Texture2D& textureToCreate) { // Get the extension of the file @@ -87,7 +87,7 @@ void TextureReaderWriter::loadTextureFromFile(const std::string& filename, } // Write a texture to a file -void TextureReaderWriter::writeTextureToFile(const std::string& filename,const Texture2D& texture) { +void TextureReaderWriter::writeTextureToFile(const etk::String& filename,const Texture2D& texture) { // Get the extension of the file uint32_t startPosExtension = filename.find_last_of("."); @@ -113,7 +113,7 @@ void TextureReaderWriter::writeTextureToFile(const std::string& filename,const T } // Load a TGA picture -void TextureReaderWriter::readTGAPicture(const std::string &filename, Texture2D& textureToCreate) { +void TextureReaderWriter::readTGAPicture(const etk::String &filename, Texture2D& textureToCreate) { // Open the file std::ifstream stream(filename.c_str(), std::ios::binary); @@ -158,7 +158,7 @@ void TextureReaderWriter::readTGAPicture(const std::string &filename, Texture2D& // Write a TGA picture -void TextureReaderWriter::writeTGAPicture(const std::string& filename, const Texture2D& texture) { +void TextureReaderWriter::writeTGAPicture(const etk::String& filename, const Texture2D& texture) { assert(texture.getID() != 0); // Bind the corresponding texture @@ -223,7 +223,7 @@ void TextureReaderWriter::writeTGAPicture(const std::string& filename, const Tex #ifdef USE_JPEG_TEXTURE // Read a JPEG picture -void TextureReaderWriter::readJPEGPicture(const std::string& filename, Texture2D& textureToCreate) { +void TextureReaderWriter::readJPEGPicture(const etk::String& filename, Texture2D& textureToCreate) { struct jpeg_decompress_struct info; struct jpeg_error_mgr error; @@ -278,7 +278,7 @@ void TextureReaderWriter::readJPEGPicture(const std::string& filename, Texture2D } // Write a JPEG picture -void TextureReaderWriter::writeJPEGPicture(const std::string& filename, const Texture2D& texture) { +void TextureReaderWriter::writeJPEGPicture(const etk::String& filename, const Texture2D& texture) { struct jpeg_compress_struct info; struct jpeg_error_mgr error; diff --git a/tools/testbed/opengl-framework/src/TextureReaderWriter.h b/tools/testbed/opengl-framework/src/TextureReaderWriter.h index 1fc6b19..48411d6 100644 --- a/tools/testbed/opengl-framework/src/TextureReaderWriter.h +++ b/tools/testbed/opengl-framework/src/TextureReaderWriter.h @@ -52,26 +52,26 @@ class TextureReaderWriter { TextureReaderWriter(); // Read a TGA picture - static void readTGAPicture(const std::string& filename, Texture2D& textureToCreate); + static void readTGAPicture(const etk::String& filename, Texture2D& textureToCreate); // Write a TGA picture - static void writeTGAPicture(const std::string& filename, const Texture2D& texture); + static void writeTGAPicture(const etk::String& filename, const Texture2D& texture); // Read a JPEG picture - static void readJPEGPicture(const std::string& filename, Texture2D& textureToCreate); + static void readJPEGPicture(const etk::String& filename, Texture2D& textureToCreate); // Write a JPEG picture - static void writeJPEGPicture(const std::string& filename, const Texture2D& texture); + static void writeJPEGPicture(const etk::String& filename, const Texture2D& texture); public : // -------------------- Methods -------------------- // // Load a texture from a file - static void loadTextureFromFile(const std::string& filename, Texture2D& textureToCreate); + static void loadTextureFromFile(const etk::String& filename, Texture2D& textureToCreate); // Write a texture to a file - static void writeTextureToFile(const std::string& filename, const Texture2D& texture); + static void writeTextureToFile(const etk::String& filename, const Texture2D& texture); }; } diff --git a/tools/testbed/scenes/collisionshapes/CollisionShapesScene.cpp b/tools/testbed/scenes/collisionshapes/CollisionShapesScene.cpp index e18a9aa..754d7a0 100644 --- a/tools/testbed/scenes/collisionshapes/CollisionShapesScene.cpp +++ b/tools/testbed/scenes/collisionshapes/CollisionShapesScene.cpp @@ -31,10 +31,10 @@ using namespace openglframework; using namespace collisionshapesscene; // Constructor -CollisionShapesScene::CollisionShapesScene(const std::string& name) +CollisionShapesScene::CollisionShapesScene(const etk::String& name) : SceneDemo(name, SCENE_RADIUS) { - std::string meshFolderPath("meshes/"); + etk::String meshFolderPath("meshes/"); // Compute the radius and the center of the scene openglframework::vec3 center(0, 5, 0); @@ -73,7 +73,7 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name) material.setBounciness(ephysics::float(0.2)); // Add the mesh the list of dumbbells in the scene - mDumbbells.push_back(dumbbell); + mDumbbells.pushBack(dumbbell); } // Create all the boxes of the scene @@ -97,7 +97,7 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name) material.setBounciness(ephysics::float(0.2)); // Add the sphere the list of sphere in the scene - mBoxes.push_back(box); + mBoxes.pushBack(box); } // Create all the spheres of the scene @@ -125,7 +125,7 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name) material.setBounciness(ephysics::float(0.2)); // Add the sphere the list of sphere in the scene - mSpheres.push_back(sphere); + mSpheres.pushBack(sphere); } // Create all the cones of the scene @@ -153,7 +153,7 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name) material.setBounciness(ephysics::float(0.2)); // Add the cone the list of sphere in the scene - mCones.push_back(cone); + mCones.pushBack(cone); } // Create all the cylinders of the scene @@ -181,7 +181,7 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name) material.setBounciness(ephysics::float(0.2)); // Add the cylinder the list of sphere in the scene - mCylinders.push_back(cylinder); + mCylinders.pushBack(cylinder); } // Create all the capsules of the scene @@ -208,7 +208,7 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name) material.setBounciness(ephysics::float(0.2)); // Add the cylinder the list of sphere in the scene - mCapsules.push_back(capsule); + mCapsules.pushBack(capsule); } // Create all the convex meshes of the scene @@ -232,7 +232,7 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name) material.setBounciness(ephysics::float(0.2)); // Add the mesh the list of sphere in the scene - mConvexMeshes.push_back(mesh); + mConvexMeshes.pushBack(mesh); } // ---------- Create the floor --------- @@ -290,7 +290,7 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name) CollisionShapesScene::~CollisionShapesScene() { // Destroy all the boxes of the scene - for (std::vector::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) { + for (etk::Vector::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) { // Destroy the corresponding rigid body from the dynamics world mDynamicsWorld->destroyRigidBody((*it)->getRigidBody()); @@ -300,7 +300,7 @@ CollisionShapesScene::~CollisionShapesScene() { } // Destroy all the sphere of the scene - for (std::vector::iterator it = mSpheres.begin(); it != mSpheres.end(); ++it) { + for (etk::Vector::iterator it = mSpheres.begin(); it != mSpheres.end(); ++it) { // Destroy the corresponding rigid body from the dynamics world mDynamicsWorld->destroyRigidBody((*it)->getRigidBody()); @@ -310,7 +310,7 @@ CollisionShapesScene::~CollisionShapesScene() { } // Destroy all the cones of the scene - for (std::vector::iterator it = mCones.begin(); it != mCones.end(); ++it) { + for (etk::Vector::iterator it = mCones.begin(); it != mCones.end(); ++it) { // Destroy the corresponding rigid body from the dynamics world mDynamicsWorld->destroyRigidBody((*it)->getRigidBody()); @@ -320,7 +320,7 @@ CollisionShapesScene::~CollisionShapesScene() { } // Destroy all the cylinders of the scene - for (std::vector::iterator it = mCylinders.begin(); it != mCylinders.end(); ++it) { + for (etk::Vector::iterator it = mCylinders.begin(); it != mCylinders.end(); ++it) { // Destroy the corresponding rigid body from the dynamics world mDynamicsWorld->destroyRigidBody((*it)->getRigidBody()); @@ -330,7 +330,7 @@ CollisionShapesScene::~CollisionShapesScene() { } // Destroy all the capsules of the scene - for (std::vector::iterator it = mCapsules.begin(); it != mCapsules.end(); ++it) { + for (etk::Vector::iterator it = mCapsules.begin(); it != mCapsules.end(); ++it) { // Destroy the corresponding rigid body from the dynamics world mDynamicsWorld->destroyRigidBody((*it)->getRigidBody()); @@ -340,7 +340,7 @@ CollisionShapesScene::~CollisionShapesScene() { } // Destroy all the convex meshes of the scene - for (std::vector::iterator it = mConvexMeshes.begin(); + for (etk::Vector::iterator it = mConvexMeshes.begin(); it != mConvexMeshes.end(); ++it) { // Destroy the corresponding rigid body from the dynamics world @@ -351,7 +351,7 @@ CollisionShapesScene::~CollisionShapesScene() { } // Destroy all the dumbbell of the scene - for (std::vector::iterator it = mDumbbells.begin(); + for (etk::Vector::iterator it = mDumbbells.begin(); it != mDumbbells.end(); ++it) { // Destroy the corresponding rigid body from the dynamics world @@ -400,42 +400,42 @@ void CollisionShapesScene::update() { SceneDemo::update(); // Update the position and orientation of the boxes - for (std::vector::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) { + for (etk::Vector::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) { // Update the transform used for the rendering (*it)->updateetk::Transform3D(mInterpolationFactor); } // Update the position and orientation of the sphere - for (std::vector::iterator it = mSpheres.begin(); it != mSpheres.end(); ++it) { + for (etk::Vector::iterator it = mSpheres.begin(); it != mSpheres.end(); ++it) { // Update the transform used for the rendering (*it)->updateetk::Transform3D(mInterpolationFactor); } // Update the position and orientation of the cones - for (std::vector::iterator it = mCones.begin(); it != mCones.end(); ++it) { + for (etk::Vector::iterator it = mCones.begin(); it != mCones.end(); ++it) { // Update the transform used for the rendering (*it)->updateetk::Transform3D(mInterpolationFactor); } // Update the position and orientation of the cylinders - for (std::vector::iterator it = mCylinders.begin(); it != mCylinders.end(); ++it) { + for (etk::Vector::iterator it = mCylinders.begin(); it != mCylinders.end(); ++it) { // Update the transform used for the rendering (*it)->updateetk::Transform3D(mInterpolationFactor); } // Update the position and orientation of the capsules - for (std::vector::iterator it = mCapsules.begin(); it != mCapsules.end(); ++it) { + for (etk::Vector::iterator it = mCapsules.begin(); it != mCapsules.end(); ++it) { // Update the transform used for the rendering (*it)->updateetk::Transform3D(mInterpolationFactor); } // Update the position and orientation of the convex meshes - for (std::vector::iterator it = mConvexMeshes.begin(); + for (etk::Vector::iterator it = mConvexMeshes.begin(); it != mConvexMeshes.end(); ++it) { // Update the transform used for the rendering @@ -443,7 +443,7 @@ void CollisionShapesScene::update() { } // Update the position and orientation of the dumbbells - for (std::vector::iterator it = mDumbbells.begin(); + for (etk::Vector::iterator it = mDumbbells.begin(); it != mDumbbells.end(); ++it) { // Update the transform used for the rendering @@ -463,38 +463,38 @@ void CollisionShapesScene::renderSinglePass(openglframework::Shader& shader, shader.bind(); // Render all the boxes of the scene - for (std::vector::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) { + for (etk::Vector::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) { (*it)->render(shader, worldToCameraMatrix); } // Render all the sphere of the scene - for (std::vector::iterator it = mSpheres.begin(); it != mSpheres.end(); ++it) { + for (etk::Vector::iterator it = mSpheres.begin(); it != mSpheres.end(); ++it) { (*it)->render(shader, worldToCameraMatrix); } // Render all the cones of the scene - for (std::vector::iterator it = mCones.begin(); it != mCones.end(); ++it) { + for (etk::Vector::iterator it = mCones.begin(); it != mCones.end(); ++it) { (*it)->render(shader, worldToCameraMatrix); } // Render all the cylinders of the scene - for (std::vector::iterator it = mCylinders.begin(); it != mCylinders.end(); ++it) { + for (etk::Vector::iterator it = mCylinders.begin(); it != mCylinders.end(); ++it) { (*it)->render(shader, worldToCameraMatrix); } // Render all the capsules of the scene - for (std::vector::iterator it = mCapsules.begin(); it != mCapsules.end(); ++it) { + for (etk::Vector::iterator it = mCapsules.begin(); it != mCapsules.end(); ++it) { (*it)->render(shader, worldToCameraMatrix); } // Render all the convex meshes of the scene - for (std::vector::iterator it = mConvexMeshes.begin(); + for (etk::Vector::iterator it = mConvexMeshes.begin(); it != mConvexMeshes.end(); ++it) { (*it)->render(shader, worldToCameraMatrix); } // Render all the dumbbells of the scene - for (std::vector::iterator it = mDumbbells.begin(); + for (etk::Vector::iterator it = mDumbbells.begin(); it != mDumbbells.end(); ++it) { (*it)->render(shader, worldToCameraMatrix); } diff --git a/tools/testbed/scenes/collisionshapes/CollisionShapesScene.h b/tools/testbed/scenes/collisionshapes/CollisionShapesScene.h index dade362..fa4bc98 100644 --- a/tools/testbed/scenes/collisionshapes/CollisionShapesScene.h +++ b/tools/testbed/scenes/collisionshapes/CollisionShapesScene.h @@ -76,21 +76,21 @@ class CollisionShapesScene : public SceneDemo { // -------------------- Attributes -------------------- // /// All the spheres of the scene - std::vector mBoxes; + etk::Vector mBoxes; - std::vector mSpheres; + etk::Vector mSpheres; - std::vector mCones; + etk::Vector mCones; - std::vector mCylinders; + etk::Vector mCylinders; - std::vector mCapsules; + etk::Vector mCapsules; /// All the convex meshes of the scene - std::vector mConvexMeshes; + etk::Vector mConvexMeshes; /// All the dumbbell of the scene - std::vector mDumbbells; + etk::Vector mDumbbells; /// Box for the floor Box* mFloor; @@ -103,7 +103,7 @@ class CollisionShapesScene : public SceneDemo { // -------------------- Methods -------------------- // /// Constructor - CollisionShapesScene(const std::string& name); + CollisionShapesScene(const etk::String& name); /// Destructor virtual ~CollisionShapesScene(); @@ -123,11 +123,11 @@ class CollisionShapesScene : public SceneDemo { virtual void reset(); /// Return all the contact points of the scene - virtual std::vector getContactPoints() const; + virtual etk::Vector getContactPoints() const; }; // Return all the contact points of the scene -inline std::vector CollisionShapesScene::getContactPoints() const { +inline etk::Vector CollisionShapesScene::getContactPoints() const { return computeContactPointsOfWorld(mDynamicsWorld); } diff --git a/tools/testbed/scenes/concavemesh/ConcaveMeshScene.cpp b/tools/testbed/scenes/concavemesh/ConcaveMeshScene.cpp index 3a8d95d..861dad7 100644 --- a/tools/testbed/scenes/concavemesh/ConcaveMeshScene.cpp +++ b/tools/testbed/scenes/concavemesh/ConcaveMeshScene.cpp @@ -31,10 +31,10 @@ using namespace openglframework; using namespace trianglemeshscene; // Constructor -ConcaveMeshScene::ConcaveMeshScene(const std::string& name) +ConcaveMeshScene::ConcaveMeshScene(const etk::String& name) : SceneDemo(name, SCENE_RADIUS) { - std::string meshFolderPath("meshes/"); + etk::String meshFolderPath("meshes/"); // Compute the radius and the center of the scene openglframework::vec3 center(0, 5, 0); diff --git a/tools/testbed/scenes/concavemesh/ConcaveMeshScene.h b/tools/testbed/scenes/concavemesh/ConcaveMeshScene.h index 67eb031..f596eb8 100644 --- a/tools/testbed/scenes/concavemesh/ConcaveMeshScene.h +++ b/tools/testbed/scenes/concavemesh/ConcaveMeshScene.h @@ -63,7 +63,7 @@ class ConcaveMeshScene : public SceneDemo { // -------------------- Methods -------------------- // /// Constructor - ConcaveMeshScene(const std::string& name); + ConcaveMeshScene(const etk::String& name); /// Destructor virtual ~ConcaveMeshScene(); @@ -83,11 +83,11 @@ class ConcaveMeshScene : public SceneDemo { virtual void reset(); /// Return all the contact points of the scene - virtual std::vector getContactPoints() const; + virtual etk::Vector getContactPoints() const; }; // Return all the contact points of the scene -inline std::vector ConcaveMeshScene::getContactPoints() const { +inline etk::Vector ConcaveMeshScene::getContactPoints() const { return computeContactPointsOfWorld(mDynamicsWorld); } diff --git a/tools/testbed/scenes/cubes/CubesScene.cpp b/tools/testbed/scenes/cubes/CubesScene.cpp index 5980674..b0cc9a6 100644 --- a/tools/testbed/scenes/cubes/CubesScene.cpp +++ b/tools/testbed/scenes/cubes/CubesScene.cpp @@ -31,7 +31,7 @@ using namespace openglframework; using namespace cubesscene; // Constructor -CubesScene::CubesScene(const std::string& name) +CubesScene::CubesScene(const etk::String& name) : SceneDemo(name, SCENE_RADIUS) { // Compute the radius and the center of the scene @@ -72,7 +72,7 @@ CubesScene::CubesScene(const std::string& name) material.setBounciness(ephysics::float(0.4)); // Add the box the list of box in the scene - mBoxes.push_back(cube); + mBoxes.pushBack(cube); } // Create the floor @@ -104,7 +104,7 @@ CubesScene::CubesScene(const std::string& name) CubesScene::~CubesScene() { // Destroy all the cubes of the scene - for (std::vector::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) { + for (etk::Vector::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) { // Destroy the corresponding rigid body from the dynamics world m_dynamicsWorld->destroyRigidBody((*it)->getRigidBody()); @@ -148,7 +148,7 @@ void CubesScene::update() { SceneDemo::update(); // Update the position and orientation of the boxes - for (std::vector::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) { + for (etk::Vector::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) { // Update the transform used for the rendering (*it)->updateetk::Transform3D(mInterpolationFactor); @@ -164,7 +164,7 @@ void CubesScene::renderSinglePass(Shader& shader, const openglframework::Matrix4 shader.bind(); // Render all the cubes of the scene - for (std::vector::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) { + for (etk::Vector::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) { (*it)->render(shader, worldToCameraMatrix); } diff --git a/tools/testbed/scenes/cubes/CubesScene.h b/tools/testbed/scenes/cubes/CubesScene.h index 6cbfa25..9474983 100644 --- a/tools/testbed/scenes/cubes/CubesScene.h +++ b/tools/testbed/scenes/cubes/CubesScene.h @@ -44,14 +44,14 @@ namespace cubesscene { class CubesScene : public SceneDemo { protected : /// All the boxes of the scene - std::vector mBoxes; + etk::Vector mBoxes; /// Box for the floor Box* mFloor; /// Dynamics world used for the physics simulation ephysics::DynamicsWorld* m_dynamicsWorld; public: /// Constructor - CubesScene(const std::string& name); + CubesScene(const etk::String& name); /// Destructor virtual ~CubesScene(); /// Update the physics world (take a simulation step) @@ -65,7 +65,7 @@ namespace cubesscene { /// Reset the scene virtual void reset(); /// Return all the contact points of the scene - virtual std::vector getContactPoints() const { + virtual etk::Vector getContactPoints() const { return computeContactPointsOfWorld(m_dynamicsWorld); } }; diff --git a/tools/testbed/scenes/heightfield/HeightFieldScene.cpp b/tools/testbed/scenes/heightfield/HeightFieldScene.cpp index 6ae630b..0793932 100644 --- a/tools/testbed/scenes/heightfield/HeightFieldScene.cpp +++ b/tools/testbed/scenes/heightfield/HeightFieldScene.cpp @@ -31,7 +31,7 @@ using namespace openglframework; using namespace heightfieldscene; // Constructor -HeightFieldScene::HeightFieldScene(const std::string& name) : SceneDemo(name, SCENE_RADIUS) { +HeightFieldScene::HeightFieldScene(const etk::String& name) : SceneDemo(name, SCENE_RADIUS) { // Compute the radius and the center of the scene openglframework::vec3 center(0, 5, 0); diff --git a/tools/testbed/scenes/heightfield/HeightFieldScene.h b/tools/testbed/scenes/heightfield/HeightFieldScene.h index 0e7dcfc..20abdf6 100644 --- a/tools/testbed/scenes/heightfield/HeightFieldScene.h +++ b/tools/testbed/scenes/heightfield/HeightFieldScene.h @@ -60,7 +60,7 @@ class HeightFieldScene : public SceneDemo { // -------------------- Methods -------------------- // /// Constructor - HeightFieldScene(const std::string& name); + HeightFieldScene(const etk::String& name); /// Destructor virtual ~HeightFieldScene(); @@ -80,11 +80,11 @@ class HeightFieldScene : public SceneDemo { virtual void reset(); /// Return all the contact points of the scene - virtual std::vector getContactPoints() const; + virtual etk::Vector getContactPoints() const; }; // Return all the contact points of the scene -inline std::vector HeightFieldScene::getContactPoints() const { +inline etk::Vector HeightFieldScene::getContactPoints() const { return computeContactPointsOfWorld(mDynamicsWorld); } diff --git a/tools/testbed/scenes/joints/JointsScene.cpp b/tools/testbed/scenes/joints/JointsScene.cpp index 943d478..cab2f1b 100644 --- a/tools/testbed/scenes/joints/JointsScene.cpp +++ b/tools/testbed/scenes/joints/JointsScene.cpp @@ -32,7 +32,7 @@ using namespace openglframework; using namespace jointsscene; // Constructor -JointsScene::JointsScene(const std::string& name) +JointsScene::JointsScene(const etk::String& name) : SceneDemo(name, SCENE_RADIUS) { // Compute the radius and the center of the scene diff --git a/tools/testbed/scenes/joints/JointsScene.h b/tools/testbed/scenes/joints/JointsScene.h index a3146f7..70c9d0d 100644 --- a/tools/testbed/scenes/joints/JointsScene.h +++ b/tools/testbed/scenes/joints/JointsScene.h @@ -117,7 +117,7 @@ class JointsScene : public SceneDemo { // -------------------- Methods -------------------- // /// Constructor - JointsScene(const std::string& name); + JointsScene(const etk::String& name); /// Destructor virtual ~JointsScene(); @@ -137,11 +137,11 @@ class JointsScene : public SceneDemo { virtual void reset(); /// Return all the contact points of the scene - virtual std::vector getContactPoints() const; + virtual etk::Vector getContactPoints() const; }; // Return all the contact points of the scene -inline std::vector JointsScene::getContactPoints() const { +inline etk::Vector JointsScene::getContactPoints() const { return computeContactPointsOfWorld(mDynamicsWorld); } diff --git a/tools/testbed/scenes/raycast/RaycastScene.cpp b/tools/testbed/scenes/raycast/RaycastScene.cpp index 3799610..3dbebd0 100644 --- a/tools/testbed/scenes/raycast/RaycastScene.cpp +++ b/tools/testbed/scenes/raycast/RaycastScene.cpp @@ -31,7 +31,7 @@ using namespace openglframework; using namespace raycastscene; // Constructor -RaycastScene::RaycastScene(const std::string& name) +RaycastScene::RaycastScene(const etk::String& name) : SceneDemo(name, SCENE_RADIUS, false), mMeshFolderPath("meshes/"), m_raycastManager(mPhongShader, mMeshFolderPath), mCurrentBodyIndex(-1), mAreNormalsDisplayed(false), mVBOVertices(GL_ARRAY_BUFFER) { @@ -172,10 +172,10 @@ void RaycastScene::createLines() { openglframework::vec3 point1(x, y, z); openglframework::vec3 point2(0.0f, 0.0f, 0.0f); Line* line = new Line(point1, point2); - mLines.push_back(line); + mLines.pushBack(line); - mLinePoints.push_back(point1); - mLinePoints.push_back(point2); + mLinePoints.pushBack(point1); + mLinePoints.pushBack(point2); } } } @@ -287,7 +287,7 @@ RaycastScene::~RaycastScene() { delete mCollisionWorld; // Destroy the lines - for (std::vector::iterator it = mLines.begin(); it != mLines.end(); + for (etk::Vector::iterator it = mLines.begin(); it != mLines.end(); ++it) { delete (*it); } @@ -309,7 +309,7 @@ void RaycastScene::update() { m_raycastManager.resetPoints(); // For each line of the scene - for (std::vector::iterator it = mLines.begin(); it != mLines.end(); + for (etk::Vector::iterator it = mLines.begin(); it != mLines.end(); ++it) { Line* line = *it; diff --git a/tools/testbed/scenes/raycast/RaycastScene.h b/tools/testbed/scenes/raycast/RaycastScene.h index 7bfa16a..a24fdee 100644 --- a/tools/testbed/scenes/raycast/RaycastScene.h +++ b/tools/testbed/scenes/raycast/RaycastScene.h @@ -67,18 +67,18 @@ class RaycastManager : public ephysics::RaycastCallback { private: /// All the visual contact points - std::vector mHitPoints; + etk::Vector mHitPoints; /// All the normals at hit points - std::vector mNormals; + etk::Vector mNormals; /// Contact point mesh folder path - std::string mMeshFolderPath; + etk::String mMeshFolderPath; public: RaycastManager(openglframework::Shader& shader, - const std::string& meshFolderPath) + const etk::String& meshFolderPath) : mMeshFolderPath(meshFolderPath) { } @@ -86,13 +86,13 @@ class RaycastManager : public ephysics::RaycastCallback { virtual ephysics::float notifyRaycastHit(const ephysics::RaycastInfo& raycastInfo) { ephysics::vec3 hitPos = raycastInfo.worldPoint; openglframework::vec3 position(hitPos.x(), hitPos.y(), hitPos.z()); - mHitPoints.push_back(ContactPoint(position)); + mHitPoints.pushBack(ContactPoint(position)); // Create a line to display the normal at hit point ephysics::vec3 n = raycastInfo.worldNormal; openglframework::vec3 normal(n.x(), n.y(), n.z()); Line* normalLine = new Line(position, position + normal); - mNormals.push_back(normalLine); + mNormals.pushBack(normalLine); return raycastInfo.hitFraction; } @@ -102,14 +102,14 @@ class RaycastManager : public ephysics::RaycastCallback { mHitPoints.clear(); // Destroy all the normals - for (std::vector::iterator it = mNormals.begin(); + for (etk::Vector::iterator it = mNormals.begin(); it != mNormals.end(); ++it) { delete (*it); } mNormals.clear(); } - std::vector getHitPoints() const { + etk::Vector getHitPoints() const { return mHitPoints; } }; @@ -122,13 +122,13 @@ class RaycastScene : public SceneDemo { // -------------------- Attributes -------------------- // /// Contact point mesh folder path - std::string mMeshFolderPath; + etk::String mMeshFolderPath; /// Raycast manager RaycastManager m_raycastManager; /// All the raycast lines - std::vector mLines; + etk::Vector mLines; /// Current body index int32_t mCurrentBodyIndex; @@ -153,7 +153,7 @@ class RaycastScene : public SceneDemo { ephysics::CollisionWorld* mCollisionWorld; /// All the points to render the lines - std::vector mLinePoints; + etk::Vector mLinePoints; /// Vertex Buffer Object for the vertices data openglframework::VertexBufferObject mVBOVertices; @@ -173,7 +173,7 @@ class RaycastScene : public SceneDemo { // -------------------- Methods -------------------- // /// Constructor - RaycastScene(const std::string& name); + RaycastScene(const etk::String& name); /// Destructor virtual ~RaycastScene(); @@ -208,7 +208,7 @@ class RaycastScene : public SceneDemo { void virtual setIsContactPointsDisplayed(bool display); /// Return all the contact points of the scene - virtual std::vector getContactPoints() const; + virtual etk::Vector getContactPoints() const; }; // Display or not the surface normals at hit points @@ -227,7 +227,7 @@ inline void RaycastScene::setIsContactPointsDisplayed(bool display) { } // Return all the contact points of the scene -inline std::vector RaycastScene::getContactPoints() const { +inline etk::Vector RaycastScene::getContactPoints() const { return m_raycastManager.getHitPoints(); } diff --git a/tools/testbed/src/Gui.cpp b/tools/testbed/src/Gui.cpp index 6394b7d..0e0d479 100644 --- a/tools/testbed/src/Gui.cpp +++ b/tools/testbed/src/Gui.cpp @@ -79,13 +79,13 @@ void Gui::update() { } // Framerate (FPS) - mFPSLabel->setCaption(std::string("FPS : ") + floatToString(mCachedFPS, 0)); + mFPSLabel->setCaption(etk::String("FPS : ") + floatToString(mCachedFPS, 0)); // Frame time - mFrameTimeLabel->setCaption(std::string("Frame time : ") + floatToString(mCachedUpdateTime * 1000.0, 1) + std::string(" ms")); + mFrameTimeLabel->setCaption(etk::String("Frame time : ") + floatToString(mCachedUpdateTime * 1000.0, 1) + etk::String(" ms")); // Physics time - mPhysicsTimeLabel->setCaption(std::string("Physics time : ") + floatToString(mCachedPhysicsUpdateTime * 1000.0, 1) + std::string(" ms")); + mPhysicsTimeLabel->setCaption(etk::String("Physics time : ") + floatToString(mCachedPhysicsUpdateTime * 1000.0, 1) + etk::String(" ms")); } void Gui::createSimulationPanel() { @@ -122,10 +122,10 @@ void Gui::createSimulationPanel() { }); // Scenes - std::vector scenes = mApp->getScenes(); - std::vector scenesNames; + etk::Vector scenes = mApp->getScenes(); + etk::Vector scenesNames; for (uint32_t i=0; igetName().c_str()); + scenesNames.pushBack(scenes[i]->getName().c_str()); } new Label(mSimulationPanel, "Scene","sans-bold"); ComboBox* comboBoxScenes = new ComboBox(mSimulationPanel, scenesNames, [&, scenes](int32_t index) { @@ -191,7 +191,7 @@ void Gui::createSettingsPanel() { out << std::setprecision(1) << std::fixed << (mApp->mEngineSettings.timeStep * 1000); textboxTimeStep->setValue(out.str()); textboxTimeStep->setUnits("ms"); - textboxTimeStep->setCallback([&, textboxTimeStep](const std::string &str) { + textboxTimeStep->setCallback([&, textboxTimeStep](const etk::String &str) { try { float value = std::stof(str); @@ -221,9 +221,9 @@ void Gui::createSettingsPanel() { TextBox* textboxVelocityIterations = new TextBox(panelVelocityIterations); textboxVelocityIterations->setFixedSize(vec2i(70, 25)); textboxVelocityIterations->setEditable(true); - textboxVelocityIterations->setValue(std::to_string(mApp->mEngineSettings.nbVelocitySolverIterations)); + textboxVelocityIterations->setValue(etk::toString(mApp->mEngineSettings.nbVelocitySolverIterations)); textboxVelocityIterations->setUnits("iter"); - textboxVelocityIterations->setCallback([&, textboxVelocityIterations](const std::string &str) { + textboxVelocityIterations->setCallback([&, textboxVelocityIterations](const etk::String &str) { try { float value = std::stof(str); @@ -252,9 +252,9 @@ void Gui::createSettingsPanel() { TextBox* textboxPositionIterations = new TextBox(panelPositionIterations); textboxPositionIterations->setFixedSize(vec2i(70, 25)); textboxPositionIterations->setEditable(true); - textboxPositionIterations->setValue(std::to_string(mApp->mEngineSettings.nbPositionSolverIterations)); + textboxPositionIterations->setValue(etk::toString(mApp->mEngineSettings.nbPositionSolverIterations)); textboxPositionIterations->setUnits("iter"); - textboxPositionIterations->setCallback([&, textboxPositionIterations](const std::string &str) { + textboxPositionIterations->setCallback([&, textboxPositionIterations](const etk::String &str) { try { float value = std::stof(str); @@ -287,7 +287,7 @@ void Gui::createSettingsPanel() { textboxTimeSleep->setEditable(true); textboxTimeSleep->setValue(out.str()); textboxTimeSleep->setUnits("ms"); - textboxTimeSleep->setCallback([&, textboxTimeSleep](const std::string &str) { + textboxTimeSleep->setCallback([&, textboxTimeSleep](const etk::String &str) { try { float value = std::stof(str); @@ -321,7 +321,7 @@ void Gui::createSettingsPanel() { textboxSleepLinearVel->setEditable(true); textboxSleepLinearVel->setValue(out.str()); textboxSleepLinearVel->setUnits("m/s"); - textboxSleepLinearVel->setCallback([&, textboxSleepLinearVel](const std::string &str) { + textboxSleepLinearVel->setCallback([&, textboxSleepLinearVel](const etk::String &str) { try { float value = std::stof(str); @@ -355,7 +355,7 @@ void Gui::createSettingsPanel() { textboxSleepAngularVel->setEditable(true); textboxSleepAngularVel->setValue(out.str()); textboxSleepAngularVel->setUnits("rad/s"); - textboxSleepAngularVel->setCallback([&, textboxSleepAngularVel](const std::string &str) { + textboxSleepAngularVel->setCallback([&, textboxSleepAngularVel](const etk::String &str) { try { float value = std::stof(str); @@ -415,13 +415,13 @@ void Gui::createProfilingPanel() { profilingPanel->setFixedWidth(220); // Framerate (FPS) - mFPSLabel = new Label(profilingPanel, std::string("FPS : ") + floatToString(mCachedFPS, 0),"sans-bold"); + mFPSLabel = new Label(profilingPanel, etk::String("FPS : ") + floatToString(mCachedFPS, 0),"sans-bold"); // Update time - mFrameTimeLabel = new Label(profilingPanel, std::string("Frame time : ") + floatToString(mCachedUpdateTime * 1000.0, 1) + std::string(" ms"),"sans-bold"); + mFrameTimeLabel = new Label(profilingPanel, etk::String("Frame time : ") + floatToString(mCachedUpdateTime * 1000.0, 1) + etk::String(" ms"),"sans-bold"); // Update time - mPhysicsTimeLabel = new Label(profilingPanel, std::string("Physics time : ") + floatToString(mCachedPhysicsUpdateTime * 1000.0, 1) + std::string(" ms"),"sans-bold"); + mPhysicsTimeLabel = new Label(profilingPanel, etk::String("Physics time : ") + floatToString(mCachedPhysicsUpdateTime * 1000.0, 1) + etk::String(" ms"),"sans-bold"); profilingPanel->setVisible(true); } diff --git a/tools/testbed/src/Gui.h b/tools/testbed/src/Gui.h index 8301644..84428ca 100644 --- a/tools/testbed/src/Gui.h +++ b/tools/testbed/src/Gui.h @@ -71,7 +71,7 @@ class Gui { Label* mFrameTimeLabel; Label* mPhysicsTimeLabel; - std::vector mCheckboxesScenes; + etk::Vector mCheckboxesScenes; // -------------------- Methods -------------------- // @@ -98,7 +98,7 @@ class Gui { void createProfilingPanel(); // Convert float value to string - std::string floatToString(float value, int32_t precision); + etk::String floatToString(float value, int32_t precision); public : @@ -132,8 +132,8 @@ inline void Gui::setScroll(double scrollX, double scrollY) { mScrollY = scrollY; } -inline std::string Gui::floatToString(float value, int32_t precision) { - std::stringstream ss; +inline etk::String Gui::floatToString(float value, int32_t precision) { + etk::Stringstream ss; ss << std::fixed << std::setprecision(precision) << value; return ss.str(); } diff --git a/tools/testbed/src/Scene.cpp b/tools/testbed/src/Scene.cpp index 8b8a9e1..3f9921b 100644 --- a/tools/testbed/src/Scene.cpp +++ b/tools/testbed/src/Scene.cpp @@ -30,7 +30,7 @@ using namespace openglframework; // Constructor -Scene::Scene(const std::string& name, bool isShadowMappingEnabled) +Scene::Scene(const etk::String& name, bool isShadowMappingEnabled) : m_name(name), mInterpolationFactor(0.0f), mViewportX(0), mViewportY(0), mViewportWidth(0), mViewportHeight(0), mIsShadowMappingEnabled(isShadowMappingEnabled), mIsContactPointsDisplayed(true) { diff --git a/tools/testbed/src/Scene.h b/tools/testbed/src/Scene.h index bbf3632..1b4b2d3 100644 --- a/tools/testbed/src/Scene.h +++ b/tools/testbed/src/Scene.h @@ -73,7 +73,7 @@ class Scene { // -------------------- Attributes -------------------- // /// Scene name - std::string m_name; + etk::String m_name; /// Physics engine settings EngineSettings mEngineSettings; @@ -134,7 +134,7 @@ class Scene { // -------------------- Methods -------------------- // /// Constructor - Scene(const std::string& name, bool isShadowMappingEnabled = false); + Scene(const etk::String& name, bool isShadowMappingEnabled = false); /// Destructor virtual ~Scene(); @@ -188,7 +188,7 @@ class Scene { void setInterpolationFactor(float int32_terpolationFactor); /// Return the name of the scene - std::string getName() const; + etk::String getName() const; /// Return true if the shadow mapping is enabled bool getIsShadowMappingEnabled() const; @@ -200,7 +200,7 @@ class Scene { void virtual setIsContactPointsDisplayed(bool display); /// Return all the contact points of the scene - std::vector virtual getContactPoints() const; + etk::Vector virtual getContactPoints() const; }; // Called when a keyboard event occurs @@ -248,7 +248,7 @@ inline void Scene::setInterpolationFactor(float int32_terpolationFactor) { } // Return the name of the scene -inline std::string Scene::getName() const { +inline etk::String Scene::getName() const { return m_name; } @@ -268,10 +268,10 @@ inline void Scene::setIsContactPointsDisplayed(bool display) { } // Return all the contact points of the scene -inline std::vector Scene::getContactPoints() const { +inline etk::Vector Scene::getContactPoints() const { // Return an empty list of contact points - return std::vector(); + return etk::Vector(); } #endif diff --git a/tools/testbed/src/SceneDemo.cpp b/tools/testbed/src/SceneDemo.cpp index 417c8c3..4c4b1d2 100644 --- a/tools/testbed/src/SceneDemo.cpp +++ b/tools/testbed/src/SceneDemo.cpp @@ -41,7 +41,7 @@ openglframework::Color SceneDemo::mDemoColors[] = {SceneDemo::mYellowColorDemo, SceneDemo::mOrangeColorDemo, SceneDemo::mPinkColorDemo}; // Constructor -SceneDemo::SceneDemo(const std::string& name, float sceneRadius, bool isShadowMappingEnabled) +SceneDemo::SceneDemo(const etk::String& name, float sceneRadius, bool isShadowMappingEnabled) : Scene(name, isShadowMappingEnabled), mIsShadowMappingInitialized(false), mDepthShader("shaders/depth.vert", "shaders/depth.frag"), mPhongShader("shaders/phong.vert", "shaders/phong.frag"), @@ -282,15 +282,15 @@ void SceneDemo::updateContactPoints() { if (mIsContactPointsDisplayed) { // Get the current contact points of the scene - std::vector contactPoints = getContactPoints(); + etk::Vector contactPoints = getContactPoints(); // For each contact point - std::vector::const_iterator it; + etk::Vector::const_iterator it; for (it = contactPoints.begin(); it != contactPoints.end(); ++it) { // Create a visual contact point for rendering VisualContactPoint* point = new VisualContactPoint(it->point, mMeshFolderPath); - m_contactPoints.push_back(point); + m_contactPoints.pushBack(point); } } } @@ -300,7 +300,7 @@ void SceneDemo::renderContactPoints(openglframework::Shader& shader, const openglframework::Matrix4& worldToCameraMatrix) { // Render all the raycast hit points - for (std::vector::iterator it = m_contactPoints.begin(); + for (etk::Vector::iterator it = m_contactPoints.begin(); it != m_contactPoints.end(); ++it) { (*it)->render(shader, worldToCameraMatrix); } @@ -309,7 +309,7 @@ void SceneDemo::renderContactPoints(openglframework::Shader& shader, void SceneDemo::removeAllContactPoints() { // Destroy all the visual contact points - for (std::vector::iterator it = m_contactPoints.begin(); + for (etk::Vector::iterator it = m_contactPoints.begin(); it != m_contactPoints.end(); ++it) { delete (*it); } @@ -317,15 +317,15 @@ void SceneDemo::removeAllContactPoints() { } // Return all the contact points of the scene -std::vector SceneDemo::computeContactPointsOfWorld(const ephysics::DynamicsWorld* world) const { +etk::Vector SceneDemo::computeContactPointsOfWorld(const ephysics::DynamicsWorld* world) const { - std::vector contactPoints; + etk::Vector contactPoints; // Get the list of contact manifolds from the world - std::vector manifolds = world->getContactsList(); + etk::Vector manifolds = world->getContactsList(); // For each contact manifold - std::vector::const_iterator it; + etk::Vector::const_iterator it; for (it = manifolds.begin(); it != manifolds.end(); ++it) { const ephysics::ContactManifold* manifold = *it; @@ -336,7 +336,7 @@ std::vector SceneDemo::computeContactPointsOfWorld(const ephysics: ephysics::ContactPoint* contactPoint = manifold->getContactPoint(i); ephysics::vec3 point = contactPoint->getWorldPointOnBody1(); ContactPoint contact(openglframework::vec3(point.x(), point.y(), point.z())); - contactPoints.push_back(contact); + contactPoints.pushBack(contact); } } diff --git a/tools/testbed/src/SceneDemo.h b/tools/testbed/src/SceneDemo.h index f161154..03f1be7 100644 --- a/tools/testbed/src/SceneDemo.h +++ b/tools/testbed/src/SceneDemo.h @@ -59,7 +59,7 @@ class SceneDemo : public Scene { static int32_t shadowMapTextureLevel; /// All the visual contact points - std::vector m_contactPoints; + etk::Vector m_contactPoints; /// Shadow map bias matrix openglframework::Matrix4 mShadowMapBiasMatrix; @@ -90,7 +90,7 @@ class SceneDemo : public Scene { static openglframework::Color mDemoColors[]; static int32_t mNbDemoColors; - std::string mMeshFolderPath; + etk::String mMeshFolderPath; // -------------------- Methods -------------------- // @@ -117,7 +117,7 @@ class SceneDemo : public Scene { // -------------------- Methods -------------------- // /// Constructor - SceneDemo(const std::string& name, float sceneRadius, bool isShadowMappingEnabled = true); + SceneDemo(const etk::String& name, float sceneRadius, bool isShadowMappingEnabled = true); /// Destructor virtual ~SceneDemo(); @@ -136,7 +136,7 @@ class SceneDemo : public Scene { void virtual setIsShadowMappingEnabled(bool isShadowMappingEnabled); /// Return all the contact points of the scene - std::vector computeContactPointsOfWorld(const ephysics::DynamicsWorld* world) const; + etk::Vector computeContactPointsOfWorld(const ephysics::DynamicsWorld* world) const; }; // Enabled/Disable the shadow mapping diff --git a/tools/testbed/src/TestbedApplication.cpp b/tools/testbed/src/TestbedApplication.cpp index a5222ec..891875b 100644 --- a/tools/testbed/src/TestbedApplication.cpp +++ b/tools/testbed/src/TestbedApplication.cpp @@ -95,27 +95,27 @@ void TestbedApplication::createScenes() { // Cubes scene CubesScene* cubeScene = new CubesScene("Cubes"); - mScenes.push_back(cubeScene); + mScenes.pushBack(cubeScene); // Joints scene JointsScene* jointsScene = new JointsScene("Joints"); - mScenes.push_back(jointsScene); + mScenes.pushBack(jointsScene); // Collision shapes scene CollisionShapesScene* collisionShapesScene = new CollisionShapesScene("Collision Shapes"); - mScenes.push_back(collisionShapesScene); + mScenes.pushBack(collisionShapesScene); // Heightfield shape scene HeightFieldScene* heightFieldScene = new HeightFieldScene("Heightfield"); - mScenes.push_back(heightFieldScene); + mScenes.pushBack(heightFieldScene); // Raycast scene RaycastScene* raycastScene = new RaycastScene("Raycast"); - mScenes.push_back(raycastScene); + mScenes.pushBack(raycastScene); // Raycast scene ConcaveMeshScene* concaveMeshScene = new ConcaveMeshScene("Concave Mesh"); - mScenes.push_back(concaveMeshScene); + mScenes.pushBack(concaveMeshScene); assert(mScenes.size() > 0); mCurrentScene = mScenes[0]; @@ -270,7 +270,7 @@ void TestbedApplication::checkOpenGLErrorsInternal(const char* file, int32_t lin // While there are errors while (glError != GL_NO_ERROR) { - std::string error; + etk::String error; switch(glError) { case GL_INVALID_OPERATION: error="INVALID_OPERATION"; break; diff --git a/tools/testbed/src/TestbedApplication.h b/tools/testbed/src/TestbedApplication.h index 370af11..07caf79 100644 --- a/tools/testbed/src/TestbedApplication.h +++ b/tools/testbed/src/TestbedApplication.h @@ -60,7 +60,7 @@ class TestbedApplication : public Screen { Timer mTimer; /// List of 3D scenes - std::vector mScenes; + etk::Vector mScenes; /// Current 3D scene Scene* mCurrentScene; @@ -142,7 +142,7 @@ class TestbedApplication : public Screen { void destroyScenes(); /// Return the list of the scenes - std::vector getScenes(); + etk::Vector getScenes(); /// Start/stop the simulation void togglePlayPauseSimulation(); @@ -208,7 +208,7 @@ class TestbedApplication : public Screen { }; // Return the list of the scenes -inline std::vector TestbedApplication::getScenes() { +inline etk::Vector TestbedApplication::getScenes() { return mScenes; }