当前位置: 首页>>代码示例>>C++>>正文


C++ FByteBulkData::IsLocked方法代码示例

本文整理汇总了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();
		}
	}
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:34,代码来源:NavCollision.cpp

示例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
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:94,代码来源:BodySetup.cpp


注:本文中的FByteBulkData::IsLocked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。