MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / createScene

Method createScene

deps/physx/physx/source/physx/src/NpPhysics.cpp:257–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 3

PhysicsSolverMethod · 0.45
onInitMethod · 0.45
createPxPhysics_ScenesFunction · 0.45

Calls 11

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

Tested by

no test coverage detected