Core: Add StackVector class

This commit is contained in:
Jérôme Leclercq
2018-07-02 17:56:27 +02:00
parent 2fcea6b79f
commit 7da0fffe07
4 changed files with 624 additions and 7 deletions

View File

@@ -3,7 +3,7 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Physics3D/PhysWorld3D.hpp>
#include <Nazara/Core/StackArray.hpp>
#include <Nazara/Core/StackVector.hpp>
#include <Newton/Newton.h>
#include <cassert>
#include <Nazara/Physics3D/Debug.hpp>
@@ -173,13 +173,9 @@ namespace Nz
using ContactJoint = void*;
// Query all joints first, to prevent removing a joint from the list while iterating on it
StackArray<ContactJoint> contacts = NazaraStackArray(ContactJoint, NewtonContactJointGetContactCount(contactJoint));
std::size_t contactIndex = 0;
StackVector<ContactJoint> contacts = NazaraStackVector(ContactJoint, NewtonContactJointGetContactCount(contactJoint));
for (ContactJoint contact = NewtonContactJointGetFirstContact(contactJoint); contact; contact = NewtonContactJointGetNextContact(contactJoint, contact))
{
assert(contactIndex < contacts.size());
contacts[contactIndex++] = contact;
}
contacts.push_back(contact);
for (ContactJoint contact : contacts)
{