7#include "Renderer/OrthographicCamera.h"
8#include "Core/Timestep.h"
10#include "Events/ApplicationEvent.h"
11#include "Events/MouseEvent.h"
36 void OnResize(
float width,
float height);
#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
The base Camera class that all Camera's derive from Only contains a pojection matrix and a getter.
Definition Camera.h:15
glm::mat4 m_Projection
Definition Camera.h:25
const glm::mat4 & GetProjection() const
Definition Camera.h:23
Camera(const glm::mat4 &projection)
Definition Camera.h:18
Definition EditorCamera.h:20
float m_AspectRatio
Definition EditorCamera.h:66
glm::vec3 GetRightDirection() const
Definition EditorCamera.cpp:129
float m_ViewportWidth
Definition EditorCamera.h:77
float m_FarClip
Definition EditorCamera.h:66
float GetYaw() const
Definition EditorCamera.h:46
bool OnMouseScroll(MouseScrolledEvent &e)
Definition EditorCamera.cpp:87
glm::vec3 CalculatePosition() const
Definition EditorCamera.cpp:119
float GetDistance() const
Definition EditorCamera.h:27
void SetPitch(float pitch)
Definition EditorCamera.h:44
float GetPitch() const
Definition EditorCamera.h:43
glm::quat GetOrientation() const
Definition EditorCamera.cpp:137
void MouseRotate(const glm::vec2 &delta)
Definition EditorCamera.cpp:102
glm::mat4 GetViewProjection() const
Definition EditorCamera.h:33
void SetPosition(const glm::vec3 &position)
void MousePan(const glm::vec2 &delta)
Definition EditorCamera.cpp:95
const glm::mat4 & GetViewMatrix() const
Definition EditorCamera.h:32
void OnEvent(Event &e)
Definition EditorCamera.cpp:65
void UpdateProjection()
Definition EditorCamera.cpp:71
glm::vec3 m_FocalPoint
Definition EditorCamera.h:70
float m_ViewportHeight
Definition EditorCamera.h:77
void SetDistance(float distance)
Definition EditorCamera.h:28
float m_FOV
Definition EditorCamera.h:66
EditorCamera()
Definition EditorCamera.cpp:12
float m_Pitch
Definition EditorCamera.h:75
glm::mat4 m_ViewMatrix
Definition EditorCamera.h:68
float RotationSpeed() const
Definition EditorCamera.cpp:32
void UpdateView()
Definition EditorCamera.cpp:77
void OnUpdate(Timestep ts)
Definition EditorCamera.cpp:46
const glm::vec3 & GetPosition() const
Definition EditorCamera.h:40
glm::vec3 m_Position
Definition EditorCamera.h:69
glm::vec3 GetUpDirection() const
Definition EditorCamera.cpp:124
EditorCamera(float fov, float aspectRation, float nearClip, float farClip)
Definition EditorCamera.cpp:15
float m_Distance
Definition EditorCamera.h:74
std::pair< float, float > PanSpeed() const
Definition EditorCamera.cpp:21
glm::vec2 m_InitialMousePosition
Definition EditorCamera.h:72
void MouseZoom(float delta)
Definition EditorCamera.cpp:109
float ZoomSpeed() const
Definition EditorCamera.cpp:37
glm::vec3 GetForwardDirection() const
Definition EditorCamera.cpp:133
float m_NearClip
Definition EditorCamera.h:66
void SetYaw(float yaw)
Definition EditorCamera.h:47
void SetViewportSize(float width, float height)
Definition EditorCamera.h:30
float m_Yaw
Definition EditorCamera.h:75
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
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
Abstract class representing a framebuffer.
Definition Framebuffer.h:26
virtual const FramebufferSpecification & GetSpecification() const =0
Returns the specification used to create the framebuffer.
virtual void Resize(uint32_t width, uint32_t height)=0
Resizes the framebuffer to the given width and height.
virtual uint32_t GetColorAttachmentRendererID() const =0
Returns the renderer ID of the color attachment texture.
static Ref< Framebuffer > Create(const FramebufferSpecification &spec)
Creates a framebuffer with the given specification.
Definition Framebuffer.cpp:9
virtual void SetBlockEvents(bool block)
Definition ImGuiLayer.h:29
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
bool m_Rotation
Definition OrthographicCameraController.h:77
void SetAspectRatio(float aspectRatio)
Definition OrthographicCameraController.cpp:128
void OnUpdate(Timestep ts)
Definition OrthographicCameraController.cpp:21
OrthographicCameraController(float aspectRatio, bool rotation=false)
Definition OrthographicCameraController.cpp:13
OrthographicCameraBounds GetBounds() const
Definition OrthographicCameraController.h:40
OrthographicCamera & GetCamera()
Definition OrthographicCameraController.h:38
float m_CameraMoveSpeed
Definition OrthographicCameraController.h:80
OrthographicCameraBounds m_Bounds
Definition OrthographicCameraController.h:75
glm::vec3 GetPosition() const
Definition OrthographicCameraController.h:42
void CalculateView()
Definition OrthographicCameraController.cpp:95
void SetZoomLevel(float level)
Definition OrthographicCameraController.h:60
float GetAspectRatio() const
Definition OrthographicCameraController.cpp:123
void OnResize(float width, float height)
Definition OrthographicCameraController.cpp:56
float GetRotation() const
Definition OrthographicCameraController.h:49
float m_ZoomLevel
Definition OrthographicCameraController.h:73
float GetRotationSpeed() const
Definition OrthographicCameraController.h:52
glm::vec3 m_CameraPosition
Definition OrthographicCameraController.h:78
void OnUpdateBounds()
Definition OrthographicCameraController.cpp:90
void SetRotationSpeed(float speed)
Definition OrthographicCameraController.cpp:118
void OnImGuiRender()
TODO: move to an editor component that can be attached to any system (EditorAbstractionComp)
Definition OrthographicCameraController.cpp:136
float m_AspectRatio
Definition OrthographicCameraController.h:72
float m_CameraRotationSpeed
Definition OrthographicCameraController.h:80
void SetPosition(float x, float y)
Definition OrthographicCameraController.cpp:101
void SetRotation(float rotation)
Definition OrthographicCameraController.cpp:112
float GetMoveSpeed() const
Definition OrthographicCameraController.h:46
void SetMoveSpeed(float speed)
Definition OrthographicCameraController.cpp:107
void SetCanRotate(bool canRotate)
Definition OrthographicCameraController.h:58
bool OnWindowResized(WindowResizeEvent &e)
Definition OrthographicCameraController.cpp:74
bool OnMouseScrolled(MouseScrolledEvent &e)
Definition OrthographicCameraController.cpp:65
float GetZoomLevel() const
Definition OrthographicCameraController.h:61
bool CanRotate() const
Definition OrthographicCameraController.h:57
const OrthographicCamera & GetCamera() const
Definition OrthographicCameraController.h:39
OrthographicCamera camera
Definition OrthographicCameraController.h:74
float m_CameraRotation
Definition OrthographicCameraController.h:79
void OnEvent(Event &e)
Definition OrthographicCameraController.cpp:47
void UpdateCameraBounds()
Definition OrthographicCameraController.cpp:81
Definition OrthographicCamera.h:15
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 DrawRotatedQuad(const glm::vec2 &position, const glm::vec2 &size, float rotationRads, const glm::vec4 &color)
Draws a rotated colored quad at the specified position, size, and rotation.
Definition Renderer2D.cpp:391
static void StartBatch()
Definition Renderer2D.cpp:532
static void FlushAndReset()
Definition Renderer2D.cpp:526
static void BeginScene(const OrthographicCamera &camera)
Begins a new scene with the given orthographic camera.
Definition Renderer2D.cpp:157
static void Init()
Initializes the 2D renderer.
Definition Renderer2D.cpp:65
static void EndScene()
Ends the current scene.
Definition Renderer2D.cpp:165
static void DrawRotatedQuad(const glm::vec2 &position, const glm::vec2 &size, const Ref< Texture2D > &texture, float rotationRads, float tilingFactor, const glm::vec4 tintColor)
Draws a rotated textured quad at the specified position, size, and rotation.
Definition Renderer2D.cpp:444
static void DrawQuad(const glm::vec2 &position, const glm::vec2 &size, const glm::vec4 &color)
Draws a colored quad at the specified position and size.
Definition Renderer2D.cpp:242
static void ResetStats()
Resets the rendering statistics.
Definition Renderer2D.cpp:516
static void DrawQuad(const glm::vec2 &position, const glm::vec2 &size, const Ref< Texture2D > &texture, float tilingFactor, const glm::vec4 tintColor)
Draws a textured quad at the specified position and size.
Definition Renderer2D.cpp:297
static void Shutdown()
Shuts down the 2D renderer.
Definition Renderer2D.cpp:130
static Ref< Texture2D > GetWhiteTexture()
Returns a reference to the default white texture that allows for coloring.
Definition Renderer2D.cpp:511
static void BeginScene(const Camera &camera, const glm::mat4 &transform)
Begins a new scene with the given camera and transform.
Definition Renderer2D.cpp:137
static void BeginScene(const EditorCamera &camera)
Begins a new scene with the given editor camera.
Definition Renderer2D.cpp:147
static void DrawQuad(const glm::mat4 &transform, const Ref< Texture2D > &texture, float tilingFactor, const glm::vec4 tintColor)
Draws a textured quad with the given transform, texture, tiling factor, and tint color.
Definition Renderer2D.cpp:253
static void DrawRotatedQuad(const glm::mat4 &transform, const Ref< Texture2D > &texture, float tilingFactor, const glm::vec4 tintColor)
Draws a rotated textured quad with the given transform, texture, tiling factor, and tint color.
Definition Renderer2D.cpp:403
static void DrawQuad(const glm::mat4 &transform, const glm::vec4 &color)
Draws a colored quad with the given transform and color.
Definition Renderer2D.cpp:215
static void Flush()
Flushes the current batch of rendering commands.
Definition Renderer2D.cpp:188
static void DrawRotatedQuad(const glm::mat4 &transform, const glm::vec4 &color)
Draws a rotated colored quad with the given transform and color.
Definition Renderer2D.cpp:365
static Statistics GetStats()
Retrieves the current rendering statistics.
Definition Renderer2D.cpp:521
Definition SceneCamera.h:12
virtual ~SceneCamera()=default
void RecalculateProjection()
Definition SceneCamera.cpp:37
float m_AspectRatio
Definition SceneCamera.h:51
float m_OrthographicFar
Definition SceneCamera.h:49
ProjectionType m_ProjectionType
Definition SceneCamera.h:43
void SetPerspectiveNearClip(float nearClip)
Definition SceneCamera.h:27
ProjectionType GetProjectionType() const
Definition SceneCamera.h:38
void SetPerspectiveVerticalFOV(float verticalFov)
Definition SceneCamera.h:25
float m_OrthographicSize
Definition SceneCamera.h:48
float GetPerspectiveNearClip() const
Definition SceneCamera.h:26
SceneCamera()
Definition SceneCamera.cpp:9
void SetOrthographicSize(float size)
Definition SceneCamera.h:32
float GetOrthographicNearClip() const
Definition SceneCamera.h:33
float GetPerspectiveVerticalFOV() const
Definition SceneCamera.h:24
float m_PerspectiveNear
Definition SceneCamera.h:46
void SetPerspectiveFarClip(float farClip)
Definition SceneCamera.h:29
float GetOrthographicFarClip() const
Definition SceneCamera.h:35
float m_PerspectiveFar
Definition SceneCamera.h:46
void SetOrthographicNearClip(float nearClip)
Definition SceneCamera.h:34
float GetPerspectiveFarClip() const
Definition SceneCamera.h:28
float m_OrthographicNear
Definition SceneCamera.h:49
float GetOrthographicSize() const
Definition SceneCamera.h:31
void SetViewportSize(uint32_t width, uint32_t height)
Definition SceneCamera.cpp:31
ProjectionType
Definition SceneCamera.h:14
void SetPerspective(float verticalFOV, float nearClip, float farClip)
Definition SceneCamera.cpp:14
void SetProjectionType(ProjectionType type)
Definition SceneCamera.h:39
float m_PerspectiveFOV
Definition SceneCamera.h:45
void SetOrthographicFarClip(float farClip)
Definition SceneCamera.h:36
void SetOrthographic(float size, float nearClip, float farClip)
Definition SceneCamera.cpp:23
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
virtual void OnDestroy()
Called when the entity is destroyed.
Definition ScriptableEntity.h:40
virtual void OnCreate()
Sets the entity associated with this scriptable entity.
Definition ScriptableEntity.h:34
virtual void OnUpdate(Timestep ts)
Called every frame to update the entity.
Definition ScriptableEntity.h:46
Entity m_Entity
Definition ScriptableEntity.h:48
T & GetComponent()
Retrieves a reference to a component of type T attached to the entity.
Definition ScriptableEntity.h:24
virtual ~ScriptableEntity()
Definition ScriptableEntity.h:16
Represents a sub-region of a 2D texture, useful for sprite sheets.
Definition SubTexture2D.h:16
glm::vec2 m_TexCoords[4]
The texture coordinates of the sub-texture.
Definition SubTexture2D.h:41
glm::vec2 * GetTexCoords()
Returns the texture coordinates of the sub-texture.
Definition SubTexture2D.h:28
Ref< Texture2D > m_Texture
The underlying texture of the sub-texture.
Definition SubTexture2D.h:39
SubTexture2D(const Ref< Texture2D > &texture, const glm::vec2 &min, const glm::vec2 &max)
Constructs a SubTexture2D from the given texture and texture coordinates.
Definition SubTexture2D.cpp:8
const Ref< Texture2D > GetTexture()
Returns the underlying texture of the sub-texture.
Definition SubTexture2D.h:26
static Ref< SubTexture2D > CreateFromCoords(const Ref< Texture2D > &texture, const glm::vec2 &coords, const glm::vec2 &cellSize, const glm::vec2 &spriteSize={1, 1})
Creates a SubTexture2D from a grid of cells within the given texture.
Definition SubTexture2D.cpp:17
An abstraction for a 2D texture.
Definition Texture.h:41
static Ref< Texture2D > Create(const std::string &path)
Definition Texture.cpp:21
static Ref< Texture2D > Create(uint32_t width, uint32_t height)
Definition Texture.cpp:10
A library for managing and storing textures.
Definition Texture.h:53
void Add(const Ref< Texture2D > &texture)
Adds a texture to the library using its own name.
Definition Texture.cpp:39
bool Exists(const std::string &name) const
Checks if a texture with the specified name exists in the library.
Definition Texture.cpp:69
Ref< Texture2D > Load(const std::string &filepath)
Loads a texture from the specified filepath and adds it to the library.
Definition Texture.cpp:46
void Add(const std::string &name, const Ref< Texture2D > &texture)
Adds a texture to the library with the specified name.
Definition Texture.cpp:32
Ref< Texture2D > Get(const std::string &name) const
Retrieves a texture from the library by name.
Definition Texture.cpp:62
Ref< Texture2D > Load(const std::string &name, const std::string &filepath)
Loads a texture from the specified filepath and adds it to the library with the given name.
Definition Texture.cpp:54
std::unordered_map< std::string, Ref< Texture2D > > m_Textures
Definition Texture.h:68
An abstraction for a texture.
Definition Texture.h:14
virtual ~Texture()=default
virtual void Bind(uint32_t slot=0) const =0
Binds the texture to the specified slot for use.
virtual std::string GetName() const =0
virtual uint32_t GetRendererID() const =0
Returns the renderer ID of the texture.
virtual uint32_t GetHeight() const =0
Returns the height of the texture.
virtual uint32_t GetWidth() const =0
Returns the width of the texture.
virtual void SetData(void *data, uint32_t size)=0
Sets the data of the texture.
virtual bool operator==(const Texture2D &other) const =0
Represents a time step in seconds.
Definition Timestep.h:11
Event for registering window resize.
Definition ApplicationEvent.h:16
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
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
uint32_t Samples
Definition Framebuffer.h:17
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
bool SwapChainTarget
Definition Framebuffer.h:19
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()=default
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
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 OrthographicCameraController.h:19
float Left
Definition OrthographicCameraController.h:20
float Right
Definition OrthographicCameraController.h:20
float Top
Definition OrthographicCameraController.h:21
float Bottom
Definition OrthographicCameraController.h:21
float GetHeight() const
Definition OrthographicCameraController.h:24
float GetWidth() const
Definition OrthographicCameraController.h:23
Definition Components.h:270
ParticleSystemComponent(const int maxParticles)
Definition Components.h:275
ParticleSystemComponent(const ParticleSystemComponent &)=default
ParticleSystem System
Definition Components.h:271
ParticleSystemComponent()=default
2D Renderer Statistics
Definition Renderer2D.h:210
uint32_t GetTotalIndexCount()
Calculates the total number of indices drawn.
Definition Renderer2D.h:218
uint32_t GetTotalVertexCount()
Calculates the total number of vertices drawn.
Definition Renderer2D.h:216
uint32_t QuadCount
The number of quads being drawn.
Definition Renderer2D.h:214
uint32_t DrawCalls
The number of draw calls being made.
Definition Renderer2D.h:212
Component that holds sprite rendering data.
Definition Components.h:96
SpriteRendererComponent()=default
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
SubTextureComponent()=default
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()=default
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 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