Finality Engine
Loading...
Searching...
No Matches
Renderer.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <Core/Core.h>
14#include <Core/RenderDevice.h>
15#include "Scene/Entity.h"
16#include "Scene/Components.h"
17#include <vector>
18#include "Camera.h"
19
20#include <Core/Pipeline.h>
21#include "Camera/Frustum.h"
22
23namespace FINALITY
24{
35 {
36 public:
37 Renderer() = default;
38 ~Renderer() = default;
39
40 Renderer(const Renderer&) = delete;
41 Renderer& operator=(const Renderer&) = delete;
42
48 static void Initialize(RenderDevice* device);
49 static void Shutdown();
50
51 static void BeginScene();
52 static void EndScene();
53
54 static void PushEntity(Entity entity);
55 static void PushEntity(Entity entity, const glm::mat4& worldTransform);
56 static void ConfigureLODGroups(const Scene& scene);
57 static RenderDevice* GetDevice() { return s_Device; }
58
59 static void SetActiveCamera(Camera* camera) { s_ActiveCamera = camera; }
60 static Camera* GetActiveCamera() { return s_ActiveCamera; }
61
62 static void SetPostProcessPipeline(std::shared_ptr<Pipeline> pipeline);
63 static std::shared_ptr<Pipeline> CreatePostProcessPipeline(const PipelineConfig& config);
64
65 static uint32_t GetSubmittedCount() { return (uint32_t)s_RenderQueue.size(); }
66 static uint32_t GetCulledCount() { return s_CulledCount; }
67 static const std::vector<RenderPacket>& GetRenderQueue() { return s_RenderQueue; }
68
69 static void SetDirectRenderingEnabled(bool enabled) { s_DirectRenderingEnabled = enabled; }
70 static bool IsDirectRenderingEnabled() { return s_DirectRenderingEnabled; }
71
72 static void SetFrustumCullingEnabled(bool enabled) { s_FrustumCullingEnabled = enabled; }
73
74 private:
75 static RenderDevice* s_Device;
76 static std::vector<RenderPacket> s_RenderQueue;
77 static inline Camera* s_ActiveCamera = nullptr;
78
79 static Frustum s_CurrentFrustum;
80 static bool s_FrustumCullingEnabled;
81
82 static uint32_t s_CulledCount;
83 static inline bool s_DirectRenderingEnabled = true;
84 static inline ViewVisibilityState s_VisibilityState;
85
86 protected:
87 static bool TryGetCullingFrustum(const Frustum*& outFrustum);
88 static bool IsFrustumCullingEnabled() { return s_FrustumCullingEnabled; }
89 };
90}
Stores camera projection and view configuration.
Defines authored entity components shared by scene and rendering systems.
#define FAPI
Definition Core.h:22
Provides a scene-bound handle for component and hierarchy operations.
Defines the graphics backend boundary and render submission contract.
Stores camera projection and view configuration.
Definition Camera.h:28
Provides a scene-bound handle for component and hierarchy operations.
Definition Entity.h:34
Defines the graphics backend boundary and render submission contract.
static void SetDirectRenderingEnabled(bool enabled)
Definition Renderer.h:69
static void ConfigureLODGroups(const Scene &scene)
static bool TryGetCullingFrustum(const Frustum *&outFrustum)
static void SetFrustumCullingEnabled(bool enabled)
Definition Renderer.h:72
static void PushEntity(Entity entity)
static uint32_t GetCulledCount()
Definition Renderer.h:66
static bool IsDirectRenderingEnabled()
Definition Renderer.h:70
Renderer(const Renderer &)=delete
static const std::vector< RenderPacket > & GetRenderQueue()
Definition Renderer.h:67
static void SetActiveCamera(Camera *camera)
Definition Renderer.h:59
static void PushEntity(Entity entity, const glm::mat4 &worldTransform)
static void EndScene()
static uint32_t GetSubmittedCount()
Definition Renderer.h:65
static std::shared_ptr< Pipeline > CreatePostProcessPipeline(const PipelineConfig &config)
static void BeginScene()
static void Initialize(RenderDevice *device)
Connects the rendering facade to a graphics backend.
static void Shutdown()
static Camera * GetActiveCamera()
Definition Renderer.h:60
static bool IsFrustumCullingEnabled()
Definition Renderer.h:88
Renderer & operator=(const Renderer &)=delete
static void SetPostProcessPipeline(std::shared_ptr< Pipeline > pipeline)
static RenderDevice * GetDevice()
Definition Renderer.h:57
Owns entities and dispatches script simulation.
Definition Scene.h:36