本文整理汇总了C++中FPhysScene::HasAsyncScene方法的典型用法代码示例。如果您正苦于以下问题:C++ FPhysScene::HasAsyncScene方法的具体用法?C++ FPhysScene::HasAsyncScene怎么用?C++ FPhysScene::HasAsyncScene使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPhysScene
的用法示例。
在下文中一共展示了FPhysScene::HasAsyncScene方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RefreshBoneTransforms
void UDestructibleComponent::RefreshBoneTransforms()
{
#if WITH_APEX
if(ApexDestructibleActor != NULL && SkeletalMesh)
{
UDestructibleMesh* TheDestructibleMesh = GetDestructibleMesh();
// Save a pointer to the APEX NxDestructibleAsset
physx::NxDestructibleAsset* ApexDestructibleAsset = TheDestructibleMesh->ApexDestructibleAsset;
check(ApexDestructibleAsset);
{
// Lock here so we don't encounter race conditions with the destruction processing
FPhysScene* PhysScene = World->GetPhysicsScene();
check(PhysScene);
const uint32 SceneType = (BodyInstance.bUseAsyncScene && PhysScene->HasAsyncScene()) ? PST_Async : PST_Sync;
PxScene* PScene = PhysScene->GetPhysXScene(SceneType);
check(PScene);
SCOPED_SCENE_WRITE_LOCK(PScene);
SCOPED_SCENE_READ_LOCK(PScene);
// Try to acquire event buffer
const physx::NxDestructibleChunkEvent* EventBuffer;
physx::PxU32 EventBufferSize;
if (ApexDestructibleActor->acquireChunkEventBuffer(EventBuffer, EventBufferSize))
{
// Buffer acquired
while (EventBufferSize--)
{
const physx::NxDestructibleChunkEvent& Event = *EventBuffer++;
// Right now the only events are visibility changes. So as an optimization we won't check for the event type.
// if (Event.event & physx::NxDestructibleChunkEvent::VisibilityChanged)
const bool bVisible = (Event.event & physx::NxDestructibleChunkEvent::ChunkVisible) != 0;
SetChunkVisible(Event.chunkIndex, bVisible);
}
// Release buffer (will be cleared)
ApexDestructibleActor->releaseChunkEventBuffer();
}
}
// Update poses for visible chunks
const physx::PxU16* VisibleChunks = ApexDestructibleActor->getVisibleChunks();
physx::PxU16 VisibleChunkCount = ApexDestructibleActor->getNumVisibleChunks();
while (VisibleChunkCount--)
{
const physx::PxU16 ChunkIndex = *VisibleChunks++;
// BRGTODO : Make a direct method to access the Px objects' quats
const physx::PxMat44 ChunkPoseRT = ApexDestructibleActor->getChunkPose(ChunkIndex); // Unscaled
const physx::PxTransform Transform(ChunkPoseRT);
SetChunkWorldRT(ChunkIndex, P2UQuat(Transform.q), P2UVector(Transform.p));
}
// Send bones to render thread at end of frame
MarkRenderDynamicDataDirty();
}
#endif // #if WITH_APEX
}