vengine  0.1.0
3D graphics engine made with Vulkan
Loading...
Searching...
No Matches
Object.hpp
Go to the documentation of this file.
1///
2/// @file Object.hpp
3/// @brief This file contains the Object class
4/// @namespace ven
5///
6
7#pragma once
8
9#include <memory>
10#include <unordered_map>
11
12#include <glm/gtc/matrix_transform.hpp>
13
14#include "VEngine/Model.hpp"
15
16namespace ven {
17
18 using id_t = unsigned int;
19
21 glm::vec3 translation{};
22 glm::vec3 scale{1.F, 1.F, 1.F};
23 glm::vec3 rotation{};
24
25 [[nodiscard]] glm::mat4 mat4() const;
26 [[nodiscard]] glm::mat3 normalMatrix() const;
27 };
28
30 float lightIntensity = 1.0F;
31 };
32
33 class Object {
34
35 public:
36
37 using Map = std::unordered_map<id_t, Object>;
38
39
40 static Object createObject() { static id_t objId = 0; return Object(objId++); }
41
42 ~Object() = default;
43
44 static Object makePointLight(float intensity = 10.F, float radius = 0.1F, glm::vec3 color = glm::vec3(1.F));
45
46 Object(const Object&) = delete;
47 Object& operator=(const Object&) = delete;
48 Object(Object&&) = default;
49 Object& operator=(Object&&) = default;
50
51 [[nodiscard]] id_t getId() const { return m_objId; }
52
53 std::shared_ptr<Model> model{};
54 glm::vec3 color{};
56
57 std::unique_ptr<PointLightComponent> pointLight = nullptr;
58
59 private:
60 explicit Object(const id_t objId) : m_objId(objId) {}
61
63
64 }; // class Object
65
66} // namespace ven
This file contains the Model class.
Transform3DComponent transform3D
Definition Object.hpp:55
Object & operator=(Object &&)=default
std::unique_ptr< PointLightComponent > pointLight
Definition Object.hpp:57
id_t m_objId
Definition Object.hpp:62
Object(const Object &)=delete
std::unordered_map< id_t, Object > Map
Definition Object.hpp:37
static Object makePointLight(float intensity=10.F, float radius=0.1F, glm::vec3 color=glm::vec3(1.F))
Definition object.cpp:67
Object(const id_t objId)
Definition Object.hpp:60
std::shared_ptr< Model > model
Definition Object.hpp:53
glm::vec3 color
Definition Object.hpp:54
id_t getId() const
Definition Object.hpp:51
~Object()=default
Object & operator=(const Object &)=delete
static Object createObject()
Definition Object.hpp:40
Object(Object &&)=default
unsigned int id_t
Definition Object.hpp:18
glm::mat3 normalMatrix() const
Definition object.cpp:38
glm::mat4 mat4() const
Definition object.cpp:3