fixes for dreamcast compilation
This commit is contained in:
parent
b289487583
commit
0ccc7813fc
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,3 +1,7 @@
|
||||||
|
#
|
||||||
|
|
||||||
|
/build*/
|
||||||
|
|
||||||
# Compiled source #
|
# Compiled source #
|
||||||
###################
|
###################
|
||||||
*.com
|
*.com
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
# Minimum cmake version required
|
# Minimum cmake version required
|
||||||
cmake_minimum_required(VERSION 3.8)
|
cmake_minimum_required(VERSION 3.8)
|
||||||
|
|
||||||
|
set(CMAKE_C_COMPILER_WORKS 1)
|
||||||
|
set(CMAKE_CXX_COMPILER_WORKS 1)
|
||||||
|
|
||||||
# Project configuration
|
# Project configuration
|
||||||
project(ReactPhysics3D VERSION 0.9.0 LANGUAGES CXX)
|
project(ReactPhysics3D VERSION 0.9.0 LANGUAGES CXX)
|
||||||
|
|
||||||
|
@ -24,6 +27,8 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
|
||||||
# Enable testing
|
# Enable testing
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os ${KOS_CPPFLAGS} ${KOS_INC_PATHS} ${KOS_LIB_PATHS} -std=c++17")
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
option(RP3D_COMPILE_TESTBED "Select this if you want to build the testbed application with demos" OFF)
|
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)
|
option(RP3D_COMPILE_TESTS "Select this if you want to build the unit tests" OFF)
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
This fork fixes some inconsistencies to get it to compile on 32-bit systems.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
<h1 align="center">
|
<h1 align="center">
|
||||||
<a href="https://www.reactphysics3d.com"><img src="https://github.com/DanielChappuis/reactphysics3d/blob/62e17155e3fc187f4a90f7328c1154fc47e41d69/documentation/UserManual/images/ReactPhysics3DLogo.png" alt="ReactPhysics3D" width="300"></a>
|
<a href="https://www.reactphysics3d.com"><img src="https://github.com/DanielChappuis/reactphysics3d/blob/62e17155e3fc187f4a90f7328c1154fc47e41d69/documentation/UserManual/images/ReactPhysics3DLogo.png" alt="ReactPhysics3D" width="300"></a>
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -245,7 +245,7 @@ class DynamicAABBTree {
|
||||||
size_t endIndex, Array<Pair<int32, int32>>& outOverlappingNodes) const;
|
size_t endIndex, Array<Pair<int32, int32>>& outOverlappingNodes) const;
|
||||||
|
|
||||||
/// Report all shapes overlapping with the AABB given in parameter.
|
/// Report all shapes overlapping with the AABB given in parameter.
|
||||||
void reportAllShapesOverlappingWithAABB(const AABB& aabb, Array<int>& overlappingNodes) const;
|
void reportAllShapesOverlappingWithAABB(const AABB& aabb, Array<int32>& overlappingNodes) const;
|
||||||
|
|
||||||
/// Ray casting method
|
/// Ray casting method
|
||||||
void raycast(const Ray& ray, DynamicAABBTreeRaycastCallback& callback) const;
|
void raycast(const Ray& ray, DynamicAABBTreeRaycastCallback& callback) const;
|
||||||
|
|
|
@ -55,14 +55,22 @@
|
||||||
#define RP3D_FORCE_INLINE inline
|
#define RP3D_FORCE_INLINE inline
|
||||||
#endif
|
#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
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
||||||
// ------------------- Type definitions ------------------- //
|
// ------------------- Type definitions ------------------- //
|
||||||
|
|
||||||
using uint = unsigned int;
|
using uint = uint32_t;
|
||||||
using uchar = unsigned char;
|
using uchar = uint8_t;
|
||||||
using ushort = unsigned short;
|
using ushort = uint16_t;
|
||||||
using luint = long unsigned int;
|
using luint = long unsigned int;
|
||||||
|
|
||||||
using int8 = std::int8_t;
|
using int8 = std::int8_t;
|
||||||
|
|
|
@ -51,10 +51,10 @@ class AABBOverlapCallback : public DynamicAABBTreeOverlapCallback {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Array<int>& mOverlappingNodes;
|
Array<int32>& mOverlappingNodes;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
AABBOverlapCallback(Array<int>& overlappingNodes) : mOverlappingNodes(overlappingNodes) {
|
AABBOverlapCallback(Array<int32>& 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
|
/// 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
|
/// created) during the last simulation step. Those are the shapes that need to be tested
|
||||||
/// for overlapping in the next simulation step.
|
/// for overlapping in the next simulation step.
|
||||||
Set<int> mMovedShapes;
|
Set<int32> mMovedShapes;
|
||||||
|
|
||||||
/// Reference to the collision detection object
|
/// Reference to the collision detection object
|
||||||
CollisionDetectionSystem& mCollisionDetection;
|
CollisionDetectionSystem& mCollisionDetection;
|
||||||
|
|
|
@ -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,
|
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 {
|
const char* filename, int lineNumber) override {
|
||||||
|
|
||||||
if (static_cast<int>(level) <= static_cast<int>(maxLevelFlag)) {
|
if (static_cast<int32>(level) <= static_cast<int32>(maxLevelFlag)) {
|
||||||
mFileStream << formatter->format(time, physicsWorldName, message, level, category, filename, lineNumber) << std::endl;
|
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,
|
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 {
|
const char* filename, int lineNumber) override {
|
||||||
|
|
||||||
if (static_cast<int>(level) <= static_cast<int>(maxLevelFlag)) {
|
if (static_cast<int32>(level) <= static_cast<int32>(maxLevelFlag)) {
|
||||||
mOutputStream << formatter->format(time, physicsWorldName, message, level, category, filename, lineNumber) << std::endl << std::flush;
|
mOutputStream << formatter->format(time, physicsWorldName, message, level, category, filename, lineNumber) << std::endl << std::flush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ int32 DynamicAABBTree::allocateNode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release a node
|
// Release a node
|
||||||
void DynamicAABBTree::releaseNode(int nodeID) {
|
void DynamicAABBTree::releaseNode(int32 nodeID) {
|
||||||
|
|
||||||
assert(mNbNodes > 0);
|
assert(mNbNodes > 0);
|
||||||
assert(nodeID >= 0 && nodeID < mNbAllocatedNodes);
|
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
|
// 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
|
// in the dynamic tree is described in the book "Introduction to Game Physics
|
||||||
// with Box2D" by Ian Parberry.
|
// with Box2D" by Ian Parberry.
|
||||||
void DynamicAABBTree::insertLeafNode(int nodeID) {
|
void DynamicAABBTree::insertLeafNode(int32 nodeID) {
|
||||||
|
|
||||||
// If the tree is empty
|
// If the tree is empty
|
||||||
if (mRootNodeID == TreeNode::NULL_TREE_NODE) {
|
if (mRootNodeID == TreeNode::NULL_TREE_NODE) {
|
||||||
|
@ -347,7 +347,7 @@ void DynamicAABBTree::insertLeafNode(int nodeID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove a leaf node from the tree
|
// Remove a leaf node from the tree
|
||||||
void DynamicAABBTree::removeLeafNode(int nodeID) {
|
void DynamicAABBTree::removeLeafNode(int32 nodeID) {
|
||||||
|
|
||||||
assert(nodeID >= 0 && nodeID < mNbAllocatedNodes);
|
assert(nodeID >= 0 && nodeID < mNbAllocatedNodes);
|
||||||
assert(mNodes[nodeID].isLeaf());
|
assert(mNodes[nodeID].isLeaf());
|
||||||
|
|
|
@ -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));
|
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
|
// Compute the nodes of the internal AABB tree that are overlapping with the AABB
|
||||||
Array<int> overlappingNodes(allocator, 64);
|
Array<int32> overlappingNodes(allocator, 64);
|
||||||
mDynamicAABBTree.reportAllShapesOverlappingWithAABB(aabb, overlappingNodes);
|
mDynamicAABBTree.reportAllShapesOverlappingWithAABB(aabb, overlappingNodes);
|
||||||
|
|
||||||
const uint32 nbOverlappingNodes = static_cast<uint32>(overlappingNodes.size());
|
const uint32 nbOverlappingNodes = static_cast<uint32>(overlappingNodes.size());
|
||||||
|
@ -230,7 +230,7 @@ decimal ConcaveMeshRaycastCallback::raycastBroadPhaseShape(int32 nodeId, const R
|
||||||
// Raycast all collision shapes that have been collected
|
// Raycast all collision shapes that have been collected
|
||||||
void ConcaveMeshRaycastCallback::raycastTriangles() {
|
void ConcaveMeshRaycastCallback::raycastTriangles() {
|
||||||
|
|
||||||
Array<int>::Iterator it;
|
Array<int32>::Iterator it;
|
||||||
decimal smallestHitFraction = mRay.maxFraction;
|
decimal smallestHitFraction = mRay.maxFraction;
|
||||||
|
|
||||||
for (it = mHitAABBNodes.begin(); it != mHitAABBNodes.end(); ++it) {
|
for (it = mHitAABBNodes.begin(); it != mHitAABBNodes.end(); ++it) {
|
||||||
|
|
|
@ -214,7 +214,7 @@ void BroadPhaseSystem::computeOverlappingPairs(MemoryManager& memoryManager, Arr
|
||||||
RP3D_PROFILE("BroadPhaseSystem::computeOverlappingPairs()", mProfiler);
|
RP3D_PROFILE("BroadPhaseSystem::computeOverlappingPairs()", mProfiler);
|
||||||
|
|
||||||
// Get the array of the colliders that have moved or have been created in the last frame
|
// Get the array of the colliders that have moved or have been created in the last frame
|
||||||
Array<int> shapesToTest = mMovedShapes.toArray(memoryManager.getHeapAllocator());
|
Array<int32> shapesToTest = mMovedShapes.toArray(memoryManager.getHeapAllocator());
|
||||||
|
|
||||||
// Ask the dynamic AABB tree to report all collision shapes that overlap with the shapes to test
|
// Ask the dynamic AABB tree to report all collision shapes that overlap with the shapes to test
|
||||||
mDynamicAABBTree.reportAllShapesOverlappingWithShapes(shapesToTest, 0, static_cast<uint32>(shapesToTest.size()), overlappingNodes);
|
mDynamicAABBTree.reportAllShapesOverlappingWithShapes(shapesToTest, 0, static_cast<uint32>(shapesToTest.size()), overlappingNodes);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user