Lugdunum  0.1.0
Node.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <vector>
6 #include <lug/Graphics/Node.hpp>
12 
13 namespace lug {
14 namespace Graphics {
15 
16 namespace Render {
17 
18 class Queue;
19 class View;
20 
21 } // Render
22 
23 namespace Scene {
24 
25 class Scene;
26 
28  friend class Scene;
29 
30 public:
31  struct MeshInstance {
33  std::vector<Resource::SharedPtr<Render::Material>> materials;
34  };
35 
36 public:
37  Node(Scene& scene, const std::string& name);
38 
39  Node(const Node&) = delete;
40  Node(Node&&) = delete;
41 
42  Node& operator=(const Node&) = delete;
43  Node& operator=(Node&&) = delete;
44 
45  virtual ~Node() = default;
46 
47  Node* getNode(const std::string& name);
48  const Node* getNode(const std::string& name) const;
49  Scene& getScene();
50  const Scene& getScene() const;
51 
52  Node* createSceneNode(const std::string& name);
53 
54  void attachLight(Resource::SharedPtr<Render::Light> light);
55  void attachMeshInstance(Resource::SharedPtr<Render::Mesh> mesh, Resource::SharedPtr<Render::Material> material = nullptr);
56  void attachCamera(Resource::SharedPtr<Render::Camera::Camera> camera);
57 
58  Render::Light* getLight();
59  const Render::Light* getLight() const;
60 
61  const MeshInstance* getMeshInstance() const;
62 
63  Render::Camera::Camera* getCamera();
64  const Render::Camera::Camera* getCamera() const;
65 
66  void fetchVisibleObjects(const Renderer& renderer, const Render::View& renderView, const Render::Camera::Camera& camera, Render::Queue& renderQueue) const;
67 
68  virtual void needUpdate() override;
69 
70 private:
72 
76 };
77 
79 
80 } // Scene
81 } // Graphics
82 } // lug
std::vector< Resource::SharedPtr< Render::Material > > materials
Definition: Node.hpp:33
#define LUG_GRAPHICS_API
Definition: Export.hpp:11
Dummy class for a shared pointer.
Definition: Resource.hpp:66
Class for Light.
Definition: Light.hpp:26
MeshInstance _meshInstance
Definition: Node.hpp:74