Untitled Game engine no.5  1.0
SceneRenderer.hpp
1 //
2 // Created by jibbo on 4/11/21.
3 //
4 
5 #ifndef ENGINE_PROJ_SCENERENDERER_HPP
6 #define ENGINE_PROJ_SCENERENDERER_HPP
7 
8 #include "Renderer.hpp"
9 #include "Scene.hpp"
10 #include "Entity.hpp"
11 #include "UI.hpp"
12 
13 namespace Engine {
14  struct SceneRenderer {
15 
24  static void Submit(const Uni <Renderer> &renderer, Scene &scene) {
25  ECS ecs = scene.GetECS();
26 
27  for (auto e : ecs.GetEntitiesWith<Transform, MeshRenderer>()) {
28  renderer->Submit("scene", ecs.GetComponent<Transform>(e), ecs.GetComponent<MeshRenderer>(e));
29  }
30 
31 
32  for (auto e : ecs.GetEntitiesWith<Transform, UIButton>()) {
33  renderer->Submit("UI", ecs.GetComponent<Transform>(e), ecs.GetComponent<UIButton>(e));
34  }
35  for (auto e : ecs.GetEntitiesWith<Transform, UIElement>()) {
36  renderer->Submit("UI", ecs.GetComponent<Transform>(e), ecs.GetComponent<UIElement>(e));
37  }
38  for (auto e : ecs.GetEntitiesWith<Transform, UIText>()) {
39  renderer->Submit("UI", ecs.GetComponent<Transform>(e), ecs.GetComponent<UIText>(e));
40  }
41  }
42  };
43 }
44 
45 #endif //ENGINE_PROJ_SCENERENDERER_HPP
Engine::MeshRenderer
Scene Component for passing drawing data to the renderer. Stores vertex data and references to the te...
Definition: MeshRenderer.hpp:15
Engine::ECS
Entity Component System.
Definition: ECS.hpp:19
Engine::Scene
A container for entities currently in the Scene.
Definition: Scene.hpp:9
Engine::Transform
Location, orientation, and scale of an entity.
Definition: Components.hpp:312
Engine::UIElement
Definition: UI.hpp:45
Engine::ECS::GetEntitiesWith
std::vector< EntityID > GetEntitiesWith()
Definition: ECS.hpp:188
Engine::SceneRenderer
Definition: SceneRenderer.hpp:14
Engine::ECS::GetComponent
Ref< C > GetComponent(const EntityID &id)
Definition: ECS.hpp:80
Engine
Definition: Animation.hpp:14
Engine::UIText
Definition: UI.hpp:186
Engine::Uni
std::unique_ptr< T > Uni
Has stuff for making references a lot more easily shared smart pointer representing a unique object.
Definition: Base.hpp:12
Engine::SceneRenderer::Submit
static void Submit(const Uni< Renderer > &renderer, Scene &scene)
Render a scene to the renderer.
Definition: SceneRenderer.hpp:24
Engine::UIButton
Definition: UI.hpp:212