UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SceneRenderingUtils.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"
6//#include "SceneManagement.h"
7#include "SceneRendering.h"
8
9template <typename PassParametersType>
10inline void AddSimpleElementCollectorPass(const FSimpleElementCollector& SimpleElementCollector, FRDGBuilder& GraphBuilder, PassParametersType* PassParameters, const FViewInfo& View, const FMeshPassProcessorRenderState& DrawRenderState)
11{
12 GraphBuilder.AddPass(
13 RDG_EVENT_NAME("EditorPrimitives"),
16 [&View, &SimpleElementCollector, DrawRenderState](FRHICommandListImmediate& RHICmdList)
17 {
18 FSceneRenderer::SetStereoViewport(RHICmdList, View, 1.0f);
19
20 SimpleElementCollector.DrawBatchedElements(RHICmdList, DrawRenderState, View, EBlendModeFilter::OpaqueAndMasked, SDPG_World, View.GetStereoPassInstanceFactor());
21 SimpleElementCollector.DrawBatchedElements(RHICmdList, DrawRenderState, View, EBlendModeFilter::OpaqueAndMasked, SDPG_Foreground, View.GetStereoPassInstanceFactor());
22 }
23 );
24}
25
26template <typename PassParametersType>
28{
29 GraphBuilder.AddPass(
30 RDG_EVENT_NAME("EditorPrimitives"),
33 [&View, &SimpleElementCollector, DrawRenderState, SceneDepthPriorityGroup](FRHICommandListImmediate& RHICmdList)
34 {
35 FSceneRenderer::SetStereoViewport(RHICmdList, View, 1.0f);
36
37 SimpleElementCollector.DrawBatchedElements(RHICmdList, DrawRenderState, View, EBlendModeFilter::OpaqueAndMasked, SceneDepthPriorityGroup, View.GetStereoPassInstanceFactor());
38 }
39 );
40}
41
42template <typename PassParametersType>
43inline void AddBatchedElementsPass(const FBatchedElements& BatchedElements, FRDGBuilder& GraphBuilder, PassParametersType* PassParameters, const FViewInfo& View, const FMeshPassProcessorRenderState& DrawRenderState)
44{
45 GraphBuilder.AddPass(
46 RDG_EVENT_NAME("BatchedElements"),
49 [&View, &BatchedElements, DrawRenderState](FRHICommandListImmediate& RHICmdList)
50 {
51 RHICmdList.SetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0.0f, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1.0f);
52
53 // Draw the view's batched simple elements(lines, sprites, etc).
54 BatchedElements.Draw(RHICmdList, DrawRenderState, View.FeatureLevel, View, false);
55 }
56 );
57}
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
ESceneDepthPriorityGroup
Definition EngineTypes.h:187
@ SDPG_Foreground
Definition EngineTypes.h:191
@ SDPG_World
Definition EngineTypes.h:189
#define RDG_EVENT_NAME(...)
Definition RenderGraphEvent.h:529
void AddSimpleElementCollectorPass(const FSimpleElementCollector &SimpleElementCollector, FRDGBuilder &GraphBuilder, PassParametersType *PassParameters, const FViewInfo &View, const FMeshPassProcessorRenderState &DrawRenderState)
Definition SceneRenderingUtils.h:10
void AddBatchedElementsPass(const FBatchedElements &BatchedElements, FRDGBuilder &GraphBuilder, PassParametersType *PassParameters, const FViewInfo &View, const FMeshPassProcessorRenderState &DrawRenderState)
Definition SceneRenderingUtils.h:43
Definition BatchedElements.h:102
ENGINE_API bool Draw(FRHICommandList &RHICmdList, const FMeshPassProcessorRenderState &DrawRenderState, ERHIFeatureLevel::Type FeatureLevel, const FSceneView &View, bool bHitTesting, float Gamma=1.0f, EBlendModeFilter::Type Filter=EBlendModeFilter::All, uint32 NumInstances=1) const
Definition BatchedElements.cpp:894
Definition RenderGraphBuilder.h:49
FRDGPassRef AddPass(FRDGEventName &&Name, const ParameterStructType *ParameterStruct, ERDGPassFlags Flags, ExecuteLambdaType &&ExecuteLambda)
Definition RHICommandList.h:4626
void SetViewport(float MinX, float MinY, float MinZ, float MaxX, float MaxY, float MaxZ)
Definition RHICommandList.h:4015
static void SetStereoViewport(FRHICommandList &RHICmdList, const FViewInfo &View, float ViewportScale=1.0f)
Definition SceneRendering.cpp:5826
const ERHIFeatureLevel::Type FeatureLevel
Definition SceneView.h:1826
int32 GetStereoPassInstanceFactor() const
Definition SceneView.h:2013
Definition SceneManagement.h:1313
ENGINE_API void DrawBatchedElements(FRHICommandList &RHICmdList, const FMeshPassProcessorRenderState &DrawRenderState, const FSceneView &InView, EBlendModeFilter::Type Filter, ESceneDepthPriorityGroup DPG, uint32 NumInstances=1) const
Definition SceneManagement.cpp:275
Definition SceneRendering.h:1132
FIntRect ViewRect
Definition SceneRendering.h:1137
@ OpaqueAndMasked
Definition BatchedElements.h:32
Definition MeshPassProcessor.h:2118
IntType Y
Definition IntPoint.h:37
IntType X
Definition IntPoint.h:34
IntPointType Max
Definition IntRect.h:37
IntPointType Min
Definition IntRect.h:34