IVSmoke 1.0
Loading...
Searching...
No Matches
FIVSmokeRenderer Class Reference

#include <IVSmokeRenderer.h>

Collaboration diagram for FIVSmokeRenderer:
Collaboration graph

Public Member Functions

void Initialize ()
 
void Shutdown ()
 
bool IsInitialized () const
 
TSharedPtr< FPerWorldDataGetOrCreateWorldData (UWorld *World)
 
TSharedPtr< FPerWorldDataGetWorldData (UWorld *World)
 
void CleanupWorldData (UWorld *World)
 
bool bIsServerTimeSynced (UWorld *World)
 
void SetServerTimeOffset (UWorld *World, float InServerTimeOffset)
 
FIVSmokePackedRenderData PrepareRenderData (UWorld *World, const TArray< AIVSmokeVoxelVolume * > &InVolumes, const FVector &CameraPosition)
 
void SetCachedRenderData (UWorld *World, FIVSmokePackedRenderData &&InRenderData)
 
FScreenPassTexture Render (FRDGBuilder &GraphBuilder, const FSceneView &View, const FPostProcessMaterialInputs &Inputs)
 
void RunPrePassPipeline (FRDGBuilder &GraphBuilder, const FSceneView &View, const struct FRenderTargetBindingSlots &RenderTargets, TRDGUniformBufferRef< FSceneTextureUniformParameters > SceneTextures)
 
void ClearViewDataForViewFamily (const FSceneViewFamily &ViewFamily)
 

Static Public Member Functions

static FIVSmokeRendererGet ()
 

Static Public Attributes

static constexpr int32 MaxSupportedVolumes = 128
 

Detailed Description

Manages registered smoke volumes and handles rendering. Owns shared rendering resources (noise volume) and reads settings from UIVSmokeSettings.

ARCHITECTURE: Per-World Data

  • Each UWorld has its own FPerWorldData instance stored in WorldDataMap
  • Enables simultaneous rendering of Editor and PIE worlds
  • World lifecycle managed via OnWorldBeginTearDown delegate

See Docs/IVSmoke_RendererArchitecture.md for detailed documentation.

Definition at line 264 of file IVSmokeRenderer.h.

Member Function Documentation

◆ bIsServerTimeSynced()

bool FIVSmokeRenderer::bIsServerTimeSynced ( UWorld *  World)

Check if server time offset was set for a World.

Definition at line 214 of file IVSmokeRenderer.cpp.

◆ CleanupWorldData()

void FIVSmokeRenderer::CleanupWorldData ( UWorld *  World)

Cleanup and remove per-world data. Called automatically when World is destroyed (via delegate). IMPORTANT: Calls FlushRenderingCommands() to ensure GPU safety.

Parameters
WorldThe world to cleanup

Definition at line 179 of file IVSmokeRenderer.cpp.

◆ ClearViewDataForViewFamily()

void FIVSmokeRenderer::ClearViewDataForViewFamily ( const FSceneViewFamily &  ViewFamily)
inline

Clear per-view data for a specific ViewFamily. Called at end of ViewFamily rendering.

Definition at line 597 of file IVSmokeRenderer.h.

◆ Get()

FIVSmokeRenderer & FIVSmokeRenderer::Get ( )
static

Definition at line 33 of file IVSmokeRenderer.cpp.

◆ GetOrCreateWorldData()

TSharedPtr< FPerWorldData > FIVSmokeRenderer::GetOrCreateWorldData ( UWorld *  World)

Get or create per-world data for a specific World. Creates new FPerWorldData if not exists and registers cleanup delegate. Must be called on Game Thread.

Parameters
WorldThe world to get data for
Returns
Shared pointer to world data (never null for valid World)

Definition at line 125 of file IVSmokeRenderer.cpp.

◆ GetWorldData()

TSharedPtr< FPerWorldData > FIVSmokeRenderer::GetWorldData ( UWorld *  World)

Get per-world data for a specific World (read-only). Returns nullptr if World is not registered. Thread-safe (uses mutex internally).

Parameters
WorldThe world to get data for
Returns
Shared pointer to world data, or nullptr if not found

Definition at line 164 of file IVSmokeRenderer.cpp.

◆ Initialize()

void FIVSmokeRenderer::Initialize ( )

Initialize renderer resources. Called on first use or settings change.

Definition at line 50 of file IVSmokeRenderer.cpp.

◆ IsInitialized()

bool FIVSmokeRenderer::IsInitialized ( ) const
inline

Check if renderer is initialized with valid resources.

Definition at line 279 of file IVSmokeRenderer.h.

◆ PrepareRenderData()

FIVSmokePackedRenderData FIVSmokeRenderer::PrepareRenderData ( UWorld *  World,
const TArray< AIVSmokeVoxelVolume * > &  InVolumes,
const FVector &  CameraPosition 
)

Prepare render data from all registered volumes for a specific World. Must be called on Game Thread. Copies and packs all volume data for safe Render Thread access. If volume count exceeds MaxSupportedVolumes (128), filters by distance from camera. Skips processing if already called this frame (uses LastPreparedFrameNumber).

Parameters
WorldThe world these volumes belong to
InVolumesArray of volumes to process
CameraPositionCamera world position for distance-based filtering
Returns
Packed render data ready for Render Thread

Definition at line 458 of file IVSmokeRenderer.cpp.

◆ Render()

FScreenPassTexture FIVSmokeRenderer::Render ( FRDGBuilder &  GraphBuilder,
const FSceneView &  View,
const FPostProcessMaterialInputs &  Inputs 
)

Main render entry point called from SceneViewExtension.

Parameters
GraphBuilderRDG builder
ViewCurrent scene view
InputsPost-process material inputs
Returns
Output texture after smoke rendering

Definition at line 902 of file IVSmokeRenderer.cpp.

◆ RunPrePassPipeline()

void FIVSmokeRenderer::RunPrePassPipeline ( FRDGBuilder &  GraphBuilder,
const FSceneView &  View,
const struct FRenderTargetBindingSlots &  RenderTargets,
TRDGUniformBufferRef< FSceneTextureUniformParameters >  SceneTextures 
)

Execute Pre-pass pipeline: Ray March → Upscale → UpsampleFilter → Depth Write. Called from PostRenderBasePassDeferred_RenderThread BEFORE Translucent Pass. Results are cached for Post-process Visual/Composite passes.

Pipeline order ensures Ray March reads only opaque depth (before smoke depth write).

Parameters
GraphBuilderRDG builder
ViewCurrent scene view
RenderTargetsRender target slots (for depth write)
SceneTexturesScene texture uniform buffer (for depth sampling in ray march)

Definition at line 1941 of file IVSmokeRenderer.cpp.

◆ SetCachedRenderData()

void FIVSmokeRenderer::SetCachedRenderData ( UWorld *  World,
FIVSmokePackedRenderData &&  InRenderData 
)

Set cached render data for a specific World. Called from Render Thread via ENQUEUE_RENDER_COMMAND.

Parameters
WorldThe world to set data for
InRenderDataThe render data to cache

Definition at line 230 of file IVSmokeRenderer.cpp.

◆ SetServerTimeOffset()

void FIVSmokeRenderer::SetServerTimeOffset ( UWorld *  World,
float  InServerTimeOffset 
)

Set server time offset for smoke wind animation for a specific World.

Definition at line 220 of file IVSmokeRenderer.cpp.

◆ Shutdown()

void FIVSmokeRenderer::Shutdown ( )

Release renderer resources.

Definition at line 67 of file IVSmokeRenderer.cpp.

Member Data Documentation

◆ MaxSupportedVolumes

constexpr int32 FIVSmokeRenderer::MaxSupportedVolumes = 128
staticconstexpr

Maximum number of volumes supported for rendering.

Definition at line 323 of file IVSmokeRenderer.h.


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