// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #pragma once #include "Engine/Graphics/PixelFormat.h" #include "Engine/Scripting/ScriptingObjectReference.h" #include "Engine/Level/Actor.h" // Amount of frames to wait for data from probe update job #define PROBES_RENDERER_LATENCY_FRAMES 1 class EnvironmentProbe; class SkyLight; class RenderTask; /// /// Probes rendering service /// class ProbesRenderer { public: enum class EntryType { Invalid = 0, EnvProbe = 1, SkyLight = 2, }; struct Entry { EntryType Type; ScriptingObjectReference Actor; float Timeout; Entry() { Type = EntryType::Invalid; } Entry(const Entry& other) { Type = other.Type; Actor = other.Actor; Timeout = other.Timeout; } bool UseTextureData() const; int32 GetResolution() const; PixelFormat GetFormat() const; }; public: /// /// Minimum amount of time between two updated of probes /// static TimeSpan ProbesUpdatedBreak; /// /// Time after last probe update when probes updating content will be released /// static TimeSpan ProbesReleaseDataTime; int32 GetBakeQueueSize(); static Delegate OnRegisterBake; static Delegate OnFinishBake; public: /// /// Checks if resources are ready to render probes (shaders or textures may be during loading). /// /// True if is ready, otherwise false. static bool HasReadyResources(); /// /// Init probes content /// /// True if cannot init service static bool Init(); /// /// Release probes content /// static void Release(); public: /// /// Register probe to baking service. /// /// Probe to bake /// Timeout in seconds left to bake it. static void Bake(EnvironmentProbe* probe, float timeout = 0); /// /// Register probe to baking service. /// /// Probe to bake /// Timeout in seconds left to bake it. static void Bake(SkyLight* probe, float timeout = 0); private: static void OnRender(RenderTask* task, GPUContext* context); };