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


C++ UStaticMeshComponent::SetLODDataCount方法代码示例

本文整理汇总了C++中UStaticMeshComponent::SetLODDataCount方法的典型用法代码示例。如果您正苦于以下问题:C++ UStaticMeshComponent::SetLODDataCount方法的具体用法?C++ UStaticMeshComponent::SetLODDataCount怎么用?C++ UStaticMeshComponent::SetLODDataCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UStaticMeshComponent的用法示例。


在下文中一共展示了UStaticMeshComponent::SetLODDataCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Apply

// FStaticLightingTextureMapping interface
void FStaticMeshStaticLightingTextureMapping::Apply(FQuantizedLightmapData* QuantizedData, const TMap<ULightComponent*,FShadowMapData2D*>& ShadowMapData)
{
	UStaticMeshComponent* StaticMeshComponent = Primitive.Get();

	if (StaticMeshComponent)
	{
		// Should have happened at a higher level
		check(!StaticMeshComponent->IsRegistered());
		// The rendering thread reads from LODData and IrrelevantLights, therefore
		// the component must have finished detaching from the scene on the rendering
		// thread before it is safe to continue.
		check(StaticMeshComponent->AttachmentCounter.GetValue() == 0);

		// Ensure LODData has enough entries in it, free not required.
		StaticMeshComponent->SetLODDataCount(LODIndex + 1, StaticMeshComponent->StaticMesh->GetNumLODs());

		FStaticMeshComponentLODInfo& ComponentLODInfo = StaticMeshComponent->LODData[LODIndex];
		ELightMapPaddingType PaddingType = GAllowLightmapPadding ? LMPT_NormalPadding : LMPT_NoPadding;
		const bool bHasNonZeroData = (QuantizedData != NULL && QuantizedData->HasNonZeroData());

		// We always create a light map if the surface either has any non-zero lighting data, or if the surface has a shadow map.  The runtime
		// shaders are always expecting a light map in the case of a shadow map, even if the lighting is entirely zero.  This is simply to reduce
		// the number of shader permutations to support in the very unlikely case of a unshadowed surfaces that has lighting values of zero.
		const bool bNeedsLightMap = bHasNonZeroData || ShadowMapData.Num() > 0 || Mesh->RelevantLights.Num() > 0 || (QuantizedData != NULL && QuantizedData->bHasSkyShadowing);
		if (bNeedsLightMap)
		{
			// Create a light-map for the primitive.
			ComponentLODInfo.LightMap = FLightMap2D::AllocateLightMap(
				StaticMeshComponent,
				QuantizedData,
				StaticMeshComponent->Bounds,
				PaddingType,
				LMF_Streamed
				);
		}
		else
		{
			ComponentLODInfo.LightMap = NULL;
		}

		if (ShadowMapData.Num() > 0)
		{
			ComponentLODInfo.ShadowMap = FShadowMap2D::AllocateShadowMap(
				StaticMeshComponent,
				ShadowMapData,
				StaticMeshComponent->Bounds,
				PaddingType,
				SMF_Streamed
				);
		}
		else
		{
			ComponentLODInfo.ShadowMap = NULL;
		}

		// Build the list of statically irrelevant lights.
		// IrrelevantLights was cleared in InvalidateLightingCacheDetailed

		for(int32 LightIndex = 0;LightIndex < Mesh->RelevantLights.Num();LightIndex++)
		{
			const ULightComponent* Light = Mesh->RelevantLights[LightIndex];

			// Check if the light is stored in the light-map.
			const bool bIsInLightMap = ComponentLODInfo.LightMap && ComponentLODInfo.LightMap->LightGuids.Contains(Light->LightGuid);

			// Check if the light is stored in the shadow-map.
			const bool bIsInShadowMap = ComponentLODInfo.ShadowMap && ComponentLODInfo.ShadowMap->LightGuids.Contains(Light->LightGuid);

			// Add the light to the statically irrelevant light list if it is in the potentially relevant light list, but didn't contribute to the light-map.
			if(!bIsInLightMap && !bIsInShadowMap)
			{	
				StaticMeshComponent->IrrelevantLights.AddUnique(Light->LightGuid);
			}
		}

		StaticMeshComponent->bHasCachedStaticLighting = true;

		// Mark the primitive's package as dirty.
		StaticMeshComponent->MarkPackageDirty();
	}
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:82,代码来源:StaticMeshLight.cpp


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