Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
ModelComponent.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "Engine/api.hpp"
3 #include "Engine/Model/Model.hpp"
5 
6 namespace Engine
7 {
8  class TransformComponent;
9 
14  {
15  private:
16  friend class Entity;
17  ModelComponent() = default;
21  explicit ModelComponent(eastl::shared_ptr<Model> newModel) noexcept;
22 
28  explicit ModelComponent(eastl::string path) noexcept;
29 
33  void InitializeComponent() override;
34 
35  public:
36  virtual ~ModelComponent();
37 
42  void SetModel(eastl::shared_ptr<Model> newModel);
43 
48  void SetModel(const eastl::string& path);
49 
54  eastl::weak_ptr<Model> GetModel() const;
55 
60  template <typename archive>
61  void SaveComponent(archive ar);
62 
67  template<typename archive>
68  void LoadComponent(archive ar);
69 
70  private:
71  void Update() override;
72  void Render();
73  void OnComponentAdded(eastl::weak_ptr<Component> addedComponent) override;
74  void OnComponentRemoved(eastl::weak_ptr<Component> removedComponent) override;
75 
76  eastl::weak_ptr<Model> model;
77  eastl::weak_ptr<TransformComponent> transformComponent;
78  eastl::string path;
79  };
80 } //namespace Engine
This component is used to keep track of the meshes and textures to render. NOTE: only the Entity clas...
This is the base class for components. NOTE: only the Entity class is allowed to create this object...
Definition: Component.hpp:16
This object is able a holder object for components. NOTE: only the EntitySystem is allowed to create ...
Definition: Entity.hpp:13
#define ENGINE_API
Definition: api.hpp:25
IMGUI_API void Render()
Definition: imgui.cpp:2769