diff --git a/.gitignore b/.gitignore index bf6b5205..c20237c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# + +/build*/ + # Compiled source # ################### *.com diff --git a/CMakeLists.txt b/CMakeLists.txt index c18a8c65..411310f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,9 @@ # Minimum cmake version required cmake_minimum_required(VERSION 3.8) +set(CMAKE_C_COMPILER_WORKS 1) +set(CMAKE_CXX_COMPILER_WORKS 1) + # Project configuration project(ReactPhysics3D VERSION 0.9.0 LANGUAGES CXX) @@ -24,6 +27,8 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) # Enable testing enable_testing() +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os ${KOS_CPPFLAGS} ${KOS_INC_PATHS} ${KOS_LIB_PATHS} -std=c++17") + # Options option(RP3D_COMPILE_TESTBED "Select this if you want to build the testbed application with demos" OFF) option(RP3D_COMPILE_TESTS "Select this if you want to build the unit tests" OFF) diff --git a/README.md b/README.md index 5a1fdba8..be0a7a36 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +This fork fixes some inconsistencies to get it to compile on 32-bit systems. + +--- +

ReactPhysics3D
diff --git a/include/reactphysics3d/collision/broadphase/DynamicAABBTree.h b/include/reactphysics3d/collision/broadphase/DynamicAABBTree.h index ac80cfe9..17e2de59 100644 --- a/include/reactphysics3d/collision/broadphase/DynamicAABBTree.h +++ b/include/reactphysics3d/collision/broadphase/DynamicAABBTree.h @@ -245,7 +245,7 @@ class DynamicAABBTree { size_t endIndex, Array>& outOverlappingNodes) const; /// Report all shapes overlapping with the AABB given in parameter. - void reportAllShapesOverlappingWithAABB(const AABB& aabb, Array& overlappingNodes) const; + void reportAllShapesOverlappingWithAABB(const AABB& aabb, Array& overlappingNodes) const; /// Ray casting method void raycast(const Ray& ray, DynamicAABBTreeRaycastCallback& callback) const; diff --git a/include/reactphysics3d/configuration.h b/include/reactphysics3d/configuration.h index 6f2de958..9f6776f5 100644 --- a/include/reactphysics3d/configuration.h +++ b/include/reactphysics3d/configuration.h @@ -55,14 +55,22 @@ #define RP3D_FORCE_INLINE inline #endif +namespace std { + template < typename T > std::string to_string( const T& n ) { + std::ostringstream stm ; + stm << n ; + return stm.str() ; + } +} + /// Namespace reactphysics3d namespace reactphysics3d { // ------------------- Type definitions ------------------- // -using uint = unsigned int; -using uchar = unsigned char; -using ushort = unsigned short; +using uint = uint32_t; +using uchar = uint8_t; +using ushort = uint16_t; using luint = long unsigned int; using int8 = std::int8_t; diff --git a/include/reactphysics3d/systems/BroadPhaseSystem.h b/include/reactphysics3d/systems/BroadPhaseSystem.h index d06b5cb3..f9a40a9d 100644 --- a/include/reactphysics3d/systems/BroadPhaseSystem.h +++ b/include/reactphysics3d/systems/BroadPhaseSystem.h @@ -51,10 +51,10 @@ class AABBOverlapCallback : public DynamicAABBTreeOverlapCallback { public: - Array& mOverlappingNodes; + Array& mOverlappingNodes; // Constructor - AABBOverlapCallback(Array& overlappingNodes) : mOverlappingNodes(overlappingNodes) { + AABBOverlapCallback(Array& overlappingNodes) : mOverlappingNodes(overlappingNodes) { } @@ -126,7 +126,7 @@ class BroadPhaseSystem { /// Set with the broad-phase IDs of all collision shapes that have moved (or have been /// created) during the last simulation step. Those are the shapes that need to be tested /// for overlapping in the next simulation step. - Set mMovedShapes; + Set mMovedShapes; /// Reference to the collision detection object CollisionDetectionSystem& mCollisionDetection; diff --git a/include/reactphysics3d/utils/DefaultLogger.h b/include/reactphysics3d/utils/DefaultLogger.h index f4d2e927..2a3ab30d 100644 --- a/include/reactphysics3d/utils/DefaultLogger.h +++ b/include/reactphysics3d/utils/DefaultLogger.h @@ -385,7 +385,7 @@ class DefaultLogger : public Logger { virtual void write(const time_t& time, const std::string& physicsWorldName, const std::string& message, Level level, Category category, const char* filename, int lineNumber) override { - if (static_cast(level) <= static_cast(maxLevelFlag)) { + if (static_cast(level) <= static_cast(maxLevelFlag)) { mFileStream << formatter->format(time, physicsWorldName, message, level, category, filename, lineNumber) << std::endl; } } @@ -425,7 +425,7 @@ class DefaultLogger : public Logger { virtual void write(const time_t& time, const std::string& physicsWorldName, const std::string& message, Level level, Category category, const char* filename, int lineNumber) override { - if (static_cast(level) <= static_cast(maxLevelFlag)) { + if (static_cast(level) <= static_cast(maxLevelFlag)) { mOutputStream << formatter->format(time, physicsWorldName, message, level, category, filename, lineNumber) << std::endl << std::flush; } } diff --git a/src/collision/broadphase/DynamicAABBTree.cpp b/src/collision/broadphase/DynamicAABBTree.cpp index 333d922b..835ab984 100644 --- a/src/collision/broadphase/DynamicAABBTree.cpp +++ b/src/collision/broadphase/DynamicAABBTree.cpp @@ -131,7 +131,7 @@ int32 DynamicAABBTree::allocateNode() { } // Release a node -void DynamicAABBTree::releaseNode(int nodeID) { +void DynamicAABBTree::releaseNode(int32 nodeID) { assert(mNbNodes > 0); assert(nodeID >= 0 && nodeID < mNbAllocatedNodes); @@ -217,7 +217,7 @@ bool DynamicAABBTree::updateObject(int32 nodeID, const AABB& newAABB, bool force // Insert a leaf node in the tree. The process of inserting a new leaf node // in the dynamic tree is described in the book "Introduction to Game Physics // with Box2D" by Ian Parberry. -void DynamicAABBTree::insertLeafNode(int nodeID) { +void DynamicAABBTree::insertLeafNode(int32 nodeID) { // If the tree is empty if (mRootNodeID == TreeNode::NULL_TREE_NODE) { @@ -347,7 +347,7 @@ void DynamicAABBTree::insertLeafNode(int nodeID) { } // Remove a leaf node from the tree -void DynamicAABBTree::removeLeafNode(int nodeID) { +void DynamicAABBTree::removeLeafNode(int32 nodeID) { assert(nodeID >= 0 && nodeID < mNbAllocatedNodes); assert(mNodes[nodeID].isLeaf()); diff --git a/src/collision/shapes/ConcaveMeshShape.cpp b/src/collision/shapes/ConcaveMeshShape.cpp index 3c4294c3..65e2c786 100644 --- a/src/collision/shapes/ConcaveMeshShape.cpp +++ b/src/collision/shapes/ConcaveMeshShape.cpp @@ -139,7 +139,7 @@ void ConcaveMeshShape::computeOverlappingTriangles(const AABB& localAABB, Array< aabb.applyScale(Vector3(decimal(1.0) / mScale.x, decimal(1.0) / mScale.y, decimal(1.0) / mScale.z)); // Compute the nodes of the internal AABB tree that are overlapping with the AABB - Array overlappingNodes(allocator, 64); + Array overlappingNodes(allocator, 64); mDynamicAABBTree.reportAllShapesOverlappingWithAABB(aabb, overlappingNodes); const uint32 nbOverlappingNodes = static_cast(overlappingNodes.size()); @@ -230,7 +230,7 @@ decimal ConcaveMeshRaycastCallback::raycastBroadPhaseShape(int32 nodeId, const R // Raycast all collision shapes that have been collected void ConcaveMeshRaycastCallback::raycastTriangles() { - Array::Iterator it; + Array::Iterator it; decimal smallestHitFraction = mRay.maxFraction; for (it = mHitAABBNodes.begin(); it != mHitAABBNodes.end(); ++it) { diff --git a/src/systems/BroadPhaseSystem.cpp b/src/systems/BroadPhaseSystem.cpp index 7fa3c06f..eda42f93 100644 --- a/src/systems/BroadPhaseSystem.cpp +++ b/src/systems/BroadPhaseSystem.cpp @@ -214,7 +214,7 @@ void BroadPhaseSystem::computeOverlappingPairs(MemoryManager& memoryManager, Arr RP3D_PROFILE("BroadPhaseSystem::computeOverlappingPairs()", mProfiler); // Get the array of the colliders that have moved or have been created in the last frame - Array shapesToTest = mMovedShapes.toArray(memoryManager.getHeapAllocator()); + Array shapesToTest = mMovedShapes.toArray(memoryManager.getHeapAllocator()); // Ask the dynamic AABB tree to report all collision shapes that overlap with the shapes to test mDynamicAABBTree.reportAllShapesOverlappingWithShapes(shapesToTest, 0, static_cast(shapesToTest.size()), overlappingNodes);