// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Scripting/ScriptingObject.h"
class GPUContext;
class GPUTexture;
class GPUTextureView;
struct RenderContext;
class RenderTask;
class SceneRenderTask;
class MaterialBase;
class Actor;
///
/// High-level rendering service.
///
API_CLASS(Static) class FLAXENGINE_API Renderer
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Renderer);
public:
///
/// Determines whether the scene rendering system is ready (all shaders are loaded and helper resources are ready).
///
/// true if this rendering service is ready for scene rendering; otherwise, false.
static bool IsReady();
///
/// Performs rendering for the input task.
///
/// The scene rendering task.
static void Render(SceneRenderTask* task);
///
/// Determinates whenever any pass requires motion vectors rendering.
///
/// The rendering context.
/// True if need to render motion vectors, otherwise false.
static bool NeedMotionVectors(RenderContext& renderContext);
public:
///
/// Draws scene objects depth (to the output Z buffer). The output must be depth texture to write hardware depth to it.
///
/// The GPU commands context to use.
/// Render task to use it's view description and the render buffers.
/// The output texture. Must be valid and created.
/// The custom set of actors to render. If empty, the loaded scenes will be rendered.
API_FUNCTION() static void DrawSceneDepth(GPUContext* context, SceneRenderTask* task, GPUTexture* output, const Array& customActors);
///
/// Draws postFx material to the render target.
///
/// The GPU commands context to use.
/// The rendering context.
/// The material to render. It must be a post fx material.
/// The output texture. Must be valid and created.
/// The input texture. It's optional.
API_FUNCTION() static void DrawPostFxMaterial(GPUContext* context, API_PARAM(Ref) const RenderContext& renderContext, MaterialBase* material, GPUTexture* output, GPUTextureView* input);
};