vengine  0.0.1
3D graphics engine
Loading...
Searching...
No Matches
Manager.hpp
Go to the documentation of this file.
1///
2/// @file Manager.hpp
3/// @brief This file contains the SceneManager class
4/// @namespace ven
5///
6
7#pragma once
8
11
12namespace ven {
13
14 ///
15 /// @class SceneManager
16 /// @brief Class for object manager
17 /// @namespace ven
18 ///
20
21 public:
22
23 explicit SceneManager(Device &device);
24
25 SceneManager(const SceneManager &) = delete;
29
30 void addObject(const std::unique_ptr<Object> &object) { m_objects.insert({object->getId(), std::move(*object)}); }
31 void addLight(const std::unique_ptr<Light> &light) { m_lights.insert({light->getId(), std::move(*light)}); }
32
33 void destroyObject(const unsigned int objectId) { m_objects.erase(objectId); }
34 void destroyLight(const unsigned int lightId) { m_lights.erase(lightId); }
35 void destroyEntity(std::vector<unsigned int> *objectsIds, std::vector<unsigned int> *lightsIds);
36
37 void updateBuffer(GlobalUbo &ubo, unsigned long frameIndex, float frameTime);
38
39 [[nodiscard]] VkDescriptorBufferInfo getBufferInfoForObject(const int frameIndex, const unsigned int objectId) const { return m_uboBuffers.at(static_cast<long unsigned int>(frameIndex))->descriptorInfoForIndex(objectId); }
42 std::vector<std::unique_ptr<Buffer>> &getUboBuffers() { return m_uboBuffers; }
43 std::shared_ptr<Texture> getTextureDefault() { return m_textureDefault; }
44 [[nodiscard]] bool getDestroyState() const { return m_destroyState; }
45
46 void setDestroyState(const bool state) { m_destroyState = state; }
47
48 private:
49
50 unsigned int m_currentObjId{0};
51 unsigned int m_currentLightId{0};
52 std::shared_ptr<Texture> m_textureDefault;
55 std::vector<std::unique_ptr<Buffer>> m_uboBuffers{MAX_FRAMES_IN_FLIGHT};
56 bool m_destroyState{false};
57
58 }; // class SceneManager
59
60} // namespace ven
This file contains the FrameInfo class.
This file contains the Shader class.
Class for device.
Definition Device.hpp:35
std::unordered_map< unsigned int, Light > Map
Definition Light.hpp:32
std::unordered_map< unsigned int, Object > Map
Definition Object.hpp:28
Class for object manager.
Definition Manager.hpp:19
unsigned int m_currentObjId
Definition Manager.hpp:50
SceneManager(const SceneManager &)=delete
void updateBuffer(GlobalUbo &ubo, unsigned long frameIndex, float frameTime)
Definition manager.cpp:29
std::vector< std::unique_ptr< Buffer > > m_uboBuffers
Definition Manager.hpp:55
void setDestroyState(const bool state)
Definition Manager.hpp:46
Light::Map m_lights
Definition Manager.hpp:54
std::shared_ptr< Texture > m_textureDefault
Definition Manager.hpp:52
SceneManager & operator=(SceneManager &&)=delete
void addLight(const std::unique_ptr< Light > &light)
Definition Manager.hpp:31
SceneManager & operator=(const SceneManager &)=delete
void destroyEntity(std::vector< unsigned int > *objectsIds, std::vector< unsigned int > *lightsIds)
Definition manager.cpp:54
void destroyLight(const unsigned int lightId)
Definition Manager.hpp:34
unsigned int m_currentLightId
Definition Manager.hpp:51
Object::Map m_objects
Definition Manager.hpp:53
std::vector< std::unique_ptr< Buffer > > & getUboBuffers()
Definition Manager.hpp:42
VkDescriptorBufferInfo getBufferInfoForObject(const int frameIndex, const unsigned int objectId) const
Definition Manager.hpp:39
void destroyObject(const unsigned int objectId)
Definition Manager.hpp:33
SceneManager(SceneManager &&)=delete
std::shared_ptr< Texture > getTextureDefault()
Definition Manager.hpp:43
SceneManager(Device &device)
Definition manager.cpp:7
Light::Map & getLights()
Definition Manager.hpp:41
Object::Map & getObjects()
Definition Manager.hpp:40
void addObject(const std::unique_ptr< Object > &object)
Definition Manager.hpp:30
bool getDestroyState() const
Definition Manager.hpp:44
static constexpr int MAX_FRAMES_IN_FLIGHT
Definition SwapChain.hpp:15