UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MorphTargetVertexInfoBuffers.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "RenderResource.h"
7#include "Math/Vector4.h"
8
11class UMorphTarget;
12
14{
15public:
18
20
22
23 inline bool IsMorphResourcesInitialized() const { return bResourcesInitialized; }
24 inline bool IsRHIInitialized() const { return bRHIInitialized; }
25 inline bool IsMorphCPUDataValid() const{ return bIsMorphCPUDataValid; }
26
29
30 ENGINE_API virtual void InitRHI(FRHICommandListBase& RHICmdList) override;
31 ENGINE_API virtual void ReleaseRHI() override;
32
33 UE_DEPRECATED(5.2, "GetMaximumThreadGroupSize will be removed as it is no longer used.")
35
37 {
38 check(index == UINT_MAX || index < (uint32)BatchesPerMorph.Num());
39 return index != UINT_MAX ? BatchesPerMorph[index] : NumTotalBatches;
40 }
41
43 {
44 return BatchesPerMorph.Num();
45 }
46
52
58
64
66 {
67 return PositionPrecision;
68 }
69
71 {
72 return TangentZPrecision;
73 }
74
75 const uint32* GetData() const
76 {
77 return MorphData.GetData();
78 }
79
81 {
82 return MorphData.Num() * sizeof(uint32);
83 }
84
85 static ENGINE_API bool IsPlatformShaderSupported(EShaderPlatform ShaderPlatform);
86
89
90protected:
92
95
96 void Compress(const TArray<FSkelMeshRenderSection>& RenderSections, const TArray<const FMorphTargetLODModel*>& MorphTargets, const TBitArray<>& UsesBuiltinMorphTargetCompression, int32 NumVertices, float TargetPositionErrorTolerance);
97
98 // Transient data. Gets deleted as soon as the GPU resource has been initialized (unless excplicitly disabled by bEmptyMorphCPUDataOnInitRHI).
100
101 //x,y,z separate for position and shared w for tangent
102
107
109 float PositionPrecision = 0.0f;
110 float TangentZPrecision = 0.0f;
111
114 bool bRHIInitialized = false;
116
118 ENGINE_API friend FArchive& operator<<(FArchive& Ar, FMorphTargetVertexInfoBuffers& MorphTargetVertexInfoBuffers);
119};
120
#define check(expr)
Definition AssertionMacros.h:314
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
ENGINE_API FArchive & operator<<(FArchive &Ar, FMorphTargetVertexInfoBuffers &MorphTargetVertexInfoBuffers)
Definition MorphTargetVertexInfoBuffers.cpp:126
EShaderPlatform
Definition RHIShaderPlatform.h:11
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
Definition MorphTargetVertexInfoBuffers.h:14
uint32 NumTotalBatches
Definition MorphTargetVertexInfoBuffers.h:108
ENGINE_API void InitMorphResources(EShaderPlatform ShaderPlatform, const TArray< FSkelMeshRenderSection > &RenderSections, const TArray< UMorphTarget * > &MorphTargets, int32 NumVertices, int32 LODIndex, float TargetPositionErrorTolerance)
Definition MorphTargetVertexInfoBuffers.cpp:132
uint32 GetNumMorphs() const
Definition MorphTargetVertexInfoBuffers.h:42
static ENGINE_API uint32 GetMaximumThreadGroupSize()
Definition MorphTargetVertexInfoBuffers.cpp:52
float GetTangentZPrecision() const
Definition MorphTargetVertexInfoBuffers.h:70
const uint32 * GetData() const
Definition MorphTargetVertexInfoBuffers.h:75
bool IsMorphResourcesInitialized() const
Definition MorphTargetVertexInfoBuffers.h:23
bool IsMorphCPUDataValid() const
Definition MorphTargetVertexInfoBuffers.h:25
bool bRHIInitialized
Definition MorphTargetVertexInfoBuffers.h:114
const FVector4f & GetMinimumMorphScale(uint32 Index) const
Definition MorphTargetVertexInfoBuffers.h:59
virtual ENGINE_API void ReleaseRHI() override
Definition MorphTargetVertexInfoBuffers.cpp:45
float PositionPrecision
Definition MorphTargetVertexInfoBuffers.h:109
ENGINE_API void ValidateVertexBuffers(bool bMorphTargetsShouldBeValid)
Definition MorphTargetVertexInfoBuffers.cpp:73
virtual ENGINE_API void InitRHI(FRHICommandListBase &RHICmdList) override
Definition MorphTargetVertexInfoBuffers.cpp:16
FBufferRHIRef MorphDataBuffer
Definition MorphTargetVertexInfoBuffers.h:87
ENGINE_API ~FMorphTargetVertexInfoBuffers()
TArray< uint32 > BatchesPerMorph
Definition MorphTargetVertexInfoBuffers.h:106
FShaderResourceViewRHIRef MorphDataSRV
Definition MorphTargetVertexInfoBuffers.h:88
ENGINE_API void InitMorphResourcesStreaming(const TArray< FSkelMeshRenderSection > &RenderSections, const TArray< const FMorphTargetLODModel * > &MorphTargets, int32 NumVertices, float TargetPositionErrorTolerance)
Definition MorphTargetVertexInfoBuffers.cpp:168
ENGINE_API void ResetCPUData()
Definition MorphTargetVertexInfoBuffers.cpp:59
uint32 GetNumBatches(uint32 index=UINT_MAX) const
Definition MorphTargetVertexInfoBuffers.h:36
bool bIsMorphCPUDataValid
Definition MorphTargetVertexInfoBuffers.h:112
float TangentZPrecision
Definition MorphTargetVertexInfoBuffers.h:110
TArray< FVector4f > MinimumValuePerMorph
Definition MorphTargetVertexInfoBuffers.h:104
TArray< FVector4f > MaximumValuePerMorph
Definition MorphTargetVertexInfoBuffers.h:103
TResourceArray< uint32 > MorphData
Definition MorphTargetVertexInfoBuffers.h:99
bool GetEmptyMorphCPUDataOnInitRHI() const
Definition MorphTargetVertexInfoBuffers.h:27
ENGINE_API friend FArchive & operator<<(FArchive &Ar, FMorphTargetVertexInfoBuffers &MorphTargetVertexInfoBuffers)
Definition MorphTargetVertexInfoBuffers.cpp:126
ENGINE_API FMorphTargetVertexInfoBuffers()
bool IsRHIInitialized() const
Definition MorphTargetVertexInfoBuffers.h:24
uint64 GetMorphDataSizeInBytes() const
Definition MorphTargetVertexInfoBuffers.h:80
uint32 GetBatchStartOffset(uint32 Index) const
Definition MorphTargetVertexInfoBuffers.h:47
static ENGINE_API bool IsPlatformShaderSupported(EShaderPlatform ShaderPlatform)
Definition MorphTargetVertexInfoBuffers.cpp:296
void SetEmptyMorphCPUDataOnInitRHI(bool bEmpty)
Definition MorphTargetVertexInfoBuffers.h:28
bool bEmptyMorphCPUDataOnInitRHI
Definition MorphTargetVertexInfoBuffers.h:115
bool bResourcesInitialized
Definition MorphTargetVertexInfoBuffers.h:113
TArray< uint32 > BatchStartOffsetPerMorph
Definition MorphTargetVertexInfoBuffers.h:105
float GetPositionPrecision() const
Definition MorphTargetVertexInfoBuffers.h:65
const FVector4f & GetMaximumMorphScale(uint32 Index) const
Definition MorphTargetVertexInfoBuffers.h:53
Definition RHICommandList.h:455
Definition RenderResource.h:37
Definition SkeletalMeshLODRenderData.h:128
FMorphTargetVertexInfoBuffers MorphTargetVertexInfoBuffers
Definition SkeletalMeshLODRenderData.h:147
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
UE_NODEBUG UE_FORCEINLINE_HINT ElementType * GetData() UE_LIFETIMEBOUND
Definition Array.h:1027
Definition DynamicRHIResourceArray.h:31
Definition MorphTarget.h:230
U16 Index
Definition radfft.cpp:71
Definition MorphTarget.h:165
Definition SkeletalMeshLODRenderData.h:28