UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ISMInstanceDataSceneProxy.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
7#include "RHIShaderPlatform.h"
8#include "RHIFeatureLevel.h"
9
14class HHitProxy;
15
17
18
26
39{
40public:
42
44
45 //void BuildLegacyData();
46
52
53 virtual void BuildFromLegacyData(TUniquePtr<FStaticMeshInstanceData> &&ExternalLegacyData, const FRenderBounds &InstanceLocalBounds, TArray<int32> &&InLegacyInstanceReorderTable) {};
54
59
64
66
68
70
72protected:
77
78 // Update the InstanceIdIndexMap given the change set.
79 template <typename IndexRemapType>
81
82 template <typename IndexRemapType>
83 void ApplyDataChanges(FISMInstanceUpdateChangeSet &ChangeSet, const IndexRemapType &IndexRemap, int32 PostUpdateNumInstances, FInstanceSceneDataBuffers::FWriteView &ProxyData);
84
85 template <typename IndexRemapType>
87
88 void TestAndApplyInstanceBufferSizeFixup(int32 PostUpdateNumInstances);
89
93
94
95 // Id allocation tracking
96 TBitArray<> ValidInstanceIdMask; // redundant, unsure if we need a copy of that, except insofar as to be able to scan the valid ones quicky? IdToIndexMap has the same info.
98
100 // True when it has never been updated before.
101 bool bIsNew = true;
102 // This should be set when constructing for a static primitive that wants pre-built instances.
103 bool bBuildOptimized = false;
104#if WITH_EDITOR
107#endif
108
110
112};
113
118{
119public:
121
122 virtual void Update(FISMInstanceUpdateChangeSet&& ChangeSet) override;
123 virtual void Build(FISMInstanceUpdateChangeSet&& ChangeSet) override;
126
127protected:
129
131 bool bLegacyReordered = false;
132 // Must hang on to this to be able to suppor primitive transform changes, otherwise we have no access to the original instance transforms.
133 // We could potentially pull out and store those explicitly instead as we don't need to retain all the other garbage.
135};
136
137
#define check(expr)
Definition AssertionMacros.h:314
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
ESceneDepthPriorityGroup
Definition EngineTypes.h:187
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
Definition ISMInstanceDataSceneProxy.h:118
TArray< int32 > LegacyInstanceReorderTable
Definition ISMInstanceDataSceneProxy.h:130
bool bLegacyReordered
Definition ISMInstanceDataSceneProxy.h:131
virtual void UpdatePrimitiveTransform(FISMInstanceUpdateChangeSet &&ChangeSet) override
Definition ISMInstanceDataSceneProxy.cpp:604
virtual void BuildFromLegacyData(TUniquePtr< FStaticMeshInstanceData > &&InExternalLegacyData, const FRenderBounds &InstanceLocalBounds, TArray< int32 > &&InLegacyInstanceReorderTable) override
Definition ISMInstanceDataSceneProxy.cpp:508
TUniquePtr< FStaticMeshInstanceData > ExternalLegacyData
Definition ISMInstanceDataSceneProxy.h:134
void UpdateInstancesTransforms(FInstanceSceneDataBuffers::FWriteView &ProxyData, const FStaticMeshInstanceData &LegacyInstanceData)
Definition ISMInstanceDataSceneProxy.cpp:587
Definition ISMInstanceDataSceneProxy.h:142
void ReleaseStaticMeshInstanceBuffer()
Definition ISMInstanceDataSceneProxy.cpp:902
virtual void UpdatePrimitiveTransform(FISMInstanceUpdateChangeSet &&ChangeSet) override
Definition ISMInstanceDataSceneProxy.cpp:887
TUniquePtr< FStaticMeshInstanceBuffer > LegacyInstanceBuffer
Definition ISMInstanceDataSceneProxy.h:165
virtual void BuildFromLegacyData(TUniquePtr< FStaticMeshInstanceData > &&ExternalLegacyData, const FRenderBounds &InstanceLocalBounds, TArray< int32 > &&InLegacyInstanceReorderTable) override
Definition ISMInstanceDataSceneProxy.cpp:864
virtual ENGINE_API FStaticMeshInstanceBuffer * GetLegacyInstanceBuffer() override
Definition ISMInstanceDataSceneProxy.cpp:750
~FISMCInstanceDataSceneProxyNoGPUScene()
Definition ISMInstanceDataSceneProxy.cpp:628
void ApplyDataChanges(FISMInstanceUpdateChangeSet &ChangeSet, const IndexRemapType &IndexRemap, int32 PostUpdateNumInstances, FInstanceSceneDataBuffers::FWriteView &ProxyData, FStaticMeshInstanceData &LegacyInstanceData)
Definition ISMInstanceDataSceneProxy.cpp:634
Definition ISMInstanceDataSceneProxy.h:39
void BuildFromOptimizedDataBuffers(FISMInstanceUpdateChangeSet &ChangeSet, FInstanceIdIndexMap &OutInstanceIdIndexMap, FInstanceSceneDataBuffers::FWriteView &OutData)
Definition ISMInstanceDataSceneProxy.cpp:181
void ApplyDataChanges(FISMInstanceUpdateChangeSet &ChangeSet, const IndexRemapType &IndexRemap, int32 PostUpdateNumInstances, FInstanceSceneDataBuffers::FWriteView &ProxyData)
Definition ISMInstanceDataSceneProxy.cpp:149
virtual void UpdatePrimitiveTransform(FISMInstanceUpdateChangeSet &&ChangeSet)
Definition ISMInstanceDataSceneProxy.h:58
virtual void BuildFromLegacyData(TUniquePtr< FStaticMeshInstanceData > &&ExternalLegacyData, const FRenderBounds &InstanceLocalBounds, TArray< int32 > &&InLegacyInstanceReorderTable)
Definition ISMInstanceDataSceneProxy.h:53
FISMPrecomputedSpatialHashDataPtr PrecomputedOptimizationData
Definition ISMInstanceDataSceneProxy.h:111
TBitArray ValidInstanceIdMask
Definition ISMInstanceDataSceneProxy.h:96
void ApplyAttributeChanges(FISMInstanceUpdateChangeSet &ChangeSet, const IndexRemapType &IndexRemap, FInstanceSceneDataBuffers::FWriteView &ProxyData)
Definition ISMInstanceDataSceneProxy.cpp:96
bool bUseLegacyRenderingPath
Definition ISMInstanceDataSceneProxy.h:92
FInstanceIdIndexMap InstanceIdIndexMap
Definition ISMInstanceDataSceneProxy.h:97
FInstanceDataUpdateTaskInfo InstanceDataUpdateTaskInfo
Definition ISMInstanceDataSceneProxy.h:99
bool CheckPlatformFeatureLevel(FStaticShaderPlatform InShaderPlatform, ERHIFeatureLevel::Type InFeatureLevel)
Definition ISMInstanceDataSceneProxy.h:63
static ENGINE_API FVector3f GetLocalBoundsPadExtent(const FRenderTransform &LocalToWorld, float PadAmount)
Definition ISMInstanceDataSceneProxy.cpp:81
void UpdateIdMapping(FISMInstanceUpdateChangeSet &ChangeSet, const IndexRemapType &IndexRemap)
Definition ISMInstanceDataSceneProxy.cpp:327
const FInstanceSceneDataBuffers & GetData() const
Definition ISMInstanceDataSceneProxy.h:43
virtual FInstanceDataUpdateTaskInfo * GetUpdateTaskInfo()
Definition ISMInstanceDataSceneProxy.h:65
bool bBuildOptimized
Definition ISMInstanceDataSceneProxy.h:103
ERHIFeatureLevel::Type FeatureLevel
Definition ISMInstanceDataSceneProxy.h:91
FStaticShaderPlatform ShaderPlatform
Definition ISMInstanceDataSceneProxy.h:90
bool bIsNew
Definition ISMInstanceDataSceneProxy.h:101
void TestAndApplyInstanceBufferSizeFixup(int32 PostUpdateNumInstances)
Definition ISMInstanceDataSceneProxy.cpp:236
ENGINE_API void DebugDrawInstanceChanges(FPrimitiveDrawInterface *DebugPDI, ESceneDepthPriorityGroup SceneDepthPriorityGroup)
Definition ISMInstanceDataSceneProxy.cpp:388
Definition ISMInstanceUpdateChangeSet.h:13
Definition InstanceDataSceneProxy.h:448
FInstanceSceneDataBuffers InstanceSceneDataBuffers
Definition InstanceDataSceneProxy.h:472
Definition InstanceDataSceneProxy.h:425
Definition InstanceDataSceneProxy.h:15
Definition InstanceDataSceneProxy.h:135
Definition PrimitiveDrawInterface.h:19
Definition ISMInstanceDataManager.h:45
Definition InstancedStaticMesh.h:71
Definition StaticMeshResources.h:1031
Definition HitProxies.h:135
Definition Array.h:670
Definition UniquePtr.h:107
Type
Definition RHIFeatureLevel.h:20
Definition ISMInstanceDataSceneProxy.h:22
TArray< FInstanceSceneDataBuffers::FCompressedSpatialHashItem > Hashes
Definition ISMInstanceDataSceneProxy.h:23
TArray< int32 > ProxyIndexToComponentIndexRemap
Definition ISMInstanceDataSceneProxy.h:24
Definition InstanceDataSceneProxy.h:222
Definition RenderTransform.h:272
Definition RenderTransform.h:23
Definition AndroidStaticShaderPlatform.inl:18
Definition PimplPtr.h:50