本文整理汇总了C++中PxScene::lockRead方法的典型用法代码示例。如果您正苦于以下问题:C++ PxScene::lockRead方法的具体用法?C++ PxScene::lockRead怎么用?C++ PxScene::lockRead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PxScene
的用法示例。
在下文中一共展示了PxScene::lockRead方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddRadialForce
void UDestructibleComponent::AddRadialForce(FVector Origin, float Radius, float Strength, ERadialImpulseFalloff Falloff, bool bAccelChange /* = false */)
{
#if WITH_APEX
if(bIgnoreRadialForce)
{
return;
}
if (ApexDestructibleActor == NULL)
{
return;
}
PxRigidDynamic** PActorBuffer = NULL;
PxU32 PActorCount = 0;
if (ApexDestructibleActor->acquirePhysXActorBuffer(PActorBuffer, PActorCount, NxDestructiblePhysXActorQueryFlags::Dynamic))
{
PxScene* LockedScene = NULL;
while (PActorCount--)
{
PxRigidDynamic* PActor = *PActorBuffer++;
if (PActor != NULL)
{
if (!LockedScene)
{
LockedScene = PActor->getScene();
LockedScene->lockWrite();
LockedScene->lockRead();
}
AddRadialForceToPxRigidBody_AssumesLocked(*PActor, Origin, Radius, Strength, Falloff, bAccelChange);
}
if (LockedScene)
{
LockedScene->unlockRead();
LockedScene->unlockWrite();
LockedScene = NULL;
}
}
ApexDestructibleActor->releasePhysXActorBuffer();
}
#endif // #if WITH_APEX
}
示例2: SetCollisionResponseForAllActors
void UDestructibleComponent::SetCollisionResponseForAllActors(const FCollisionResponseContainer& ResponseOverride)
{
#if WITH_APEX
if (ApexDestructibleActor == NULL)
{
return;
}
PxRigidDynamic** PActorBuffer = NULL;
PxU32 PActorCount = 0;
if (ApexDestructibleActor->acquirePhysXActorBuffer(PActorBuffer, PActorCount))
{
PxScene* LockedScene = NULL;
while (PActorCount--)
{
PxRigidDynamic* PActor = *PActorBuffer++;
if (PActor != NULL)
{
FDestructibleChunkInfo* ChunkInfo = FPhysxUserData::Get<FDestructibleChunkInfo>(PActor->userData);
if (ChunkInfo != NULL)
{
if (!LockedScene)
{
LockedScene = PActor->getScene();
LockedScene->lockWrite();
LockedScene->lockRead();
}
SetCollisionResponseForActor(PActor, ChunkInfo->ChunkIndex, &ResponseOverride); // ChunkIndex is the last chunk made visible. But SetCollisionResponseForActor already doesn't respect per-chunk collision properties.
}
}
}
if (LockedScene)
{
LockedScene->unlockRead();
LockedScene->unlockWrite();
LockedScene = NULL;
}
ApexDestructibleActor->releasePhysXActorBuffer();
}
#endif
}