MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / createScene

Method createScene

physx/source/physx/src/NpPhysics.cpp:253–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253PxScene* NpPhysics::createScene(const PxSceneDesc& desc)
254{
255 PX_CHECK_AND_RETURN_NULL(desc.isValid(), "Physics::createScene: desc.isValid() is false!");
256
257 const PxTolerancesScale& scale = mPhysics.getTolerancesScale();
258 const PxTolerancesScale& descScale = desc.getTolerancesScale();
259 PX_UNUSED(scale);
260 PX_UNUSED(descScale);
261 PX_CHECK_AND_RETURN_NULL((descScale.length == scale.length) && (descScale.speed == scale.speed), "Physics::createScene: PxTolerancesScale must be the same as used for creation of PxPhysics!");
262
263 Ps::Mutex::ScopedLock lock(mSceneAndMaterialMutex); // done here because scene constructor accesses profiling manager of the SDK
264
265 NpScene* npScene = PX_NEW (NpScene)(desc);
266 if(!npScene)
267 {
268 Ps::getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "Unable to create scene.");
269 return NULL;
270 }
271 if(!npScene->getTaskManager())
272 {
273 Ps::getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "Unable to create scene. Task manager creation failed.");
274 return NULL;
275 }
276
277 npScene->loadFromDesc(desc);
278
279#if PX_SUPPORT_PVD
280 if(mPvd)
281 {
282 npScene->mScene.getScenePvdClient().setPsPvd(mPvd);
283 mPvd->addClient(&npScene->mScene.getScenePvdClient());
284 }
285#endif
286
287 if (!sendMaterialTable(*npScene) || !npScene->getScene().isValid())
288 {
289 PX_DELETE(npScene);
290 Ps::getFoundation().error(PxErrorCode::eOUT_OF_MEMORY, __FILE__, __LINE__, "Unable to create scene.");
291 return NULL;
292 }
293
294 mSceneArray.pushBack(npScene);
295 return npScene;
296}
297
298void NpPhysics::releaseSceneInternal(PxScene& scene)
299{

Callers 15

createPhysicsAndSceneFunction · 0.80
initPhysicsFunction · 0.80
initPhysicsFunction · 0.80
initPhysicsFunction · 0.80
initPhysicsFunction · 0.80
initPhysicsFunction · 0.80
initPhysicsFunction · 0.80
initPhysicsFunction · 0.80
initPhysicsFunction · 0.80
initPhysicsFunction · 0.80
initPhysicsFunction · 0.80
initPhysicsFunction · 0.80

Calls 11

PX_UNUSEDFunction · 0.85
getTolerancesScaleMethod · 0.80
errorMethod · 0.80
setPsPvdMethod · 0.80
getScenePvdClientMethod · 0.80
isValidMethod · 0.45
getTaskManagerMethod · 0.45
loadFromDescMethod · 0.45
addClientMethod · 0.45
getSceneMethod · 0.45
pushBackMethod · 0.45

Tested by

no test coverage detected