CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
RendererScene.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "Forward.hpp"
11
12#include "RendererGeometry.hpp"
13#include "RendererObject.hpp"
15
18
21
22namespace CeresEngine {
23
24 class RendererSceneManager;
26
29
32
34 class RendererScene final : public TRendererObject<RendererScene> {
36
37 private:
40 bool mDirty = true;
41
44
47
48 private:
51
54
57
60
63
64 public:
65 using super::super;
67
68 public:
74 void prepare(RendererContext& context);
75
76 public:
79 if(mEnvironments.empty()) {
80 return nullptr;
81 }
82 return mEnvironments.front();
83 }
84
85 public: // Scene Object management
89 template<typename T> T& create();
90
91 private:
92 template<typename, typename> friend class TRendererSceneObject;
93
98 template<typename T> void add(T& object);
99
104 template<typename T> void remove(T& object);
105
106 public:
109
112
115
118
121
122 public: // Render Elements
124
125 public:
128
129 // /// \copydoc Scene::Scene::getRendererSettings
130 // [[nodiscard]] const RendererSceneSettings& getSettings() const { return mScene->getRendererSettings(); }
131
133 [[nodiscard]] bool isDirty() const noexcept { return mDirty; }
134
136 void markAsDirty() noexcept { mDirty = true; }
137
139 [[nodiscard]] const RendererSceneInfo& getInfo() const { return mInfo; }
140
143
146
147 private:
150 };
151
152 // ---------------------------------------------------------------------------------------------
153
183
184} // namespace CeresEngine
#define CE_DECL_RENDERER_OBJECT(T)
Definition RendererObject.hpp:25
Definition GPUBufferObject.hpp:562
Definition GPUBufferObject.hpp:221
A generator represents a coroutine type that produces a sequence of values of type T,...
Definition Generator.hpp:50
A class that represents a environment inside the renderer.
Definition RendererEnvironment.hpp:67
The CeresEngine renderer.
Definition Renderer.hpp:35
A class that represents a scene inside the renderer.
Definition RendererScene.hpp:34
void add(T &object)
Adds a new object to the scene.
RendererEnvironment * getEnvironment() const noexcept
A pointer to the sky environment for the scene.
Definition RendererScene.hpp:78
const Vector< RendererTerrain * > & getTerrains()
Enumerates the currently registered terrains.
Definition RendererScene.hpp:117
const GPUUniformBuffer & getUniformBuffer() const
The uniform buffer storing the scene GPU parameters used by the renderer.
Definition RendererScene.hpp:145
const RendererSceneInfo & getInfo() const
A structure that holds renderer-specific information for the scene.
Definition RendererScene.hpp:139
RendererSceneInfo & getInfo()
A structure that holds renderer-specific information for the scene.
Definition RendererScene.hpp:142
T & create()
Creates a new renderer object of the given type T.
Vector< RendererEnvironment * > mEnvironments
The set of registered terrains with the renderer scene.
Definition RendererScene.hpp:62
bool isDirty() const noexcept
If set to true, the scene is dirty and needs to be synchronized from the entity.
Definition RendererScene.hpp:133
Vector< RendererRenderable * > mRenderables
The set of registered renderables with the renderer scene.
Definition RendererScene.hpp:56
void remove(T &object)
Removes an existing object from the scene.
RendererSceneInfo mInfo
A structure that holds renderer-specific information for the scene.
Definition RendererScene.hpp:43
Vector< RendererCamera * > mCameras
The set of registered cameras with the renderer scene.
Definition RendererScene.hpp:50
const Vector< RendererRenderable * > & getRenderables()
Enumerates the currently registered renderables.
Definition RendererScene.hpp:114
const Vector< RendererCamera * > & getCameras()
Enumerates the currently registered cameras.
Definition RendererScene.hpp:108
Vector< RendererLight * > mLights
The set of registered lights with the renderer scene.
Definition RendererScene.hpp:53
GPUDynamicUniformBuffer< RendererSceneParams > mUniformBuffer
The uniform buffer storing the scene GPU parameters used by the renderer.
Definition RendererScene.hpp:46
Vector< RendererTerrain * > mTerrains
The set of registered terrains with the renderer scene.
Definition RendererScene.hpp:59
const Vector< RendererLight * > & getLights()
Enumerates the currently registered lights.
Definition RendererScene.hpp:111
const Vector< RendererEnvironment * > & getEnvironments()
Enumerates the currently registered environments.
Definition RendererScene.hpp:120
bool mDirty
If set to true, the scene is dirty and needs to be synchronized from the entity.
Definition RendererScene.hpp:40
void prepare(RendererContext &context)
Prepares the scene for the rendering of the current frame.
Renderer & getRenderer() const
The renderer that owns this manager instance.
Generator< RendererGeometry > enumerateGeometry(const RendererGeometryEnumerationRequest &enumerationRequest=RendererGeometryEnumerationRequest()) const
void markAsDirty() noexcept
If set to true, the scene is dirty and needs to be synchronized from the entity.
Definition RendererScene.hpp:136
A manager that controls all scenes currently registered with the renderer.
Definition RendererScene.hpp:156
RendererSceneManager(Renderer &renderer)
Creates a new instance of the RendererSceneManager.
Async prepare(RendererContext &context)
Prepares the scenes for the rendering of the current frame.
Vector< UPtr< RendererScene > > mScenes
A list of scenes currently registered with the renderer.
Definition RendererScene.hpp:161
~RendererSceneManager() final
Destroys the RendererSceneManager and releases all GPU resources managed and allocated by it.
Generator< RendererScene & > enumerateScenes()
Enumerates the currently registered scenes.
Template class to help implement sub-classes of RendererObject.
Definition RendererObject.hpp:82
Template class to help implement sub-classes of RendererObjectManager.
Definition RendererObject.hpp:136
Template class to help implement sub-classes of RendererSceneObject.
Definition RendererSceneObject.hpp:47
Definition Application.hpp:19
cti::continuable< Args... > Async
Defines a non-copyable continuation type which uses the function2 backend for type erasure.
Definition Async.hpp:22
std::vector< T, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > Vector
Vector is a sequence container that encapsulates dynamic size arrays.
Definition Vector.hpp:17
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
A structure that contains context given by the renderer to render it's objects.
Definition Renderer.hpp:252
Parameters to customize a geometry enumeration request.
Definition RendererGeometry.hpp:47
A structure that holds renderer-specific information for the scene.
Definition RendererScene.hpp:31
A structure that mirrors the GPU uniform data for the scene.
Definition RendererScene.hpp:28