Hymn to Beauty
C++ 3D Engine
RenderManager.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <glm/glm.hpp>
4#include "../Entity/ComponentContainer.hpp"
5#include <string>
6
7namespace Video {
8class Renderer;
9struct RenderScene;
10class Texture2D;
11} // namespace Video
12class World;
13class Entity;
14namespace Component {
15class DirectionalLight;
16class Camera;
17class Material;
18class Mesh;
19class PointLight;
20class SpotLight;
21class Sprite;
22} // namespace Component
23class TextureAsset;
24
27 friend class Hub;
28
29 public:
34
37
40
43
46
49
52
55
57 bool unlit;
58 };
59
61
66 void Render(World& world, const DebugConfiguration& debugConfiguration, Entity* cameraEntity = nullptr);
67
69
73
75
78 const std::vector<Component::DirectionalLight*>& GetDirectionalLights() const;
79
81
85
87
90 const std::vector<Component::Camera*>& GetCameras() const;
91
93
97
99
102 const std::vector<Component::Material*>& GetMaterials() const;
103
105
109
111
114 const std::vector<Component::Mesh*>& GetMeshes() const;
115
117
121
123
126 const std::vector<Component::PointLight*>& GetPointLights() const;
127
129
133
135
138 const std::vector<Component::SpotLight*>& GetSpotLights() const;
139
141
145
147
150 const std::vector<Component::Sprite*>& GetSprites() const;
151
154
157
158 private:
159 explicit RenderManager(Video::Renderer* renderer);
161 RenderManager(RenderManager const&) = delete;
162 void operator=(RenderManager const&) = delete;
163
164 void AddCamera(Video::RenderScene& renderScene, const Component::Camera& camera, const glm::uvec2& windowSize);
165 void AddCameras(Video::RenderScene& renderScene, const glm::uvec2& windowSize);
166
167 void AddLights(Video::RenderScene& renderScene, bool lighting, bool showLightVolumes);
168 void AddWorldLights(Video::RenderScene& renderScene, bool showLightVolumes);
169 void AddAmbientLight(Video::RenderScene& renderScene);
170
171 void AddMeshes(Video::RenderScene& renderScene);
172
173 void AddEditorEntities(Video::RenderScene& renderScene, const DebugConfiguration& debugConfiguration);
174
175 void AddDebugShapes(Video::RenderScene& renderScene);
176
177 void AddSprites(Video::RenderScene& renderScene);
178
179 Video::Renderer* renderer;
180
181 // Components.
189
190 uint8_t textureReduction = 0;
191};
Component handling a camera through which the world can be rendered.
Definition: Camera.hpp:8
Component describing a directional light source (like the sun).
Definition: DirectionalLight.hpp:8
Component providing a material to Entity.
Definition: Material.hpp:9
Component providing geometry to an entity.
Definition: Mesh.hpp:11
Component describing a point light.
Definition: PointLight.hpp:8
Component describing a spot light.
Definition: SpotLight.hpp:8
Component defining a 2D sprite.
Definition: Sprite.hpp:11
Stores components.
Definition: ComponentContainer.hpp:7
Entity containing various components.
Definition: Entity.hpp:16
Singleton class that holds all subsystems.
Definition: Managers.hpp:16
Handles rendering the world.
Definition: RenderManager.hpp:26
void Render(World &world, const DebugConfiguration &debugConfiguration, Entity *cameraEntity=nullptr)
Render world containing entities.
Definition: RenderManager.cpp:45
const std::vector< Component::Mesh * > & GetMeshes() const
Get all mesh components.
Definition: RenderManager.cpp:117
const std::vector< Component::Material * > & GetMaterials() const
Get all material components.
Definition: RenderManager.cpp:109
Video::Renderer * GetRenderer()
Get the renderer.
Definition: RenderManager.cpp:155
Component::PointLight * CreatePointLight()
Create point light component.
Definition: RenderManager.cpp:121
Component::SpotLight * CreateSpotLight()
Create spot light component.
Definition: RenderManager.cpp:129
const std::vector< Component::DirectionalLight * > & GetDirectionalLights() const
Get all directional light components.
Definition: RenderManager.cpp:93
Component::DirectionalLight * CreateDirectionalLight()
Create directional light component.
Definition: RenderManager.cpp:89
Component::Sprite * CreateSprite()
Create sprite component.
Definition: RenderManager.cpp:137
const std::vector< Component::PointLight * > & GetPointLights() const
Get all point light components.
Definition: RenderManager.cpp:125
Component::Mesh * CreateMesh()
Create mesh component.
Definition: RenderManager.cpp:113
const std::vector< Component::Camera * > & GetCameras() const
Get all camera components.
Definition: RenderManager.cpp:101
Component::Material * CreateMaterial()
Create material component.
Definition: RenderManager.cpp:105
Component::Camera * CreateCamera()
Create camera component.
Definition: RenderManager.cpp:97
void ClearKilledComponents()
Remove all killed components.
Definition: RenderManager.cpp:145
const std::vector< Component::Sprite * > & GetSprites() const
Get all sprite components.
Definition: RenderManager.cpp:141
const std::vector< Component::SpotLight * > & GetSpotLights() const
Get all spot light components.
Definition: RenderManager.cpp:133
A texture used in a hymn.
Definition: TextureAsset.hpp:12
Handles rendering using a low-level renderer.
Definition: Renderer.hpp:32
A two-dimensional texture.
Definition: Texture2D.hpp:10
The game world containing all entities.
Definition: World.hpp:14
Definition: BoxShapeEditor.hpp:5
Definition: Editor.hpp:18
Configuration for visualizing debug information.
Definition: RenderManager.hpp:31
bool showSoundSources
Whether to show sound sources.
Definition: RenderManager.hpp:33
bool showLightVolumes
Whether to show light culling volumes.
Definition: RenderManager.hpp:54
bool showLightSources
Whether to show light sources.
Definition: RenderManager.hpp:39
bool showCameras
Whether to show cameras.
Definition: RenderManager.hpp:45
Video::Texture2D * cameraTexture
Texture to show cameras with.
Definition: RenderManager.hpp:48
bool showPhysics
Whether to show physics volumes.
Definition: RenderManager.hpp:51
bool unlit
Whether to use full ambient instead of lighting the scene.
Definition: RenderManager.hpp:57
Video::Texture2D * lightTexture
Texture to show light sources with.
Definition: RenderManager.hpp:42
Video::Texture2D * soundSourceTexture
Texture to show sound sources with.
Definition: RenderManager.hpp:36
Contains all data needed to render a scene.
Definition: RenderScene.hpp:16