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

Method simulateOrCollide

deps/physx/physx/source/physx/src/NpScene.cpp:1844–1936  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

1842
1843///////////////////////////////////////////////////////////////////////////////
1844void NpScene::simulateOrCollide(PxReal elapsedTime, physx::PxBaseTask* completionTask, void* scratchBlock, PxU32 scratchBlockSize, bool controlSimulation, const char* invalidCallMsg, Sc::SimulationStage::Enum simStage)
1845{
1846 PX_SIMD_GUARD;
1847
1848 {
1849 // write guard must end before simulation kicks off worker threads
1850 // otherwise the simulation callbacks could overlap with this function
1851 // and perform API reads,triggering an error
1852 NP_WRITE_CHECK(this);
1853
1854 PX_PROFILE_START_CROSSTHREAD("Basic.simulate", getContextId());
1855
1856 if(getSimulationStage() != Sc::SimulationStage::eCOMPLETE)
1857 {
1858 //fetchResult doesn't get called
1859 Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, invalidCallMsg);
1860 return;
1861 }
1862
1863 PX_CHECK_AND_RETURN(elapsedTime > 0, "PxScene::collide/simulate: The elapsed time must be positive!");
1864
1865 PX_CHECK_AND_RETURN((reinterpret_cast<size_t>(scratchBlock)&15) == 0, "PxScene::simulate: scratch block must be 16-byte aligned!");
1866
1867 PX_CHECK_AND_RETURN((scratchBlockSize&16383) == 0, "PxScene::simulate: scratch block size must be a multiple of 16K");
1868
1869#if PX_SUPPORT_PVD
1870 //signal the frame is starting.
1871 mScene.getScenePvdClient().frameStart(elapsedTime);
1872#endif
1873
1874#if PX_ENABLE_DEBUG_VISUALIZATION
1875 visualize();
1876#endif
1877
1878 updateDirtyShaders();
1879
1880#if PX_SUPPORT_PVD
1881 mScene.getScenePvdClient().updateJoints();
1882#endif
1883
1884 mScene.getScScene().setScratchBlock(scratchBlock, scratchBlockSize);
1885
1886 mElapsedTime = elapsedTime;
1887 if (simStage == Sc::SimulationStage::eCOLLIDE)
1888 mScene.getScScene().setElapsedTime(elapsedTime);
1889
1890 mControllingSimulation = controlSimulation;
1891
1892 //sync all the material events
1893 NpPhysics& physics = static_cast<NpPhysics&>(this->getPhysics());
1894 NpMaterialManager& manager = physics.getMaterialManager();
1895 NpMaterial** materials = manager.getMaterials();
1896 mScene.updateLowLevelMaterial(materials);
1897
1898 setSimulationStage(simStage);
1899 mScene.setPhysicsBuffering(true);
1900 mHasSimulatedOnce = true;
1901 }

Callers

nothing calls this directly

Calls 15

frameStartMethod · 0.80
getScenePvdClientMethod · 0.80
updateJointsMethod · 0.80
setScratchBlockMethod · 0.80
setElapsedTimeMethod · 0.80
getMaterialManagerMethod · 0.80
resetDependenciesMethod · 0.80
startSimulationMethod · 0.80
setContinuationMethod · 0.80
visualizeFunction · 0.70
setSimulationStageFunction · 0.70

Tested by

no test coverage detected