Muto 0.0.1
Cross-Platform Application Template
GitHub Repo | Muto Updates | Muto's Author
Loading...
Searching...
No Matches
Components.h
Go to the documentation of this file.
1#pragma once
2/// @file Components.h
3/// @author Damon S. Green II
4/// @brief Defines various components that can be attached to entities within a scene.
5/// @note Components include UUID, Name, Transform, SpriteRenderer, SubTexture, TextureAnimation, Camera, and NativeScript.
6/// @todo Move GLM Enable Experimental to Math.h and remove from here
7
8#include "Renderer/Texture.h"
9#include "Renderer/SubTexture2D.h"
10#include "ParticleSystem/ParticleSystem.h"
11#include "SceneCamera.h"
12#include "Core/Random.h"
13
14#include <glm/glm.hpp>
15#include <glm/gtc/matrix_transform.hpp>
16#define GLM_ENABLE_EXPERIMENTAL
17#include <glm/gtx/quaternion.hpp>
18
19namespace Muto {
20 /// @brief Universally Unique Identifier
21 ///
22 /// A simple wrapper around a string representing a UUID.
23 struct UUID {
24 /// @brief The string representation of the UUID.
25 std::string ID;
26
28 UUID(const std::string& id)
29 : ID{ id } {
30 }
31 operator std::string& () { return ID; }
32 operator const std::string& () const { return ID; }
33 };
34
35 /// @brief Component that holds a UUID.
37 /// @brief The UUID of the owning entity.
39
41 : ID() {
42 }
43 UUIDComponent(const UUIDComponent&) = default;
44 UUIDComponent(const std::string& id)
45 : ID{ id } {
46 }
47
48 };
49
50 /// @brief Component that holds the name of an entity.
52 {
53 /// @brief The name of the owning entity.
54 std::string Name;
55
56 NameComponent() = default;
57 NameComponent(const NameComponent&) = default;
58 NameComponent(const std::string& name)
59 : Name(name) {
60 }
61 operator std::string& () { return Name; }
62 operator const std::string& () const { return Name; }
63 std::string& GetName() { return Name; }
64 };
65
66 /// @brief Component that holds the transform of an entity.
68 {
69 /// @brief Translation (position) vector.
70 glm::vec3 Translation = { 0.0f, 0.0f, 0.0f };
71 /// @brief Rotation vector (in radians).
72 glm::vec3 Rotation = { 0.0f, 0.0f, 0.0f };
73 /// @brief Scale vector.
74 glm::vec3 Scale = { 1.0f, 1.0f, 1.0f };
75
76 TransformComponent() = default;
78 /// @brief Constructor that initializes the translation with a 3D vector.
79 TransformComponent(const glm::vec3& translation)
81 }
82
83 /// @brief Calculates and returns the transformation matrix.
85 {
86 glm::mat4 rotation = glm::toMat4(glm::quat(Rotation));
87
88 return glm::translate(glm::mat4(1.0f), Translation)
89 * rotation
90 * glm::scale(glm::mat4(1.0f), Scale);
91 }
92 };
93
94 /// @brief Component that holds sprite rendering data.
96 {
97 /// @brief Color of the sprite.
98 glm::vec4 Color{ 1.0f, 1.0f, 1.0f, 1.0f };
99 /// @brief Texture of the sprite.
101 /// @brief Tiling factor for the texture.
102 float TilingFactor = 1.0f;
103
106 /// @brief Constructor that initializes the color.
107 SpriteRendererComponent(const glm::vec4& color)
108 : Color(color) {
109 }
110
111 operator glm::vec4& () { return Color; }
112 operator const glm::vec4& () const { return Color; }
113
114 /// @brief Returns the color of the sprite.
115 glm::vec4& GetColor() { return Color; }
116
117 /// @brief whether the texturing is enabled
118 bool TextureEnabled = false;
119
120 /// @brief whether the sprite should always face the camera
121 ///
122 /// WIP
123 bool Billboard = false;
124 };
125
126 /// @brief Component that holds sub-texture data for sprites.
128 {
129 /// @brief The sub-texture reference.
131 /// @brief Tiling factor for the sub-texture.
132 glm::vec2 TilingFactor = { 1.0f, 1.0f };
133 /// @brief Offset for the sub-texture.
134 glm::vec2 Offset = { 0.0f, 0.0f };
135
136
138
139 /// @brief Constructor that initializes the sub-texture from a full texture.
140 SubTextureComponent(const Ref<Texture2D>& texture)
142 }
143 /// @brief Constructor that initializes the sub-texture directly.
144 SubTextureComponent(const Ref<SubTexture2D>& subTexture)
146 }
147 /// @brief Copy constructor.
148 void SetTexture(const Ref<Texture2D>& texture) {
149 SubTexture = SubTexture2D::CreateFromCoords(texture, { 0, 0 }, { texture->GetWidth(), texture->GetHeight() });
150 }
151
152 /// @brief Sets the tiling factor for the sub-texture.
153 void SetTilingFactor(const glm::vec2& tiling) {
154 TilingFactor = tiling;
155 }
156
157 /// @brief Sets the offset for the sub-texture.
158 void SetOffset(const glm::vec2& offset) {
159 Offset = offset;
160 }
161
163 operator const Ref<SubTexture2D>& () const { return SubTexture; }
165 };
166
167 /// @brief Animates through a series of sub textures
168 ///
169 /// (can be used with full textures)
171 {
172 /// @brief The list of sub-textures for the animation.
174 /// @brief The current frame index.
176 /// @brief Time per frame in seconds.
177 float FrameTime = 0.6f; // Time per frame in seconds
178 /// @brief Accumulated time for frame switching.
179 float TimeAccumulator = 0.0f; // per-instance accumulator
180
181 bool IsLooping = true;
182
183
186 /// @brief Constructor that initializes the sub-textures and frame time.
187 ///
188 /// @param subTextures Vector of sub-textures for the animation.
189 /// @param frameTime Time per frame in seconds.
190 TextureAnimationComponent(const std::vector<Ref<SubTexture2D>>& subTextures, float frameTime)
191 : SubTextures(subTextures), FrameTime(frameTime) {
192 }
194 operator const std::vector<Ref<SubTexture2D>>& () const { return SubTextures; }
195
197 if (SubTextures.empty())
198 return nullptr;
199 if (CurrentFrame < 0) CurrentFrame = 0;
200 if (CurrentFrame >= (int)SubTextures.size()) CurrentFrame = (int)SubTextures.size() - 1;
202 }
204
205 /// @brief Returns the index of the current frame.
206 int GetCurrentFrame() const { return CurrentFrame; }
207
208 /// @brief Updates the animation based on the elapsed time.
209 ///
210 /// @param deltaTime The elapsed time since the last update.
211 void Update(float deltaTime) {
212 if (SubTextures.empty() || FrameTime <= 0.0f)
213 return;
214
216 while (TimeAccumulator >= FrameTime) {
217 CurrentFrame = (CurrentFrame + 1) % static_cast<uint32_t>(SubTextures.size());
219 }
220 }
221 };
222
223 /// @brief Component that holds camera data.
225 {
226 /// @brief The scene camera.
228
229 /// @brief Whether this camera is the primary camera.
230 ///
231 /// If multiple cameras exist, the primary camera for rendering will be the first one found marked as primary.
232 bool Primary = true;
233
234 /// @brief Whether the aspect ratio is fixed.
235 bool FixedAspectRatio = false;
236
237 CameraComponent() = default;
239
240 };
241
242
243 class ScriptableEntity;
244 class Timestep;
245
246 /// @brief Component that holds scripting data for an entity.
248 {
249 /// @brief Pointer to the instance of the scriptable entity.
251
252 /// @brief Function pointer to instantiate the script.
253 ScriptableEntity* (*InstantiateScript)();
254 /// @brief Function pointer to destroy the script.
256
257 /// @brief Binds a script type to this component.
258 ///
259 /// @tparam T The type of the script to bind.
260 template<typename T>
261 void Bind()
262 {
263 InstantiateScript = []() { return static_cast<ScriptableEntity*> (new T()); };
264 DestroyScript = [](NativeScriptComponent* nsc) { delete nsc->Instance; nsc->Instance = nullptr; };
265 }
266 };
267
268
270 {
272
275 ParticleSystemComponent(const int maxParticles)
277 }
278
279 };
280
281}
#define MU_CORE_ASSERT(x,...)
Definition Asserts.h:32
#define MU_BIND_EVENT_FN(fn)
Binds a member function as an event handler.
Definition Defines_Macros.h:17
static const uint32_t s_MapHeight
Definition EditorLayer.cpp:14
static const char * s_MapTiles
Definition EditorLayer.cpp:15
static const uint32_t s_MapWidth
Definition EditorLayer.cpp:13
#define MU_PROFILE_SCOPE(name)
Definition Instrumentor.h:239
#define MU_PROFILE_FUNCTION()
Definition Instrumentor.h:240
#define MU_CORE_ERROR(...)
error: indicates an error that has occurred
Definition Log.h:42
#define MU_CORE_INFO(...)
info: general information about application flow
Definition Log.h:38
The core application class that manages the main loop, window, layers, and event handling.
Definition Application.h:70
void Close()
Closes the application.
Definition Application.cpp:103
ImGuiLayer * GetImGuiLayer()
Retrieves the ImGui layer.
Definition Application.h:104
static Application & Get()
Retrieves the singleton instance of the Application.
Definition Application.h:107
Definition EditorCamera.h:20
Definition EditorLayer.h:13
bool useEntityScene
Definition EditorLayer.h:90
OrthographicCameraController m_CameraController
Definition EditorLayer.h:52
bool m_PrimaryCamera
Definition EditorLayer.h:46
virtual void OnAttach() override
Called when the layer is attached to the application.
Definition EditorLayer.cpp:46
bool scene3
Definition EditorLayer.h:89
glm::vec2 m_ViewportBounds[2]
Definition EditorLayer.h:45
Ref< Scene > m_ActiveScene
Definition EditorLayer.h:34
Ref< Scene > m_EditorScene
Definition EditorLayer.h:35
ParticleProps m_ParticleProps
Definition EditorLayer.h:86
glm::vec4 m_TextureTintColor2
Definition EditorLayer.h:94
Ref< SubTexture2D > m_SubTextureSmoke
Definition EditorLayer.h:70
void OpenScene()
Definition EditorLayer.cpp:539
glm::vec4 m_SpecialQuadColor
Definition EditorLayer.h:97
bool scene2
Definition EditorLayer.h:89
EditorCamera m_EditorCamera
Definition EditorLayer.h:78
bool scene1
Definition EditorLayer.h:89
int m_GizmoType
Definition EditorLayer.h:49
Ref< Shader > m_FlatColorShader
Definition EditorLayer.h:59
bool OnKeyPressed(KeyPressedEvent &e)
Definition EditorLayer.cpp:480
Entity m_CameraEntity
Definition EditorLayer.h:47
EditorLayer()
Definition EditorLayer.cpp:38
void NewScene()
Definition EditorLayer.cpp:532
Ref< Framebuffer > m_Framebuffer
Definition EditorLayer.h:76
Entity m_FireEntity
Definition EditorLayer.h:55
float m_textureScale
Definition EditorLayer.h:80
void SaveSceneAs()
Definition EditorLayer.cpp:555
Ref< Texture2D > m_SpriteSheetFire
Definition EditorLayer.h:62
Ref< SubTexture2D > m_SubTextureFire
Definition EditorLayer.h:69
bool scene4
Definition EditorLayer.h:89
std::unordered_map< char, Ref< SubTexture2D > > s_TextureMap
Definition EditorLayer.h:100
virtual void OnDetach() override
Called when the layer is detached from the application.
Definition EditorLayer.cpp:230
SceneHierarchyPanel m_SceneHierarchyPanel
Definition EditorLayer.h:32
float m_squareRotation
Definition EditorLayer.h:81
bool m_UseSpecialQuadColor
Definition EditorLayer.h:98
glm::vec4 m_ClearColor
Definition EditorLayer.h:96
float lastFrameTime
Definition EditorLayer.h:54
virtual void OnEvent(Event &e) override
Called when an event is dispatched to the layer.
Definition EditorLayer.cpp:468
virtual ~EditorLayer()=default
glm::vec4 m_SquareColor
Definition EditorLayer.h:92
virtual void OnUpdate(Timestep ts) override
Called every frame to update the layer with the given timestep.
Definition EditorLayer.cpp:235
ParticleSystem m_ParticleSystem
Definition EditorLayer.h:85
glm::vec4 m_TextureTintColor1
Definition EditorLayer.h:93
void ResetScene()
Definition EditorLayer.cpp:566
glm::vec2 m_ViewportSize
Definition EditorLayer.h:44
float m_TranslationSnap
Definition EditorLayer.h:50
SceneState m_SceneState
Definition EditorLayer.h:41
float m_ScaleSnap
Definition EditorLayer.h:50
Ref< Texture2D > m_SpriteSheetTown
Definition EditorLayer.h:64
Ref< Texture2D > m_CheckerboardTexture
Definition EditorLayer.h:60
bool m_ViewportFocused
Definition EditorLayer.h:43
Ref< Texture2D > m_SpriteSheetRocks
Definition EditorLayer.h:66
Ref< VertexArray > m_SquareVA
Definition EditorLayer.h:58
float m_RotationSnap
Definition EditorLayer.h:50
int m_ParticleEmitCount
Definition EditorLayer.h:83
glm::vec4 m_BackgroundColor
Definition EditorLayer.h:95
Ref< Texture2D > m_SpriteSheetSmoke
Definition EditorLayer.h:63
virtual void OnImGuiRender() override
Called when the layer should render its ImGui components.
Definition EditorLayer.cpp:281
SceneState
Definition EditorLayer.h:38
Entity m_SmokeEntity
Definition EditorLayer.h:55
bool m_ViewportHovered
Definition EditorLayer.h:43
float m_specialQuadRotation
Definition EditorLayer.h:82
Ref< SubTexture2D > m_SubTextureTown
Definition EditorLayer.h:71
Ref< Texture2D > m_SpriteSheetCursedLands
Definition EditorLayer.h:67
Ref< Texture2D > m_SpriteSheetCrystals
Definition EditorLayer.h:65
Represents an entity in a scene.
Definition Entity.h:17
T & AddOrReplaceComponent(Args &&... args)
Adds or replaces a component of type T to the entity with the provided arguments.
Definition Entity.h:63
T & GetOrAddComponent(Args &&... args)
Retrieves a reference to the component of type T attached to the entity if it exists....
Definition Entity.h:86
Entity(entt::entity handle, Scene *scene)
Constructs an Entity with the given handle and scene.
Definition Entity.cpp:6
Entity(const Entity &other)=default
Copy constructor for Entity.
T & GetComponent()
Retrieves a reference to the component of type T attached to the entity if it exists....
Definition Entity.h:73
Scene * m_Scene
Pointer to the scene that contains the entity.
Definition Entity.h:131
const std::string & GetName()
Retrieves a const reference to the name of the entity.
Definition Entity.h:115
bool HasComponent() const
Checks if the entity has a component of type T.
Definition Entity.h:36
Entity()=default
void RemoveComponent()
Removes the component of type T from the entity if it exists. Otherwise, asserts.
Definition Entity.h:98
const UUID & GetID()
Retrieves a const reference to the UUID of the entity.
Definition Entity.h:107
T & AddComponent(Args &&... args)
Adds a component of type T to the entity with the provided arguments Otherwise, asserts if the entity...
Definition Entity.h:48
operator bool() const
Definition Entity.h:121
Stack-based templated event dispatcher.
Definition Event.h:66
EventDispatcher(Event &event)
Construct an EventDispatcher for a specific event.
Definition Event.h:76
Abstract base class for all events.
Definition Event.h:35
Cross-platform file dialog utilities.
Definition PlatformUtils.h:13
static std::string SaveFile(const char *filter)
Opens a file dialog to select a location to save a file.
Definition LinuxPlatformUtils.cpp:165
static std::string OpenFile(const char *filter)
Opens a file dialog to select a file to open.
Definition LinuxPlatformUtils.cpp:160
WIP.
Definition PlatformUtils.h:31
static std::string m_RootEditorDirectory
Definition PlatformUtils.h:41
static std::string m_RootEngineDirectory
Definition PlatformUtils.h:40
static std::string m_ProjectsDirectory
Definition PlatformUtils.h:44
static std::string m_AssetsDirectory
Definition PlatformUtils.h:43
static bool IsInitialized()
Definition PlatformUtils.h:37
static void Initialize()
Definition FileSystem.cpp:16
static bool m_Initialized
Definition PlatformUtils.h:39
static std::string GetAbsolutePath(const std::string &relativePath)
Definition FileSystem.cpp:38
static std::string GetCurrentWorkingDirectory()
Definition FileSystem.cpp:33
static std::string m_ResourcesDirectory
Definition PlatformUtils.h:42
static std::string m_CurrentProjectDirectory
Definition PlatformUtils.h:45
static std::string GetTravelingUpPath(const std::string &path)
Definition FileSystem.cpp:43
virtual void SetBlockEvents(bool block)
Definition ImGuiLayer.h:29
Base input class for querying input states.
Definition Input.h:15
static bool IsKeyPressed(int keycode)
Checks if the specified key is currently pressed.
Definition WindowsInput.cpp:9
int GetKeyCode() const
Get the key code associated with the event.
Definition KeyEvent.h:20
Event for registering key press.
Definition KeyEvent.h:37
int GetRepeatCount() const
Get the repeat count of the key press event.
Definition KeyEvent.h:48
Represents a reusable application layer that receives lifecycle callbacks (attach,...
Definition Layer.h:17
Definition OrthographicCameraController.h:30
A simple particle system for stress testing the renderer. This is a temporary starter particle system...
Definition ParticleSystem.h:45
int m_EmitRate
Definition ParticleSystem.h:64
ParticleSystem(uint32_t maxParticles)
Definition ParticleSystem.cpp:18
void ResetParticle(Particle &particle, const ParticleProps &particleProps)
Definition ParticleSystem.cpp:120
void OnRender()
Definition ParticleSystem.cpp:76
bool m_Loop
Definition ParticleSystem.h:65
bool m_IsEmitting
Definition ParticleSystem.h:63
uint32_t m_PoolIndex
Definition ParticleSystem.h:58
void OnUpdate(Timestep ts)
Definition ParticleSystem.cpp:24
ParticleProps m_Props
Definition ParticleSystem.h:61
float m_TimeSinceLastEmit
Definition ParticleSystem.h:62
ParticleSystem()
Definition ParticleSystem.cpp:11
void SetParticleProps(const ParticleProps &particleProps)
Definition ParticleSystem.h:53
std::vector< Particle > m_ParticlePool
Definition ParticleSystem.h:57
void Emit(const ParticleProps &particleProps)
Definition ParticleSystem.cpp:96
void ResetSystem()
Definition ParticleSystem.h:54
int m_activeParticleCount
Definition ParticleSystem.h:59
A static class that provides an interface for issuing rendering commands.
Definition RenderCommand.h:13
static void Clear()
Clears the rendering buffers.
Definition RenderCommand.h:35
A 2D renderer for drawing quads and sprites.
Definition Renderer2D.h:21
static void ResetStats()
Resets the rendering statistics.
Definition Renderer2D.cpp:516
static Statistics GetStats()
Retrieves the current rendering statistics.
Definition Renderer2D.cpp:521
Definition SceneCamera.h:12
Definition SceneHierarchyPanel.h:12
Handles serialization and deserialization of scenes.
Definition SceneSerializer.h:16
void Serialize(const std::string &filepath)
Definition SceneSerializer.cpp:179
bool Deserialize(const std::string &filepath)
Definition SceneSerializer.cpp:206
Represents a scene in the application and manages entities and their components.
Definition Scene.h:21
entt::registry m_Registry
Definition Scene.h:41
void OnUpdateRuntime(Timestep ts)
Definition Scene.cpp:58
void OnUpdateEditor(Timestep ts, EditorCamera &camera)
Definition Scene.cpp:188
const std::string & GetName() const
Definition Scene.h:50
void OnComponentAdded(Entity entity, T &component)
Definition Scene.cpp:313
void SetName(const std::string &name)
Definition Scene.h:49
Scene()
Definition Scene.cpp:14
void DestroyEntity(Entity entity)
Definition Scene.cpp:52
uint32_t m_ViewportHeight
Definition Scene.h:42
Entity GetPrimaryCameraEntity()
Definition Scene.cpp:295
void OnViewportResize(uint32_t width, uint32_t height)
Definition Scene.cpp:280
~Scene()
Definition Scene.cpp:26
Entity CreateEntity(const std::string &name=std::string())
Definition Scene.cpp:30
Scene(const std::string &name)
Definition Scene.cpp:21
Entity CreateEntity(const std::string &name, const std::string &uuid)
Definition Scene.cpp:41
std::string m_Name
Definition Scene.h:40
uint32_t m_ViewportWidth
Definition Scene.h:42
Base class for scriptable entities within a scene.
Definition ScriptableEntity.h:14
Represents a time step in seconds.
Definition Timestep.h:11
static glm::vec4 Brown()
Returns a vec4 representing the color brown.
Definition Color.h:44
static glm::vec4 StripAlpha(const glm::vec4 &color)
Strips the alpha component from the given color, setting it to 1.0 (fully opaque).
Definition Color.h:49
static glm::vec4 Cyan()
Returns a vec4 representing the color cyan.
Definition Color.h:38
static glm::vec4 Indigo()
Returns a vec4 representing the color indigo.
Definition Color.h:33
static glm::vec4 Orange()
Returns a vec4 representing the color orange.
Definition Color.h:25
static glm::vec4 Black()
Returns a vec4 representing the color black.
Definition Color.h:18
static glm::vec4 SetAlpha(const glm::vec4 &color, float alpha=0.0f)
Sets the alpha component of the given color to the specified value.
Definition Color.h:51
static glm::vec4 Yellow()
Returns a vec4 representing the color yellow.
Definition Color.h:27
static glm::vec4 Purple()
Returns a vec4 representing the color purple.
Definition Color.h:35
static glm::vec4 Gray()
Returns a vec4 representing the color gray.
Definition Color.h:20
static glm::vec4 Pink()
Returns a vec4 representing the color pink.
Definition Color.h:42
static glm::vec4 White()
Returns a vec4 representing the color white.
Definition Color.h:16
static glm::vec4 Green()
Returns a vec4 representing the color green.
Definition Color.h:29
static glm::vec4 Blue()
Returns a vec4 representing the color blue.
Definition Color.h:31
static glm::vec4 Transparent()
Returns a vec4 representing a fully transparent color.
Definition Color.h:46
static glm::vec4 Red()
Returns a vec4 representing the color red.
Definition Color.h:23
static glm::vec4 Magenta()
Returns a vec4 representing the color magenta.
Definition Color.h:40
@ RightControl
Definition KeyCodes.h:147
@ NumLock
Definition KeyCodes.h:93
@ KP_9
Definition KeyCodes.h:132
@ Enter
Definition KeyCodes.h:78
@ KP_1
Definition KeyCodes.h:124
@ RightAlt
Definition KeyCodes.h:148
@ A
Definition KeyCodes.h:41
@ F16
Definition KeyCodes.h:111
@ D9
Definition KeyCodes.h:36
@ F23
Definition KeyCodes.h:118
@ F2
Definition KeyCodes.h:97
@ KP_SUBTRACT
Definition KeyCodes.h:136
@ F4
Definition KeyCodes.h:99
@ J
Definition KeyCodes.h:50
@ Equal
Definition KeyCodes.h:39
@ Home
Definition KeyCodes.h:89
@ E
Definition KeyCodes.h:45
@ World1
Definition KeyCodes.h:73
@ C
Definition KeyCodes.h:43
@ P
Definition KeyCodes.h:56
@ PrintScreen
Definition KeyCodes.h:94
@ F12
Definition KeyCodes.h:107
@ GraveAccent
Definition KeyCodes.h:71
@ LeftControl
Definition KeyCodes.h:143
@ LeftSuper
Definition KeyCodes.h:145
@ S
Definition KeyCodes.h:59
@ Backslash
Definition KeyCodes.h:69
@ F25
Definition KeyCodes.h:120
@ RightBracket
Definition KeyCodes.h:70
@ F11
Definition KeyCodes.h:106
@ R
Definition KeyCodes.h:58
@ K
Definition KeyCodes.h:51
@ F
Definition KeyCodes.h:46
@ Z
Definition KeyCodes.h:66
@ KP_DECIMAL
Definition KeyCodes.h:133
@ Period
Definition KeyCodes.h:24
@ F3
Definition KeyCodes.h:98
@ End
Definition KeyCodes.h:90
@ F14
Definition KeyCodes.h:109
@ Up
Definition KeyCodes.h:86
@ PageDown
Definition KeyCodes.h:88
@ PageUp
Definition KeyCodes.h:87
@ W
Definition KeyCodes.h:63
@ KP_4
Definition KeyCodes.h:127
@ LeftBracket
Definition KeyCodes.h:68
@ D0
Definition KeyCodes.h:27
@ F20
Definition KeyCodes.h:115
@ Menu
Definition KeyCodes.h:150
@ Left
Definition KeyCodes.h:84
@ N
Definition KeyCodes.h:54
@ Space
Definition KeyCodes.h:20
@ Minus
Definition KeyCodes.h:23
@ D8
Definition KeyCodes.h:35
@ Tab
Definition KeyCodes.h:79
@ KP_MULTIPLY
Definition KeyCodes.h:135
@ F22
Definition KeyCodes.h:117
@ KP_DIVIDE
Definition KeyCodes.h:134
@ D3
Definition KeyCodes.h:30
@ KP_5
Definition KeyCodes.h:128
@ KP_EQUAL
Definition KeyCodes.h:139
@ F7
Definition KeyCodes.h:102
@ KP_7
Definition KeyCodes.h:130
@ F21
Definition KeyCodes.h:116
@ CapsLock
Definition KeyCodes.h:91
@ F19
Definition KeyCodes.h:114
@ Y
Definition KeyCodes.h:65
@ F18
Definition KeyCodes.h:113
@ KP_6
Definition KeyCodes.h:129
@ Apostrophe
Definition KeyCodes.h:21
@ Delete
Definition KeyCodes.h:82
@ KP_0
Definition KeyCodes.h:123
@ Q
Definition KeyCodes.h:57
@ F5
Definition KeyCodes.h:100
@ O
Definition KeyCodes.h:55
@ F6
Definition KeyCodes.h:101
@ Pause
Definition KeyCodes.h:95
@ KP_ENTER
Definition KeyCodes.h:138
@ X
Definition KeyCodes.h:64
@ LeftShift
Definition KeyCodes.h:142
@ KP_ADD
Definition KeyCodes.h:137
@ RightShift
Definition KeyCodes.h:146
@ B
Definition KeyCodes.h:42
@ D1
Definition KeyCodes.h:28
@ D4
Definition KeyCodes.h:31
@ LeftAlt
Definition KeyCodes.h:144
@ I
Definition KeyCodes.h:49
@ F17
Definition KeyCodes.h:112
@ F24
Definition KeyCodes.h:119
@ Insert
Definition KeyCodes.h:81
@ D
Definition KeyCodes.h:44
@ D6
Definition KeyCodes.h:33
@ F8
Definition KeyCodes.h:103
@ F15
Definition KeyCodes.h:110
@ RightSuper
Definition KeyCodes.h:149
@ Right
Definition KeyCodes.h:83
@ ScrollLock
Definition KeyCodes.h:92
@ KP_3
Definition KeyCodes.h:126
@ Semicolon
Definition KeyCodes.h:38
@ Escape
Definition KeyCodes.h:77
@ KP_2
Definition KeyCodes.h:125
@ KP_8
Definition KeyCodes.h:131
@ F1
Definition KeyCodes.h:96
@ Slash
Definition KeyCodes.h:25
@ G
Definition KeyCodes.h:47
@ F10
Definition KeyCodes.h:105
@ L
Definition KeyCodes.h:52
@ M
Definition KeyCodes.h:53
@ D7
Definition KeyCodes.h:34
@ V
Definition KeyCodes.h:62
@ T
Definition KeyCodes.h:60
@ F13
Definition KeyCodes.h:108
@ H
Definition KeyCodes.h:48
@ U
Definition KeyCodes.h:61
@ D5
Definition KeyCodes.h:32
@ Down
Definition KeyCodes.h:85
@ World2
Definition KeyCodes.h:74
@ D2
Definition KeyCodes.h:29
@ F9
Definition KeyCodes.h:104
@ Comma
Definition KeyCodes.h:22
@ Backspace
Definition KeyCodes.h:80
MouseButtonCodes
Enumeration of mouse button codes.
Definition MouseButtonCodes.h:17
@ MBC_Button4
Definition MouseButtonCodes.h:23
@ MBC_Button2
Definition MouseButtonCodes.h:21
@ MBC_Button6
Definition MouseButtonCodes.h:25
@ MBC_Button1
Definition MouseButtonCodes.h:20
@ MBC_ButtonRight
Definition MouseButtonCodes.h:30
@ MBC_ButtonLast
Definition MouseButtonCodes.h:28
@ MBC_ButtonMiddle
Definition MouseButtonCodes.h:31
@ MBC_Button3
Definition MouseButtonCodes.h:22
@ MBC_Button5
Definition MouseButtonCodes.h:24
@ MBC_Button7
Definition MouseButtonCodes.h:26
@ MBC_Button0
Definition MouseButtonCodes.h:19
@ MBC_ButtonLeft
Definition MouseButtonCodes.h:29
Definition Random.h:17
glm::vec3 RangeF3(float min, float max)
Definition Random.h:129
glm::vec3 Float3()
Definition Random.h:124
glm::vec2 RangeF2(float min1, float max1, float min2, float max2)
Definition Random.h:113
float RangeF1(float min, float max)
Definition Random.h:87
glm::vec3 RangeF3(const glm::vec2 &range1, const glm::vec2 &range2, const glm::vec2 &range3)
Definition Random.h:139
std::string String(size_t length)
Definition Random.h:46
glm::vec2 Float2()
Definition Random.h:103
std::mt19937 & GetRNG()
Definition Random.h:19
uint32_t UInt1(uint32_t max)
Definition Random.h:28
bool Bool1(float trueChance)
Definition Random.h:34
glm::vec2 RangeF2(float min, float max)
Definition Random.h:108
std::string HexString(size_t length)
Definition Random.h:60
void Seed(uint32_t seed)
Definition Random.h:24
glm::vec3 RangeF3(float min1, float max1, float min2, float max2, float min3, float max3)
Definition Random.h:134
float Float1()
Definition Random.h:79
unsigned char Char()
Definition Random.h:40
float RangeF1_Inclusive(float min, float max)
Definition Random.h:95
glm::vec4 Float4()
Definition Random.h:144
std::string UUID()
Definition Random.h:73
glm::vec2 RangeF2(const glm::vec2 &minRange, const glm::vec2 &maxRange)
Definition Random.h:118
glm::vec4 RangeF4(float min, float max)
Definition Random.h:149
The main namespace for the Muto engine.
Definition Application.cpp:15
float LifeRemaining
Definition ParticleSystem.h:36
float SizeVariation
Definition ParticleSystem.h:21
float SizeBegin
Definition ParticleSystem.h:19
uint32_t Height
Definition Framebuffer.h:15
glm::vec4 ColorBegin
Definition ParticleSystem.h:32
glm::vec3 Position
Definition ParticleSystem.h:13
float Lifetime
Definition ParticleSystem.h:35
float SizeEnd
Definition ParticleSystem.h:33
float RotationVariation
Definition ParticleSystem.h:23
float Lifetime
Definition ParticleSystem.h:24
glm::vec3 Velocity
Definition ParticleSystem.h:31
uint32_t Width
Definition Framebuffer.h:15
float Rotation
Definition ParticleSystem.h:34
glm::vec4 ColorEnd
Definition ParticleSystem.h:18
glm::vec3 VelocityVariation
Definition ParticleSystem.h:16
bool Active
Definition ParticleSystem.h:37
glm::vec4 ColorBegin
Definition ParticleSystem.h:17
glm::vec4 ColorEnd
Definition ParticleSystem.h:32
glm::vec3 PositionVariation
Definition ParticleSystem.h:14
float SizeBegin
Definition ParticleSystem.h:33
float LifetimeVariation
Definition ParticleSystem.h:25
float Rotation
Definition ParticleSystem.h:22
glm::vec3 Velocity
Definition ParticleSystem.h:15
glm::vec3 Position
Definition ParticleSystem.h:30
float SizeEnd
Definition ParticleSystem.h:20
Specification for creating a Framebuffer.
Definition Framebuffer.h:14
Definition ParticleSystem.h:29
Definition ParticleSystem.h:12
Component that holds camera data.
Definition Components.h:225
CameraComponent(const CameraComponent &)=default
bool Primary
Whether this camera is the primary camera.
Definition Components.h:232
bool FixedAspectRatio
Whether the aspect ratio is fixed.
Definition Components.h:235
SceneCamera Camera
The scene camera.
Definition Components.h:227
Component that holds the name of an entity.
Definition Components.h:52
NameComponent(const NameComponent &)=default
NameComponent()=default
std::string Name
The name of the owning entity.
Definition Components.h:54
operator const std::string &() const
Definition Components.h:62
std::string & GetName()
Definition Components.h:63
operator std::string &()
Definition Components.h:61
NameComponent(const std::string &name)
Definition Components.h:58
Component that holds scripting data for an entity.
Definition Components.h:248
void(* DestroyScript)(NativeScriptComponent *)
Function pointer to destroy the script.
Definition Components.h:255
ScriptableEntity * Instance
Pointer to the instance of the scriptable entity.
Definition Components.h:250
void Bind()
Binds a script type to this component.
Definition Components.h:261
Definition Components.h:270
ParticleSystemComponent(const int maxParticles)
Definition Components.h:275
ParticleSystemComponent(const ParticleSystemComponent &)=default
ParticleSystem System
Definition Components.h:271
Component that holds sprite rendering data.
Definition Components.h:96
SpriteRendererComponent(const SpriteRendererComponent &)=default
SpriteRendererComponent(const glm::vec4 &color)
Constructor that initializes the color.
Definition Components.h:107
Ref< Texture2D > Texture
Texture of the sprite.
Definition Components.h:100
bool Billboard
whether the sprite should always face the camera
Definition Components.h:123
glm::vec4 Color
Color of the sprite.
Definition Components.h:98
float TilingFactor
Tiling factor for the texture.
Definition Components.h:102
Component that holds sub-texture data for sprites.
Definition Components.h:128
SubTextureComponent(const Ref< Texture2D > &texture)
Constructor that initializes the sub-texture from a full texture.
Definition Components.h:140
void SetTexture(const Ref< Texture2D > &texture)
Copy constructor.
Definition Components.h:148
Ref< SubTexture2D > SubTexture
The sub-texture reference.
Definition Components.h:130
glm::vec2 TilingFactor
Tiling factor for the sub-texture.
Definition Components.h:132
void SetTilingFactor(const glm::vec2 &tiling)
Sets the tiling factor for the sub-texture.
Definition Components.h:153
void SetOffset(const glm::vec2 &offset)
Sets the offset for the sub-texture.
Definition Components.h:158
glm::vec2 Offset
Offset for the sub-texture.
Definition Components.h:134
Animates through a series of sub textures.
Definition Components.h:171
int CurrentFrame
The current frame index.
Definition Components.h:175
TextureAnimationComponent(const std::vector< Ref< SubTexture2D > > &subTextures, float frameTime)
Constructor that initializes the sub-textures and frame time.
Definition Components.h:190
bool IsLooping
Definition Components.h:181
TextureAnimationComponent(const TextureAnimationComponent &)=default
float FrameTime
Time per frame in seconds.
Definition Components.h:177
float TimeAccumulator
Accumulated time for frame switching.
Definition Components.h:179
std::vector< Ref< SubTexture2D > > SubTextures
The list of sub-textures for the animation.
Definition Components.h:173
Component that holds the transform of an entity.
Definition Components.h:68
glm::vec3 Translation
Translation (position) vector.
Definition Components.h:70
glm::vec3 Scale
Scale vector.
Definition Components.h:74
glm::mat4 GetTransform() const
Calculates and returns the transformation matrix.
Definition Components.h:84
TransformComponent(const glm::vec3 &translation)
Constructor that initializes the translation with a 3D vector.
Definition Components.h:79
glm::vec3 Rotation
Rotation vector (in radians).
Definition Components.h:72
TransformComponent(const TransformComponent &)=default
Component that holds a UUID.
Definition Components.h:36
UUID ID
The UUID of the owning entity.
Definition Components.h:38
UUIDComponent(const std::string &id)
Definition Components.h:44
UUIDComponent(const UUIDComponent &)=default
UUIDComponent()
Definition Components.h:40
Universally Unique Identifier.
Definition Components.h:23
UUID()
Definition Components.h:27
UUID(const std::string &id)
Definition Components.h:28
operator std::string &()
Definition Components.h:31
operator const std::string &() const
Definition Components.h:32
std::string ID
The string representation of the UUID.
Definition Components.h:25