void NewtonDemos::OnSelectNumberOfMicroThreads(wxCommandEvent& event) { BEGIN_MENU_OPTION(); m_microthreadIndex = event.GetId() - ID_SELECT_MICROTHREADS; NewtonSetThreadsCount(m_scene->GetNewton(), m_threadsTracks[m_microthreadIndex]); END_MENU_OPTION(); }
dNewton::dNewton() :m_maxUpdatePerIterations(2) { // create a newton world m_world = NewtonCreate(); // for two way communication between low and high lever, link the world with this class for NewtonWorldSetUserData(m_world, this); // set the simplified solver mode (faster but less accurate) NewtonSetSolverModel (m_world, 1); // by default runs on four micro threads NewtonSetThreadsCount(m_world, 4); // set the collision copy constructor callback NewtonWorldSetCollisionConstructorDestructorCallback (m_world, OnCollisionCopyConstruct, OnCollisionDestructorCallback); // use default material to implement traditional "Game style" one side material system int defaultMaterial = NewtonMaterialGetDefaultGroupID (m_world); NewtonMaterialSetCallbackUserData (m_world, defaultMaterial, defaultMaterial, m_world); NewtonMaterialSetCompoundCollisionCallback(m_world, defaultMaterial, defaultMaterial, OnCompoundSubCollisionAABBOverlap); NewtonMaterialSetCollisionCallback (m_world, defaultMaterial, defaultMaterial, OnBodiesAABBOverlap, OnContactProcess); // add a hierarchical transform manage to update local transforms new dNewtonTransformManager (this); // set the timer ResetTimer(); }
void World::setThreadCount(int threads) { // clean up all pending bodies for update for( BodyVectorVector::iterator it = m_bodyUpdateNodeRequests.begin(); it != m_bodyUpdateNodeRequests.end(); it++ ) { for( BodyVector::iterator body = it->begin(); body != it->end(); body++ ) { (*body)->SetNodeUpdateState (false); } it->clear(); } NewtonSetThreadsCount (m_world, threads) ; // resize the update queue m_bodyUpdateNodeRequests.resize(getThreadCount()); }
iPhysicsWorld* iPhysics::createWorld() { iPhysicsWorld* result = nullptr; #ifdef __IGOR_DEBUG__ _worldListMutex.lock(); // this is a workaround to prevent an assertion within the creation of a newton world #endif NewtonWorld* world = NewtonCreate(); NewtonSetSolverModel(static_cast<const NewtonWorld*>(world), 1); NewtonSetThreadsCount(static_cast<const NewtonWorld*>(world), 4); result = new iPhysicsWorld(world); #ifndef __IGOR_DEBUG__ _worldListMutex.lock(); // this is a workaround to prevent an assertion within the creation of a newton world #endif _worlds[result->getID()] = result; _worldListMutex.unlock(); return result; }
void world::threads(unsigned n) { NewtonSetThreadsCount(_world, n); }
void NewtonDemos::RestoreSettings () { NewtonSetCurrentDevice (m_scene->GetNewton(), m_hardwareDevice); NewtonSetThreadsCount(m_scene->GetNewton(), m_threadsTracks[m_microthreadIndex]); }
void dNewton::SetNumberOfThreads(int threadCount) { // by default runs on four micro threads NewtonSetThreadsCount(m_world, threadCount); }
void PhysWorld3D::SetThreadCount(unsigned int threadCount) { NewtonSetThreadsCount(m_world, threadCount); }