UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FMeshElementCollector Class Reference

#include <MeshElementCollector.h>

Public Member Functions

ENGINE_API FPrimitiveDrawInterfaceGetPDI (int32 ViewIndex)
 
ENGINE_API FPrimitiveDrawInterfaceGetDebugPDI (int32 ViewIndex)
 
FMeshBatchAllocateMesh ()
 
FGlobalDynamicIndexBufferGetDynamicIndexBuffer ()
 
FGlobalDynamicVertexBufferGetDynamicVertexBuffer ()
 
FGlobalDynamicReadBufferGetDynamicReadBuffer ()
 
FRHICommandListGetRHICommandList ()
 
uint32 GetMeshBatchCount (uint32 ViewIndex) const
 
uint32 GetMeshElementCount (uint32 ViewIndex) const
 
ENGINE_API void AddMesh (int32 ViewIndex, FMeshBatch &MeshBatch)
 
ENGINE_API void RegisterOneFrameMaterialProxy (FMaterialRenderProxy *Proxy)
 
ENGINE_API void CacheUniformExpressions (FMaterialRenderProxy *Proxy, bool bRecreateUniformBuffer)
 
template<typename T , typename... ARGS>
T & AllocateOneFrameResource (ARGS &&... Args)
 
bool ShouldUseTasks () const
 
void AddTask (TFunction< void()> &&Task)
 
void AddTask (const TFunction< void()> &Task)
 
void ProcessTasks ()
 
ERHIFeatureLevel::Type GetFeatureLevel () const
 

Protected Types

enum class  ECommitFlags { None = 0 , DeferMaterials = 1 << 0 , DeferGPUScene = 1 << 1 , DeferAll = DeferMaterials | DeferGPUScene }
 

Protected Member Functions

 FRIEND_ENUM_CLASS_FLAGS (ECommitFlags)
 
ENGINE_API FMeshElementCollector (ERHIFeatureLevel::Type InFeatureLevel, FSceneRenderingBulkObjectAllocator &InBulkAllocator, ECommitFlags CommitFlags=ECommitFlags::None)
 
ENGINE_API ~FMeshElementCollector ()
 
ENGINE_API void SetPrimitive (const FPrimitiveSceneProxy *InPrimitiveSceneProxy, const FHitProxyId &DefaultHitProxyId)
 
ENGINE_API void Start (FRHICommandList &RHICmdList, FGlobalDynamicVertexBuffer &DynamicVertexBuffer, FGlobalDynamicIndexBuffer &DynamicIndexBuffer, FGlobalDynamicReadBuffer &DynamicReadBuffer)
 
ENGINE_API void AddViewMeshArrays (const FSceneView *InView, TArray< FMeshBatchAndRelevance, SceneRenderingAllocator > *ViewMeshes, FSimpleElementCollector *ViewSimpleElementCollector, FGPUScenePrimitiveCollector *DynamicPrimitiveCollector, FSimpleElementCollector *DebugSimpleElementCollector=nullptr)
 
ENGINE_API void ClearViewMeshArrays ()
 
ENGINE_API void Commit ()
 
ENGINE_API void Finish ()
 

Protected Attributes

TChunkedArray< FMeshBatch, 16384, FConcurrentLinearArrayAllocatorMeshBatchStorage
 
TArray< TArray< FMeshBatchAndRelevance, SceneRenderingAllocator > *, TInlineAllocator< 2, SceneRenderingAllocator > > MeshBatches
 
TArray< int32, TInlineAllocator< 2, SceneRenderingAllocator > > NumMeshBatchElementsPerView
 
TArray< FSimpleElementCollector *, TInlineAllocator< 2, SceneRenderingAllocator > > SimpleElementCollectors
 
TArray< FSimpleElementCollector *, TInlineAllocator< 2, SceneRenderingAllocator > > DebugSimpleElementCollectors
 
TArray< const FSceneView *, TInlineAllocator< 2, SceneRenderingAllocator > > Views
 
TArray< uint16, TInlineAllocator< 2, SceneRenderingAllocator > > MeshIdInPrimitivePerView
 
TArray< FMaterialRenderProxy *, SceneRenderingAllocatorMaterialProxiesToDelete
 
TArray< TPair< FMaterialRenderProxy *, bool >, SceneRenderingAllocatorMaterialProxiesToInvalidate
 
TArray< const FMaterialRenderProxy *, SceneRenderingAllocatorMaterialProxiesToUpdate
 
TArray< TPair< FGPUScenePrimitiveCollector *, FMeshBatch * >, SceneRenderingAllocatorMeshBatchesForGPUScene
 
FSceneRenderingBulkObjectAllocatorOneFrameResources
 
const FPrimitiveSceneProxyPrimitiveSceneProxy
 
FGlobalDynamicIndexBufferDynamicIndexBuffer = nullptr
 
FGlobalDynamicVertexBufferDynamicVertexBuffer = nullptr
 
FGlobalDynamicReadBufferDynamicReadBuffer = nullptr
 
FRHICommandListRHICmdList = nullptr
 
const ERHIFeatureLevel::Type FeatureLevel
 
const ECommitFlags CommitFlags
 
const bool bUseGPUScene
 
TArray< FGPUScenePrimitiveCollector *, TInlineAllocator< 2, SceneRenderingAllocator > > DynamicPrimitiveCollectorPerView
 
friend FSceneRenderingBulkObjectAllocator
 

Friends

class FVisibilityTaskData
 
class FSceneRenderer
 
class FDeferredShadingSceneRenderer
 
class FProjectedShadowInfo
 
class FCardPageRenderData
 
class FViewFamilyInfo
 
class FShadowMeshCollector
 
class FDynamicMeshElementContext
 
class RuntimeVirtualTexture::FDynamicMeshCollector
 

Detailed Description

Encapsulates the gathering of meshes from the various FPrimitiveSceneProxy classes.

Member Enumeration Documentation

◆ ECommitFlags

Enumerator
None 
DeferMaterials 
DeferGPUScene 
DeferAll 

Constructor & Destructor Documentation

◆ FMeshElementCollector()

FMeshElementCollector::FMeshElementCollector ( ERHIFeatureLevel::Type  InFeatureLevel,
FSceneRenderingBulkObjectAllocator InBulkAllocator,
ECommitFlags  CommitFlags = ECommitFlags::None 
)
protected

◆ ~FMeshElementCollector()

FMeshElementCollector::~FMeshElementCollector ( )
protected

Member Function Documentation

◆ AddMesh()

void FMeshElementCollector::AddMesh ( int32  ViewIndex,
FMeshBatch MeshBatch 
)

Adds a mesh batch to the collector for the specified view so that it can be rendered.

◆ AddTask() [1/2]

void FMeshElementCollector::AddTask ( const TFunction< void()> &  Task)
inline

◆ AddTask() [2/2]

void FMeshElementCollector::AddTask ( TFunction< void()> &&  Task)
inline

◆ AddViewMeshArrays()

void FMeshElementCollector::AddViewMeshArrays ( const FSceneView InView,
TArray< FMeshBatchAndRelevance, SceneRenderingAllocator > *  ViewMeshes,
FSimpleElementCollector ViewSimpleElementCollector,
FGPUScenePrimitiveCollector DynamicPrimitiveCollector,
FSimpleElementCollector DebugSimpleElementCollector = nullptr 
)
protected

◆ AllocateMesh()

FMeshBatch & FMeshElementCollector::AllocateMesh ( )
inline

Allocates an FMeshBatch that can be safely referenced by the collector (lifetime will be long enough). Returns a reference that will not be invalidated due to further AllocateMesh() calls.

◆ AllocateOneFrameResource()

template<typename T , typename... ARGS>
T & FMeshElementCollector::AllocateOneFrameResource ( ARGS &&...  Args)
inline

Allocates a temporary resource that is safe to be referenced by an FMeshBatch added to the collector.

◆ CacheUniformExpressions()

void FMeshElementCollector::CacheUniformExpressions ( FMaterialRenderProxy Proxy,
bool  bRecreateUniformBuffer 
)

Adds a request to force caching of uniform expressions for a material render proxy.

◆ ClearViewMeshArrays()

void FMeshElementCollector::ClearViewMeshArrays ( )
protected

◆ Commit()

void FMeshElementCollector::Commit ( )
protected

◆ Finish()

void FMeshElementCollector::Finish ( )
protected

◆ FRIEND_ENUM_CLASS_FLAGS()

FMeshElementCollector::FRIEND_ENUM_CLASS_FLAGS ( ECommitFlags  )
protected

◆ GetDebugPDI()

ENGINE_API FPrimitiveDrawInterface * FMeshElementCollector::GetDebugPDI ( int32  ViewIndex)

◆ GetDynamicIndexBuffer()

FGlobalDynamicIndexBuffer & FMeshElementCollector::GetDynamicIndexBuffer ( )
inline

Return dynamic index buffer for this collector.

◆ GetDynamicReadBuffer()

FGlobalDynamicReadBuffer & FMeshElementCollector::GetDynamicReadBuffer ( )
inline

Return dynamic read buffer for this collector.

◆ GetDynamicVertexBuffer()

FGlobalDynamicVertexBuffer & FMeshElementCollector::GetDynamicVertexBuffer ( )
inline

Return dynamic vertex buffer for this collector.

◆ GetFeatureLevel()

ERHIFeatureLevel::Type FMeshElementCollector::GetFeatureLevel ( ) const
inline

◆ GetMeshBatchCount()

uint32 FMeshElementCollector::GetMeshBatchCount ( uint32  ViewIndex) const
inline

◆ GetMeshElementCount()

uint32 FMeshElementCollector::GetMeshElementCount ( uint32  ViewIndex) const
inline

◆ GetPDI()

FPrimitiveDrawInterface * FMeshElementCollector::GetPDI ( int32  ViewIndex)

Accesses the PDI for drawing lines, sprites, etc.

◆ GetRHICommandList()

FRHICommandList & FMeshElementCollector::GetRHICommandList ( )
inline

Return the current RHI command list used to initialize resources.

◆ ProcessTasks()

void FMeshElementCollector::ProcessTasks ( )
inline

◆ RegisterOneFrameMaterialProxy()

void FMeshElementCollector::RegisterOneFrameMaterialProxy ( FMaterialRenderProxy Proxy)

Add a material render proxy that will be cleaned up automatically

◆ SetPrimitive()

void FMeshElementCollector::SetPrimitive ( const FPrimitiveSceneProxy InPrimitiveSceneProxy,
const FHitProxyId DefaultHitProxyId 
)
protected

◆ ShouldUseTasks()

bool FMeshElementCollector::ShouldUseTasks ( ) const
inline

◆ Start()

void FMeshElementCollector::Start ( FRHICommandList RHICmdList,
FGlobalDynamicVertexBuffer DynamicVertexBuffer,
FGlobalDynamicIndexBuffer DynamicIndexBuffer,
FGlobalDynamicReadBuffer DynamicReadBuffer 
)
protected

Friends And Related Symbol Documentation

◆ FCardPageRenderData

◆ FDeferredShadingSceneRenderer

◆ FDynamicMeshElementContext

◆ FProjectedShadowInfo

◆ FSceneRenderer

friend class FSceneRenderer
friend

◆ FShadowMeshCollector

◆ FViewFamilyInfo

friend class FViewFamilyInfo
friend

◆ FVisibilityTaskData

◆ RuntimeVirtualTexture::FDynamicMeshCollector

Member Data Documentation

◆ bUseGPUScene

const bool FMeshElementCollector::bUseGPUScene
protected

◆ CommitFlags

const ECommitFlags FMeshElementCollector::CommitFlags
protected

◆ DebugSimpleElementCollectors

TArray<FSimpleElementCollector*, TInlineAllocator<2, SceneRenderingAllocator> > FMeshElementCollector::DebugSimpleElementCollectors
protected

◆ DynamicIndexBuffer

FGlobalDynamicIndexBuffer* FMeshElementCollector::DynamicIndexBuffer = nullptr
protected

Dynamic buffer pools.

◆ DynamicPrimitiveCollectorPerView

TArray<FGPUScenePrimitiveCollector*, TInlineAllocator<2, SceneRenderingAllocator> > FMeshElementCollector::DynamicPrimitiveCollectorPerView
protected

Tracks dynamic primitive data for upload to GPU Scene for every view, when enabled.

◆ DynamicReadBuffer

FGlobalDynamicReadBuffer* FMeshElementCollector::DynamicReadBuffer = nullptr
protected

◆ DynamicVertexBuffer

FGlobalDynamicVertexBuffer* FMeshElementCollector::DynamicVertexBuffer = nullptr
protected

◆ FeatureLevel

const ERHIFeatureLevel::Type FMeshElementCollector::FeatureLevel
protected

◆ FSceneRenderingBulkObjectAllocator

friend FMeshElementCollector::FSceneRenderingBulkObjectAllocator
protected

◆ MaterialProxiesToDelete

TArray<FMaterialRenderProxy*, SceneRenderingAllocator> FMeshElementCollector::MaterialProxiesToDelete
protected

Material proxies that will be deleted at the end of the frame.

◆ MaterialProxiesToInvalidate

TArray<TPair<FMaterialRenderProxy*, bool>, SceneRenderingAllocator> FMeshElementCollector::MaterialProxiesToInvalidate
protected

Material proxies to force uniform expression evaluation.

◆ MaterialProxiesToUpdate

TArray<const FMaterialRenderProxy*, SceneRenderingAllocator> FMeshElementCollector::MaterialProxiesToUpdate
protected

Material proxies to force uniform expression evaluation.

◆ MeshBatches

Meshes to render

◆ MeshBatchesForGPUScene

TArray<TPair<FGPUScenePrimitiveCollector*, FMeshBatch*>, SceneRenderingAllocator> FMeshElementCollector::MeshBatchesForGPUScene
protected

List of mesh batches that require GPU scene updates.

◆ MeshBatchStorage

TChunkedArray<FMeshBatch, 16384, FConcurrentLinearArrayAllocator> FMeshElementCollector::MeshBatchStorage
protected

Using TChunkedArray which will never realloc as new elements are added

◆ MeshIdInPrimitivePerView

TArray<uint16, TInlineAllocator<2, SceneRenderingAllocator> > FMeshElementCollector::MeshIdInPrimitivePerView
protected

Current Mesh Id In Primitive per view

◆ NumMeshBatchElementsPerView

TArray<int32, TInlineAllocator<2, SceneRenderingAllocator> > FMeshElementCollector::NumMeshBatchElementsPerView
protected

Number of elements in gathered meshes per view.

◆ OneFrameResources

FSceneRenderingBulkObjectAllocator& FMeshElementCollector::OneFrameResources
protected

Resources that will be deleted at the end of the frame.

◆ PrimitiveSceneProxy

const FPrimitiveSceneProxy* FMeshElementCollector::PrimitiveSceneProxy
protected

Current primitive being gathered.

◆ RHICmdList

FRHICommandList* FMeshElementCollector::RHICmdList = nullptr
protected

◆ SimpleElementCollectors

TArray<FSimpleElementCollector*, TInlineAllocator<2, SceneRenderingAllocator> > FMeshElementCollector::SimpleElementCollectors
protected

PDIs

◆ Views

TArray<const FSceneView*, TInlineAllocator<2, SceneRenderingAllocator> > FMeshElementCollector::Views
protected

Views being collected for


The documentation for this class was generated from the following files: