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

Method updateRenderPlatforms

physx/samples/samplebridges/SampleBridges.cpp:840–879  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

838
839#ifdef PLATFORMS_AS_OBSTACLES
840void SampleBridges::updateRenderPlatforms(float dtime)
841{
842 // PT: compute new positions for (render) platforms, then move their corresponding obstacles to these positions.
843 const PxU32 nbPlatforms = mPlatformManager.getNbPlatforms();
844 KinematicPlatform** platforms = mPlatformManager.getPlatforms();
845
846 {
847 PxSceneReadLock scopedLock(*mScene);
848
849 for(PxU32 i=0;i<nbPlatforms;i++)
850 {
851 if(1)
852 {
853 PxRigidDynamic* actor = platforms[i]->getPhysicsActor();
854 PxShape* shape = NULL;
855 actor->getShapes(&shape, 1);
856 RenderBaseActor* renderActor = getRenderActor(actor, shape);
857 renderActor->setTransform(platforms[i]->getRenderPose());
858 }
859
860 platforms[i]->updateRender(dtime, mObstacleContext);
861 }
862 }
863
864 // PT: if render time & physics time varies too much, we must resync the physics to avoid large visual mismatchs
865 if(mMustResync)
866 {
867 PxSceneWriteLock scopedLock(*mScene);
868
869// mElapsedPlatformTime = mElapsedRenderTime;
870 mPlatformManager.syncElapsedTime(mElapsedRenderTime);
871// static int count=0; shdfnd::printFormatted("Resync %d\n", count++);
872 for(PxU32 i=0;i<nbPlatforms;i++)
873 {
874 PxRigidDynamic* actor = platforms[i]->getPhysicsActor();
875 actor->setKinematicTarget(platforms[i]->getRenderPose());
876 platforms[i]->resync();
877 }
878 }
879}
880#endif
881
882///////////////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 9

getNbPlatformsMethod · 0.80
getPlatformsMethod · 0.80
setTransformMethod · 0.80
updateRenderMethod · 0.80
syncElapsedTimeMethod · 0.80
resyncMethod · 0.80
getPhysicsActorMethod · 0.45
getShapesMethod · 0.45
setKinematicTargetMethod · 0.45

Tested by

no test coverage detected