diff --git a/include/reactphysics3d/collision/broadphase/DynamicAABBTree.h b/include/reactphysics3d/collision/broadphase/DynamicAABBTree.h index a354de7c..d565ca39 100644 --- a/include/reactphysics3d/collision/broadphase/DynamicAABBTree.h +++ b/include/reactphysics3d/collision/broadphase/DynamicAABBTree.h @@ -90,6 +90,11 @@ struct TreeNode { // -------------------- Methods -------------------- // + /// Constructor + TreeNode() : nextNodeID(NULL_TREE_NODE), height(-1) { + + } + /// Return true if the node is a leaf of the tree bool isLeaf() const; }; diff --git a/include/reactphysics3d/components/BallAndSocketJointComponents.h b/include/reactphysics3d/components/BallAndSocketJointComponents.h index 52886d94..1a080bb6 100644 --- a/include/reactphysics3d/components/BallAndSocketJointComponents.h +++ b/include/reactphysics3d/components/BallAndSocketJointComponents.h @@ -131,8 +131,12 @@ class BallAndSocketJointComponents : public Components { /// Structure for the data of a transform component struct BallAndSocketJointComponent { + bool isConeLimitEnabled; + decimal coneLimitHalfAngle; + /// Constructor - BallAndSocketJointComponent() { + BallAndSocketJointComponent(bool isConeLimitEnabled, decimal coneLimitHalfAngle) + : isConeLimitEnabled(isConeLimitEnabled), coneLimitHalfAngle(coneLimitHalfAngle) { } }; diff --git a/include/reactphysics3d/containers/Array.h b/include/reactphysics3d/containers/Array.h index 74c9a507..9d01c6ff 100755 --- a/include/reactphysics3d/containers/Array.h +++ b/include/reactphysics3d/containers/Array.h @@ -93,12 +93,6 @@ class Array { } - /// Copy constructor - Iterator(const Iterator& it) - :mCurrentIndex(it.mCurrentIndex), mBuffer(it.mBuffer), mSize(it.mSize) { - - } - /// Deferencable reference operator*() { assert(mCurrentIndex >= 0 && mCurrentIndex < mSize); diff --git a/include/reactphysics3d/containers/Map.h b/include/reactphysics3d/containers/Map.h index 42bc3474..c46f22ef 100755 --- a/include/reactphysics3d/containers/Map.h +++ b/include/reactphysics3d/containers/Map.h @@ -162,12 +162,6 @@ class Map { } - /// Copy constructor - Iterator(const Iterator& it) - :mMap(it.mMap), mCurrentBucketIndex(it.mCurrentBucketIndex), mCurrentEntryIndex(it.mCurrentEntryIndex) { - - } - /// Deferencable reference operator*() const { assert(mCurrentEntryIndex < mMap->mNbAllocatedEntries); @@ -204,20 +198,6 @@ class Map { bool operator!=(const Iterator& iterator) const { return !(*this == iterator); } - - /// Overloaded assignment operator - Iterator& operator=(const Iterator& it) { - - // Check for self assignment - if (this != &it) { - - mMap = it.mMap; - mCurrentBucketIndex = it.mCurrentBucketIndex; - mCurrentEntryIndex = it.mCurrentEntryIndex; - } - - return *this; - } }; diff --git a/include/reactphysics3d/containers/Pair.h b/include/reactphysics3d/containers/Pair.h index e07c070e..a9143693 100644 --- a/include/reactphysics3d/containers/Pair.h +++ b/include/reactphysics3d/containers/Pair.h @@ -59,14 +59,6 @@ class Pair { } - /// Copy constructor - Pair(const Pair& pair) : first(pair.first), second(pair.second) { - - } - - /// Destructor - ~Pair() = default; - /// Overloaded equality operator bool operator==(const Pair& pair) const { return first == pair.first && second == pair.second; @@ -76,13 +68,6 @@ class Pair { bool operator!=(const Pair& pair) const { return !((*this) == pair); } - - /// Overloaded assignment operator - Pair& operator=(const Pair& pair) { - first = pair.first; - second = pair.second; - return *this; - } }; } diff --git a/include/reactphysics3d/containers/Set.h b/include/reactphysics3d/containers/Set.h index f524d17a..5db0b7f1 100755 --- a/include/reactphysics3d/containers/Set.h +++ b/include/reactphysics3d/containers/Set.h @@ -162,12 +162,6 @@ class Set { } - /// Copy constructor - Iterator(const Iterator& it) - :mSet(it.mSet), mCurrentBucketIndex(it.mCurrentBucketIndex), mCurrentEntryIndex(it.mCurrentEntryIndex) { - - } - /// Deferencable reference operator*() const { assert(mCurrentEntryIndex < mSet->mNbAllocatedEntries); @@ -204,20 +198,6 @@ class Set { bool operator!=(const Iterator& iterator) const { return !(*this == iterator); } - - /// Overloaded assignment operator - Iterator& operator=(const Iterator& it) { - - // Check for self assignment - if (this != &it) { - - mSet = it.mSet; - mCurrentBucketIndex = it.mCurrentBucketIndex; - mCurrentEntryIndex = it.mCurrentEntryIndex; - } - - return *this; - } }; diff --git a/src/collision/broadphase/DynamicAABBTree.cpp b/src/collision/broadphase/DynamicAABBTree.cpp index e01fbe16..ddcb3c7e 100644 --- a/src/collision/broadphase/DynamicAABBTree.cpp +++ b/src/collision/broadphase/DynamicAABBTree.cpp @@ -58,7 +58,11 @@ void DynamicAABBTree::init() { // Allocate memory for the nodes of the tree mNodes = static_cast(mAllocator.allocate(static_cast(mNbAllocatedNodes) * sizeof(TreeNode))); assert(mNodes); - std::memset(mNodes, 0, static_cast(mNbAllocatedNodes) * sizeof(TreeNode)); + + // Construct the nodes + for (int32 i=0; i < mNbAllocatedNodes; i++) { + new (mNodes + i) TreeNode(); + } // Initialize the allocated nodes for (int32 i=0; i(mNbAllocatedNodes) * sizeof(TreeNode)); @@ -94,11 +103,15 @@ int32 DynamicAABBTree::allocateNode() { TreeNode* oldNodes = mNodes; mNodes = static_cast(mAllocator.allocate(static_cast(mNbAllocatedNodes) * sizeof(TreeNode))); assert(mNodes); - memcpy(mNodes, oldNodes, static_cast(mNbNodes) * sizeof(TreeNode)); + + // Copy the elements to the new allocated memory location + std::uninitialized_copy(oldNodes, oldNodes + mNbNodes, mNodes); + mAllocator.release(oldNodes, static_cast(oldNbAllocatedNodes) * sizeof(TreeNode)); // Initialize the allocated nodes for (int32 i=mNbNodes; i