本文整理汇总了C++中PxScene::fetchResults方法的典型用法代码示例。如果您正苦于以下问题:C++ PxScene::fetchResults方法的具体用法?C++ PxScene::fetchResults怎么用?C++ PxScene::fetchResults使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PxScene
的用法示例。
在下文中一共展示了PxScene::fetchResults方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessPhysScene
void FPhysScene::ProcessPhysScene(uint32 SceneType)
{
SCOPE_CYCLE_COUNTER(STAT_TotalPhysicsTime);
SCOPE_CYCLE_COUNTER(STAT_PhysicsFetchDynamicsTime);
check(SceneType < NumPhysScenes);
if (bPhysXSceneExecuting[SceneType] == 0)
{
// Not executing this scene, must call TickPhysScene before calling this function again.
UE_LOG(LogPhysics, Log, TEXT("WaitPhysScene`: Not executing this scene (%d) - aborting."), SceneType);
return;
}
if (FrameLagAsync())
{
static_assert(PST_MAX == 3, "Physics scene static test failed."); // Here we assume the PST_Sync is the master and never fame lagged
if (SceneType == PST_Sync)
{
// the one frame lagged one should be done by now.
check(!FrameLaggedPhysicsSubsceneCompletion[PST_Async].GetReference() || FrameLaggedPhysicsSubsceneCompletion[PST_Async]->IsComplete());
}
else if (SceneType == PST_Async)
{
FrameLaggedPhysicsSubsceneCompletion[PST_Async] = NULL;
}
}
// Reset execution flag
//This fetches and gets active transforms. It's important that the function that calls this locks because getting the transforms and using the data must be an atomic operation
#if WITH_PHYSX
PxScene* PScene = GetPhysXScene(SceneType);
check(PScene);
PxU32 OutErrorCode = 0;
#if !WITH_APEX
PScene->lockWrite();
PScene->fetchResults(true, &OutErrorCode);
PScene->unlockWrite();
#else // #if !WITH_APEX
// The APEX scene calls the fetchResults function for the PhysX scene, so we only call ApexScene->fetchResults().
NxApexScene* ApexScene = GetApexScene(SceneType);
check(ApexScene);
ApexScene->fetchResults(true, &OutErrorCode);
#endif // #if !WITH_APEX
UpdateActiveTransforms(SceneType);
if (OutErrorCode != 0)
{
UE_LOG(LogPhysics, Log, TEXT("PHYSX FETCHRESULTS ERROR: %d"), OutErrorCode);
}
#endif // WITH_PHYSX
PhysicsSubsceneCompletion[SceneType] = NULL;
bPhysXSceneExecuting[SceneType] = false;
}
示例2: update
void Engine::update( double step )
{
for ( SceneMap::iterator itr=_sceneMap.begin(); itr!=_sceneMap.end(); ++itr )
{
PxScene* scene = itr->second;
scene->simulate( step );
while( !scene->fetchResults() ) { /* do nothing but wait */ }
}
}
示例3: ProcessPhysScene
void FPhysScene::ProcessPhysScene(uint32 SceneType)
{
SCOPE_CYCLE_COUNTER(STAT_TotalPhysicsTime);
SCOPE_CYCLE_COUNTER(STAT_PhysicsFetchDynamicsTime);
check(SceneType < NumPhysScenes);
if( bPhysXSceneExecuting[SceneType] == 0 )
{
// Not executing this scene, must call TickPhysScene before calling this function again.
UE_LOG(LogPhysics, Log, TEXT("WaitPhysScene`: Not executing this scene (%d) - aborting."), SceneType);
return;
}
PhysicsSubsceneCompletion[SceneType] = NULL;
if (FrameLagAsync())
{
checkAtCompileTime(PST_MAX == 2, Assumtiopns_about_physics_scenes); // Here we assume the PST_Sync is the master and never fame lagged
if (SceneType == PST_Sync)
{
// the one frame lagged one should be done by now.
check(!FrameLaggedPhysicsSubsceneCompletion[PST_Async].GetReference() || FrameLaggedPhysicsSubsceneCompletion[PST_Async]->IsComplete());
}
else
{
FrameLaggedPhysicsSubsceneCompletion[PST_Async] = NULL;
}
}
#if WITH_PHYSX
PxScene* PScene = GetPhysXScene(SceneType);
check(PScene);
PxU32 OutErrorCode = 0;
#if !WITH_APEX
PScene->lockWrite();
PScene->fetchResults( true, &OutErrorCode );
PScene->unlockWrite();
#else // #if !WITH_APEX
// The APEX scene calls the fetchResults function for the PhysX scene, so we only call ApexScene->fetchResults().
NxApexScene* ApexScene = GetApexScene(SceneType);
check(ApexScene);
ApexScene->fetchResults( true, &OutErrorCode );
#endif // #if !WITH_APEX
if(OutErrorCode != 0)
{
UE_LOG(LogPhysics, Log, TEXT("PHYSX FETCHRESULTS ERROR: %d"), OutErrorCode);
}
#endif // WITH_PHYSX
// Reset execution flag
bPhysXSceneExecuting[SceneType] = false;
}
示例4: run
void PhysXBetweenStepsTask::run()
{
PX_ASSERT(mSubStepSize > 0.0f);
PX_ASSERT(mNumSubSteps > 0);
#if PX_PHYSICS_VERSION_MAJOR == 3
PxScene* scene = mScene.getPhysXScene();
if (scene != NULL)
{
while (mSubStepNumber < mNumSubSteps)
{
PX_PROFILE_ZONE("ApexSceneManualSubstep", GetInternalApexSDK()->getContextId());
// fetch the first substep
uint32_t errorState = 0;
{
SCOPED_PHYSX_LOCK_WRITE(&mScene);
scene->fetchResults(true, &errorState);
}
PX_ASSERT(errorState == 0);
for (uint32_t i = 0; i < mScene.mModuleScenes.size(); i++)
{
PX_PROFILE_ZONE("ModuleSceneManualSubstep", GetInternalApexSDK()->getContextId());
mScene.mModuleScenes[i]->interStep(mSubStepNumber, mNumSubSteps);
}
// run the next substep
{
SCOPED_PHYSX_LOCK_WRITE(&mScene);
scene->simulate(mSubStepSize);
}
mSubStepNumber++;
}
}
#endif
mLast->removeReference(); // decrement artificially high ref count that prevented checkresults from being executed
}
示例5: StepPhysX
void StepPhysX() {
gScene->simulate(gTimeStep);
gScene->fetchResults(true);
}