mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 00:24:40 +00:00
Merge pull request #998 from rextimmy/physx3_cpu_dispatcher_fix
Fixed issue where physx3 cpu dispatcher was created multiple times
This commit is contained in:
commit
e9308e40ed
1 changed files with 18 additions and 15 deletions
|
|
@ -201,24 +201,27 @@ void Px3World::destroyWorld()
|
||||||
|
|
||||||
bool Px3World::initWorld( bool isServer, ProcessList *processList )
|
bool Px3World::initWorld( bool isServer, ProcessList *processList )
|
||||||
{
|
{
|
||||||
if ( !gPhysics3SDK )
|
if ( !gPhysics3SDK )
|
||||||
{
|
{
|
||||||
Con::errorf( "Physx3World::init - PhysXSDK not initialized!" );
|
Con::errorf( "Physx3World::init - PhysXSDK not initialized!" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mIsServer = isServer;
|
mIsServer = isServer;
|
||||||
|
|
||||||
physx::PxSceneDesc sceneDesc(gPhysics3SDK->getTolerancesScale());
|
physx::PxSceneDesc sceneDesc(gPhysics3SDK->getTolerancesScale());
|
||||||
|
|
||||||
sceneDesc.gravity = px3Cast<physx::PxVec3>(mGravity);
|
sceneDesc.gravity = px3Cast<physx::PxVec3>(mGravity);
|
||||||
sceneDesc.userData = this;
|
sceneDesc.userData = this;
|
||||||
if(!sceneDesc.cpuDispatcher)
|
if(!sceneDesc.cpuDispatcher)
|
||||||
{
|
{
|
||||||
smCpuDispatcher = physx::PxDefaultCpuDispatcherCreate(PHYSICSMGR->getThreadCount());
|
//Create shared cpu dispatcher
|
||||||
sceneDesc.cpuDispatcher = smCpuDispatcher;
|
if(!smCpuDispatcher)
|
||||||
Con::printf("PhysX3 using Cpu: %d workers", smCpuDispatcher->getWorkerCount());
|
smCpuDispatcher = physx::PxDefaultCpuDispatcherCreate(PHYSICSMGR->getThreadCount());
|
||||||
}
|
|
||||||
|
sceneDesc.cpuDispatcher = smCpuDispatcher;
|
||||||
|
Con::printf("PhysX3 using Cpu: %d workers", smCpuDispatcher->getWorkerCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_CCD;
|
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_CCD;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue