Merge branch 'master' into physics3d-material

This commit is contained in:
Lynix
2018-02-11 14:39:14 +01:00
19 changed files with 352 additions and 96 deletions

View File

@@ -32,7 +32,7 @@ namespace Nz
bool IsPaused() const;
void Pause();
void Restart();
UInt64 Restart();
void Unpause();
Clock& operator=(const Clock& clock) = default;
@@ -46,7 +46,7 @@ namespace Nz
bool m_paused;
};
typedef UInt64 (*ClockFunction)();
using ClockFunction = UInt64 (*)();
extern NAZARA_CORE_API ClockFunction GetElapsedMicroseconds;
extern NAZARA_CORE_API ClockFunction GetElapsedMilliseconds;

View File

@@ -54,6 +54,8 @@ namespace Nz
float GetDamping() const;
Vector2f GetGravity() const;
cpSpace* GetHandle() const;
std::size_t GetIterationCount() const;
std::size_t GetMaxStepCount() const;
float GetStepSize() const;
bool NearestBodyQuery(const Vector2f& from, float maxDistance, Nz::UInt32 collisionGroup, Nz::UInt32 categoryMask, Nz::UInt32 collisionMask, RigidBody2D** nearestBody = nullptr);
@@ -69,10 +71,14 @@ namespace Nz
void SetDamping(float dampingValue);
void SetGravity(const Vector2f& gravity);
void SetIterationCount(std::size_t iterationCount);
void SetMaxStepCount(std::size_t maxStepCount);
void SetStepSize(float stepSize);
void Step(float timestep);
void UseSpatialHash(float cellSize, std::size_t entityCount);
PhysWorld2D& operator=(const PhysWorld2D&) = delete;
PhysWorld2D& operator=(PhysWorld2D&&) = delete; ///TODO
@@ -140,6 +146,7 @@ namespace Nz
static_assert(std::is_nothrow_move_constructible<PostStepContainer>::value, "PostStepContainer should be noexcept MoveConstructible");
std::size_t m_maxStepCount;
std::unordered_map<cpCollisionHandler*, std::unique_ptr<Callback>> m_callbacks;
std::unordered_map<RigidBody2D*, PostStepContainer> m_rigidPostSteps;
cpSpace* m_handle;

View File

@@ -42,9 +42,11 @@ namespace Nz
Vector3f GetGravity() const;
NewtonWorld* GetHandle() const;
int GetMaterial(const Nz::String& name);
std::size_t GetMaxStepCount() const;
float GetStepSize() const;
void SetGravity(const Vector3f& gravity);
void SetMaxStepCount(std::size_t maxStepCount);
void SetSolverModel(unsigned int model);
void SetStepSize(float stepSize);
@@ -72,6 +74,7 @@ namespace Nz
std::unordered_map<Nz::UInt64, std::unique_ptr<Callback>> m_callbacks;
std::unordered_map<Nz::String, int> m_materialIds;
std::size_t m_maxStepCount;
Vector3f m_gravity;
NewtonWorld* m_world;
float m_stepSize;