9#ifndef AVARA3D_RENDER_RENDERER_H
10#define AVARA3D_RENDER_RENDERER_H
16#include "a3d/render/PipelineDesc.h"
17#include "a3d/scene/Scene.h"
21 struct BackgroundPass;
25 struct RenderMemoryStats;
27 class FrameStatsHistory;
45 bool wireframeRendering {
false};
46 bool gpuTiming {
false};
54 std::int32_t width = 0;
55 std::int32_t height = 0;
58 bool clearColor =
true;
59 bool clearDepth =
true;
60 bool clearStencil =
false;
61 math::vec4 color = {0.f, 0.f, 0.f, 1.f};
64 std::optional<Scissor> scissor = {};
67 bool forceWriteMasks =
true;
71 const RenderContext& context;
72 math::mat4 view = math::mat4(1.0f);
73 math::mat4 proj = math::mat4(1.0f);
75 FrameStats* stats =
nullptr;
76 Profiler* profiler =
nullptr;
83 Renderer(
const Renderer&) =
delete;
84 Renderer& operator=(
const Renderer&) =
delete;
86 Renderer(Renderer&&) =
delete;
87 Renderer& operator=(Renderer&&) =
delete;
89 virtual ~Renderer() = 0;
93 virtual bool initialize(
const RenderContext& context) = 0;
94 virtual bool isInitialized()
const = 0;
96 virtual const Capabilities& capabilities()
const = 0;
98 virtual void beginFrame(
const Scene& scene,
99 const RenderContext& context,
102 Profiler& profiler) = 0;
103 virtual void endFrame(
const Scene& scene,
104 const RenderContext& context,
108 const FrameStatsHistory& statsHistory) = 0;
110 virtual void preTraversal(
const Scene& scene,
111 const RenderContext& context,
113 FrameStats& stats) = 0;
114 virtual void postTraversal(
const Scene& scene,
115 const RenderContext& context,
116 const math::mat4& view,
117 const std::vector<Node*>& lightNodes,
119 FrameStats& stats) = 0;
121 virtual void clear(
const ClearCommand& cmd,
const RenderContext& context) = 0;
123 virtual void renderPacket(DrawPacket& packet,
const FrameParams& frame) = 0;
125 virtual std::unique_ptr<Image> snapshot(
const RenderContext& context)
const = 0;
130 virtual void resolvePacket(DrawPacket& packet,
const FrameParams& frame) = 0;
131 virtual void drawPacket(
const DrawPacket& packet,
const FrameParams& frame) = 0;
133 virtual void drawBackground(
const BackgroundPass& backgroundPass,
134 const math::mat4& view,
135 const math::mat4& proj) = 0;
136 virtual void drawGround(
const GroundPass& groundPass,
137 const math::mat4& view,
138 const math::mat4& proj) = 0;
140 virtual void bindPipeline(PipelineId pipelineId) = 0;
141 virtual void bindMaterial(
const Material& material) = 0;
142 virtual void bindMeshElement(
const MeshElement& element) = 0;
143 virtual void applyMVP(
const math::mat4& model,
const math::mat4& view,
const math::mat4& proj) = 0;
144 virtual void drawElements() = 0;
146 virtual void drawLines(
const LinesPass& pass,
147 const RenderContext& context,
148 const math::mat4& view,
149 const math::mat4& proj) = 0;
DebugOptions
Scene-wide debug visualization options.
@ None
No scene debug visualization options enabled.