From 01ccca433da8ad82fd98528664771bb2b1503383 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 15 Jul 2018 16:46:01 +0200 Subject: [PATCH] Physics/PhysWorld3D: Add [Get|Set]ThreadCount --- include/Nazara/Physics3D/PhysWorld3D.hpp | 2 ++ src/Nazara/Physics3D/PhysWorld3D.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/Nazara/Physics3D/PhysWorld3D.hpp b/include/Nazara/Physics3D/PhysWorld3D.hpp index 223fce4fe..129c2d89c 100644 --- a/include/Nazara/Physics3D/PhysWorld3D.hpp +++ b/include/Nazara/Physics3D/PhysWorld3D.hpp @@ -45,11 +45,13 @@ namespace Nz int GetMaterial(const String& name); std::size_t GetMaxStepCount() const; float GetStepSize() const; + unsigned int GetThreadCount() const; void SetGravity(const Vector3f& gravity); void SetMaxStepCount(std::size_t maxStepCount); void SetSolverModel(unsigned int model); void SetStepSize(float stepSize); + void SetThreadCount(unsigned int threadCount); void SetMaterialCollisionCallback(int firstMaterial, int secondMaterial, AABBOverlapCallback aabbOverlapCallback, CollisionCallback collisionCallback); void SetMaterialDefaultCollidable(int firstMaterial, int secondMaterial, bool collidable); diff --git a/src/Nazara/Physics3D/PhysWorld3D.cpp b/src/Nazara/Physics3D/PhysWorld3D.cpp index 01ed2226b..bce1f5b6d 100644 --- a/src/Nazara/Physics3D/PhysWorld3D.cpp +++ b/src/Nazara/Physics3D/PhysWorld3D.cpp @@ -76,6 +76,11 @@ namespace Nz return m_stepSize; } + unsigned int PhysWorld3D::GetThreadCount() const + { + return NewtonGetThreadsCount(m_world); + } + void PhysWorld3D::SetGravity(const Vector3f& gravity) { m_gravity = gravity; @@ -96,6 +101,11 @@ namespace Nz m_stepSize = stepSize; } + void PhysWorld3D::SetThreadCount(unsigned int threadCount) + { + NewtonSetThreadsCount(m_world, threadCount); + } + void PhysWorld3D::SetMaterialCollisionCallback(int firstMaterial, int secondMaterial, AABBOverlapCallback aabbOverlapCallback, CollisionCallback collisionCallback) { static_assert(sizeof(UInt64) >= 2 * sizeof(int), "Oops");