UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SkeletalMeshLODRenderData.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
14#include "SkeletalMeshTypes.h"
15#include "BoneIndices.h"
16#include "StaticMeshResources.h"
20
21class USkinnedAsset;
22#if WITH_EDITOR
25#endif // WITH_EDITOR
26
28{
31
34
37
40
43
46
49
52
55
66
69
72
75
76 // INDEX_NONE if not set
78
81
84
87
102
103 inline bool HasClothingData() const
104 {
105 constexpr int32 ClothLODBias = 0; // Must at least have the mapping for the matching cloth LOD
107 }
108
110 {
111 return BaseVertexIndex;
112 }
113
114 inline int32 GetNumVertices() const
115 {
116 return NumVertices;
117 }
118
119 inline bool IsValid() const
120 {
121 return NumTriangles > 0 && !bDisabled;
122 }
123
125};
126
128{
129public:
130
133
134 // Index Buffer (MultiSize: 16bit or 32bit)
136
139
142
145
148
151
153
156
158
160
162
165
167
172
173#if WITH_EDITOR
175#endif
176
177#if RHI_RAYTRACING
184#endif
185
192
193 void InitMorphResources();
194
199
203 void ReleaseCPUResources(bool bForStreaming = false);
204
207 : BuffersSize(0)
210 {
211 if (bAddRef)
212 {
213 AddRef();
214 }
215 }
216
218 {
219 check(GetRefCount() == 0);
220 }
221
230 void Serialize(FArchive& Ar, UObject* Owner, int32 Idx);
231
238 ENGINE_API void SerializeStreamedData(FArchive& Ar, USkinnedAsset* Owner, int32 LODIdx, uint8 ClassStripFlags, bool bNeedsCPUAccess, bool bForceKeepCPUResources);
239
240 void SerializeAvailabilityInfo(FArchive& Ar, int32 LODIdx, bool bHasAdjacencyData, bool bNeedsCPUAccess);
241
242#if WITH_EDITOR
243
244 struct FBuildSettings
245 {
247 bool bBuildHalfEdgeBuffers = false;
248 };
249
260 );
261#endif // WITH_EDITOR
262
267
272
277
282
289
296
299
303 ENGINE_API bool HasClothData() const;
304
307
312
315
316 // O(1)
317 // @return -1 if not found
318 uint32 FindSectionIndex(const FSkelMeshRenderSection& Section) const;
319
321
324
325 static bool ShouldForceKeepCPUResources();
326 static bool ShouldKeepCPUResources(const USkinnedAsset* SkinnedAsset, int32 LODIdx, bool bForceKeep);
327
328private:
329 enum EClassDataStripFlag : uint8
330 {
331 CDSF_AdjacencyData_DEPRECATED = 1,
332 CDSF_MinLodData = 2
333 };
334
335 static uint8 GenerateClassStripFlags(FArchive& Ar, const USkinnedAsset* OwnerMesh, int32 LODIdx);
336
337 static bool IsLODCookedOut(const ITargetPlatform* TargetPlatform, const USkinnedAsset* SkinnedAsset, bool bIsBelowMinLOD);
338
339 static bool IsLODInlined(const ITargetPlatform* TargetPlatform, const USkinnedAsset* SkinnedAsset, int32 LODIdx, bool bIsBelowMinLOD);
340
341 static int32 GetNumOptionalLODsAllowed(const ITargetPlatform* TargetPlatform, const USkinnedAsset* SkinnedAsset);
342
344};
#define check(expr)
Definition AssertionMacros.h:314
FPlatformTypes::int16 int16
A 16-bit signed integer.
Definition Platform.h:1123
FPlatformTypes::SIZE_T SIZE_T
An unsigned integer the same size as a pointer, the same as UPTRINT.
Definition Platform.h:1150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
ESkeletalMeshVertexFlags
Definition SkeletalMeshTypes.h:26
ESkinVertexColorChannel
Definition SkeletalMeshTypes.h:38
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
Definition SkeletalMeshDuplicatedVerticesBuffer.h:31
Definition MorphTargetVertexInfoBuffers.h:14
Definition MultiSizeIndexContainer.h:18
uint32 GetNumVertices() const
Definition PositionVertexBuffer.h:100
Definition RayTracingGeometry.h:31
Definition RefCounting.h:213
uint32 GetRefCount() const
Definition RefCounting.h:231
FReturnedRefCountValue AddRef() const
Definition RefCounting.h:221
Definition SkeletalMeshHalfEdgeBuffer.h:21
Definition SkeletalMeshLODRenderData.h:128
ENGINE_API void GetResourceSizeEx(FResourceSizeEx &CumulativeResourceSize) const
Definition SkeletalMeshLODRenderData.cpp:559
FSkinWeightVertexBuffer SkinWeightVertexBuffer
Definition SkeletalMeshLODRenderData.h:141
FSkeletalMeshVertexAttributeRenderData VertexAttributeBuffers
Definition SkeletalMeshLODRenderData.h:152
FSkinWeightVertexBuffer * GetSkinWeightVertexBuffer()
Definition SkeletalMeshLODRenderData.h:284
const FSkinWeightVertexBuffer * GetSkinWeightVertexBuffer() const
Definition SkeletalMeshLODRenderData.h:291
uint32 GetNumVertices() const
Definition SkeletalMeshLODRenderData.h:263
uint32 bStreamedDataInlined
Definition SkeletalMeshLODRenderData.h:169
void SerializeAvailabilityInfo(FArchive &Ar, int32 LODIdx, bool bHasAdjacencyData, bool bNeedsCPUAccess)
Definition SkeletalMeshLODRenderData.cpp:903
FSkeletalMeshVertexClothBuffer ClothVertexBuffer
Definition SkeletalMeshLODRenderData.h:144
ENGINE_API void SerializeStreamedData(FArchive &Ar, USkinnedAsset *Owner, int32 LODIdx, uint8 ClassStripFlags, bool bNeedsCPUAccess, bool bForceKeepCPUResources)
Definition SkeletalMeshLODRenderData.cpp:740
void InitMorphResources()
Definition SkeletalMeshLODRenderData.cpp:199
FMorphTargetVertexInfoBuffers MorphTargetVertexInfoBuffers
Definition SkeletalMeshLODRenderData.h:147
FSkeletalMeshLODRenderData(bool bAddRef=true)
Definition SkeletalMeshLODRenderData.h:206
ENGINE_API void GetSectionFromVertexIndex(int32 InVertIndex, int32 &OutSectionIndex, int32 &OutVertIndex) const
Definition SkeletalMeshLODRenderData.cpp:1161
uint32 GetNumTexCoords() const
Definition SkeletalMeshLODRenderData.h:278
static bool ShouldForceKeepCPUResources()
Definition SkeletalMeshLODRenderData.cpp:684
static bool ShouldKeepCPUResources(const USkinnedAsset *SkinnedAsset, int32 LODIdx, bool bForceKeep)
Definition SkeletalMeshLODRenderData.cpp:696
FRayTracingGeometry SourceRayTracingGeometry
Definition SkeletalMeshLODRenderData.h:164
void DecrementMemoryStats()
Definition SkeletalMeshLODRenderData.cpp:364
FStaticMeshVertexBuffers StaticVertexBuffers
Definition SkeletalMeshLODRenderData.h:138
FMultiSizeIndexContainer MultiSizeIndexContainer
Definition SkeletalMeshLODRenderData.h:135
ENGINE_API int32 NumNonClothingSections() const
Definition SkeletalMeshLODRenderData.cpp:1100
uint32 bIsLODOptional
Definition SkeletalMeshLODRenderData.h:171
FByteBulkData StreamingBulkData
Definition SkeletalMeshLODRenderData.h:166
ENGINE_API bool HasClothData() const
Definition SkeletalMeshLODRenderData.cpp:1149
TArray< FSkelMeshRenderSection > RenderSections
Definition SkeletalMeshLODRenderData.h:132
void InitResources(bool bNeedsVertexColors, int32 LODIndex, USkinnedAsset *Owner)
Definition SkeletalMeshLODRenderData.cpp:213
uint32 FindSectionIndex(const FSkelMeshRenderSection &Section) const
Definition SkeletalMeshLODRenderData.cpp:1119
void ReleaseCPUResources(bool bForStreaming=false)
Definition SkeletalMeshLODRenderData.cpp:534
FSkeletalMeshHalfEdgeBuffer HalfEdgeBuffer
Definition SkeletalMeshLODRenderData.h:155
uint32 BuffersSize
Definition SkeletalMeshLODRenderData.h:161
ENGINE_API void ReleaseResources()
Definition SkeletalMeshLODRenderData.cpp:313
FSkinWeightProfilesData SkinWeightProfilesData
Definition SkeletalMeshLODRenderData.h:150
SIZE_T GetCPUAccessMemoryOverhead() const
Definition SkeletalMeshLODRenderData.cpp:581
TArray< FBoneIndexType > ActiveBoneIndices
Definition SkeletalMeshLODRenderData.h:157
~FSkeletalMeshLODRenderData()
Definition SkeletalMeshLODRenderData.h:217
uint32 GetVertexBufferMaxBoneInfluences() const
Definition SkeletalMeshLODRenderData.h:268
bool DoesVertexBufferUse16BitBoneIndex() const
Definition SkeletalMeshLODRenderData.h:273
ENGINE_API int32 GetTotalFaces() const
Definition SkeletalMeshLODRenderData.cpp:1138
TArray< FBoneIndexType > RequiredBones
Definition SkeletalMeshLODRenderData.h:159
void IncrementMemoryStats(bool bNeedsVertexColors)
Definition SkeletalMeshLODRenderData.cpp:346
Definition SkeletalMeshRenderData.h:17
Definition SkeletalMeshVertexClothBuffer.h:15
Definition SkinWeightVertexBuffer.h:364
uint32 GetMaxBoneInfluences() const
Definition SkinWeightVertexBuffer.h:418
bool Use16BitBoneIndex() const
Definition SkinWeightVertexBuffer.h:424
uint32 GetNumTexCoords() const
Definition StaticMeshVertexBuffer.h:411
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
Definition Object.h:95
Definition SkinnedAsset.h:47
@ false
Definition radaudio_common.h:23
Definition SkeletalMeshTypes.h:141
Definition ResourceSize.h:31
Definition SkeletalMeshLODRenderData.h:28
FSkelMeshRenderSection()
Definition SkeletalMeshLODRenderData.h:88
TArray< TArray< FMeshToMeshVertData > > ClothMappingDataLODs
Definition SkeletalMeshLODRenderData.h:65
FClothingSectionData ClothingData
Definition SkeletalMeshLODRenderData.h:80
bool bDisabled
Definition SkeletalMeshLODRenderData.h:86
int16 CorrespondClothAssetIndex
Definition SkeletalMeshLODRenderData.h:77
TArray< FBoneIndexType > BoneMap
Definition SkeletalMeshLODRenderData.h:68
bool HasClothingData() const
Definition SkeletalMeshLODRenderData.h:103
bool bVisibleInRayTracing
Definition SkeletalMeshLODRenderData.h:45
ESkinVertexColorChannel RecomputeTangentsVertexMaskChannel
Definition SkeletalMeshLODRenderData.h:48
ENGINE_API friend FArchive & operator<<(FArchive &Ar, FSkelMeshRenderSection &S)
Definition SkeletalMeshLODRenderData.cpp:129
int32 GetVertexBufferIndex() const
Definition SkeletalMeshLODRenderData.h:109
int32 MaxBoneInfluences
Definition SkeletalMeshLODRenderData.h:74
uint16 MaterialIndex
Definition SkeletalMeshLODRenderData.h:30
uint32 BaseVertexIndex
Definition SkeletalMeshLODRenderData.h:51
FDuplicatedVerticesBuffer DuplicatedVerticesBuffer
Definition SkeletalMeshLODRenderData.h:83
TArray< FMeshToMeshVertData > ClothMappingData_DEPRECATED
Definition SkeletalMeshLODRenderData.h:54
uint32 NumVertices
Definition SkeletalMeshLODRenderData.h:71
uint32 BaseIndex
Definition SkeletalMeshLODRenderData.h:33
bool bCastShadow
Definition SkeletalMeshLODRenderData.h:42
bool IsValid() const
Definition SkeletalMeshLODRenderData.h:119
bool bRecomputeTangent
Definition SkeletalMeshLODRenderData.h:39
uint32 NumTriangles
Definition SkeletalMeshLODRenderData.h:36
int32 GetNumVertices() const
Definition SkeletalMeshLODRenderData.h:114
Definition SkeletalMeshVertexAttribute.h:29
Definition SkeletalMeshVertexAttribute.h:70
Definition SkinWeightProfile.h:238
FSkinWeightVertexBuffer * GetDefaultOverrideBuffer() const
Definition SkinWeightProfile.h:253
Definition StaticMeshResources.h:320
FStaticMeshVertexBuffer StaticMeshVertexBuffer
Definition StaticMeshResources.h:322
FPositionVertexBuffer PositionVertexBuffer
Definition StaticMeshResources.h:325