| 176 | } |
| 177 | |
| 178 | NpPhysics* NpPhysics::createInstance(PxU32 version, PxFoundation& foundation, const PxTolerancesScale& scale, bool trackOutstandingAllocations, pvdsdk::PsPvd* pvd) |
| 179 | { |
| 180 | PX_UNUSED(foundation); |
| 181 | |
| 182 | #if PX_SWITCH |
| 183 | NpSetMiddlewareInfo(); // register middleware info such that PhysX usage can be tracked |
| 184 | #endif |
| 185 | |
| 186 | if (version!=PX_PHYSICS_VERSION) |
| 187 | { |
| 188 | char buffer[256]; |
| 189 | Ps::snprintf(buffer, 256, "Wrong version: PhysX version is 0x%08x, tried to create 0x%08x", PX_PHYSICS_VERSION, version); |
| 190 | foundation.getErrorCallback().reportError(PxErrorCode::eINVALID_PARAMETER, buffer, __FILE__, __LINE__); |
| 191 | return NULL; |
| 192 | } |
| 193 | |
| 194 | if (!scale.isValid()) |
| 195 | { |
| 196 | foundation.getErrorCallback().reportError(PxErrorCode::eINVALID_PARAMETER, "Scale invalid.\n", __FILE__, __LINE__); |
| 197 | return NULL; |
| 198 | } |
| 199 | |
| 200 | if(0 == mRefCount) |
| 201 | { |
| 202 | PX_ASSERT(static_cast<Ps::Foundation*>(&foundation) == &Ps::Foundation::getInstance()); |
| 203 | |
| 204 | Ps::Foundation::incRefCount(); |
| 205 | |
| 206 | // init offset tables for Pxs/Sc/Scb/Px conversions |
| 207 | PxvOffsetTable pxvOffsetTable; |
| 208 | initOffsetTables(pxvOffsetTable); |
| 209 | |
| 210 | //SerialFactory::createInstance(); |
| 211 | mInstance = PX_NEW (NpPhysics)(scale, pxvOffsetTable, trackOutstandingAllocations, pvd); |
| 212 | NpFactory::createInstance(); |
| 213 | |
| 214 | #if PX_SUPPORT_PVD |
| 215 | if(pvd) |
| 216 | { |
| 217 | NpFactory::getInstance().setNpFactoryListener( *mInstance->mPvdPhysicsClient ); |
| 218 | pvd->addClient(mInstance->mPvdPhysicsClient); |
| 219 | } |
| 220 | #endif |
| 221 | |
| 222 | NpFactory::getInstance().addFactoryListener(mInstance->mDeletionMeshListener); |
| 223 | } |
| 224 | ++mRefCount; |
| 225 | |
| 226 | return mInstance; |
| 227 | } |
| 228 | |
| 229 | PxU32 NpPhysics::releaseInstance() |
| 230 | { |
nothing calls this directly
no test coverage detected