本文整理汇总了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();
}
}