本文整理汇总了C++中USkeletalMesh::GetResourceForRendering方法的典型用法代码示例。如果您正苦于以下问题:C++ USkeletalMesh::GetResourceForRendering方法的具体用法?C++ USkeletalMesh::GetResourceForRendering怎么用?C++ USkeletalMesh::GetResourceForRendering使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USkeletalMesh
的用法示例。
在下文中一共展示了USkeletalMesh::GetResourceForRendering方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Add
/** Add a new statistic to the internal map (or update an existing one) from the supplied component */
UPrimitiveStats* Add(UPrimitiveComponent* InPrimitiveComponent, EPrimitiveObjectSets InObjectSet)
{
// Objects in transient package or transient objects are not part of level.
if( InPrimitiveComponent->GetOutermost() == GetTransientPackage() || InPrimitiveComponent->HasAnyFlags( RF_Transient ) )
{
return NULL;
}
// Owned by a default object? Not part of a level either.
if(InPrimitiveComponent->GetOuter() && InPrimitiveComponent->GetOuter()->IsDefaultSubobject() )
{
return NULL;
}
UStaticMeshComponent* StaticMeshComponent = Cast<UStaticMeshComponent>(InPrimitiveComponent);
UModelComponent* ModelComponent = Cast<UModelComponent>(InPrimitiveComponent);
USkeletalMeshComponent* SkeletalMeshComponent = Cast<USkeletalMeshComponent>(InPrimitiveComponent);
ULandscapeComponent* LandscapeComponent = Cast<ULandscapeComponent>(InPrimitiveComponent);
UObject* Resource = NULL;
AActor* ActorOuter = Cast<AActor>(InPrimitiveComponent->GetOuter());
int32 VertexColorMem = 0;
int32 InstVertexColorMem = 0;
// Calculate number of direct and other lights relevant to this component.
int32 LightsLMCount = 0;
int32 LightsOtherCount = 0;
bool bUsesOnlyUnlitMaterials = InPrimitiveComponent->UsesOnlyUnlitMaterials();
// The static mesh is a static mesh component's resource.
if( StaticMeshComponent )
{
UStaticMesh* Mesh = StaticMeshComponent->StaticMesh;
Resource = Mesh;
// Calculate vertex color memory on the actual mesh.
if( Mesh && Mesh->RenderData )
{
// Accumulate memory for each LOD
for( int32 LODIndex = 0; LODIndex < Mesh->RenderData->LODResources.Num(); ++LODIndex )
{
VertexColorMem += Mesh->RenderData->LODResources[LODIndex].ColorVertexBuffer.GetAllocatedSize();
}
}
// Calculate instanced vertex color memory used on the component.
for( int32 LODIndex = 0; LODIndex < StaticMeshComponent->LODData.Num(); ++LODIndex )
{
// Accumulate memory for each LOD
const FStaticMeshComponentLODInfo& LODInfo = StaticMeshComponent->LODData[ LODIndex ];
if( LODInfo.OverrideVertexColors )
{
InstVertexColorMem += LODInfo.OverrideVertexColors->GetAllocatedSize();
}
}
// Calculate the number of lightmap and shadow map lights
if( !bUsesOnlyUnlitMaterials )
{
if( StaticMeshComponent->LODData.Num() > 0 )
{
FStaticMeshComponentLODInfo& ComponentLODInfo = StaticMeshComponent->LODData[0];
if( ComponentLODInfo.LightMap )
{
LightsLMCount = ComponentLODInfo.LightMap->LightGuids.Num();
}
}
}
}
// A model component is its own resource.
else if( ModelComponent )
{
// Make sure model component is referenced by level.
ULevel* Level = CastChecked<ULevel>(ModelComponent->GetOuter());
if( Level->ModelComponents.Find( ModelComponent ) != INDEX_NONE )
{
Resource = ModelComponent->GetModel();
// Calculate the number of lightmap and shadow map lights
if( !bUsesOnlyUnlitMaterials )
{
const TIndirectArray<FModelElement> Elements = ModelComponent->GetElements();
if( Elements.Num() > 0 )
{
if( Elements[0].LightMap )
{
LightsLMCount = Elements[0].LightMap->LightGuids.Num();
}
}
}
}
}
// The skeletal mesh of a skeletal mesh component is its resource.
else if( SkeletalMeshComponent )
{
USkeletalMesh* Mesh = SkeletalMeshComponent->SkeletalMesh;
Resource = Mesh;
// Calculate vertex color usage for skeletal meshes
if( Mesh )
{
FSkeletalMeshResource* SkelMeshResource = Mesh->GetResourceForRendering();
//.........这里部分代码省略.........