Muto 0.0.1
Cross-Platform Application Template
GitHub Repo | Muto Updates | Muto's Author
Loading...
Searching...
No Matches
Muto Namespace Reference

The main namespace for the Muto engine. More...

Namespaces

namespace  Color
 Provides commonly used colors and color manipulation functions.
 
namespace  Key
 Namespace for keyboard key codes.
 
namespace  Math
 Contains mathematical utility functions for the Vesper engine.
 
namespace  Math2D
 
namespace  Mouse
 Namespace for mouse button codes.
 
namespace  Random
 

Classes

class  Application
 The core application class that manages the main loop, window, layers, and event handling. More...
 
struct  ApplicationSettings
 Holds configuration settings for the application. More...
 
class  AppRenderEvent
 Event for registering application render. More...
 
class  AppTickEvent
 Event for registering application tick. More...
 
class  AppUpdateEvent
 Event for registering application update. More...
 
struct  BufferElement
 Represents a single element in a buffer layout. More...
 
class  BufferLayout
 Represents the layout of a buffer, consisting of multiple BufferElements. More...
 
class  Camera
 The base Camera class that all Camera's derive from Only contains a pojection matrix and a getter. More...
 
struct  CameraComponent
 Component that holds camera data. More...
 
class  EditorCamera
 
class  EditorLayer
 
class  Entity
 Represents an entity in a scene. More...
 
class  Event
 Abstract base class for all events. More...
 
class  EventDispatcher
 Stack-based templated event dispatcher. More...
 
class  FileDialogs
 Cross-platform file dialog utilities. More...
 
class  FileSystem
 WIP. More...
 
class  Framebuffer
 Abstract class representing a framebuffer. More...
 
struct  FramebufferSpecification
 Specification for creating a Framebuffer. More...
 
class  GraphicsContext
 Abstract class representing a graphics context. More...
 
class  ImGuiLayer
 
class  IndexBuffer
 Abstract base class for an index buffer. More...
 
class  Input
 Base input class for querying input states. More...
 
struct  InstrumentationSession
 
class  InstrumentationTimer
 
class  Instrumentor
 
class  KeyEvent
 Base class for keyboard events. More...
 
class  KeyPressedEvent
 Event for registering key press. More...
 
class  KeyReleasedEvent
 Event for registering key release. More...
 
class  KeyTypedEvent
 Event for registering key typing. More...
 
class  Layer
 Represents a reusable application layer that receives lifecycle callbacks (attach, detach, update, events, render, and ImGui render). Intended as a base class for concrete layers. More...
 
class  LayerStack
 Manages an ordered stack of Layer pointers. Layers can be pushed or popped and the stack can be iterated in forward or reverse order. More...
 
class  Log
 A logging utility class for the Vesper engine. More...
 
class  MouseButtonEvent
 Base class for mouse button events. More...
 
class  MouseButtonPressedEvent
 Event for registering mouse button presses. More...
 
class  MouseButtonReleasedEvent
 Event for registering mouse button releases. More...
 
class  MouseMovedEvent
 Event for registering mouse movement. More...
 
class  MouseScrolledEvent
 Event for registering mouse scroll wheel movement. More...
 
class  Mutare
 
struct  MutoResult
 
struct  NameComponent
 Component that holds the name of an entity. More...
 
struct  NativeScriptComponent
 Component that holds scripting data for an entity. More...
 
class  OpenGLContext
 
class  OpenGLFramebuffer
 
class  OpenGLImGuiLayer
 
class  OpenGLIndexBuffer
 
class  OpenGLRendererAPI
 An implementation of the RenderAPI for OpenGL. More...
 
class  OpenGLShader
 
class  OpenGLTexture2D
 
class  OpenGLUniformBuffer
 
class  OpenGLVertexArray
 
class  OpenGLVertexBuffer
 
class  OrthographicCamera
 
struct  OrthographicCameraBounds
 
class  OrthographicCameraController
 
struct  Particle
 
struct  ParticleProps
 
class  ParticleSystem
 A simple particle system for stress testing the renderer. This is a temporary starter particle system and will be replaced with a more robust implementation in the future. More...
 
struct  ParticleSystemComponent
 
struct  ProfileResult
 
struct  QuadVertex
 Represents a single vertex in a quad, containing position, color, texture coordinates, texture index, and tiling factor. More...
 
class  RenderAPI
 An abstract class defining the interface for a rendering API. More...
 
class  RenderCommand
 A static class that provides an interface for issuing rendering commands. More...
 
class  Renderer
 The main renderer class responsible for managing rendering operations. More...
 
class  Renderer2D
 A 2D renderer for drawing quads and sprites. More...
 
struct  Renderer2DData
 Contains all the internal data and resources used by the Renderer2D, such as vertex arrays, buffers, shaders, textures, and rendering statistics. More...
 
class  ResourceManager
 The ResourceManager class is responsible for managing application resources and pathing. More...
 
class  Scene
 Represents a scene in the application and manages entities and their components. More...
 
class  SceneCamera
 
class  SceneHierarchyPanel
 
class  SceneSerializer
 Handles serialization and deserialization of scenes. More...
 
class  ScriptableEntity
 Base class for scriptable entities within a scene. More...
 
class  Shader
 An abstraction for a shader program. More...
 
class  ShaderLibrary
 A library for managing and storing shaders. More...
 
struct  SpriteRendererComponent
 Component that holds sprite rendering data. More...
 
class  SubTexture2D
 Represents a sub-region of a 2D texture, useful for sprite sheets. More...
 
struct  SubTextureComponent
 Component that holds sub-texture data for sprites. More...
 
class  Texture
 An abstraction for a texture. More...
 
class  Texture2D
 An abstraction for a 2D texture. More...
 
struct  TextureAnimationComponent
 Animates through a series of sub textures. More...
 
class  TextureLibrary
 A library for managing and storing textures. More...
 
class  Timestep
 Represents a time step in seconds. More...
 
struct  TransformComponent
 Component that holds the transform of an entity. More...
 
class  UniformBuffer
 An abstraction for a uniform buffer object (UBO). More...
 
struct  UUID
 Universally Unique Identifier. More...
 
struct  UUIDComponent
 Component that holds a UUID. More...
 
class  VertexArray
 An abstraction for a vertex array object (VAO). More...
 
class  VertexBuffer
 Abstract base class for a vertex buffer. More...
 
class  Window
 Abstract interface representing an application window. More...
 
class  WindowCloseEvent
 Event for registering window close. More...
 
struct  WindowProps
 Holds the data for window configuration. More...
 
class  WindowResizeEvent
 Event for registering window resize. More...
 
class  WindowsWindow
 

Typedefs

using FloatingPointMicroseconds = std::chrono::duration< double, std::micro >
 
using KeyCode = uint16_t
 Alias for keyboard key code type.
 
using MouseButtonCodes = uint8_t
 Alias for mouse button code type.
 
template<typename T >
using Ref = std::shared_ptr< T >
 A smart pointer type representing shared ownership of an object.
 
template<typename T >
using Scope = std::unique_ptr< T >
 A smart pointer type representing exclusive ownership of an object.
 

Enumerations

enum  EventCategory {
  EC_None = 0 , EC_Application = BIT(0) , EC_Input = BIT(1) , EC_Keyboard = BIT(2) ,
  EC_Mouse = BIT(3) , EC_MouseButton = BIT(4)
}
 Enumeration of event categories. More...
 
enum class  EventType {
  ET_None = 0 , ET_WindowClose , ET_WindowResize , ET_WindowFocus ,
  ET_WindowLostFocus , ET_WindowMoved , ET_AppTick , ET_AppUpdate ,
  ET_AppRender , ET_KeyPressed , ET_KeyReleased , ET_KeyTyped ,
  ET_MouseButtonPressed , ET_MouseButtonReleased , ET_MouseMoved , ET_MouseScrolled
}
 Enumeration of event types. More...
 
enum class  MU_RETURN {
  SUCCESS = 0 , FAILURE , FILE_NOT_FOUND , INVALID_ARGUMENT ,
  OUT_OF_MEMORY , UNKNOWN_ERROR
}
 
enum class  PathResolveMode { WorkingDirectory , ProjectDirectory , AssetsDirectory }
 Specifies the mode for resolving resource paths in the application. More...
 
enum class  ShaderDataType {
  SDT_None = 0 , SDT_Float , SDT_Float2 , SDT_Float3 ,
  SDT_Float4 , SDT_Mat3 , SDT_Mat4 , SDT_Int ,
  SDT_Int2 , SDT_Int3 , SDT_Int4 , SDT_Bool
}
 The different data types that can be used in shaders. More...
 
enum class  WindowMode { Windowed = 0 , Fullscreen = 1 , Borderless = 2 }
 WIP. More...
 

Functions

Application * CreateApplication ()
 
template<typename T , typename... Args>
constexpr Ref< T > CreateRef (Args &&... args)
 Creates a Ref (shared_ptr) for the given type and constructor arguments.
 
template<typename T , typename... Args>
constexpr Scope< T > CreateScope (Args &&... args)
 Creates a Scope (unique_ptr) for the given type and constructor arguments.
 
template<typename T , typename UIFunction >
static void DrawComponent (const std::string &name, Entity entity, UIFunction uiFunction)
 
static void DrawVec2Control (const std::string &label, glm::vec2 &values, float resetValue=0.0f, float columnWidth=100.0f)
 
static void DrawVec3Control (const std::string &label, glm::vec3 &values, float resetValue=0.0f, float columnWidth=100.0f)
 
std::string format_as (const Event &e)
 Format an event as a string.
 
static void GLFWErrorCallback (int error, const char *description)
 
static bool IsAbsolutePath (const std::string &path)
 Determines whether the given path is an absolute path (Unix-style, Windows-style, or drive-letter).
 
static std::string JoinPaths (const std::string &base, const std::string &relative)
 Joins two path segments with proper separator handling.
 
static std::string NormalizePath (const std::string &path)
 Normalizes path separators to forward slashes for cross-platform consistency.
 
static void SerializeEntity (YAML::Emitter &out, Entity entity)
 
static uint32_t ShaderDataTypeSize (ShaderDataType type)
 Returns the size in bytes of the given ShaderDataType.
 
static GLenum ShaderDataTypeToOpenGLBaseType (ShaderDataType type)
 
static GLenum ShaderTypeFromString (const std::string &type)
 
static void SubTextureEdit (Entity entity, const std::string &label, SubTextureComponent &subTexture)
 
static void TextureAnimationEdit (const std::string &label, SubTextureComponent &subTexture, TextureAnimationComponent &texAnim)
 

Variables

static Renderer2DData s_Data
 
static bool s_GLFWInitialized = false
 
static const uint32_t s_MaxFramebufferSize = 8192
 TODO: Get the actual maximum size from the GPU!
 

Detailed Description

The main namespace for the Muto engine.

Temporary.

Todo:
Remove GLFW include once abstracted
Todo:
Abstract this class to OpenGL/DirectX/Vulkan etc ImGui layers
Todo:
Remove GLFW include once abstracted
Todo:
Abstract this class to OpenGL/DirectX/Vulkan etc ImGui layers

Class Documentation

◆ Muto::ApplicationSettings

struct Muto::ApplicationSettings

Holds configuration settings for the application.

Class Members
string ApplicationName = "Muto Application" The name of the application.
string AssetsDirectory The assets directory of the application.
bool EnableImGui = true Flag indicating whether ImGui is enabled for the application.
bool EnableVSync = false Flag indicating whether vertical synchronization (VSync) is enabled for the application.
GFile FileSystem The file system interface for the application.
uint32_t Height = 720 The height of the application window.
WindowMode Mode = WindowMode::Windowed The window mode of the application (e.g., windowed, fullscreen, borderless).
string ProjectDirectory The project directory of the application.
API RendererAPIType = RenderAPI::API::RAPI_OpenGL The renderer API to use for the application.
uint32_t Width = 1280 The width of the application window.
string WorkingDirectory The working directory of the application.

◆ Muto::FramebufferSpecification

struct Muto::FramebufferSpecification

Specification for creating a Framebuffer.

Class Members
uint32_t Height
uint32_t Samples = 1
bool SwapChainTarget = false
uint32_t Width

◆ Muto::InstrumentationSession

struct Muto::InstrumentationSession
Class Members
string Name

◆ Muto::Particle

struct Muto::Particle
Class Members
bool Active = false
vec4 ColorBegin
vec4 ColorEnd
float LifeRemaining = 0.0f
float Lifetime = 0.0f
vec3 Position
float Rotation
float SizeBegin
float SizeEnd
vec3 Velocity

◆ Muto::ParticleProps

struct Muto::ParticleProps
Class Members
vec4 ColorBegin = { 1.0f, 1.0f, 1.0f, 1.0f }
vec4 ColorEnd = { 1.0f, 1.0f, 1.0f, 1.0f }
float Lifetime = 1.0f
float LifetimeVariation = 0.0f
vec3 Position = { 0.0f, 0.0f, 0.0f }
vec3 PositionVariation = { 0.0f, 0.0f, 0.0f }
float Rotation = 0.0f
float RotationVariation = 0.0f
float SizeBegin = 1.0f
float SizeEnd = 0.0f
float SizeVariation = 0.0f
vec3 Velocity = { 0.0f, 0.0f, 0.0f }
vec3 VelocityVariation = { 0.0f, 0.0f, 0.0f }

◆ Muto::ProfileResult

struct Muto::ProfileResult
Class Members
long long End
string Name
long long Start
uint32_t ThreadID

◆ Muto::QuadVertex

struct Muto::QuadVertex

Represents a single vertex in a quad, containing position, color, texture coordinates, texture index, and tiling factor.

Todo:
move to Geometry dir
Todo:
move to Geometry dir
Class Members
vec4 Color
vec3 Position
vec2 TexCoord
float TexIndex
float TilingFactor

Typedef Documentation

◆ FloatingPointMicroseconds

using Muto::FloatingPointMicroseconds = typedef std::chrono::duration<double, std::micro>

◆ KeyCode

using Muto::KeyCode = typedef uint16_t

Alias for keyboard key code type.

◆ MouseButtonCodes

using Muto::MouseButtonCodes = typedef uint8_t

Alias for mouse button code type.

◆ Ref

template<typename T >
using Muto::Ref = typedef std::shared_ptr<T>

A smart pointer type representing shared ownership of an object.

Template Parameters
TThe type of object to manage.
Note
This is an alias for std::shared_ptr.

◆ Scope

template<typename T >
using Muto::Scope = typedef std::unique_ptr<T>

A smart pointer type representing exclusive ownership of an object.

Template Parameters
TThe type of object to manage.
Note
This is an alias for std::unique_ptr.

Enumeration Type Documentation

◆ EventCategory

Enumeration of event categories.

Enumerator
EC_None 
EC_Application 
EC_Input 
EC_Keyboard 
EC_Mouse 
EC_MouseButton 
22 {
23 EC_None = 0,
25 EC_Input = BIT(1),
26 EC_Keyboard = BIT(2),
27 EC_Mouse = BIT(3),
29 };
#define BIT(x)
Macro to shift 1 by x positions to create a bitmask.
Definition Defines_Macros.h:13
@ EC_Keyboard
Definition Event.h:26
@ EC_Input
Definition Event.h:25
@ EC_None
Definition Event.h:23
@ EC_MouseButton
Definition Event.h:28
@ EC_Application
Definition Event.h:24
@ EC_Mouse
Definition Event.h:27

◆ EventType

enum class Muto::EventType
strong

Enumeration of event types.

Enumerator
ET_None 
ET_WindowClose 
ET_WindowResize 
ET_WindowFocus 
ET_WindowLostFocus 
ET_WindowMoved 
ET_AppTick 
ET_AppUpdate 
ET_AppRender 
ET_KeyPressed 
ET_KeyReleased 
ET_KeyTyped 
ET_MouseButtonPressed 
ET_MouseButtonReleased 
ET_MouseMoved 
ET_MouseScrolled 

◆ MU_RETURN

enum class Muto::MU_RETURN
strong
Enumerator
SUCCESS 
FAILURE 
FILE_NOT_FOUND 
INVALID_ARGUMENT 
OUT_OF_MEMORY 
UNKNOWN_ERROR 

◆ PathResolveMode

enum class Muto::PathResolveMode
strong

Specifies the mode for resolving resource paths in the application.

Enumerator
WorkingDirectory 
ProjectDirectory 
AssetsDirectory 

◆ ShaderDataType

enum class Muto::ShaderDataType
strong

The different data types that can be used in shaders.

Enumerator
SDT_None 
SDT_Float 
SDT_Float2 
SDT_Float3 
SDT_Float4 
SDT_Mat3 
SDT_Mat4 
SDT_Int 
SDT_Int2 
SDT_Int3 
SDT_Int4 
SDT_Bool 

◆ WindowMode

enum class Muto::WindowMode
strong

WIP.

Enumerator
Windowed 
Fullscreen 
Borderless 
15 {
16 Windowed = 0,
17 Fullscreen = 1,
18 Borderless = 2
19 };

Function Documentation

◆ CreateApplication()

Muto::Application * Muto::CreateApplication ( )
201{
202 ApplicationSettings settings;
203 settings.ApplicationName = "Sandbox";
204
205 //settings.WorkingDirectory = "";
206 settings.ProjectDirectory = "";
207 settings.AssetsDirectory = ("Muto/src/Editor/assets");
208
209 settings.RendererAPIType = RenderAPI::API::RAPI_OpenGL;
210 settings.Width = 1600;
211 settings.Height = 900;
212 settings.Mode = WindowMode::Windowed;
213 settings.EnableImGui = true;
214 settings.EnableVSync = true;
215
216 //return new SandboxApp();
217 return new SandboxApp(settings);
218}
Definition SandboxApp.cpp:183
WindowMode Mode
The window mode of the application (e.g., windowed, fullscreen, borderless).
Definition Application.h:53
std::string ProjectDirectory
The project directory of the application.
Definition Application.h:38
RenderAPI::API RendererAPIType
The renderer API to use for the application.
Definition Application.h:44
uint32_t Height
The height of the application window.
Definition Application.h:50
bool EnableImGui
Flag indicating whether ImGui is enabled for the application.
Definition Application.h:56
std::string ApplicationName
The name of the application.
Definition Application.h:32
std::string AssetsDirectory
The assets directory of the application.
Definition Application.h:41
bool EnableVSync
Flag indicating whether vertical synchronization (VSync) is enabled for the application.
Definition Application.h:59
uint32_t Width
The width of the application window.
Definition Application.h:47
Holds configuration settings for the application.
Definition Application.h:30

References Muto::ApplicationSettings::AssetsDirectory, Muto::ApplicationSettings::EnableImGui, Muto::ApplicationSettings::EnableVSync, Muto::ApplicationSettings::Height, Muto::ApplicationSettings::Mode, Muto::ApplicationSettings::ProjectDirectory, Muto::RenderAPI::RAPI_OpenGL, Muto::ApplicationSettings::RendererAPIType, SandboxApp::SandboxApp(), Muto::ApplicationSettings::Width, and Windowed.

◆ CreateRef()

template<typename T , typename... Args>
constexpr Ref< T > Muto::CreateRef ( Args &&...  args)
constexpr

Creates a Ref (shared_ptr) for the given type and constructor arguments.

Template Parameters
TThe type of object to create.
ArgsThe types of constructor arguments.
Parameters
argsThe constructor arguments.
Returns
A Ref (shared_ptr) managing the created object.
72 {
73 return std::make_shared<T>(std::forward<Args>(args)...);
74 }

◆ CreateScope()

template<typename T , typename... Args>
constexpr Scope< T > Muto::CreateScope ( Args &&...  args)
constexpr

Creates a Scope (unique_ptr) for the given type and constructor arguments.

Template Parameters
TThe type of object to create.
ArgsThe types of constructor arguments.
Parameters
argsThe constructor arguments.
Returns
A Scope (unique_ptr) managing the created object.
52 {
53 return std::make_unique<T>(std::forward<Args>(args)...);
54 }

◆ DrawComponent()

template<typename T , typename UIFunction >
static void Muto::DrawComponent ( const std::string &  name,
Entity  entity,
UIFunction  uiFunction 
)
static
412 {
413 const ImGuiTreeNodeFlags treeNodeFlags = ImGuiTreeNodeFlags_DefaultOpen | ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_AllowItemOverlap | ImGuiTreeNodeFlags_FramePadding;
414 if (entity.HasComponent<T>())
415 {
416 auto& component = entity.GetComponent<T>();
417 ImVec2 contentRegionAvailable = ImGui::GetContentRegionAvail();
418
419 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2{ 4, 4 });
420 float lineHeight = ImGui::GetFontSize() + ImGui::GetStyle().FramePadding.y * 2.0f;
421 ImGui::Separator();
422 bool open = ImGui::TreeNodeEx((void*)typeid(T).hash_code(), treeNodeFlags, name.c_str());
423 ImGui::PopStyleVar(
424 );
425 ImGui::SameLine(contentRegionAvailable.x - lineHeight * 0.5f);
426 if (ImGui::Button("+", ImVec2{ lineHeight, lineHeight }))
427 {
428 ImGui::OpenPopup("ComponentSettings");
429 }
430
431 bool removeComponent = false;
432 if (ImGui::BeginPopup("ComponentSettings"))
433 {
434 if (ImGui::MenuItem("Remove component"))
435 removeComponent = true;
436
437 ImGui::EndPopup();
438 }
439
440 if (open)
441 {
442 uiFunction(entity, component);
443 ImGui::TreePop();
444 }
445
446 if (removeComponent)
447 entity.RemoveComponent<T>();
448 }
449 }
T & GetComponent()
Retrieves a reference to the component of type T attached to the entity if it exists....
Definition Entity.h:73
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
@ T
Definition KeyCodes.h:60

◆ DrawVec2Control()

static void Muto::DrawVec2Control ( const std::string &  label,
glm::vec2 &  values,
float  resetValue = 0.0f,
float  columnWidth = 100.0f 
)
static
235 {
236 ImGuiIO& io = ImGui::GetIO();
237 auto boldFont = io.Fonts->Fonts[0];
238
239 ImGui::PushID(label.c_str());
240
241 ImGui::Columns(2);
242 ImGui::SetColumnWidth(0, columnWidth);
243 ImGui::Text(label.c_str());
244 ImGui::NextColumn();
245
246 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ 0, 0 });
247
248 float lineHeight = ImGui::GetFontSize() + ImGui::GetStyle().FramePadding.y * 2.0f;
249 ImVec2 buttonSize = { lineHeight + 3.0f, lineHeight };
250
251 // Compute available width for the three float controls in the right column
252 float availableWidth = ImGui::GetContentRegionAvail().x;
253 float itemSpacing = ImGui::GetStyle().ItemSpacing.x;
254 float totalButtonWidth = buttonSize.x * 2.0f;
255 // Account for SameLine() spacings between button+control pairs (conservative estimate)
256 float totalSpacing = itemSpacing * 4.0f;
257 float itemWidth = (availableWidth - totalButtonWidth - totalSpacing) / 2.0f;
258 if (itemWidth <= 0.0f)
259 itemWidth = ImGui::CalcItemWidth();
260
261 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{ 0.8f, 0.1f, 0.15f, 1.0f });
262 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{ 0.9f, 0.2f, 0.2f, 1.0f });
263 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4{ 0.8f, 0.1f, 0.15f, 1.0f });
264 ImGui::PushFont(boldFont);
265 if (ImGui::Button("X", buttonSize))
266 values.x = resetValue;
267 ImGui::PopFont();
268 ImGui::PopStyleColor(3);
269
270 ImGui::SameLine();
271 ImGui::PushItemWidth(itemWidth);
272 ImGui::DragFloat("##X", &values.x, 0.1f, 0.0f, 0.0f, "%.2f");
273 ImGui::PopItemWidth();
274 ImGui::SameLine();
275
276 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{ 0.2f, 0.7f, 0.2f, 1.0f });
277 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{ 0.3f, 0.8f, 0.3f, 1.0f });
278 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4{ 0.2f, 0.7f, 0.2f, 1.0f });
279 ImGui::PushFont(boldFont);
280 if (ImGui::Button("Y", buttonSize))
281 values.y = resetValue;
282 ImGui::PopFont();
283 ImGui::PopStyleColor(3);
284
285 ImGui::SameLine();
286 ImGui::PushItemWidth(itemWidth);
287 ImGui::DragFloat("##Y", &values.y, 0.1f, 0.0f, 0.0f, "%.2f");
288 ImGui::PopItemWidth();
289 ImGui::SameLine();
290
291 ImGui::PopStyleVar();
292
293 ImGui::Columns(1);
294
295 ImGui::PopID();
296 }

◆ DrawVec3Control()

static void Muto::DrawVec3Control ( const std::string &  label,
glm::vec3 &  values,
float  resetValue = 0.0f,
float  columnWidth = 100.0f 
)
static
157 {
158 ImGuiIO& io = ImGui::GetIO();
159 auto boldFont = io.Fonts->Fonts[0];
160
161 ImGui::PushID(label.c_str());
162
163 ImGui::Columns(2);
164 ImGui::SetColumnWidth(0, columnWidth);
165 ImGui::Text(label.c_str());
166 ImGui::NextColumn();
167
168 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ 0, 0 });
169
170 float lineHeight = ImGui::GetFontSize() + ImGui::GetStyle().FramePadding.y * 2.0f;
171 ImVec2 buttonSize = { lineHeight + 3.0f, lineHeight };
172
173 // Compute available width for the three float controls in the right column
174 float availableWidth = ImGui::GetContentRegionAvail().x;
175 float itemSpacing = ImGui::GetStyle().ItemSpacing.x;
176 float totalButtonWidth = buttonSize.x * 3.0f;
177 // Account for SameLine() spacings between button+control pairs (conservative estimate)
178 float totalSpacing = itemSpacing * 6.0f;
179 float itemWidth = (availableWidth - totalButtonWidth - totalSpacing) / 3.0f;
180 if (itemWidth <= 0.0f)
181 itemWidth = ImGui::CalcItemWidth();
182
183 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{ 0.8f, 0.1f, 0.15f, 1.0f });
184 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{ 0.9f, 0.2f, 0.2f, 1.0f });
185 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4{ 0.8f, 0.1f, 0.15f, 1.0f });
186 ImGui::PushFont(boldFont);
187 if (ImGui::Button("X", buttonSize))
188 values.x = resetValue;
189 ImGui::PopFont();
190 ImGui::PopStyleColor(3);
191
192 ImGui::SameLine();
193 ImGui::PushItemWidth(itemWidth);
194 ImGui::DragFloat("##X", &values.x, 0.1f, 0.0f, 0.0f, "%.2f");
195 ImGui::PopItemWidth();
196 ImGui::SameLine();
197
198 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{ 0.2f, 0.7f, 0.2f, 1.0f });
199 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{ 0.3f, 0.8f, 0.3f, 1.0f });
200 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4{ 0.2f, 0.7f, 0.2f, 1.0f });
201 ImGui::PushFont(boldFont);
202 if (ImGui::Button("Y", buttonSize))
203 values.y = resetValue;
204 ImGui::PopFont();
205 ImGui::PopStyleColor(3);
206
207 ImGui::SameLine();
208 ImGui::PushItemWidth(itemWidth);
209 ImGui::DragFloat("##Y", &values.y, 0.1f, 0.0f, 0.0f, "%.2f");
210 ImGui::PopItemWidth();
211 ImGui::SameLine();
212
213 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{ 0.1f, 0.25f, 0.8f, 1.0f });
214 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{ 0.2f, 0.35f, 0.9f, 1.0f });
215 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4{ 0.1f, 0.25f, 0.8f, 1.0f });
216 ImGui::PushFont(boldFont);
217 if (ImGui::Button("Z", buttonSize))
218 values.z = resetValue;
219 ImGui::PopFont();
220 ImGui::PopStyleColor(3);
221
222 ImGui::SameLine();
223 ImGui::PushItemWidth(itemWidth);
224 ImGui::DragFloat("##Z", &values.z, 0.1f, 0.0f, 0.0f, "%.2f");
225 ImGui::PopItemWidth();
226
227 ImGui::PopStyleVar();
228
229 ImGui::Columns(1);
230
231 ImGui::PopID();
232 }

◆ format_as()

std::string Muto::format_as ( const Event &  e)
inline

Format an event as a string.

103 {
104 return e.ToString();
105 }
virtual std::string ToString() const
Convert the event to a string representation.
Definition Event.h:50

References Muto::Event::ToString().

◆ GLFWErrorCallback()

static void Muto::GLFWErrorCallback ( int  error,
const char *  description 
)
static
16 {
17 MU_CORE_ERROR("GLFW Error ({0}): {1}", error, description);
18 }
#define MU_CORE_ERROR(...)
error: indicates an error that has occurred
Definition Log.h:42

Referenced by Muto::WindowsWindow::Init().

◆ IsAbsolutePath()

static bool Muto::IsAbsolutePath ( const std::string &  path)
static

Determines whether the given path is an absolute path (Unix-style, Windows-style, or drive-letter).

48 {
49 if (path.empty())
50 return false;
51
52 if (path[0] == '/' || path[0] == '\\')
53 return true;
54
55 if (path.size() > 1 && path[1] == ':')
56 return true;
57
58 return false;
59 }

Referenced by Muto::Application::InitFileSystem(), Muto::Application::ResolvePath_AssetsDirectory(), Muto::Application::ResolvePath_ProjectDirectory(), and Muto::Application::ResolvePath_WorkingDirectory().

◆ JoinPaths()

static std::string Muto::JoinPaths ( const std::string &  base,
const std::string &  relative 
)
static

Joins two path segments with proper separator handling.

23 {
24 if (base.empty())
25 return relative;
26 if (relative.empty())
27 return base;
28
29 std::string result = base;
30
31 // Ensure base doesn't end with a separator
32 if (result.back() == '/' || result.back() == '\\')
33 result.pop_back();
34
35 result += '/';
36
37 // Append relative path, removing leading separators
38 size_t start = 0;
39 while (start < relative.size() && (relative[start] == '/' || relative[start] == '\\'))
40 start++;
41
42 result += relative.substr(start);
43 return result;
44 }

Referenced by Muto::Renderer2D::Init(), and Muto::Application::InitFileSystem().

◆ NormalizePath()

static std::string Muto::NormalizePath ( const std::string &  path)
static

Normalizes path separators to forward slashes for cross-platform consistency.

11 {
12 std::string normalized = path;
13 for (char& c : normalized)
14 {
15 if (c == '\\')
16 c = '/';
17 }
18 return normalized;
19 }

Referenced by Muto::Application::InitFileSystem(), Muto::Application::ResolvePath_AssetsDirectory(), Muto::Application::ResolvePath_ProjectDirectory(), and Muto::Application::ResolvePath_WorkingDirectory().

◆ SerializeEntity()

static void Muto::SerializeEntity ( YAML::Emitter &  out,
Entity  entity 
)
static
121 {
122
123 MU_CORE_ASSERT(entity.HasComponent<UUIDComponent>(), "Entity has no UUIDComponent!");
124 MU_CORE_ASSERT(entity.HasComponent<NameComponent>(), "Entity has no NameComponent!");
125
126 out << YAML::BeginMap; // Entity
127 out << YAML::Key << "Entity" << YAML::Value << entity.GetID(); // UUIDComponent
128 out << YAML::Key << "NameComponent" << YAML::Value << entity.GetName();
129
130 if (entity.HasComponent<TransformComponent>()) {
131 out << YAML::Key << "TransformComponent";
132 out << YAML::BeginMap; // TransformComponent
133
134 auto& tc = entity.GetComponent<TransformComponent>();
135 out << YAML::Key << "Translation" << YAML::Value << tc.Translation;
136 out << YAML::Key << "Rotation" << YAML::Value << tc.Rotation;
137 out << YAML::Key << "Scale" << YAML::Value << tc.Scale;
138
139 out << YAML::EndMap; // TransformComponent
140 }
141
142 if (entity.HasComponent<CameraComponent>()) {
143 out << YAML::Key << "CameraComponent";
144 out << YAML::BeginMap; // CameraComponent
145
146 auto& cameraComp = entity.GetComponent<CameraComponent>();
147 auto& camera = cameraComp.Camera;
148
149
150 out << YAML::Key << "Camera" << YAML::Value;
151 out << YAML::BeginMap; // Camera
152 out << YAML::Key << "PerspectiveFOV" << YAML::Value << camera.GetPerspectiveVerticalFOV();
153 out << YAML::Key << "PerspectiveNear" << YAML::Value << camera.GetPerspectiveNearClip();
154 out << YAML::Key << "PerspectiveFar" << YAML::Value << camera.GetPerspectiveFarClip();
155 out << YAML::Key << "OrthographicSize" << YAML::Value << camera.GetOrthographicSize();
156 out << YAML::Key << "OrthographicNear" << YAML::Value << camera.GetOrthographicNearClip();
157 out << YAML::Key << "OrthographicFar" << YAML::Value << camera.GetOrthographicFarClip();
158 out << YAML::EndMap;
159
160 out << YAML::Key << "Primary" << YAML::Value << cameraComp.Primary;
161 out << YAML::Key << "ProjectionType" << YAML::Value << (int)camera.GetProjectionType();
162 out << YAML::Key << "FixedAspectRatio" << YAML::Value << cameraComp.FixedAspectRatio;
163
164 out << YAML::EndMap; // CameraComponent
165 }
166
167 if (entity.HasComponent<SpriteRendererComponent>()) {
168 out << YAML::Key << "SpriteRendererComponent";
169 out << YAML::BeginMap; // SpriteRendererComponent
170
171 auto& src = entity.GetComponent<SpriteRendererComponent>();
172 out << YAML::Key << "Color" << YAML::Value << src.Color;
173 // Texture serialization can be added here in the future
174 out << YAML::EndMap; // SpriteRendererComponent
175 }
176 out << YAML::EndMap; // Entity
177 }
#define MU_CORE_ASSERT(x,...)
Definition Asserts.h:32
const std::string & GetName()
Retrieves a const reference to the name of the entity.
Definition Entity.h:115
const UUID & GetID()
Retrieves a const reference to the UUID of the entity.
Definition Entity.h:107
Component that holds the name of an entity.
Definition Components.h:52
Component that holds the transform of an entity.
Definition Components.h:68
glm::vec3 Translation
Translation (position) vector.
Definition Components.h:70
Component that holds a UUID.
Definition Components.h:36

◆ ShaderDataTypeSize()

static uint32_t Muto::ShaderDataTypeSize ( ShaderDataType  type)
static

Returns the size in bytes of the given ShaderDataType.

Parameters
typeThe ShaderDataType to get the size of.
Returns
The size in bytes of the ShaderDataType. Will assert if the type is unknown.
22 {
23 switch (type) {
24 case ShaderDataType::SDT_Float: return 4;
25 case ShaderDataType::SDT_Float2: return 4 * 2;
26 case ShaderDataType::SDT_Float3: return 4 * 3;
27 case ShaderDataType::SDT_Float4: return 4 * 4;
28 case ShaderDataType::SDT_Mat3: return 4 * 3 * 3;
29 case ShaderDataType::SDT_Mat4: return 4 * 4 * 4;
30 case ShaderDataType::SDT_Int: return 4;
31 case ShaderDataType::SDT_Int2: return 4 * 2;
32 case ShaderDataType::SDT_Int3: return 4 * 3;
33 case ShaderDataType::SDT_Int4: return 4 * 4;
34 case ShaderDataType::SDT_Bool: return 1;
35 }
36 MU_CORE_ASSERT(false, "Unknown ShaderDataType!");
37 return 0;
38 }

References SDT_Bool, SDT_Float, SDT_Float2, SDT_Float3, SDT_Float4, SDT_Int, SDT_Int2, SDT_Int3, SDT_Int4, SDT_Mat3, and SDT_Mat4.

Referenced by Muto::BufferElement::BufferElement().

◆ ShaderDataTypeToOpenGLBaseType()

static GLenum Muto::ShaderDataTypeToOpenGLBaseType ( ShaderDataType  type)
static
10 {
11 switch (type)
12 {
13 case ShaderDataType::SDT_Float: return GL_FLOAT;
14 case ShaderDataType::SDT_Float2: return GL_FLOAT;
15 case ShaderDataType::SDT_Float3: return GL_FLOAT;
16 case ShaderDataType::SDT_Float4: return GL_FLOAT;
17 case ShaderDataType::SDT_Mat3: return GL_FLOAT;
18 case ShaderDataType::SDT_Mat4: return GL_FLOAT;
19 case ShaderDataType::SDT_Int: return GL_INT;
20 case ShaderDataType::SDT_Int2: return GL_INT;
21 case ShaderDataType::SDT_Int3: return GL_INT;
22 case ShaderDataType::SDT_Int4: return GL_INT;
23 case ShaderDataType::SDT_Bool: return GL_BOOL;
24 }
25 MU_CORE_ASSERT(false, "Unknown ShaderDataType!");
26 return 0;
27 }

◆ ShaderTypeFromString()

static GLenum Muto::ShaderTypeFromString ( const std::string &  type)
static
11 {
13 if (type == "vertex")
14 return GL_VERTEX_SHADER;
15 if (type == "fragment" || type == "pixel")
16 return GL_FRAGMENT_SHADER;
17 MU_CORE_ASSERT(false, "Unknown shader type!");
18 return 0;
19 }
#define MU_PROFILE_FUNCTION()
Definition Instrumentor.h:240

Referenced by Muto::OpenGLShader::PreProcess().

◆ SubTextureEdit()

static void Muto::SubTextureEdit ( Entity  entity,
const std::string &  label,
SubTextureComponent &  subTexture 
)
static
299 {
300 ImGui::Text(label.c_str());
301
302 auto& subTexRef = subTexture.GetSubTexture();
303 if (subTexRef && subTexRef->GetTexture()) {
304 auto oldSubRef = subTexRef;
305 glm::vec2 oldOffset = subTexture.Offset;
306 glm::vec2 oldTiling = subTexture.TilingFactor;
307
308 DrawVec2Control("Offset", subTexture.Offset);
309 DrawVec2Control("Scale", subTexture.TilingFactor, 1.0f);
310
311 if (subTexRef->GetTexture())
312 {
313 auto tex = subTexRef->GetTexture();
314 if (tex) {
315
316 auto newSub = SubTexture2D::CreateFromCoords(
317 tex, subTexture.Offset,
318 glm::vec2(static_cast<float>(tex->GetWidth()) * subTexture.TilingFactor.x,
319 static_cast<float>(tex->GetHeight()) * subTexture.TilingFactor.y));
320 subTexture.SubTexture = newSub;
321
323 auto& texAnim = entity.GetComponent<TextureAnimationComponent>();
324 for (auto& frame : texAnim.SubTextures) {
325 // frame == oldSubRef compares Ref<> identity
326 if (frame == oldSubRef) {
327 frame = newSub;
328 }
329 }
330
331 if (texAnim.CurrentFrame >= (int)texAnim.SubTextures.size())
332 texAnim.CurrentFrame = texAnim.SubTextures.empty() ? 0 : (int)texAnim.SubTextures.size() - 1;
333 }
334 }
335 }
336 }
337 else {
338 ImGui::Text("No texture assigned.");
339 }
340
341 }
static void DrawVec2Control(const std::string &label, glm::vec2 &values, float resetValue=0.0f, float columnWidth=100.0f)
Definition SceneHierarchyPanel.cpp:234
Ref< SubTexture2D > & GetSubTexture()
Definition Components.h:164
Ref< SubTexture2D > SubTexture
The sub-texture reference.
Definition Components.h:130
glm::vec2 TilingFactor
Tiling factor for the sub-texture.
Definition Components.h:132
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

◆ TextureAnimationEdit()

static void Muto::TextureAnimationEdit ( const std::string &  label,
SubTextureComponent &  subTexture,
TextureAnimationComponent &  texAnim 
)
static
343 {
344 ImGui::Text(label.c_str());
345
346 auto& subTexRef = subTexture.GetSubTexture();
347 if (subTexRef && subTexRef->GetTexture()) {
348 glm::vec2 oldOffset = subTexture.Offset;
349 glm::vec2 oldTiling = subTexture.TilingFactor;
350
351 DrawVec2Control("Offset", subTexture.Offset);
352 DrawVec2Control("Scale", subTexture.TilingFactor, 1.0f);
353
354 if (subTexRef->GetTexture())
355 {
356 auto tex = subTexRef->GetTexture();
357 if (tex) {
358
359 if (ImGui::Button("Add SubTexture to Animation")) {
360 bool skip = false;
361 for (int i = 0; i < texAnim.SubTextures.size(); i++) {
362 if (texAnim.SubTextures[i] == subTexture.GetSubTexture()) {
363 MU_CORE_WARN("Sub Texture already stored in array. Skipping addition");
364 skip = true;
365 break;
366 }
367 }
368 if (!skip) {
369 texAnim.SubTextures.push_back(subTexture.GetSubTexture());
370 }
371 }
372 if (ImGui::Button("Override Current Frame")) {
373 if (texAnim.SubTextures.size() == 0) {
374 MU_CORE_WARN("No frames to override.");
375 }
376 else {
377 if (texAnim.CurrentFrame < 0 || texAnim.CurrentFrame >= (int)texAnim.SubTextures.size())
378 texAnim.CurrentFrame = 0;
379 texAnim.SubTextures[texAnim.CurrentFrame] = SubTexture2D::CreateFromCoords(tex, subTexture.Offset,
380 glm::vec2(static_cast<float>(tex->GetWidth()) * subTexture.TilingFactor.x,
381 static_cast<float>(tex->GetHeight()) * subTexture.TilingFactor.y));
382 }
383 }
384 if (ImGui::Button("Remove Current Frame")) {
385
386 if (texAnim.SubTextures.size() <= 1) {
387 return;
388 }
389
390 int idx = texAnim.CurrentFrame;
391 if (idx < 0) idx = 0;
392 if (idx >= (int)texAnim.SubTextures.size()) idx = (int)texAnim.SubTextures.size() - 1;
393
394 texAnim.SubTextures.erase(texAnim.SubTextures.begin() + idx);
395 MU_CORE_INFO("Animation Frame removed successfully!");
396
397 if (texAnim.SubTextures.empty())
398 texAnim.CurrentFrame = 0;
399 else if (texAnim.CurrentFrame >= (int)texAnim.SubTextures.size())
400 texAnim.CurrentFrame = 0;
401 }
402 }
403 }
404 }
405 else {
406 ImGui::Text("No texture assigned.");
407 }
408 }
#define MU_CORE_WARN(...)
warn: indicates a potential issue or important event
Definition Log.h:40
#define MU_CORE_INFO(...)
info: general information about application flow
Definition Log.h:38
std::vector< Ref< SubTexture2D > > SubTextures
The list of sub-textures for the animation.
Definition Components.h:173

References Muto::TextureAnimationComponent::CurrentFrame.

Variable Documentation

◆ s_Data

◆ s_GLFWInitialized

static bool Muto::s_GLFWInitialized = false
static

◆ s_MaxFramebufferSize

static const uint32_t Muto::s_MaxFramebufferSize = 8192
static

TODO: Get the actual maximum size from the GPU!