本文整理汇总了C++中FByteBulkData::IsLocked方法的典型用法代码示例。如果您正苦于以下问题:C++ FByteBulkData::IsLocked方法的具体用法?C++ FByteBulkData::IsLocked怎么用?C++ FByteBulkData::IsLocked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FByteBulkData
的用法示例。
在下文中一共展示了FByteBulkData::IsLocked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Setup
void UNavCollision::Setup(UBodySetup* BodySetup)
{
// Create meshes from cooked data if not already done
if (bHasConvexGeometry || BodySetup == NULL)
{
return;
}
BodySetupGuid = BodySetup->BodySetupGuid;
// Make sure all are cleared before we start
ClearCollision();
if (ShouldUseConvexCollision())
{
// Find or create cooked navcollision data
FByteBulkData* FormatData = GetCookedData(NAVCOLLISION_FORMAT);
if (!bForceGeometryRebuild && FormatData)
{
// if it's not being already processed
if (FormatData->IsLocked() == false)
{
// Create physics objects
FNavCollisionDataReader CookedDataReader(*FormatData, TriMeshCollision, ConvexCollision, ConvexShapeIndices);
bHasConvexGeometry = true;
}
}
else
{
GatherCollision();
}
}
}
示例2: CreatePhysicsMeshes
void UBodySetup::CreatePhysicsMeshes()
{
#if WITH_PHYSX
// Create meshes from cooked data if not already done
if(bCreatedPhysicsMeshes)
{
return;
}
// Find or create cooked physics data
static FName PhysicsFormatName(FPlatformProperties::GetPhysicsFormat());
FByteBulkData* FormatData = GetCookedData(PhysicsFormatName);
if( FormatData )
{
if (FormatData->IsLocked())
{
// seems it's being already processed
return;
}
FPhysXFormatDataReader CookedDataReader(*FormatData);
if (CollisionTraceFlag != CTF_UseComplexAsSimple)
{
bool bNeedsCooking = bGenerateNonMirroredCollision && CookedDataReader.ConvexMeshes.Num() != AggGeom.ConvexElems.Num();
bNeedsCooking = bNeedsCooking || (bGenerateMirroredCollision && CookedDataReader.ConvexMeshesNegX.Num() != AggGeom.ConvexElems.Num());
if (bNeedsCooking) //Because of bugs it's possible to save with out of sync cooked data. In editor we want to fixup this data
{
#if WITH_EDITOR
InvalidatePhysicsData();
CreatePhysicsMeshes();
return;
#endif
}
}
ClearPhysicsMeshes();
if (CollisionTraceFlag != CTF_UseComplexAsSimple)
{
ensure(!bGenerateNonMirroredCollision || CookedDataReader.ConvexMeshes.Num() == 0 || CookedDataReader.ConvexMeshes.Num() == AggGeom.ConvexElems.Num());
ensure(!bGenerateMirroredCollision || CookedDataReader.ConvexMeshesNegX.Num() == 0 || CookedDataReader.ConvexMeshesNegX.Num() == AggGeom.ConvexElems.Num());
//If the cooked data no longer has convex meshes, make sure to empty AggGeom.ConvexElems - otherwise we leave NULLS which cause issues, and we also read past the end of CookedDataReader.ConvexMeshes
if ((bGenerateNonMirroredCollision && CookedDataReader.ConvexMeshes.Num() == 0) || (bGenerateMirroredCollision && CookedDataReader.ConvexMeshesNegX.Num() == 0))
{
AggGeom.ConvexElems.Empty();
}
for (int32 ElementIndex = 0; ElementIndex < AggGeom.ConvexElems.Num(); ElementIndex++)
{
FKConvexElem& ConvexElem = AggGeom.ConvexElems[ElementIndex];
if (bGenerateNonMirroredCollision)
{
ConvexElem.ConvexMesh = CookedDataReader.ConvexMeshes[ElementIndex];
FPhysxSharedData::Get().Add(ConvexElem.ConvexMesh);
}
if (bGenerateMirroredCollision)
{
ConvexElem.ConvexMeshNegX = CookedDataReader.ConvexMeshesNegX[ElementIndex];
FPhysxSharedData::Get().Add(ConvexElem.ConvexMeshNegX);
}
}
}
if(bGenerateNonMirroredCollision)
{
TriMesh = CookedDataReader.TriMesh;
FPhysxSharedData::Get().Add(TriMesh);
}
if(bGenerateMirroredCollision)
{
TriMeshNegX = CookedDataReader.TriMeshNegX;
FPhysxSharedData::Get().Add(TriMeshNegX);
}
}
else
{
ClearPhysicsMeshes(); // Make sure all are cleared then
}
// Clear the cooked data
if (!GIsEditor && !bSharedCookedData)
{
CookedFormatData.FlushData();
}
bCreatedPhysicsMeshes = true;
#endif
}