diff --git a/modules/engine/include/engine/camera/camera.hpp b/modules/engine/include/engine/camera/camera.hpp index 42ed6ef..1554d1d 100644 --- a/modules/engine/include/engine/camera/camera.hpp +++ b/modules/engine/include/engine/camera/camera.hpp @@ -8,27 +8,27 @@ namespace Light { class Camera { private: - glm::vec4 m_BackgroundColor = glm::vec4(1.0f, 0.0f, 0.0f, 1.0f); + glm::vec4 m_background_color = glm::vec4(1.0f, 0.0f, 0.0f, 1.0f); protected: - glm::mat4 m_Projection; + glm::mat4 m_projection; public: Camera() = default; inline const glm::mat4 &GetProjection() const { - return m_Projection; + return m_projection; } inline const glm::vec4 &GetBackgroundColor() const { - return m_BackgroundColor; + return m_background_color; } inline void SetBackgroundColor(const glm::vec4 &color) { - m_BackgroundColor = color; + m_background_color = color; } }; diff --git a/modules/engine/include/engine/camera/ortho.hpp b/modules/engine/include/engine/camera/ortho.hpp index 08d2cdc..75a5ec1 100644 --- a/modules/engine/include/engine/camera/ortho.hpp +++ b/modules/engine/include/engine/camera/ortho.hpp @@ -8,16 +8,16 @@ namespace Light { class OrthographicCamera { private: - glm::vec2 m_Position; - float m_AspectRatio; - float m_ZoomLevel; + glm::vec2 m_position; + float m_aspect_ratio; + float m_zoom_level; - const glm::vec3 m_Up; + const glm::vec3 m_up; - glm::mat4 m_Projection; - glm::mat4 m_View; + glm::mat4 m_projection; + glm::mat4 m_view; - glm::vec4 m_ClearColor; + glm::vec4 m_clear_color; public: OrthographicCamera( @@ -35,16 +35,16 @@ public: inline const glm::mat4 &GetView() const { - return m_View; + return m_view; } inline const glm::mat4 &GetProjection() const { - return m_Projection; + return m_projection; } inline const glm::vec4 &GetClearColor() const { - return m_ClearColor; + return m_clear_color; } // CAMERA_CONTROLLER // diff --git a/modules/engine/include/engine/camera/scene.hpp b/modules/engine/include/engine/camera/scene.hpp index d0db48a..5376326 100644 --- a/modules/engine/include/engine/camera/scene.hpp +++ b/modules/engine/include/engine/camera/scene.hpp @@ -27,11 +27,11 @@ public: }; private: - OrthographicSpecification m_OrthographicSpecification; - PerspectiveSpecification m_PerspectiveSpecification; - float m_AspectRatio; + OrthographicSpecification m_orthographic_specification; + PerspectiveSpecification m_perspective_specification; + float m_aspect_ratio; - ProjectionType m_ProjectionType; + ProjectionType m_projection_type; public: SceneCamera(); @@ -50,33 +50,33 @@ public: inline float GetOrthographicSize() const { - return m_OrthographicSpecification.size; + return m_orthographic_specification.size; } inline float GetOrthographicFarPlane() const { - return m_OrthographicSpecification.farPlane; + return m_orthographic_specification.farPlane; } inline float GetOrthographicNearPlane() const { - return m_OrthographicSpecification.nearPlane; + return m_orthographic_specification.nearPlane; } inline float GetPerspectiveVerticalFOV() const { - return m_PerspectiveSpecification.verticalFOV; + return m_perspective_specification.verticalFOV; } inline float GetPerspectiveFarPlane() const { - return m_PerspectiveSpecification.farPlane; + return m_perspective_specification.farPlane; } inline float GetPerspectiveNearPlane() const { - return m_PerspectiveSpecification.nearPlane; + return m_perspective_specification.nearPlane; } inline ProjectionType GetProjectionType() const { - return m_ProjectionType; + return m_projection_type; } private: diff --git a/modules/engine/include/engine/core/application.hpp b/modules/engine/include/engine/core/application.hpp index 2deff27..a2bf533 100644 --- a/modules/engine/include/engine/core/application.hpp +++ b/modules/engine/include/engine/core/application.hpp @@ -19,14 +19,14 @@ private: static Application *s_Context; private: - Scope m_Logger; - Scope m_Instrumentor; - Scope m_LayerStack; - Scope m_Input; - Scope m_ResourceManager; + Scope m_logger; + Scope m_instrumentor; + Scope m_layer_stack; + Scope m_input; + Scope m_resource_manager; protected: - Scope m_Window; + Scope m_window; public: Application(const Application &) = delete; diff --git a/modules/engine/include/engine/core/uuid.hpp b/modules/engine/include/engine/core/uuid.hpp index 69ef940..658cb87 100644 --- a/modules/engine/include/engine/core/uuid.hpp +++ b/modules/engine/include/engine/core/uuid.hpp @@ -11,14 +11,14 @@ private: static std::uniform_int_distribution s_UniformDistribution; private: - uint64_t m_UUID; + uint64_t m_uuid; public: UUID(uint64_t uuid = -1); operator uint64_t() const { - return m_UUID; + return m_uuid; } }; diff --git a/modules/engine/include/engine/core/window.hpp b/modules/engine/include/engine/core/window.hpp index 48149fe..9770c97 100644 --- a/modules/engine/include/engine/core/window.hpp +++ b/modules/engine/include/engine/core/window.hpp @@ -18,14 +18,14 @@ struct WindowProperties class Window { protected: - Scope m_GraphicsContext; - WindowProperties m_Properties; + Scope m_graphics_context; + WindowProperties m_properties; bool b_Closed; public: static Scope Create(std::function callback); - Window(): m_GraphicsContext(nullptr), m_Properties {}, b_Closed(false) + Window(): m_graphics_context(nullptr), m_properties {}, b_Closed(false) { } @@ -61,22 +61,22 @@ public: //============================== GETTERS ==============================// inline GraphicsContext *GetGfxContext() const { - return m_GraphicsContext.get(); + return m_graphics_context.get(); } inline const WindowProperties &GetProperties() const { - return m_Properties; + return m_properties; } inline const std::string &GetTitle() const { - return m_Properties.title; + return m_properties.title; } inline const glm::uvec2 &GetSize() const { - return m_Properties.size; + return m_properties.size; } inline bool IsClosed() const @@ -85,11 +85,11 @@ public: } inline bool IsVSync() const { - return m_Properties.vsync; + return m_properties.vsync; } inline bool IsVisible() const { - return m_Properties.visible; + return m_properties.visible; } //============================== GETTERS ==============================// diff --git a/modules/engine/include/engine/debug/instrumentor.hpp b/modules/engine/include/engine/debug/instrumentor.hpp index 9bd31ee..38b6eff 100644 --- a/modules/engine/include/engine/debug/instrumentor.hpp +++ b/modules/engine/include/engine/debug/instrumentor.hpp @@ -21,9 +21,9 @@ private: static Instrumentor *s_Context; private: - std::ofstream m_OutputFileStream; + std::ofstream m_output_file_stream; - unsigned int m_CurrentSessionCount; + unsigned int m_current_session_count; public: static Scope Create(); @@ -54,8 +54,8 @@ private: class InstrumentorTimer { private: - ScopeProfileResult m_Result; - std::chrono::time_point m_Start; + ScopeProfileResult m_result; + std::chrono::time_point m_start; public: InstrumentorTimer(const std::string &scopeName); diff --git a/modules/engine/include/engine/debug/logger.hpp b/modules/engine/include/engine/debug/logger.hpp index c5ee0c1..06868eb 100644 --- a/modules/engine/include/engine/debug/logger.hpp +++ b/modules/engine/include/engine/debug/logger.hpp @@ -32,19 +32,19 @@ private: static Logger *s_Context; private: - Ref m_EngineLogger, m_FileLogger; - std::string m_LogFilePath; + Ref m_engine_logger, m_file_logger; + std::string m_log_file_path; public: static Scope Create(); static inline Ref GetEngineLogger() { - return s_Context->m_EngineLogger; + return s_Context->m_engine_logger; } static inline Ref GetFileLogger() { - return s_Context->m_FileLogger; + return s_Context->m_file_logger; } void LogDebugData(); diff --git a/modules/engine/include/engine/events/char.hpp b/modules/engine/include/engine/events/char.hpp index c3dc01f..9e0101d 100644 --- a/modules/engine/include/engine/events/char.hpp +++ b/modules/engine/include/engine/events/char.hpp @@ -9,22 +9,22 @@ namespace Light { class SetCharEvent: public Event { private: - const unsigned int m_Character; + const unsigned int m_character; public: - SetCharEvent(unsigned int character): m_Character(character) + SetCharEvent(unsigned int character): m_character(character) { } inline int GetCharacter() const { - return m_Character; + return m_character; } virtual std::string GetInfoLog() const override { std::stringstream ss; - ss << "CharSet: " << m_Character; + ss << "CharSet: " << m_character; return ss.str(); } EVENT_TYPE(SetChar) diff --git a/modules/engine/include/engine/events/keyboard.hpp b/modules/engine/include/engine/events/keyboard.hpp index 78b2109..ecde4d4 100644 --- a/modules/engine/include/engine/events/keyboard.hpp +++ b/modules/engine/include/engine/events/keyboard.hpp @@ -9,22 +9,22 @@ namespace Light { class KeyPressedEvent: public Event { private: - const int m_Key; + const int m_key; public: - KeyPressedEvent(int key): m_Key(key) + KeyPressedEvent(int key): m_key(key) { } inline int GetKey() const { - return m_Key; + return m_key; } virtual std::string GetInfoLog() const override { std::stringstream ss; - ss << "KeyPressed: " << m_Key; + ss << "KeyPressed: " << m_key; return ss.str(); } EVENT_TYPE(KeyPressed) @@ -34,22 +34,22 @@ public: class KeyRepeatEvent: public Event { private: - const int m_Key; + const int m_key; public: - KeyRepeatEvent(int key): m_Key(key) + KeyRepeatEvent(int key): m_key(key) { } inline int GetKey() const { - return m_Key; + return m_key; } virtual std::string GetInfoLog() const override { std::stringstream ss; - ss << "KeyRepeated: " << m_Key; + ss << "KeyRepeated: " << m_key; return ss.str(); } EVENT_TYPE(KeyRepeated) @@ -59,22 +59,22 @@ public: class KeyReleasedEvent: public Event { private: - const int m_Key; + const int m_key; public: - KeyReleasedEvent(int key): m_Key(key) + KeyReleasedEvent(int key): m_key(key) { } inline int GetKey() const { - return m_Key; + return m_key; } virtual std::string GetInfoLog() const override { std::stringstream ss; - ss << "KeyReleased: " << m_Key; + ss << "KeyReleased: " << m_key; return ss.str(); } EVENT_TYPE(KeyReleased) diff --git a/modules/engine/include/engine/events/mouse.hpp b/modules/engine/include/engine/events/mouse.hpp index 44211cb..a070cd4 100644 --- a/modules/engine/include/engine/events/mouse.hpp +++ b/modules/engine/include/engine/events/mouse.hpp @@ -10,31 +10,31 @@ namespace Light { class MouseMovedEvent: public Event { private: - const glm::vec2 m_Position; + const glm::vec2 m_position; public: - MouseMovedEvent(float x, float y): m_Position(x, y) + MouseMovedEvent(float x, float y): m_position(x, y) { } inline const glm::vec2 &GetPosition() const { - return m_Position; + return m_position; } inline float GetX() const { - return m_Position.x; + return m_position.x; } inline float GetY() const { - return m_Position.y; + return m_position.y; } virtual std::string GetInfoLog() const override { std::stringstream ss; - ss << "MouseMoved: " << m_Position.x << ", " << m_Position.y; + ss << "MouseMoved: " << m_position.x << ", " << m_position.y; return ss.str(); } EVENT_TYPE(MouseMoved) @@ -44,22 +44,22 @@ public: class WheelScrolledEvent: public Event { private: - const float m_Offset; + const float m_offset; public: - WheelScrolledEvent(float offset): m_Offset(offset) + WheelScrolledEvent(float offset): m_offset(offset) { } inline float GetOffset() const { - return m_Offset; + return m_offset; } virtual std::string GetInfoLog() const override { std::stringstream ss; - ss << "WheelScrolled: " << m_Offset; + ss << "WheelScrolled: " << m_offset; return ss.str(); } EVENT_TYPE(WheelScrolled) @@ -69,22 +69,22 @@ public: class ButtonPressedEvent: public Event { private: - const int m_Button; + const int m_button; public: - ButtonPressedEvent(int button): m_Button(button) + ButtonPressedEvent(int button): m_button(button) { } inline int GetButton() const { - return m_Button; + return m_button; } virtual std::string GetInfoLog() const override { std::stringstream ss; - ss << "ButtonPressed: " << m_Button; + ss << "ButtonPressed: " << m_button; return ss.str(); } EVENT_TYPE(ButtonPressed) @@ -94,22 +94,22 @@ public: class ButtonReleasedEvent: public Event { private: - const int m_Button; + const int m_button; public: - ButtonReleasedEvent(int button): m_Button(button) + ButtonReleasedEvent(int button): m_button(button) { } inline int GetButton() const { - return m_Button; + return m_button; } virtual std::string GetInfoLog() const override { std::stringstream ss; - ss << "ButtonReleased: " << m_Button; + ss << "ButtonReleased: " << m_button; return ss.str(); } EVENT_TYPE(ButtonReleased) diff --git a/modules/engine/include/engine/events/window.hpp b/modules/engine/include/engine/events/window.hpp index 2b3365e..ba61cb4 100644 --- a/modules/engine/include/engine/events/window.hpp +++ b/modules/engine/include/engine/events/window.hpp @@ -21,22 +21,22 @@ public: class WindowMovedEvent: public Event { private: - const glm::ivec2 m_Position; + const glm::ivec2 m_position; public: - WindowMovedEvent(int x, int y): m_Position(x, y) + WindowMovedEvent(int x, int y): m_position(x, y) { } const glm::ivec2 &GetPosition() const { - return m_Position; + return m_position; } virtual std::string GetInfoLog() const override { std::stringstream ss; - ss << "WindwoMoved: " << m_Position.x << ", " << m_Position.y; + ss << "WindwoMoved: " << m_position.x << ", " << m_position.y; return ss.str(); ; } @@ -47,22 +47,22 @@ public: class WindowResizedEvent: public Event { private: - const glm::uvec2 m_Size; + const glm::uvec2 m_size; public: - WindowResizedEvent(unsigned int width, unsigned int height): m_Size(width, height) + WindowResizedEvent(unsigned int width, unsigned int height): m_size(width, height) { } const glm::uvec2 &GetSize() const { - return m_Size; + return m_size; } virtual std::string GetInfoLog() const override { std::stringstream ss; - ss << "WindowResized: " << m_Size.x << ", " << m_Size.y; + ss << "WindowResized: " << m_size.x << ", " << m_size.y; return ss.str(); } EVENT_TYPE(WindowResized) diff --git a/modules/engine/include/engine/graphics/graphics_context.hpp b/modules/engine/include/engine/graphics/graphics_context.hpp index b4f2c1e..0be3b20 100644 --- a/modules/engine/include/engine/graphics/graphics_context.hpp +++ b/modules/engine/include/engine/graphics/graphics_context.hpp @@ -29,12 +29,12 @@ private: static GraphicsContext* s_Context; private: - Scope m_UserInterface; - Scope m_Renderer; + Scope m_user_interface; + Scope m_renderer; protected: - GraphicsAPI m_GraphicsAPI; - Ref m_SharedContext = nullptr; + GraphicsAPI m_graphics_api; + Ref m_shared_context = nullptr; public: static Scope Create(GraphicsAPI api, GLFWwindow* windowHandle); @@ -46,11 +46,11 @@ public: virtual void LogDebugData() = 0; - static inline GraphicsAPI GetGraphicsAPI() { return s_Context->m_GraphicsAPI; } - static inline Ref GetSharedContext() { return s_Context->m_SharedContext; } + static inline GraphicsAPI GetGraphicsAPI() { return s_Context->m_graphics_api; } + static inline Ref GetSharedContext() { return s_Context->m_shared_context; } - inline Renderer* GetRenderer() { return m_Renderer.get(); } - inline UserInterface* GetUserInterface() { return m_UserInterface.get(); } + inline Renderer* GetRenderer() { return m_renderer.get(); } + inline UserInterface* GetUserInterface() { return m_user_interface.get(); } protected: GraphicsContext() = default; diff --git a/modules/engine/include/engine/graphics/renderer.hpp b/modules/engine/include/engine/graphics/renderer.hpp index 9202df5..e704c0d 100644 --- a/modules/engine/include/engine/graphics/renderer.hpp +++ b/modules/engine/include/engine/graphics/renderer.hpp @@ -31,20 +31,20 @@ private: static Renderer *s_Context; // renderer programs - QuadRendererProgram m_QuadRenderer; - TextureRendererProgram m_TextureRenderer; - TintedTextureRendererProgram m_TintedTextureRenderer; + QuadRendererProgram m_quad_renderer; + TextureRendererProgram m_texture_renderer; + TintedTextureRendererProgram m_tinted_texture_renderer; // constant buffers - Scope m_ViewProjectionBuffer; + Scope m_view_projection_buffer; - Scope m_RenderCommand; - Scope m_Blender; + Scope m_render_command; + Scope m_blender; - Camera *m_DefaultFramebufferCamera; - Ref m_TargetFramebuffer; + Camera *m_default_framebuffer_camera; + Ref m_target_framebuffer; - bool m_ShouldClearBackbuffer; + bool m_should_clear_backbuffer; public: static Scope Create(GLFWwindow *windowHandle, Ref sharedContext); diff --git a/modules/engine/include/engine/graphics/renderer_programs/quad.hpp b/modules/engine/include/engine/graphics/renderer_programs/quad.hpp index 369abbe..2ef301c 100644 --- a/modules/engine/include/engine/graphics/renderer_programs/quad.hpp +++ b/modules/engine/include/engine/graphics/renderer_programs/quad.hpp @@ -25,16 +25,16 @@ public: }; private: - Ref m_Shader; - Ref m_VertexBuffer; - Ref m_IndexBuffer; - Ref m_VertexLayout; + Ref m_shader; + Ref m_vertex_buffer; + Ref m_index_buffer; + Ref m_vertex_layout; - QuadVertexData *m_MapCurrent = nullptr; - QuadVertexData *m_MapEnd = nullptr; + QuadVertexData *m_map_current = nullptr; + QuadVertexData *m_map_end = nullptr; - unsigned int m_QuadCount = 0u; - unsigned int m_MaxVertices = 0u; + unsigned int m_quad_count = 0u; + unsigned int m_max_vertices = 0u; public: QuadRendererProgram(unsigned int maxVertices, Ref sharedContext); @@ -48,11 +48,11 @@ public: inline QuadVertexData *GetMapCurrent() { - return m_MapCurrent; + return m_map_current; } inline unsigned int GetQuadCount() const { - return m_QuadCount; + return m_quad_count; } inline constexpr unsigned int GetVertexSize() const { diff --git a/modules/engine/include/engine/graphics/renderer_programs/texture.hpp b/modules/engine/include/engine/graphics/renderer_programs/texture.hpp index 48f901d..4f00abc 100644 --- a/modules/engine/include/engine/graphics/renderer_programs/texture.hpp +++ b/modules/engine/include/engine/graphics/renderer_programs/texture.hpp @@ -25,16 +25,16 @@ public: }; private: - Ref m_Shader; - Ref m_VertexBuffer; - Ref m_IndexBuffer; - Ref m_VertexLayout; + Ref m_shader; + Ref m_vertex_buffer; + Ref m_index_buffer; + Ref m_vertex_layout; - TextureVertexData *m_MapCurrent = nullptr; - TextureVertexData *m_MapEnd = nullptr; + TextureVertexData *m_map_current = nullptr; + TextureVertexData *m_map_end = nullptr; - unsigned int m_QuadCount; - unsigned int m_MaxVertices; + unsigned int m_quad_count; + unsigned int m_max_vertices; public: TextureRendererProgram(unsigned int maxVertices, Ref sharedContext); @@ -48,12 +48,12 @@ public: inline TextureVertexData *GetMapCurrent() { - return m_MapCurrent; + return m_map_current; } inline unsigned int GetQuadCount() const { - return m_QuadCount; + return m_quad_count; } inline constexpr unsigned int GetVertexSize() const diff --git a/modules/engine/include/engine/graphics/renderer_programs/tinted_texture.hpp b/modules/engine/include/engine/graphics/renderer_programs/tinted_texture.hpp index e7ff698..db3f495 100644 --- a/modules/engine/include/engine/graphics/renderer_programs/tinted_texture.hpp +++ b/modules/engine/include/engine/graphics/renderer_programs/tinted_texture.hpp @@ -26,16 +26,16 @@ public: }; private: - Ref m_Shader; - Ref m_VertexBuffer; - Ref m_IndexBuffer; - Ref m_VertexLayout; + Ref m_shader; + Ref m_vertex_buffer; + Ref m_index_buffer; + Ref m_vertex_layout; - TintedTextureVertexData *m_MapCurrent = nullptr; - TintedTextureVertexData *m_MapEnd = nullptr; + TintedTextureVertexData *m_map_current = nullptr; + TintedTextureVertexData *m_map_end = nullptr; - unsigned int m_QuadCount; - unsigned int m_MaxVertices; + unsigned int m_quad_count; + unsigned int m_max_vertices; public: TintedTextureRendererProgram(unsigned int maxVertices, Ref sharedContext); @@ -49,12 +49,12 @@ public: inline TintedTextureVertexData *GetMapCurrent() { - return m_MapCurrent; + return m_map_current; } inline unsigned int GetQuadCount() const { - return m_QuadCount; + return m_quad_count; } inline constexpr unsigned int GetVertexSize() const diff --git a/modules/engine/include/engine/graphics/texture.hpp b/modules/engine/include/engine/graphics/texture.hpp index 07b9d24..198ae8c 100644 --- a/modules/engine/include/engine/graphics/texture.hpp +++ b/modules/engine/include/engine/graphics/texture.hpp @@ -21,13 +21,13 @@ public: virtual void* GetTexture() = 0; - inline const std::string& GetFilePath() const { return m_FilePath; } + inline const std::string& GetFilePath() const { return m_file_path; } protected: Texture(const std::string& filePath); protected: - std::string m_FilePath; + std::string m_file_path; }; } // namespace Light diff --git a/modules/engine/include/engine/input/input.hpp b/modules/engine/include/engine/input/input.hpp index 581f9a0..97fe1fd 100644 --- a/modules/engine/include/engine/input/input.hpp +++ b/modules/engine/include/engine/input/input.hpp @@ -14,15 +14,15 @@ private: static Input *s_Context; private: - std::array m_KeyboadKeys; - std::array m_MouseButtons; + std::array m_keyboad_keys; + std::array m_mouse_buttons; - glm::vec2 m_MousePosition; - glm::vec2 m_MouseDelta; - float m_MouseWheelDelta; + glm::vec2 m_mouse_position; + glm::vec2 m_mouse_delta; + float m_mouse_wheel_delta; - bool m_UserInterfaceEvents; - bool m_GameEvents; + bool m_user_interface_events; + bool m_game_events; public: static Scope Create(); @@ -38,27 +38,27 @@ public: static inline bool GetKeyboardKey(int code) { - return s_Context->m_KeyboadKeys[code]; + return s_Context->m_keyboad_keys[code]; } static inline bool GetMouseButton(int code) { - return s_Context->m_MouseButtons[code]; + return s_Context->m_mouse_buttons[code]; } static inline const glm::vec2 &GetMousePosition(int code) { - return s_Context->m_MousePosition; + return s_Context->m_mouse_position; } void OnEvent(const Event &inputEvent); inline bool IsReceivingInputEvents() const { - return m_UserInterfaceEvents; + return m_user_interface_events; } inline bool IsReceivingGameEvents() const { - return m_GameEvents; + return m_game_events; } private: diff --git a/modules/engine/include/engine/layer/layer.hpp b/modules/engine/include/engine/layer/layer.hpp index c481477..51607d2 100644 --- a/modules/engine/include/engine/layer/layer.hpp +++ b/modules/engine/include/engine/layer/layer.hpp @@ -30,7 +30,7 @@ class WindowGainFocusEvent; class Layer { protected: - std::string m_LayerName; + std::string m_layer_name; public: Layer(const std::string &name); @@ -38,7 +38,7 @@ public: inline const std::string &GetName() const { - return m_LayerName; + return m_layer_name; } /* update */ diff --git a/modules/engine/include/engine/layer/layer_stack.hpp b/modules/engine/include/engine/layer/layer_stack.hpp index 57dd8ea..aa1f170 100644 --- a/modules/engine/include/engine/layer/layer_stack.hpp +++ b/modules/engine/include/engine/layer/layer_stack.hpp @@ -14,10 +14,10 @@ private: static LayerStack *s_Context; private: - std::vector m_Layers; + std::vector m_layers; - std::vector::iterator m_Begin; - std::vector::iterator m_End; + std::vector::iterator m_begin; + std::vector::iterator m_end; public: static Scope Create(); @@ -42,24 +42,24 @@ public: inline bool IsEmpty() { - return m_Layers.empty(); + return m_layers.empty(); } std::vector::iterator begin() { - return m_Layers.begin(); + return m_layers.begin(); } std::vector::iterator end() { - return m_Layers.end(); + return m_layers.end(); } std::vector::reverse_iterator rbegin() { - return m_Layers.rbegin(); + return m_layers.rbegin(); } std::vector::reverse_iterator rend() { - return m_Layers.rend(); + return m_layers.rend(); } private: diff --git a/modules/engine/include/engine/platform/graphics/directx/blender.hpp b/modules/engine/include/engine/platform/graphics/directx/blender.hpp index e09fb30..cc5ec0f 100644 --- a/modules/engine/include/engine/platform/graphics/directx/blender.hpp +++ b/modules/engine/include/engine/platform/graphics/directx/blender.hpp @@ -12,13 +12,13 @@ class dxSharedContext; class dxBlender: public Blender { private: - Ref m_Context; + Ref m_context; - const std::unordered_map m_FactorMap; + const std::unordered_map m_factor_map; - Microsoft::WRL::ComPtr m_BlendState; + Microsoft::WRL::ComPtr m_blend_state; - D3D11_BLEND_DESC m_Desc; + D3D11_BLEND_DESC m_desc; public: dxBlender(Ref sharedContext); diff --git a/modules/engine/include/engine/platform/graphics/directx/buffers.hpp b/modules/engine/include/engine/platform/graphics/directx/buffers.hpp index 1aa2439..5d64d6c 100644 --- a/modules/engine/include/engine/platform/graphics/directx/buffers.hpp +++ b/modules/engine/include/engine/platform/graphics/directx/buffers.hpp @@ -13,12 +13,12 @@ class dxSharedContext; class dxConstantBuffer: public ConstantBuffer { private: - Ref m_Context; + Ref m_context; - Microsoft::WRL::ComPtr m_Buffer; - D3D11_MAPPED_SUBRESOURCE m_Map; + Microsoft::WRL::ComPtr m_buffer; + D3D11_MAPPED_SUBRESOURCE m_map; - unsigned int m_Index; + unsigned int m_index; public: dxConstantBuffer( @@ -37,12 +37,12 @@ public: class dxVertexBuffer: public VertexBuffer { private: - Ref m_Context; + Ref m_context; - Microsoft::WRL::ComPtr m_Buffer; - D3D11_MAPPED_SUBRESOURCE m_Map; + Microsoft::WRL::ComPtr m_buffer; + D3D11_MAPPED_SUBRESOURCE m_map; - unsigned int m_Stride; + unsigned int m_stride; public: dxVertexBuffer( @@ -64,9 +64,9 @@ public: class dxIndexBuffer: public IndexBuffer { private: - Ref m_Context; + Ref m_context; - Microsoft::WRL::ComPtr m_Buffer; + Microsoft::WRL::ComPtr m_buffer; public: dxIndexBuffer(unsigned int *indices, unsigned int count, Ref sharedContext); diff --git a/modules/engine/include/engine/platform/graphics/directx/framebuffers.hpp b/modules/engine/include/engine/platform/graphics/directx/framebuffers.hpp index f4053cc..0b22019 100644 --- a/modules/engine/include/engine/platform/graphics/directx/framebuffers.hpp +++ b/modules/engine/include/engine/platform/graphics/directx/framebuffers.hpp @@ -12,15 +12,15 @@ class dxSharedContext; class dxFramebuffer: public Framebuffer { private: - Ref m_Context; + Ref m_context; - FramebufferSpecification m_Specification; + FramebufferSpecification m_specification; - Microsoft::WRL::ComPtr m_RenderTargetView; - Microsoft::WRL::ComPtr m_ColorAttachment; - Microsoft::WRL::ComPtr m_DepthStencilAttachment; - Microsoft::WRL::ComPtr m_ShaderResourceView; - Microsoft::WRL::ComPtr m_DepthStencilView; + Microsoft::WRL::ComPtr m_render_target_view; + Microsoft::WRL::ComPtr m_color_attachment; + Microsoft::WRL::ComPtr m_depth_stencil_attachment; + Microsoft::WRL::ComPtr m_shader_resource_view; + Microsoft::WRL::ComPtr m_depth_stencil_view; public: dxFramebuffer( @@ -30,7 +30,7 @@ public: inline void *GetColorAttachment() override { - return (void *)m_ShaderResourceView.Get(); + return (void *)m_shader_resource_view.Get(); } void BindAsTarget(const glm::vec4 &clearColor) override; diff --git a/modules/engine/include/engine/platform/graphics/directx/graphics_context.hpp b/modules/engine/include/engine/platform/graphics/directx/graphics_context.hpp index 48a8051..31f117c 100644 --- a/modules/engine/include/engine/platform/graphics/directx/graphics_context.hpp +++ b/modules/engine/include/engine/platform/graphics/directx/graphics_context.hpp @@ -12,9 +12,9 @@ namespace Light { class dxGraphicsContext: public GraphicsContext { private: - GLFWwindow *m_WindowHandle; + GLFWwindow *m_window_handle; - Microsoft::WRL::ComPtr m_DebugInterface; + Microsoft::WRL::ComPtr m_debug_interface; public: dxGraphicsContext(GLFWwindow *windowHandle); diff --git a/modules/engine/include/engine/platform/graphics/directx/render_command.hpp b/modules/engine/include/engine/platform/graphics/directx/render_command.hpp index cb08d76..1c7b9e9 100644 --- a/modules/engine/include/engine/platform/graphics/directx/render_command.hpp +++ b/modules/engine/include/engine/platform/graphics/directx/render_command.hpp @@ -12,7 +12,7 @@ class dxSharedContext; class dxRenderCommand: public RenderCommand { private: - Ref m_Context; + Ref m_context; public: dxRenderCommand(Ref sharedContext); diff --git a/modules/engine/include/engine/platform/graphics/directx/shader.hpp b/modules/engine/include/engine/platform/graphics/directx/shader.hpp index 76103b4..6c8ba99 100644 --- a/modules/engine/include/engine/platform/graphics/directx/shader.hpp +++ b/modules/engine/include/engine/platform/graphics/directx/shader.hpp @@ -13,12 +13,12 @@ class dxSharedContext; class dxShader: public Shader { private: - Ref m_Context; + Ref m_context; - Microsoft::WRL::ComPtr m_VertexShader; - Microsoft::WRL::ComPtr m_PixelShader; + Microsoft::WRL::ComPtr m_vertex_shader; + Microsoft::WRL::ComPtr m_pixel_shader; - Microsoft::WRL::ComPtr m_VertexBlob; + Microsoft::WRL::ComPtr m_vertex_blob; public: dxShader( @@ -33,7 +33,7 @@ public: inline Microsoft::WRL::ComPtr GetVertexBlob() { - return m_VertexBlob; + return m_vertex_blob; } }; diff --git a/modules/engine/include/engine/platform/graphics/directx/shared_context.hpp b/modules/engine/include/engine/platform/graphics/directx/shared_context.hpp index 0a57914..3f008c7 100644 --- a/modules/engine/include/engine/platform/graphics/directx/shared_context.hpp +++ b/modules/engine/include/engine/platform/graphics/directx/shared_context.hpp @@ -10,44 +10,44 @@ namespace Light { class dxSharedContext: public SharedContext { private: - Microsoft::WRL::ComPtr m_Device = nullptr; - Microsoft::WRL::ComPtr m_DeviceContext = nullptr; - Microsoft::WRL::ComPtr m_SwapChain = nullptr; - Microsoft::WRL::ComPtr m_RenderTargetView = nullptr; + Microsoft::WRL::ComPtr m_device = nullptr; + Microsoft::WRL::ComPtr m_deviceContext = nullptr; + Microsoft::WRL::ComPtr m_swap_chain = nullptr; + Microsoft::WRL::ComPtr m_render_target_view = nullptr; public: inline Microsoft::WRL::ComPtr GetDevice() { - return m_Device; + return m_device; } inline Microsoft::WRL::ComPtr GetDeviceContext() { - return m_DeviceContext; + return m_deviceContext; } inline Microsoft::WRL::ComPtr GetSwapChain() { - return m_SwapChain; + return m_swap_chain; } inline Microsoft::WRL::ComPtr GetRenderTargetView() { - return m_RenderTargetView; + return m_render_target_view; } inline Microsoft::WRL::ComPtr &GetDeviceRef() { - return m_Device; + return m_device; } inline Microsoft::WRL::ComPtr &GetDeviceContextRef() { - return m_DeviceContext; + return m_deviceContext; } inline Microsoft::WRL::ComPtr &GetSwapChainRef() { - return m_SwapChain; + return m_swap_chain; } inline Microsoft::WRL::ComPtr &GetRenderTargetViewRef() { - return m_RenderTargetView; + return m_render_target_view; } }; diff --git a/modules/engine/include/engine/platform/graphics/directx/texture.hpp b/modules/engine/include/engine/platform/graphics/directx/texture.hpp index 84516c5..30f00e4 100644 --- a/modules/engine/include/engine/platform/graphics/directx/texture.hpp +++ b/modules/engine/include/engine/platform/graphics/directx/texture.hpp @@ -12,11 +12,11 @@ class dxSharedContext; class dxTexture: public Texture { private: - Ref m_Context; + Ref m_context; - Microsoft::WRL::ComPtr m_Texture2D; - Microsoft::WRL::ComPtr m_ShaderResourceView; - Microsoft::WRL::ComPtr m_SamplerState; + Microsoft::WRL::ComPtr m_texture_2d; + Microsoft::WRL::ComPtr m_shader_resource_view; + Microsoft::WRL::ComPtr m_sampler_state; public: dxTexture( diff --git a/modules/engine/include/engine/platform/graphics/directx/vertex_layout.hpp b/modules/engine/include/engine/platform/graphics/directx/vertex_layout.hpp index 3ac285b..fc8ca2e 100644 --- a/modules/engine/include/engine/platform/graphics/directx/vertex_layout.hpp +++ b/modules/engine/include/engine/platform/graphics/directx/vertex_layout.hpp @@ -14,9 +14,9 @@ class dxSharedContext; class dxVertexLayout: public VertexLayout { private: - Ref m_Context; + Ref m_context; - Microsoft::WRL::ComPtr m_InputLayout; + Microsoft::WRL::ComPtr m_input_layout; public: dxVertexLayout( diff --git a/modules/engine/include/engine/platform/graphics/opengl/blender.hpp b/modules/engine/include/engine/platform/graphics/opengl/blender.hpp index 71fcf9c..d6ad8db 100644 --- a/modules/engine/include/engine/platform/graphics/opengl/blender.hpp +++ b/modules/engine/include/engine/platform/graphics/opengl/blender.hpp @@ -8,7 +8,7 @@ namespace Light { class glBlender: public Blender { private: - std::unordered_map m_FactorMap; + std::unordered_map m_factor_map; public: glBlender(); diff --git a/modules/engine/include/engine/platform/graphics/opengl/buffers.hpp b/modules/engine/include/engine/platform/graphics/opengl/buffers.hpp index bf8c67b..7da50d1 100644 --- a/modules/engine/include/engine/platform/graphics/opengl/buffers.hpp +++ b/modules/engine/include/engine/platform/graphics/opengl/buffers.hpp @@ -9,8 +9,8 @@ namespace Light { class glConstantBuffer: public ConstantBuffer { private: - unsigned int m_BufferID; - unsigned int m_Index; + unsigned int m_buffer_id; + unsigned int m_index; public: glConstantBuffer(ConstantBufferIndex index, unsigned int size); @@ -26,7 +26,7 @@ public: class glVertexBuffer: public VertexBuffer { private: - unsigned int m_BufferID; + unsigned int m_buffer_id; public: glVertexBuffer(float *vertices, unsigned int stride, unsigned int count); @@ -43,7 +43,7 @@ public: class glIndexBuffer: public IndexBuffer { private: - unsigned int m_BufferID; + unsigned int m_buffer_id; public: glIndexBuffer(unsigned int *indices, unsigned int count); diff --git a/modules/engine/include/engine/platform/graphics/opengl/framebuffers.hpp b/modules/engine/include/engine/platform/graphics/opengl/framebuffers.hpp index 03f7012..a2db30d 100644 --- a/modules/engine/include/engine/platform/graphics/opengl/framebuffers.hpp +++ b/modules/engine/include/engine/platform/graphics/opengl/framebuffers.hpp @@ -8,10 +8,10 @@ namespace Light { class glFramebuffer: public Framebuffer { private: - FramebufferSpecification m_Specification; + FramebufferSpecification m_specification; - unsigned int m_BufferID; - unsigned int m_ColorAttachmentID, m_DepthStencilAttachmentID; + unsigned int m_buffer_id; + unsigned int m_color_attachment_id, m_depth_stencil_attachment_id; public: glFramebuffer(const FramebufferSpecification &specification); @@ -24,7 +24,7 @@ public: inline void *GetColorAttachment() override { - return (void *)m_ColorAttachmentID; + return (void *)m_color_attachment_id; } }; diff --git a/modules/engine/include/engine/platform/graphics/opengl/graphics_context.hpp b/modules/engine/include/engine/platform/graphics/opengl/graphics_context.hpp index 9ff5c07..e1208b0 100644 --- a/modules/engine/include/engine/platform/graphics/opengl/graphics_context.hpp +++ b/modules/engine/include/engine/platform/graphics/opengl/graphics_context.hpp @@ -10,7 +10,7 @@ namespace Light { class glGraphicsContext: public GraphicsContext { private: - GLFWwindow *m_WindowHandle; + GLFWwindow *m_window_handle; public: glGraphicsContext(GLFWwindow *windowHandle); diff --git a/modules/engine/include/engine/platform/graphics/opengl/render_command.hpp b/modules/engine/include/engine/platform/graphics/opengl/render_command.hpp index d47a6be..144fefb 100644 --- a/modules/engine/include/engine/platform/graphics/opengl/render_command.hpp +++ b/modules/engine/include/engine/platform/graphics/opengl/render_command.hpp @@ -10,7 +10,7 @@ namespace Light { class glRenderCommand: public RenderCommand { private: - GLFWwindow *m_WindowHandle; + GLFWwindow *m_window_handle; public: glRenderCommand(GLFWwindow *windowHandle); diff --git a/modules/engine/include/engine/platform/graphics/opengl/shader.hpp b/modules/engine/include/engine/platform/graphics/opengl/shader.hpp index ac851c5..848fc70 100644 --- a/modules/engine/include/engine/platform/graphics/opengl/shader.hpp +++ b/modules/engine/include/engine/platform/graphics/opengl/shader.hpp @@ -9,7 +9,7 @@ namespace Light { class glShader: public Shader { private: - unsigned int m_ShaderID; + unsigned int m_shader_id; public: glShader(BasicFileHandle vertexFile, BasicFileHandle pixelFile); diff --git a/modules/engine/include/engine/platform/graphics/opengl/texture.hpp b/modules/engine/include/engine/platform/graphics/opengl/texture.hpp index 2f64d44..4d6b574 100644 --- a/modules/engine/include/engine/platform/graphics/opengl/texture.hpp +++ b/modules/engine/include/engine/platform/graphics/opengl/texture.hpp @@ -8,7 +8,7 @@ namespace Light { class glTexture: public Texture { private: - unsigned int m_TextureID; + unsigned int m_texture_id; public: glTexture(unsigned int width, unsigned int height, unsigned int components, unsigned char* pixels, const std::string& filePath); diff --git a/modules/engine/include/engine/platform/graphics/opengl/user_interface.hpp b/modules/engine/include/engine/platform/graphics/opengl/user_interface.hpp index d81272c..0083cbf 100644 --- a/modules/engine/include/engine/platform/graphics/opengl/user_interface.hpp +++ b/modules/engine/include/engine/platform/graphics/opengl/user_interface.hpp @@ -10,7 +10,7 @@ namespace Light { class glUserInterface: public UserInterface { private: - GLFWwindow *m_WindowHandle; + GLFWwindow *m_window_handle; public: glUserInterface() = default; diff --git a/modules/engine/include/engine/platform/graphics/opengl/vertex_layout.hpp b/modules/engine/include/engine/platform/graphics/opengl/vertex_layout.hpp index a7d3e31..3135463 100644 --- a/modules/engine/include/engine/platform/graphics/opengl/vertex_layout.hpp +++ b/modules/engine/include/engine/platform/graphics/opengl/vertex_layout.hpp @@ -18,7 +18,7 @@ struct glVertexElementDesc class glVertexLayout: public VertexLayout { private: - unsigned int m_ArrayID; + unsigned int m_array_id; public: glVertexLayout( diff --git a/modules/engine/include/engine/platform/os/linux/l_window.hpp b/modules/engine/include/engine/platform/os/linux/l_window.hpp index d030976..c39a28c 100644 --- a/modules/engine/include/engine/platform/os/linux/l_window.hpp +++ b/modules/engine/include/engine/platform/os/linux/l_window.hpp @@ -13,9 +13,9 @@ class WindowResizedEvent; class lWindow: public Window { private: - GLFWwindow *m_Handle; + GLFWwindow *m_handle; - std::function m_EventCallback; + std::function m_event_callback; public: lWindow(std::function callback); diff --git a/modules/engine/include/engine/platform/os/windows/w_window.cpp b/modules/engine/include/engine/platform/os/windows/w_window.cpp index 7ac0139..cfe6204 100644 --- a/modules/engine/include/engine/platform/os/windows/w_window.cpp +++ b/modules/engine/include/engine/platform/os/windows/w_window.cpp @@ -22,8 +22,8 @@ Scope Window::Create(std::function callback) } wWindow::wWindow(std::function callback) - : m_Handle(nullptr) - , m_EventCallback(callback) + : m_handle(nullptr) + , m_event_callback(callback) { // init glfw ASSERT(glfwInit(), "wWindow::wWindow: failed to initialize 'glfw'"); @@ -34,21 +34,21 @@ wWindow::wWindow(std::function callback) glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - m_Handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr); - ASSERT(m_Handle, "wWindow::wWindow: glfwCreateWindow: failed to create 'GLFWwindow'"); + m_handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr); + ASSERT(m_handle, "wWindow::wWindow: glfwCreateWindow: failed to create 'GLFWwindow'"); // bind event stuff - glfwSetWindowUserPointer(m_Handle, &m_EventCallback); + glfwSetWindowUserPointer(m_handle, &m_event_callback); BindGlfwEvents(); // create graphics context - m_GraphicsContext = GraphicsContext::Create(GraphicsAPI::DirectX, m_Handle); - ASSERT(m_GraphicsContext, "wWindow::wWindow: failed to create 'GraphicsContext'"); + m_graphics_context = GraphicsContext::Create(GraphicsAPI::DirectX, m_handle); + ASSERT(m_graphics_context, "wWindow::wWindow: failed to create 'GraphicsContext'"); } wWindow::~wWindow() { - glfwDestroyWindow(m_Handle); + glfwDestroyWindow(m_handle); } void wWindow::PollEvents() @@ -70,16 +70,16 @@ void wWindow::OnEvent(const Event &event) void wWindow::OnWindowResize(const WindowResizedEvent &event) { - m_Properties.size = event.GetSize(); + m_properties.size = event.GetSize(); } void wWindow:: SetProperties(const WindowProperties &properties, bool overrideVisiblity /* = false */) { // save the visibility status and re-assign if 'overrideVisibility' is false - bool visible = overrideVisiblity ? properties.visible : m_Properties.visible; - m_Properties = properties; - m_Properties.visible = visible; + bool visible = overrideVisiblity ? properties.visible : m_properties.visible; + m_properties = properties; + m_properties.visible = visible; // set properties SetTitle(properties.title); @@ -90,46 +90,46 @@ void wWindow:: void wWindow::SetTitle(const std::string &title) { - m_Properties.title = title; + m_properties.title = title; - glfwSetWindowTitle(m_Handle, m_Properties.title.c_str()); + glfwSetWindowTitle(m_handle, m_properties.title.c_str()); } void wWindow::SetSize(const glm::uvec2 &size, bool additive /* = false */) { - m_Properties.size.x = size.x == 0u ? m_Properties.size.x : - additive ? m_Properties.size.x + size.x : + m_properties.size.x = size.x == 0u ? m_properties.size.x : + additive ? m_properties.size.x + size.x : size.x; - m_Properties.size.y = size.y == 0u ? m_Properties.size.y : - additive ? m_Properties.size.y + size.y : + m_properties.size.y = size.y == 0u ? m_properties.size.y : + additive ? m_properties.size.y + size.y : size.y; - glfwSetWindowSize(m_Handle, size.x, size.y); + glfwSetWindowSize(m_handle, size.x, size.y); } void wWindow::SetVSync(bool vsync, bool toggle /* = false */) { - m_Properties.vsync = toggle ? !m_Properties.vsync : vsync; + m_properties.vsync = toggle ? !m_properties.vsync : vsync; - glfwSwapInterval(m_Properties.vsync); + glfwSwapInterval(m_properties.vsync); } void wWindow::SetVisibility(bool visible, bool toggle) { - m_Properties.visible = toggle ? !m_Properties.visible : visible; + m_properties.visible = toggle ? !m_properties.visible : visible; - if (m_Properties.visible) - glfwShowWindow(m_Handle); + if (m_properties.visible) + glfwShowWindow(m_handle); else - glfwHideWindow(m_Handle); + glfwHideWindow(m_handle); } void wWindow::BindGlfwEvents() { //============================== MOUSE_EVENTS ==============================// /* cursor position */ - glfwSetCursorPosCallback(m_Handle, [](GLFWwindow *window, double xpos, double ypos) { + glfwSetCursorPosCallback(m_handle, [](GLFWwindow *window, double xpos, double ypos) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -138,7 +138,7 @@ void wWindow::BindGlfwEvents() }); /* mouse button */ - glfwSetMouseButtonCallback(m_Handle, [](GLFWwindow *window, int button, int action, int mods) { + glfwSetMouseButtonCallback(m_handle, [](GLFWwindow *window, int button, int action, int mods) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -155,7 +155,7 @@ void wWindow::BindGlfwEvents() }); /* scroll */ - glfwSetScrollCallback(m_Handle, [](GLFWwindow *window, double xoffset, double yoffset) { + glfwSetScrollCallback(m_handle, [](GLFWwindow *window, double xoffset, double yoffset) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -167,7 +167,7 @@ void wWindow::BindGlfwEvents() //============================== KEYBOARD_EVENTS ==============================// /* key */ glfwSetKeyCallback( - m_Handle, + m_handle, [](GLFWwindow *window, int key, int scancode, int action, int mods) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -185,7 +185,7 @@ void wWindow::BindGlfwEvents() } ); /* char */ - glfwSetCharCallback(m_Handle, [](GLFWwindow *window, unsigned int character) { + glfwSetCharCallback(m_handle, [](GLFWwindow *window, unsigned int character) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -197,7 +197,7 @@ void wWindow::BindGlfwEvents() //============================== WINDOW_EVENTS ==============================// /* window position */ - glfwSetWindowPosCallback(m_Handle, [](GLFWwindow *window, int xpos, int ypos) { + glfwSetWindowPosCallback(m_handle, [](GLFWwindow *window, int xpos, int ypos) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); WindowMovedEvent event(xpos, ypos); @@ -206,7 +206,7 @@ void wWindow::BindGlfwEvents() }); /* window size */ - glfwSetWindowSizeCallback(m_Handle, [](GLFWwindow *window, int width, int height) { + glfwSetWindowSizeCallback(m_handle, [](GLFWwindow *window, int width, int height) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); WindowResizedEvent event(width, height); @@ -215,7 +215,7 @@ void wWindow::BindGlfwEvents() }); /* window close */ - glfwSetWindowCloseCallback(m_Handle, [](GLFWwindow *window) { + glfwSetWindowCloseCallback(m_handle, [](GLFWwindow *window) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); WindowClosedEvent event; @@ -224,7 +224,7 @@ void wWindow::BindGlfwEvents() }); /* window focus */ - glfwSetWindowFocusCallback(m_Handle, [](GLFWwindow *window, int focus) { + glfwSetWindowFocusCallback(m_handle, [](GLFWwindow *window, int focus) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); diff --git a/modules/engine/include/engine/platform/os/windows/w_window.hpp b/modules/engine/include/engine/platform/os/windows/w_window.hpp index dd708f3..a370c6b 100644 --- a/modules/engine/include/engine/platform/os/windows/w_window.hpp +++ b/modules/engine/include/engine/platform/os/windows/w_window.hpp @@ -13,9 +13,9 @@ class WindowResizedEvent; class wWindow: public Window { private: - GLFWwindow *m_Handle; + GLFWwindow *m_handle; - std::function m_EventCallback; + std::function m_event_callback; public: wWindow(std::function callback); diff --git a/modules/engine/include/engine/scene/components/scriptable_entity.hpp b/modules/engine/include/engine/scene/components/scriptable_entity.hpp index f2ebe43..17b48aa 100644 --- a/modules/engine/include/engine/scene/components/scriptable_entity.hpp +++ b/modules/engine/include/engine/scene/components/scriptable_entity.hpp @@ -10,8 +10,8 @@ class NativeScript friend class Scene; private: - Entity m_Entity; - unsigned int m_UniqueIdentifier = 0; // :#todo + Entity m_entity; + unsigned int m_unique_identifier = 0; // :#todo public: NativeScript() = default; @@ -19,13 +19,13 @@ public: inline unsigned int GetUID() const { - return m_UniqueIdentifier; + return m_unique_identifier; } template T &GetComponent() { - return m_Entity.GetComponent(); + return m_entity.GetComponent(); } protected: diff --git a/modules/engine/include/engine/scene/entity.hpp b/modules/engine/include/engine/scene/entity.hpp index 1c7443c..907e400 100644 --- a/modules/engine/include/engine/scene/entity.hpp +++ b/modules/engine/include/engine/scene/entity.hpp @@ -10,8 +10,8 @@ namespace Light { class Entity { private: - entt::entity m_Handle; - Scene *m_Scene; + entt::entity m_handle; + Scene *m_scene; public: Entity(entt::entity handle = entt::null, Scene *registry = nullptr); @@ -20,25 +20,25 @@ public: template inline T &AddComponent(Args &&...args) { - return m_Scene->m_Registry.emplace(m_Handle, std::forward(args)...); + return m_scene->m_registry.emplace(m_handle, std::forward(args)...); } template inline T &GetComponent() { - return m_Scene->m_Registry.get(m_Handle); + return m_scene->m_registry.get(m_handle); } template inline bool HasComponent() { - return m_Scene->m_Registry.any_of(m_Handle); + return m_scene->m_registry.any_of(m_handle); } template inline void RemoveComponent() { - m_Scene->m_Registry.remove(m_Handle); + m_scene->m_registry.remove(m_handle); } inline uint64_t GetUUID() @@ -48,12 +48,12 @@ public: inline bool IsValid() const { - return m_Handle != entt::null && m_Scene != nullptr; + return m_handle != entt::null && m_scene != nullptr; } operator uint32_t() { - return (uint32_t)m_Handle; + return (uint32_t)m_handle; } }; diff --git a/modules/engine/include/engine/scene/scene.hpp b/modules/engine/include/engine/scene/scene.hpp index 2a3eff8..4bab48e 100644 --- a/modules/engine/include/engine/scene/scene.hpp +++ b/modules/engine/include/engine/scene/scene.hpp @@ -20,7 +20,7 @@ private: friend class SceneHierarchyPanel; private: - entt::registry m_Registry; + entt::registry m_registry; public: Scene(); diff --git a/modules/engine/include/engine/time/timer.hpp b/modules/engine/include/engine/time/timer.hpp index c14e581..688f497 100644 --- a/modules/engine/include/engine/time/timer.hpp +++ b/modules/engine/include/engine/time/timer.hpp @@ -8,7 +8,7 @@ namespace Light { class Timer { private: - std::chrono::time_point m_Start; + std::chrono::time_point m_start; public: Timer(); @@ -16,7 +16,7 @@ public: inline float GetElapsedTime() const { return (std::chrono::duration_cast( - std::chrono::steady_clock::now() - m_Start + std::chrono::steady_clock::now() - m_start ) .count()) / 1000.; @@ -24,7 +24,7 @@ public: inline void Reset() { - m_Start = std::chrono::steady_clock::now(); + m_start = std::chrono::steady_clock::now(); } }; @@ -33,8 +33,8 @@ class DeltaTimer private: Timer timer; - float m_PreviousFrame; - float m_DeltaTime; + float m_previous_frame; + float m_delta_time; public: DeltaTimer(); @@ -43,7 +43,7 @@ public: inline float GetDeltaTime() const { - return m_DeltaTime; + return m_delta_time; } }; diff --git a/modules/engine/include/engine/user_interface/user_interface.hpp b/modules/engine/include/engine/user_interface/user_interface.hpp index 702b84c..64b6dd4 100644 --- a/modules/engine/include/engine/user_interface/user_interface.hpp +++ b/modules/engine/include/engine/user_interface/user_interface.hpp @@ -18,7 +18,7 @@ private: static UserInterface *s_Context; private: - ImGuiWindowFlags m_DockspaceFlags; + ImGuiWindowFlags m_dockspace_flags; public: static Scope Create(GLFWwindow *windowHandle, Ref sharedContext); diff --git a/modules/engine/include/engine/utils/file_manager.hpp b/modules/engine/include/engine/utils/file_manager.hpp index 5b33938..e21e711 100644 --- a/modules/engine/include/engine/utils/file_manager.hpp +++ b/modules/engine/include/engine/utils/file_manager.hpp @@ -20,34 +20,34 @@ public: // getters inline uint8_t *GetData() { - return m_Data; + return m_data; } inline uint32_t GetSize() { - return m_Size; + return m_size; } inline const std::string &GetPath() { - return m_Path; + return m_path; } inline const std::string &GetName() { - return m_Name; + return m_name; } inline const std::string &GetExtension() { - return m_Extension; + return m_extension; } inline const std::string &GetNameWithExtension() { - return m_Name + '.' + m_Extension; + return m_name + '.' + m_extension; } inline bool IsValid() const { - return !!m_Data; + return !!m_data; } // operators @@ -58,11 +58,11 @@ public: protected: // made protected for custom Free(): - uint8_t *m_Data; - uint32_t m_Size; + uint8_t *m_data; + uint32_t m_size; private: - const std::string m_Path, m_Name, m_Extension; + const std::string m_path, m_name, m_extension; }; class ImageFileHandle: public BasicFileHandle @@ -80,10 +80,10 @@ public: uint32_t desiredComponents ) : BasicFileHandle(data, size, path, name, extension) - , m_Width(width) - , m_Height(height) - , m_Components(components) - , m_DesiredComponents(desiredComponents) + , m_width(width) + , m_height(height) + , m_components(components) + , m_desired_components(desiredComponents) { } @@ -92,23 +92,23 @@ public: // getters inline uint32_t GetWidth() const { - return m_Width; + return m_width; } inline uint32_t GetHeight() const { - return m_Height; + return m_height; } inline uint32_t GetComponents() const { - return m_Components; + return m_components; } inline uint32_t GetDesiredComponents() const { - return m_DesiredComponents; + return m_desired_components; } private: - uint32_t m_Width, m_Height, m_Components, m_DesiredComponents; + uint32_t m_width, m_height, m_components, m_desired_components; }; class FileManager diff --git a/modules/engine/include/engine/utils/resource_manager.hpp b/modules/engine/include/engine/utils/resource_manager.hpp index f88863e..3a5ae1b 100644 --- a/modules/engine/include/engine/utils/resource_manager.hpp +++ b/modules/engine/include/engine/utils/resource_manager.hpp @@ -15,8 +15,8 @@ private: static ResourceManager *s_Context; private: - std::unordered_map> m_Shaders; - std::unordered_map> m_Textures; + std::unordered_map> m_shaders; + std::unordered_map> m_textures; public: static Scope Create(); @@ -47,11 +47,11 @@ public: static inline Ref GetShader(const std::string &name) { - return s_Context->m_Shaders[name]; + return s_Context->m_shaders[name]; } static inline Ref GetTexture(const std::string &name) { - return s_Context->m_Textures[name]; + return s_Context->m_textures[name]; } private: diff --git a/modules/engine/include/engine/utils/serializer.hpp b/modules/engine/include/engine/utils/serializer.hpp index f69f43b..2f9eb8e 100644 --- a/modules/engine/include/engine/utils/serializer.hpp +++ b/modules/engine/include/engine/utils/serializer.hpp @@ -22,7 +22,7 @@ private: void SerializeEntity(YAML::Emitter &out, Entity entity); private: - Ref m_Scene; + Ref m_scene; }; diff --git a/modules/engine/src/camera/ortho.cpp b/modules/engine/src/camera/ortho.cpp index 59540e6..1fcade5 100644 --- a/modules/engine/src/camera/ortho.cpp +++ b/modules/engine/src/camera/ortho.cpp @@ -10,26 +10,26 @@ OrthographicCamera::OrthographicCamera( float zoomLevel, const glm::vec4 &clearColor /* = glm::vec4(0.1f, 0.3f, 0.7f, 1.0f) */ ) - : m_Up(0.0f, 1.0f, 0.0f) - , m_Position(position) - , m_AspectRatio(aspectRatio) - , m_ZoomLevel(zoomLevel) - , m_ClearColor(clearColor) + : m_up(0.0f, 1.0f, 0.0f) + , m_position(position) + , m_aspect_ratio(aspectRatio) + , m_zoom_level(zoomLevel) + , m_clear_color(clearColor) { } void OrthographicCamera::CalculateView() { - m_View = glm::lookAt(glm::vec3(m_Position, 100.0f), glm::vec3(m_Position, 0.0f), m_Up); + m_view = glm::lookAt(glm::vec3(m_position, 100.0f), glm::vec3(m_position, 0.0f), m_up); } void OrthographicCamera::CalculateProjection() { - m_Projection = glm::ortho( - -m_ZoomLevel * m_AspectRatio, - +m_ZoomLevel * m_AspectRatio, - -m_ZoomLevel, - +m_ZoomLevel, + m_projection = glm::ortho( + -m_zoom_level * m_aspect_ratio, + +m_zoom_level * m_aspect_ratio, + -m_zoom_level, + +m_zoom_level, FLT_MAX, FLT_MIN ); @@ -37,13 +37,13 @@ void OrthographicCamera::CalculateProjection() void OrthographicCamera::OnResize(const glm::vec2 &size) { - m_AspectRatio = size.x / size.y; + m_aspect_ratio = size.x / size.y; CalculateProjection(); } void OrthographicCamera::Move(const glm::vec2 &position) { - m_Position += position; + m_position += position; } } // namespace Light diff --git a/modules/engine/src/camera/scene.cpp b/modules/engine/src/camera/scene.cpp index 08a7dfe..bcb935e 100644 --- a/modules/engine/src/camera/scene.cpp +++ b/modules/engine/src/camera/scene.cpp @@ -4,82 +4,82 @@ namespace Light { SceneCamera::SceneCamera() - : m_OrthographicSpecification { 1000.0f, -1.0f, 10000.0f } - , m_PerspectiveSpecification { glm::radians(45.0f), 0.01f, 10000.0f } - , m_AspectRatio(16.0f / 9.0f) - , m_ProjectionType(ProjectionType::Orthographic) + : m_orthographic_specification { 1000.0f, -1.0f, 10000.0f } + , m_perspective_specification { glm::radians(45.0f), 0.01f, 10000.0f } + , m_aspect_ratio(16.0f / 9.0f) + , m_projection_type(ProjectionType::Orthographic) { CalculateProjection(); } void SceneCamera::SetViewportSize(unsigned int width, unsigned int height) { - m_AspectRatio = width / (float)height; + m_aspect_ratio = width / (float)height; CalculateProjection(); } void SceneCamera::SetProjectionType(ProjectionType projectionType) { - m_ProjectionType = projectionType; + m_projection_type = projectionType; CalculateProjection(); } void SceneCamera::SetOrthographicSize(float size) { - m_OrthographicSpecification.size = size; + m_orthographic_specification.size = size; CalculateProjection(); } void SceneCamera::SetOrthographicFarPlane(float farPlane) { - m_OrthographicSpecification.farPlane = farPlane; + m_orthographic_specification.farPlane = farPlane; CalculateProjection(); } void SceneCamera::SetOrthographicNearPlane(float nearPlane) { - m_OrthographicSpecification.nearPlane = nearPlane; + m_orthographic_specification.nearPlane = nearPlane; CalculateProjection(); } void SceneCamera::SetPerspectiveVerticalFOV(float verticalFOV) { - m_PerspectiveSpecification.verticalFOV = verticalFOV; + m_perspective_specification.verticalFOV = verticalFOV; CalculateProjection(); } void SceneCamera::SetPerspectiveFarPlane(float farPlane) { - m_PerspectiveSpecification.farPlane = farPlane; + m_perspective_specification.farPlane = farPlane; CalculateProjection(); } void SceneCamera::SetPerspectiveNearPlane(float nearPlane) { - m_PerspectiveSpecification.nearPlane = nearPlane; + m_perspective_specification.nearPlane = nearPlane; CalculateProjection(); } void SceneCamera::CalculateProjection() { - if (m_ProjectionType == ProjectionType::Orthographic) + if (m_projection_type == ProjectionType::Orthographic) { - m_Projection = glm::ortho( - -m_OrthographicSpecification.size * 0.5f * m_AspectRatio, - m_OrthographicSpecification.size * 0.5f * m_AspectRatio, - -m_OrthographicSpecification.size * 0.5f, - m_OrthographicSpecification.size * 0.5f, - m_OrthographicSpecification.farPlane, - m_OrthographicSpecification.nearPlane + m_projection = glm::ortho( + -m_orthographic_specification.size * 0.5f * m_aspect_ratio, + m_orthographic_specification.size * 0.5f * m_aspect_ratio, + -m_orthographic_specification.size * 0.5f, + m_orthographic_specification.size * 0.5f, + m_orthographic_specification.farPlane, + m_orthographic_specification.nearPlane ); } else // perspective { - m_Projection = glm::perspective( - m_PerspectiveSpecification.verticalFOV, - m_AspectRatio, - m_PerspectiveSpecification.nearPlane, - m_PerspectiveSpecification.farPlane + m_projection = glm::perspective( + m_perspective_specification.verticalFOV, + m_aspect_ratio, + m_perspective_specification.nearPlane, + m_perspective_specification.farPlane ); } } diff --git a/modules/engine/src/core/application.cpp b/modules/engine/src/core/application.cpp index 00ed8b7..00d4916 100644 --- a/modules/engine/src/core/application.cpp +++ b/modules/engine/src/core/application.cpp @@ -14,101 +14,101 @@ namespace Light { Application *Application::s_Context = nullptr; Application::Application() - : m_Instrumentor(nullptr) - , m_LayerStack(nullptr) - , m_Input(nullptr) - , m_Window(nullptr) + : m_instrumentor(nullptr) + , m_layer_stack(nullptr) + , m_input(nullptr) + , m_window(nullptr) { ASSERT(!s_Context, "Repeated singleton construction"); s_Context = this; - m_Logger = Logger::Create(); + m_logger = Logger::Create(); LogDebugData(); - m_Instrumentor = Instrumentor::Create(); - m_Instrumentor->BeginSession("Logs/ProfileResults_Startup.json"); + m_instrumentor = Instrumentor::Create(); + m_instrumentor->BeginSession("Logs/ProfileResults_Startup.json"); - m_LayerStack = LayerStack::Create(); - m_Input = Input::Create(); + m_layer_stack = LayerStack::Create(); + m_input = Input::Create(); - m_ResourceManager = ResourceManager::Create(); + m_resource_manager = ResourceManager::Create(); - m_Window = Window::Create(std::bind(&Application::OnEvent, this, std::placeholders::_1)); + m_window = Window::Create(std::bind(&Application::OnEvent, this, std::placeholders::_1)); } Application::~Application() { LOG(trace, "Application::~Application()"); - m_Instrumentor->EndSession(); // ProfileResults_Termination // + m_instrumentor->EndSession(); // ProfileResults_Termination // } void Application::GameLoop() { // check - ASSERT(!m_LayerStack->IsEmpty(), "LayerStack is empty"); + ASSERT(!m_layer_stack->IsEmpty(), "LayerStack is empty"); // log debug data - m_Logger->LogDebugData(); - m_Window->GetGfxContext()->LogDebugData(); - m_Window->GetGfxContext()->GetUserInterface()->LogDebugData(); + m_logger->LogDebugData(); + m_window->GetGfxContext()->LogDebugData(); + m_window->GetGfxContext()->GetUserInterface()->LogDebugData(); // reveal window - m_Window->SetVisibility(true); + m_window->SetVisibility(true); - m_Instrumentor->EndSession(); // ProfileResults_GameLoop // - m_Instrumentor->BeginSession("Logs/ProfileResults_GameLoop.json"); + m_instrumentor->EndSession(); // ProfileResults_GameLoop // + m_instrumentor->BeginSession("Logs/ProfileResults_GameLoop.json"); /* game loop */ DeltaTimer deltaTimer; - while (!m_Window->IsClosed()) + while (!m_window->IsClosed()) { { // update layers LT_PROFILE_SCOPE("GameLoop::Update"); - for (auto it = m_LayerStack->begin(); it != m_LayerStack->end(); it++) + for (auto it = m_layer_stack->begin(); it != m_layer_stack->end(); it++) (*it)->OnUpdate(deltaTimer.GetDeltaTime()); } { // render layers LT_PROFILE_SCOPE("GameLoop::Render"); - m_Window->GetGfxContext()->GetRenderer()->BeginFrame(); + m_window->GetGfxContext()->GetRenderer()->BeginFrame(); - for (auto it = m_LayerStack->begin(); it != m_LayerStack->end(); it++) + for (auto it = m_layer_stack->begin(); it != m_layer_stack->end(); it++) (*it)->OnRender(); - m_Window->GetGfxContext()->GetRenderer()->EndFrame(); + m_window->GetGfxContext()->GetRenderer()->EndFrame(); } { // render user interface LT_PROFILE_SCOPE("GameLoop::UserInterface"); - m_Window->GetGfxContext()->GetUserInterface()->Begin(); + m_window->GetGfxContext()->GetUserInterface()->Begin(); - for (auto it = m_LayerStack->begin(); it != m_LayerStack->end(); it++) + for (auto it = m_layer_stack->begin(); it != m_layer_stack->end(); it++) (*it)->OnUserInterfaceUpdate(); - m_Window->GetGfxContext()->GetUserInterface()->End(); + m_window->GetGfxContext()->GetUserInterface()->End(); } { // poll events LT_PROFILE_SCOPE("GameLoop::Events"); - m_Window->PollEvents(); + m_window->PollEvents(); } /// update delta time deltaTimer.Update(); } - m_Instrumentor->EndSession(); // ProfileResults_GameLoop // - m_Instrumentor->BeginSession("Logs/ProfileResults_Termination.json"); + m_instrumentor->EndSession(); // ProfileResults_GameLoop // + m_instrumentor->BeginSession("Logs/ProfileResults_Termination.json"); } void Application::Quit() { - s_Context->m_Window->Close(); + s_Context->m_window->Close(); } void Application::OnEvent(const Event &event) @@ -116,10 +116,10 @@ void Application::OnEvent(const Event &event) // window if (event.HasCategory(WindowEventCategory)) { - m_Window->OnEvent(event); + m_window->OnEvent(event); if (event.GetEventType() == EventType::WindowResized) - m_Window->GetGfxContext()->GetRenderer()->OnWindowResize( + m_window->GetGfxContext()->GetRenderer()->OnWindowResize( (const WindowResizedEvent &)event ); } @@ -127,15 +127,15 @@ void Application::OnEvent(const Event &event) // input if (event.HasCategory(InputEventCategory)) { - m_Input->OnEvent(event); + m_input->OnEvent(event); - if (!m_Input->IsReceivingGameEvents()) // return if the event is an input event and 'Input' + if (!m_input->IsReceivingGameEvents()) // return if the event is an input event and 'Input' // has disabled the game events return; } /* layers */ - for (auto it = m_LayerStack->rbegin(); it != m_LayerStack->rend(); it++) + for (auto it = m_layer_stack->rbegin(); it != m_layer_stack->rend(); it++) if ((*it)->OnEvent(event)) return; } diff --git a/modules/engine/src/core/uuid.cpp b/modules/engine/src/core/uuid.cpp index 9efda4d..cc50e70 100644 --- a/modules/engine/src/core/uuid.cpp +++ b/modules/engine/src/core/uuid.cpp @@ -5,7 +5,7 @@ namespace Light { std::mt19937_64 UUID::s_Engine = std::mt19937_64(std::random_device()()); std::uniform_int_distribution UUID::s_UniformDistribution; -UUID::UUID(uint64_t uuid /* = -1 */): m_UUID(uuid == -1 ? s_UniformDistribution(s_Engine) : uuid) +UUID::UUID(uint64_t uuid /* = -1 */): m_uuid(uuid == -1 ? s_UniformDistribution(s_Engine) : uuid) { } diff --git a/modules/engine/src/debug/instrumentor.cpp b/modules/engine/src/debug/instrumentor.cpp index b25cb78..ae21570 100644 --- a/modules/engine/src/debug/instrumentor.cpp +++ b/modules/engine/src/debug/instrumentor.cpp @@ -9,7 +9,7 @@ Scope Instrumentor::Create() return MakeScope(new Instrumentor); } -Instrumentor::Instrumentor(): m_CurrentSessionCount(0u) +Instrumentor::Instrumentor(): m_current_session_count(0u) { // #todo: maintenance ASSERT( @@ -23,42 +23,42 @@ void Instrumentor::BeginSessionImpl(const std::string &outputPath) { std::filesystem::create_directory(outputPath.substr(0, outputPath.find_last_of('/') + 1)); - m_OutputFileStream.open(outputPath); - m_OutputFileStream << "{\"traceEvents\":["; + m_output_file_stream.open(outputPath); + m_output_file_stream << "{\"traceEvents\":["; } void Instrumentor::EndSessionImpl() { - if (m_CurrentSessionCount == 0u) + if (m_current_session_count == 0u) LOG(warn, "0 profiling for the ended session"); - m_CurrentSessionCount = 0u; + m_current_session_count = 0u; - m_OutputFileStream << "]}"; - m_OutputFileStream.flush(); - m_OutputFileStream.close(); + m_output_file_stream << "]}"; + m_output_file_stream.flush(); + m_output_file_stream.close(); } void Instrumentor::SubmitScopeProfileImpl(const ScopeProfileResult &profileResult) { - if (m_CurrentSessionCount++ == 0u) - m_OutputFileStream << "{"; + if (m_current_session_count++ == 0u) + m_output_file_stream << "{"; else - m_OutputFileStream << ",{"; + m_output_file_stream << ",{"; - m_OutputFileStream << "\"name\":\"" << profileResult.name << "\","; - m_OutputFileStream << "\"cat\": \"scope\","; - m_OutputFileStream << "\"ph\": \"X\","; - m_OutputFileStream << "\"ts\":" << profileResult.start << ","; - m_OutputFileStream << "\"dur\":" << profileResult.duration << ","; - m_OutputFileStream << "\"pid\":0,"; - m_OutputFileStream << "\"tid\":" << profileResult.threadID << ""; - m_OutputFileStream << "}"; + m_output_file_stream << "\"name\":\"" << profileResult.name << "\","; + m_output_file_stream << "\"cat\": \"scope\","; + m_output_file_stream << "\"ph\": \"X\","; + m_output_file_stream << "\"ts\":" << profileResult.start << ","; + m_output_file_stream << "\"dur\":" << profileResult.duration << ","; + m_output_file_stream << "\"pid\":0,"; + m_output_file_stream << "\"tid\":" << profileResult.threadID << ""; + m_output_file_stream << "}"; } InstrumentorTimer::InstrumentorTimer(const std::string &scopeName) - : m_Result({ scopeName, 0, 0, 0 }) - , m_Start(std::chrono::steady_clock::now()) + : m_result({ scopeName, 0, 0, 0 }) + , m_start(std::chrono::steady_clock::now()) { } @@ -66,15 +66,15 @@ InstrumentorTimer::~InstrumentorTimer() { auto end = std::chrono::steady_clock::now(); - m_Result.start = std::chrono::time_point_cast(m_Start) + m_result.start = std::chrono::time_point_cast(m_start) .time_since_epoch() .count(); - m_Result.duration = std::chrono::time_point_cast(end) + m_result.duration = std::chrono::time_point_cast(end) .time_since_epoch() .count() - - m_Result.start; + - m_result.start; - Instrumentor::SubmitScopeProfile(m_Result); + Instrumentor::SubmitScopeProfile(m_result); } } // namespace Light diff --git a/modules/engine/src/debug/logger.cpp b/modules/engine/src/debug/logger.cpp index 775d461..c886099 100644 --- a/modules/engine/src/debug/logger.cpp +++ b/modules/engine/src/debug/logger.cpp @@ -12,9 +12,9 @@ Scope Logger::Create() } Logger::Logger() - : m_EngineLogger(nullptr) - , m_FileLogger(nullptr) - , m_LogFilePath(LT_LOG_FILE_LOCATION) + : m_engine_logger(nullptr) + , m_file_logger(nullptr) + , m_log_file_path(LT_LOG_FILE_LOCATION) { ASSERT(!s_Context, "An instance of 'Logger' already exists, do not construct this class!"); s_Context = this; @@ -24,16 +24,16 @@ Logger::Logger() spdlog::set_pattern("%^[%H:%M:%S]%g@%! ==> %v%$"); #ifndef LIGHT_DIST spdlog::set_pattern("%^[%H:%M:%S]%! ==> %v%$"); - m_EngineLogger = spdlog::stdout_color_mt("Engine"); + m_engine_logger = spdlog::stdout_color_mt("Engine"); #endif - m_FileLogger = spdlog::basic_logger_mt("File", m_LogFilePath); - m_FileLogger->set_pattern("%^[%M:%S:%e] <%l>: %v%$"); + m_file_logger = spdlog::basic_logger_mt("File", m_log_file_path); + m_file_logger->set_pattern("%^[%M:%S:%e] <%l>: %v%$"); // set level #if defined(LIGHT_DEBUG) - m_EngineLogger->set_level(spdlog::level::trace); - m_ClientLogger->set_level(spdlog::level::trace); + m_engine_logger->set_level(spdlog::level::trace); + m_client_logger->set_level(spdlog::level::trace); #elif defined(LIGHT_RELEASE) s_EngineLogger->set_level(spdlog::level::info); s_ClientLogger->set_level(spdlog::level::info); @@ -45,8 +45,8 @@ void Logger::LogDebugData() // #todo: improve LOG(info, "________________________________________"); LOG(info, "Logger::"); - LOG(info, " EngineLevel : {}", Stringifier::spdlogLevel(m_EngineLogger->level())); - LOG(info, " FileLevel : {}", Stringifier::spdlogLevel(m_FileLogger->level())); + LOG(info, " EngineLevel : {}", Stringifier::spdlogLevel(m_engine_logger->level())); + LOG(info, " FileLevel : {}", Stringifier::spdlogLevel(m_file_logger->level())); LOG(info, " DefaultLevel: {}", Stringifier::spdlogLevel(spdlog::get_level())); LOG(info, "________________________________________"); } diff --git a/modules/engine/src/graphics/graphics_context.cpp b/modules/engine/src/graphics/graphics_context.cpp index 2ec2389..33f13e1 100644 --- a/modules/engine/src/graphics/graphics_context.cpp +++ b/modules/engine/src/graphics/graphics_context.cpp @@ -26,8 +26,8 @@ Scope GraphicsContext::Create(GraphicsAPI api, GLFWwindow *wind // terminate 'GraphicsContext' dependent classes if (s_Context) { - s_Context->m_Renderer.reset(); - s_Context->m_UserInterface.reset(); + s_Context->m_renderer.reset(); + s_Context->m_user_interface.reset(); delete s_Context; } @@ -68,12 +68,12 @@ Scope GraphicsContext::Create(GraphicsAPI api, GLFWwindow *wind } // create 'GraphicsContext' dependent classes - s_Context->m_UserInterface = UserInterface::Create(windowHandle, s_Context->m_SharedContext); - s_Context->m_Renderer = Renderer::Create(windowHandle, s_Context->m_SharedContext); + s_Context->m_user_interface = UserInterface::Create(windowHandle, s_Context->m_shared_context); + s_Context->m_renderer = Renderer::Create(windowHandle, s_Context->m_shared_context); // check - ASSERT(s_Context->m_UserInterface, "Failed to create UserInterface"); - ASSERT(s_Context->m_Renderer, "Failed to create Renderer"); + ASSERT(s_Context->m_user_interface, "Failed to create UserInterface"); + ASSERT(s_Context->m_renderer, "Failed to create Renderer"); return std::move(scopeGfx); } diff --git a/modules/engine/src/graphics/renderer.cpp b/modules/engine/src/graphics/renderer.cpp index 7749db2..9219879 100644 --- a/modules/engine/src/graphics/renderer.cpp +++ b/modules/engine/src/graphics/renderer.cpp @@ -15,28 +15,28 @@ namespace Light { Renderer *Renderer::s_Context = nullptr; Renderer::Renderer(GLFWwindow *windowHandle, Ref sharedContext) - : m_QuadRenderer(LT_MAX_QUAD_RENDERER_VERTICES, sharedContext) - , m_TextureRenderer(LT_MAX_TEXTURE_RENDERER_VERTICES, sharedContext) - , m_TintedTextureRenderer(LT_MAX_TINTED_TEXTURE_RENDERER_VERTICES, sharedContext) - , m_ViewProjectionBuffer(nullptr) - , m_RenderCommand(nullptr) - , m_Blender(nullptr) - , m_DefaultFramebufferCamera(nullptr) - , m_TargetFramebuffer(nullptr) - , m_ShouldClearBackbuffer(false) + : m_quad_renderer(LT_MAX_QUAD_RENDERER_VERTICES, sharedContext) + , m_texture_renderer(LT_MAX_TEXTURE_RENDERER_VERTICES, sharedContext) + , m_tinted_texture_renderer(LT_MAX_TINTED_TEXTURE_RENDERER_VERTICES, sharedContext) + , m_view_projection_buffer(nullptr) + , m_render_command(nullptr) + , m_blender(nullptr) + , m_default_framebuffer_camera(nullptr) + , m_target_framebuffer(nullptr) + , m_should_clear_backbuffer(false) { ASSERT(!s_Context, "An instance of 'Renderer' already exists, do not construct this class!"); s_Context = this; - m_ViewProjectionBuffer = ConstantBuffer::Create( + m_view_projection_buffer = ConstantBuffer::Create( ConstantBufferIndex::ViewProjection, sizeof(glm::mat4), sharedContext ); - m_RenderCommand = RenderCommand::Create(windowHandle, sharedContext); - m_Blender = Blender::Create(sharedContext); - m_Blender->Enable(BlendFactor::SRC_ALPHA, BlendFactor::INVERSE_SRC_ALPHA); + m_render_command = RenderCommand::Create(windowHandle, sharedContext); + m_blender = Blender::Create(sharedContext); + m_blender->Enable(BlendFactor::SRC_ALPHA, BlendFactor::INVERSE_SRC_ALPHA); } Scope Renderer::Create(GLFWwindow *windowHandle, Ref sharedContext) @@ -46,7 +46,7 @@ Scope Renderer::Create(GLFWwindow *windowHandle, Ref sh void Renderer::OnWindowResize(const WindowResizedEvent &event) { - m_RenderCommand->SetViewport(0u, 0u, event.GetSize().x, event.GetSize().y); + m_render_command->SetViewport(0u, 0u, event.GetSize().x, event.GetSize().y); } //======================================== DRAW_QUAD ========================================// @@ -91,7 +91,7 @@ void Renderer::DrawQuadImpl(const glm::vec3 &position, const glm::vec2 &size, Re void Renderer::DrawQuadImpl(const glm::mat4 &transform, const glm::vec4 &tint) { // locals - QuadRendererProgram::QuadVertexData *bufferMap = m_QuadRenderer.GetMapCurrent(); + QuadRendererProgram::QuadVertexData *bufferMap = m_quad_renderer.GetMapCurrent(); // top left bufferMap[0].position = transform * glm::vec4(-0.5f, -0.5f, 0.0f, 1.0f); @@ -110,7 +110,7 @@ void Renderer::DrawQuadImpl(const glm::mat4 &transform, const glm::vec4 &tint) bufferMap[3].tint = tint; // advance - if (!m_QuadRenderer.Advance()) + if (!m_quad_renderer.Advance()) { LOG(warn, "Exceeded LT_MAX_QUAD_RENDERER_VERTICES: {}", LT_MAX_QUAD_RENDERER_VERTICES); FlushScene(); @@ -126,7 +126,7 @@ void Renderer::DrawQuadImpl(const glm::mat4 &transform, Ref texture) texture->Bind(); // locals - TextureRendererProgram::TextureVertexData *bufferMap = m_TextureRenderer.GetMapCurrent(); + TextureRendererProgram::TextureVertexData *bufferMap = m_texture_renderer.GetMapCurrent(); // top left bufferMap[0].position = transform * glm::vec4(-0.5f, -0.5f, 0.0f, 1.0f); @@ -145,7 +145,7 @@ void Renderer::DrawQuadImpl(const glm::mat4 &transform, Ref texture) bufferMap[3].texcoord = { 0.0f, 1.0f }; // advance - if (!m_TextureRenderer.Advance()) + if (!m_texture_renderer.Advance()) { LOG(warn, "Exceeded LT_MAX_TEXTURE_RENDERER_VERTICES: {}", LT_MAX_TEXTURE_RENDERER_VERTICES ); @@ -160,7 +160,7 @@ void Renderer::DrawQuadImpl(const glm::mat4 &transform, const glm::vec4 &tint, R texture->Bind(); // locals - TintedTextureRendererProgram::TintedTextureVertexData *bufferMap = m_TintedTextureRenderer + TintedTextureRendererProgram::TintedTextureVertexData *bufferMap = m_tinted_texture_renderer .GetMapCurrent(); // top left @@ -184,7 +184,7 @@ void Renderer::DrawQuadImpl(const glm::mat4 &transform, const glm::vec4 &tint, R bufferMap[3].texcoord = { 0.0f, 1.0f }; // advance - if (!m_TintedTextureRenderer.Advance()) + if (!m_tinted_texture_renderer.Advance()) { LOG(warn, "Exceeded LT_MAX_TEXTURE_RENDERER_VERTICES: {}", LT_MAX_TEXTURE_RENDERER_VERTICES ); @@ -200,13 +200,13 @@ void Renderer::BeginFrame() void Renderer::EndFrame() { - m_RenderCommand->SwapBuffers(); - m_RenderCommand->ClearBackBuffer( - m_DefaultFramebufferCamera ? m_DefaultFramebufferCamera->GetBackgroundColor() : + m_render_command->SwapBuffers(); + m_render_command->ClearBackBuffer( + m_default_framebuffer_camera ? m_default_framebuffer_camera->GetBackgroundColor() : glm::vec4(0.0f) ); - m_DefaultFramebufferCamera = nullptr; + m_default_framebuffer_camera = nullptr; } void Renderer::BeginSceneImpl( @@ -216,89 +216,89 @@ void Renderer::BeginSceneImpl( ) { // determine the target frame buffer - m_TargetFramebuffer = targetFrameBuffer; + m_target_framebuffer = targetFrameBuffer; if (targetFrameBuffer) targetFrameBuffer->BindAsTarget(camera->GetBackgroundColor()); else { - m_DefaultFramebufferCamera = camera; - m_RenderCommand->DefaultTargetFramebuffer(); + m_default_framebuffer_camera = camera; + m_render_command->DefaultTargetFramebuffer(); } // update view projection buffer - glm::mat4 *map = (glm::mat4 *)m_ViewProjectionBuffer->Map(); + glm::mat4 *map = (glm::mat4 *)m_view_projection_buffer->Map(); map[0] = camera->GetProjection() * glm::inverse(cameraTransform); - m_ViewProjectionBuffer->UnMap(); + m_view_projection_buffer->UnMap(); // map renderers - m_QuadRenderer.Map(); - m_TextureRenderer.Map(); - m_TintedTextureRenderer.Map(); + m_quad_renderer.Map(); + m_texture_renderer.Map(); + m_tinted_texture_renderer.Map(); } void Renderer::FlushScene() { /* tinted texture renderer */ - m_TintedTextureRenderer.UnMap(); - if (m_TintedTextureRenderer.GetQuadCount()) + m_tinted_texture_renderer.UnMap(); + if (m_tinted_texture_renderer.GetQuadCount()) { - m_TintedTextureRenderer.Bind(); - m_RenderCommand->DrawIndexed(m_TintedTextureRenderer.GetQuadCount() * 6u); + m_tinted_texture_renderer.Bind(); + m_render_command->DrawIndexed(m_tinted_texture_renderer.GetQuadCount() * 6u); } /* quad renderer */ - m_QuadRenderer.UnMap(); - if (m_QuadRenderer.GetQuadCount()) + m_quad_renderer.UnMap(); + if (m_quad_renderer.GetQuadCount()) { - m_QuadRenderer.Bind(); - m_RenderCommand->DrawIndexed(m_QuadRenderer.GetQuadCount() * 6u); + m_quad_renderer.Bind(); + m_render_command->DrawIndexed(m_quad_renderer.GetQuadCount() * 6u); } /* texture renderer */ - m_TextureRenderer.UnMap(); - if (m_TextureRenderer.GetQuadCount()) + m_texture_renderer.UnMap(); + if (m_texture_renderer.GetQuadCount()) { - m_TextureRenderer.Bind(); - m_RenderCommand->DrawIndexed(m_TextureRenderer.GetQuadCount() * 6u); + m_texture_renderer.Bind(); + m_render_command->DrawIndexed(m_texture_renderer.GetQuadCount() * 6u); } - m_QuadRenderer.Map(); - m_TextureRenderer.Map(); - m_TintedTextureRenderer.Map(); + m_quad_renderer.Map(); + m_texture_renderer.Map(); + m_tinted_texture_renderer.Map(); } void Renderer::EndSceneImpl() { /* tinted texture renderer */ - m_TintedTextureRenderer.UnMap(); - if (m_TintedTextureRenderer.GetQuadCount()) + m_tinted_texture_renderer.UnMap(); + if (m_tinted_texture_renderer.GetQuadCount()) { - m_TintedTextureRenderer.Bind(); - m_RenderCommand->DrawIndexed(m_TintedTextureRenderer.GetQuadCount() * 6u); + m_tinted_texture_renderer.Bind(); + m_render_command->DrawIndexed(m_tinted_texture_renderer.GetQuadCount() * 6u); } /* quad renderer */ - m_QuadRenderer.UnMap(); - if (m_QuadRenderer.GetQuadCount()) + m_quad_renderer.UnMap(); + if (m_quad_renderer.GetQuadCount()) { - m_QuadRenderer.Bind(); - m_RenderCommand->DrawIndexed(m_QuadRenderer.GetQuadCount() * 6u); + m_quad_renderer.Bind(); + m_render_command->DrawIndexed(m_quad_renderer.GetQuadCount() * 6u); } /* texture renderer */ - m_TextureRenderer.UnMap(); - if (m_TextureRenderer.GetQuadCount()) + m_texture_renderer.UnMap(); + if (m_texture_renderer.GetQuadCount()) { - m_TextureRenderer.Bind(); - m_RenderCommand->DrawIndexed(m_TextureRenderer.GetQuadCount() * 6u); + m_texture_renderer.Bind(); + m_render_command->DrawIndexed(m_texture_renderer.GetQuadCount() * 6u); } // reset frame buffer - if (m_TargetFramebuffer) + if (m_target_framebuffer) { - m_TargetFramebuffer = nullptr; - m_RenderCommand->DefaultTargetFramebuffer(); + m_target_framebuffer = nullptr; + m_render_command->DefaultTargetFramebuffer(); } } diff --git a/modules/engine/src/graphics/renderer_programs/quad.cpp b/modules/engine/src/graphics/renderer_programs/quad.cpp index 64c8dea..47115c1 100644 --- a/modules/engine/src/graphics/renderer_programs/quad.cpp +++ b/modules/engine/src/graphics/renderer_programs/quad.cpp @@ -8,13 +8,13 @@ namespace Light { QuadRendererProgram::QuadRendererProgram(unsigned int maxVertices, Ref sharedContext) - : m_Shader(nullptr) - , m_IndexBuffer(nullptr) - , m_VertexLayout(nullptr) - , m_MapCurrent(nullptr) - , m_MapEnd(nullptr) - , m_QuadCount(0u) - , m_MaxVertices(maxVertices) + : m_shader(nullptr) + , m_index_buffer(nullptr) + , m_vertex_layout(nullptr) + , m_map_current(nullptr) + , m_map_end(nullptr) + , m_quad_count(0u) + , m_max_vertices(maxVertices) { // #todo: don't use relative path ResourceManager::LoadShader( @@ -23,16 +23,16 @@ QuadRendererProgram::QuadRendererProgram(unsigned int maxVertices, Ref( + m_shader = ResourceManager::GetShader("LT_ENGINE_RESOURCES_QUAD_SHADER"); + m_vertex_buffer = Ref( VertexBuffer::Create(nullptr, sizeof(QuadVertexData), maxVertices, sharedContext) ); - m_IndexBuffer = Ref( + m_index_buffer = Ref( IndexBuffer::Create(nullptr, (maxVertices / 4) * 6, sharedContext) ); - m_VertexLayout = Ref(VertexLayout::Create( - m_VertexBuffer, - m_Shader, + m_vertex_layout = Ref(VertexLayout::Create( + m_vertex_buffer, + m_shader, { { "POSITION", VertexElementType::Float4 }, { "COLOR", VertexElementType::Float4 } }, sharedContext )); @@ -40,37 +40,37 @@ QuadRendererProgram::QuadRendererProgram(unsigned int maxVertices, Ref= m_MapEnd) + if (m_map_current >= m_map_end) { - LOG(warn, "'VertexBuffer' map went beyond 'MaxVertices': {}", m_MaxVertices); + LOG(warn, "'VertexBuffer' map went beyond 'MaxVertices': {}", m_max_vertices); return false; } - m_QuadCount++; + m_quad_count++; return true; } void QuadRendererProgram::Map() { - m_QuadCount = 0u; + m_quad_count = 0u; - m_MapCurrent = (QuadRendererProgram::QuadVertexData *)m_VertexBuffer->Map(); - m_MapEnd = m_MapCurrent + m_MaxVertices; + m_map_current = (QuadRendererProgram::QuadVertexData *)m_vertex_buffer->Map(); + m_map_end = m_map_current + m_max_vertices; } void QuadRendererProgram::UnMap() { - m_VertexBuffer->UnMap(); + m_vertex_buffer->UnMap(); } void QuadRendererProgram::Bind() { - m_Shader->Bind(); - m_VertexLayout->Bind(); - m_VertexBuffer->Bind(); - m_IndexBuffer->Bind(); + m_shader->Bind(); + m_vertex_layout->Bind(); + m_vertex_buffer->Bind(); + m_index_buffer->Bind(); } } // namespace Light diff --git a/modules/engine/src/graphics/renderer_programs/texture.cpp b/modules/engine/src/graphics/renderer_programs/texture.cpp index 5790e59..11398d2 100644 --- a/modules/engine/src/graphics/renderer_programs/texture.cpp +++ b/modules/engine/src/graphics/renderer_programs/texture.cpp @@ -11,13 +11,13 @@ TextureRendererProgram::TextureRendererProgram( unsigned int maxVertices, Ref sharedContext ) - : m_Shader(nullptr) - , m_IndexBuffer(nullptr) - , m_VertexLayout(nullptr) - , m_MapCurrent(nullptr) - , m_MapEnd(nullptr) - , m_QuadCount(0u) - , m_MaxVertices(maxVertices) + : m_shader(nullptr) + , m_index_buffer(nullptr) + , m_vertex_layout(nullptr) + , m_map_current(nullptr) + , m_map_end(nullptr) + , m_quad_count(0u) + , m_max_vertices(maxVertices) { // #todo: don't use relative path ResourceManager::LoadShader( @@ -26,16 +26,16 @@ TextureRendererProgram::TextureRendererProgram( "Assets/Shaders/Texture/Texture_PS.glsl" ); - m_Shader = ResourceManager::GetShader("LT_ENGINE_RESOURCES_TEXTURE_SHADER"); - m_VertexBuffer = Ref( + m_shader = ResourceManager::GetShader("LT_ENGINE_RESOURCES_TEXTURE_SHADER"); + m_vertex_buffer = Ref( VertexBuffer::Create(nullptr, sizeof(TextureVertexData), maxVertices, sharedContext) ); - m_IndexBuffer = Ref( + m_index_buffer = Ref( IndexBuffer::Create(nullptr, (maxVertices / 4) * 6, sharedContext) ); - m_VertexLayout = Ref(VertexLayout::Create( - m_VertexBuffer, - m_Shader, + m_vertex_layout = Ref(VertexLayout::Create( + m_vertex_buffer, + m_shader, { { "POSITION", VertexElementType::Float4 }, { "TEXCOORD", VertexElementType::Float2 } }, sharedContext )); @@ -43,36 +43,36 @@ TextureRendererProgram::TextureRendererProgram( bool TextureRendererProgram::Advance() { - if (m_MapCurrent + 4 >= m_MapEnd) + if (m_map_current + 4 >= m_map_end) { - LOG(warn, "'VertexBuffer' map went beyond 'MaxVertices': {}", m_MaxVertices); + LOG(warn, "'VertexBuffer' map went beyond 'MaxVertices': {}", m_max_vertices); return false; } - m_MapCurrent += 4; - m_QuadCount++; + m_map_current += 4; + m_quad_count++; return true; } void TextureRendererProgram::Map() { - m_QuadCount = 0u; + m_quad_count = 0u; - m_MapCurrent = (TextureRendererProgram::TextureVertexData *)m_VertexBuffer->Map(); - m_MapEnd = m_MapCurrent + m_MaxVertices; + m_map_current = (TextureRendererProgram::TextureVertexData *)m_vertex_buffer->Map(); + m_map_end = m_map_current + m_max_vertices; } void TextureRendererProgram::UnMap() { - m_VertexBuffer->UnMap(); + m_vertex_buffer->UnMap(); } void TextureRendererProgram::Bind() { - m_Shader->Bind(); - m_VertexLayout->Bind(); - m_VertexBuffer->Bind(); - m_IndexBuffer->Bind(); + m_shader->Bind(); + m_vertex_layout->Bind(); + m_vertex_buffer->Bind(); + m_index_buffer->Bind(); } } // namespace Light diff --git a/modules/engine/src/graphics/renderer_programs/tinted_texture.cpp b/modules/engine/src/graphics/renderer_programs/tinted_texture.cpp index 6b81d83..74d18a8 100644 --- a/modules/engine/src/graphics/renderer_programs/tinted_texture.cpp +++ b/modules/engine/src/graphics/renderer_programs/tinted_texture.cpp @@ -11,13 +11,13 @@ TintedTextureRendererProgram::TintedTextureRendererProgram( unsigned int maxVertices, Ref sharedContext ) - : m_Shader(nullptr) - , m_IndexBuffer(nullptr) - , m_VertexLayout(nullptr) - , m_MapCurrent(nullptr) - , m_MapEnd(nullptr) - , m_QuadCount(0u) - , m_MaxVertices(maxVertices) + : m_shader(nullptr) + , m_index_buffer(nullptr) + , m_vertex_layout(nullptr) + , m_map_current(nullptr) + , m_map_end(nullptr) + , m_quad_count(0u) + , m_max_vertices(maxVertices) { // #todo: don't use relative path ResourceManager::LoadShader( @@ -26,16 +26,16 @@ TintedTextureRendererProgram::TintedTextureRendererProgram( "Assets/Shaders/TintedTexture/TintedTexture_PS.glsl" ); - m_Shader = ResourceManager::GetShader("LT_ENGINE_RESOURCES_TINTED_TEXTURE_SHADER"); - m_VertexBuffer = Ref( + m_shader = ResourceManager::GetShader("LT_ENGINE_RESOURCES_TINTED_TEXTURE_SHADER"); + m_vertex_buffer = Ref( VertexBuffer::Create(nullptr, sizeof(TintedTextureVertexData), maxVertices, sharedContext) ); - m_IndexBuffer = Ref( + m_index_buffer = Ref( IndexBuffer::Create(nullptr, (maxVertices / 4) * 6, sharedContext) ); - m_VertexLayout = Ref(VertexLayout::Create( - m_VertexBuffer, - m_Shader, + m_vertex_layout = Ref(VertexLayout::Create( + m_vertex_buffer, + m_shader, { { "POSITION", VertexElementType::Float4 }, { "TINT", VertexElementType::Float4 }, { "TEXCOORD", VertexElementType::Float2 } }, @@ -45,37 +45,37 @@ TintedTextureRendererProgram::TintedTextureRendererProgram( bool TintedTextureRendererProgram::Advance() { - m_MapCurrent += 4; + m_map_current += 4; - if (m_MapCurrent >= m_MapEnd) + if (m_map_current >= m_map_end) { - LOG(warn, "'VertexBuffer' map went beyond 'MaxVertices': {}", m_MaxVertices); + LOG(warn, "'VertexBuffer' map went beyond 'MaxVertices': {}", m_max_vertices); return false; } - m_QuadCount++; + m_quad_count++; return true; } void TintedTextureRendererProgram::Map() { - m_QuadCount = 0u; + m_quad_count = 0u; - m_MapCurrent = (TintedTextureRendererProgram::TintedTextureVertexData *)m_VertexBuffer->Map(); - m_MapEnd = m_MapCurrent + m_MaxVertices; + m_map_current = (TintedTextureRendererProgram::TintedTextureVertexData *)m_vertex_buffer->Map(); + m_map_end = m_map_current + m_max_vertices; } void TintedTextureRendererProgram::UnMap() { - m_VertexBuffer->UnMap(); + m_vertex_buffer->UnMap(); } void TintedTextureRendererProgram::Bind() { - m_Shader->Bind(); - m_VertexLayout->Bind(); - m_VertexBuffer->Bind(); - m_IndexBuffer->Bind(); + m_shader->Bind(); + m_vertex_layout->Bind(); + m_vertex_buffer->Bind(); + m_index_buffer->Bind(); } } // namespace Light diff --git a/modules/engine/src/graphics/texture.cpp b/modules/engine/src/graphics/texture.cpp index cbcd319..0ad8f68 100644 --- a/modules/engine/src/graphics/texture.cpp +++ b/modules/engine/src/graphics/texture.cpp @@ -44,7 +44,7 @@ Ref Texture::Create( } } -Texture::Texture(const std::string &filePath): m_FilePath(filePath) +Texture::Texture(const std::string &filePath): m_file_path(filePath) { } diff --git a/modules/engine/src/input/input.cpp b/modules/engine/src/input/input.cpp index 52bffea..482c83a 100644 --- a/modules/engine/src/input/input.cpp +++ b/modules/engine/src/input/input.cpp @@ -16,13 +16,13 @@ Scope Input::Create() } Input::Input() - : m_KeyboadKeys {} - , m_MouseButtons {} - , m_MousePosition {} - , m_MouseDelta {} - , m_MouseWheelDelta {} - , m_UserInterfaceEvents(true) - , m_GameEvents(true) + : m_keyboad_keys {} + , m_mouse_buttons {} + , m_mouse_position {} + , m_mouse_delta {} + , m_mouse_wheel_delta {} + , m_user_interface_events(true) + , m_game_events(true) { ASSERT( !s_Context, @@ -35,26 +35,26 @@ Input::Input() void Input::ReceiveUserInterfaceEventsImpl(bool receive, bool toggle /* = false */) { - m_UserInterfaceEvents = toggle ? !m_UserInterfaceEvents : receive; + m_user_interface_events = toggle ? !m_user_interface_events : receive; } void Input::ReceieveGameEventsImpl(bool receive, bool toggle /*= false*/) { - bool prev = m_GameEvents; - m_GameEvents = toggle ? !m_UserInterfaceEvents : receive; + bool prev = m_game_events; + m_game_events = toggle ? !m_user_interface_events : receive; - if (m_GameEvents != prev) + if (m_game_events != prev) RestartInputState(); } void Input::RestartInputState() { - m_KeyboadKeys.fill(false); - m_MouseButtons.fill(false); + m_keyboad_keys.fill(false); + m_mouse_buttons.fill(false); - m_MousePosition = glm::vec2(0.0f); - m_MouseDelta = glm::vec2(0.0f); - m_MouseWheelDelta = 0.0f; + m_mouse_position = glm::vec2(0.0f); + m_mouse_delta = glm::vec2(0.0f); + m_mouse_wheel_delta = 0.0f; } void Input::OnEvent(const Event &inputEvent) @@ -67,13 +67,13 @@ void Input::OnEvent(const Event &inputEvent) { const MouseMovedEvent &event = (const MouseMovedEvent &)inputEvent; - if (m_GameEvents) + if (m_game_events) { - m_MouseDelta = event.GetPosition() - m_MousePosition; - m_MousePosition = event.GetPosition(); + m_mouse_delta = event.GetPosition() - m_mouse_position; + m_mouse_position = event.GetPosition(); } - if (m_UserInterfaceEvents) + if (m_user_interface_events) io.MousePos = ImVec2(event.GetX(), event.GetY()); return; @@ -82,10 +82,10 @@ void Input::OnEvent(const Event &inputEvent) { const ButtonPressedEvent &event = (const ButtonPressedEvent &)inputEvent; - if (m_GameEvents) - m_MouseButtons[event.GetButton()] = true; + if (m_game_events) + m_mouse_buttons[event.GetButton()] = true; - if (m_UserInterfaceEvents) + if (m_user_interface_events) io.MouseDown[event.GetButton()] = true; return; @@ -94,10 +94,10 @@ void Input::OnEvent(const Event &inputEvent) { const ButtonReleasedEvent &event = (const ButtonReleasedEvent &)inputEvent; - if (m_GameEvents) - m_MouseButtons[event.GetButton()] = false; + if (m_game_events) + m_mouse_buttons[event.GetButton()] = false; - if (m_UserInterfaceEvents) + if (m_user_interface_events) io.MouseDown[event.GetButton()] = false; return; @@ -106,10 +106,10 @@ void Input::OnEvent(const Event &inputEvent) { const WheelScrolledEvent &event = (const WheelScrolledEvent &)inputEvent; - if (m_GameEvents) - m_MouseWheelDelta = event.GetOffset(); + if (m_game_events) + m_mouse_wheel_delta = event.GetOffset(); - if (m_UserInterfaceEvents) + if (m_user_interface_events) io.MouseWheel = event.GetOffset(); return; @@ -119,10 +119,10 @@ void Input::OnEvent(const Event &inputEvent) { const KeyPressedEvent &event = (const KeyPressedEvent &)inputEvent; - if (m_GameEvents) - m_KeyboadKeys[event.GetKey()] = true; + if (m_game_events) + m_keyboad_keys[event.GetKey()] = true; - if (m_UserInterfaceEvents) + if (m_user_interface_events) { io.KeysDown[event.GetKey()] = true; // if (event.GetKey() == Key::BackSpace) @@ -135,17 +135,17 @@ void Input::OnEvent(const Event &inputEvent) { const KeyReleasedEvent &event = (const KeyReleasedEvent &)inputEvent; - if (m_GameEvents) - m_KeyboadKeys[event.GetKey()] = false; + if (m_game_events) + m_keyboad_keys[event.GetKey()] = false; - if (m_UserInterfaceEvents) + if (m_user_interface_events) io.KeysDown[event.GetKey()] = false; return; } case EventType::SetChar: { - if (m_UserInterfaceEvents) + if (m_user_interface_events) { const SetCharEvent &event = (const SetCharEvent &)inputEvent; io.AddInputCharacter(event.GetCharacter()); diff --git a/modules/engine/src/layer/layer.cpp b/modules/engine/src/layer/layer.cpp index c1d5ec3..8969d84 100644 --- a/modules/engine/src/layer/layer.cpp +++ b/modules/engine/src/layer/layer.cpp @@ -7,7 +7,7 @@ namespace Light { -Layer::Layer(const std::string &name): m_LayerName(name) +Layer::Layer(const std::string &name): m_layer_name(name) { } diff --git a/modules/engine/src/layer/layer_stack.cpp b/modules/engine/src/layer/layer_stack.cpp index 24c85b5..cbac910 100644 --- a/modules/engine/src/layer/layer_stack.cpp +++ b/modules/engine/src/layer/layer_stack.cpp @@ -14,7 +14,7 @@ Scope LayerStack::Create() return MakeScope(new LayerStack()); } -LayerStack::LayerStack(): m_Layers {}, m_Begin(), m_End() +LayerStack::LayerStack(): m_layers {}, m_begin(), m_end() { ASSERT(!s_Context, "An instance of 'LayerStack' already exists, do not construct this class!") s_Context = this; @@ -22,16 +22,16 @@ LayerStack::LayerStack(): m_Layers {}, m_Begin(), m_End() LayerStack::~LayerStack() { - for (Layer *layer : m_Layers) + for (Layer *layer : m_layers) delete layer; } void LayerStack::AttachLayerImpl(Layer *layer) { // #todo: handle attaching layer inside a for loop - m_Layers.push_back(layer); - m_Begin = m_Layers.begin(); - m_End = m_Layers.end(); + m_layers.push_back(layer); + m_begin = m_layers.begin(); + m_end = m_layers.end(); LOG(trace, "Attached [{}]", layer->GetName()); } @@ -39,9 +39,9 @@ void LayerStack::AttachLayerImpl(Layer *layer) void LayerStack::DetachLayerImpl(Layer *layer) { // #todo: handle detaching layer inside a for loop - m_Layers.erase(std::find(m_Layers.begin(), m_Layers.end(), layer)); - m_Begin = m_Layers.begin(); - m_End = m_Layers.end(); + m_layers.erase(std::find(m_layers.begin(), m_layers.end(), layer)); + m_begin = m_layers.begin(); + m_end = m_layers.end(); LOG(trace, "Detached [{}]", layer->GetName()); } diff --git a/modules/engine/src/platform/graphics/directx/blender.cpp b/modules/engine/src/platform/graphics/directx/blender.cpp index 7ba8ae5..63aa69c 100644 --- a/modules/engine/src/platform/graphics/directx/blender.cpp +++ b/modules/engine/src/platform/graphics/directx/blender.cpp @@ -4,7 +4,7 @@ namespace Light { dxBlender::dxBlender(Ref sharedContext) - : m_Context(sharedContext), m_FactorMap { // constants + : m_context(sharedContext), m_factor_map { // constants { BlendFactor::ZERO, D3D11_BLEND_ZERO }, { BlendFactor::ONE, D3D11_BLEND_ONE }, @@ -29,53 +29,53 @@ dxBlender::dxBlender(Ref sharedContext) { BlendFactor::SRC1_ALPHA, D3D11_BLEND_SRC1_ALPHA }, { BlendFactor::INVERSE_SRC1_ALPHA, D3D11_BLEND_INV_SRC1_ALPHA } } - , m_BlendState(nullptr) - , m_Desc {} + , m_blend_state(nullptr) + , m_desc {} { // factor map // blender desc - m_Desc = {}; + m_desc = {}; - m_Desc.RenderTarget[0].BlendEnable = true; - m_Desc.RenderTarget[0].SrcBlend = D3D11_BLEND_ZERO; - m_Desc.RenderTarget[0].DestBlend = D3D11_BLEND_ZERO; - m_Desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; - m_Desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ZERO; - m_Desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE; - m_Desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; - m_Desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + m_desc.RenderTarget[0].BlendEnable = true; + m_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_ZERO; + m_desc.RenderTarget[0].DestBlend = D3D11_BLEND_ZERO; + m_desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + m_desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ZERO; + m_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE; + m_desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + m_desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; // create blend state HRESULT hr; - DXC(m_Context->GetDevice()->CreateBlendState(&m_Desc, &m_BlendState)); + DXC(m_context->GetDevice()->CreateBlendState(&m_desc, &m_blend_state)); } void dxBlender::Enable(BlendFactor srcFactor, BlendFactor dstFactor) { // update desc - m_Desc.RenderTarget[0].BlendEnable = true; - m_Desc.RenderTarget[0].SrcBlend = m_FactorMap.at(srcFactor); - m_Desc.RenderTarget[0].DestBlend = m_FactorMap.at(dstFactor); + m_desc.RenderTarget[0].BlendEnable = true; + m_desc.RenderTarget[0].SrcBlend = m_factor_map.at(srcFactor); + m_desc.RenderTarget[0].DestBlend = m_factor_map.at(dstFactor); // re-create blind state HRESULT hr; - DXC(m_Context->GetDevice()->CreateBlendState(&m_Desc, &m_BlendState)); + DXC(m_context->GetDevice()->CreateBlendState(&m_desc, &m_blend_state)); // bind blend state - m_Context->GetDeviceContext()->OMSetBlendState(m_BlendState.Get(), nullptr, 0x0000000f); + m_context->GetDeviceContext()->OMSetBlendState(m_blend_state.Get(), nullptr, 0x0000000f); } void dxBlender::Disable() { // update desc - m_Desc.RenderTarget[0].BlendEnable = false; + m_desc.RenderTarget[0].BlendEnable = false; // re-create blind state HRESULT hr; - DXC(m_Context->GetDevice()->CreateBlendState(&m_Desc, &m_BlendState)); + DXC(m_context->GetDevice()->CreateBlendState(&m_desc, &m_blend_state)); // bind blend state - m_Context->GetDeviceContext()->OMSetBlendState(m_BlendState.Get(), nullptr, 0xffffffff); + m_context->GetDeviceContext()->OMSetBlendState(m_blend_state.Get(), nullptr, 0xffffffff); } } // namespace Light diff --git a/modules/engine/src/platform/graphics/directx/buffers.cpp b/modules/engine/src/platform/graphics/directx/buffers.cpp index 5068bbb..8c22ce3 100644 --- a/modules/engine/src/platform/graphics/directx/buffers.cpp +++ b/modules/engine/src/platform/graphics/directx/buffers.cpp @@ -10,10 +10,10 @@ dxConstantBuffer::dxConstantBuffer( unsigned int size, Ref sharedContext ) - : m_Context(sharedContext) - , m_Buffer(nullptr) - , m_Map {} - , m_Index(static_cast(index)) + : m_context(sharedContext) + , m_buffer(nullptr) + , m_map {} + , m_index(static_cast(index)) { D3D11_BUFFER_DESC bDesc = {}; @@ -23,25 +23,25 @@ dxConstantBuffer::dxConstantBuffer( bDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; HRESULT hr; - DXC(m_Context->GetDevice()->CreateBuffer(&bDesc, nullptr, &m_Buffer)); - m_Context->GetDeviceContext()->VSSetConstantBuffers(m_Index, 1u, m_Buffer.GetAddressOf()); + DXC(m_context->GetDevice()->CreateBuffer(&bDesc, nullptr, &m_buffer)); + m_context->GetDeviceContext()->VSSetConstantBuffers(m_index, 1u, m_buffer.GetAddressOf()); } void dxConstantBuffer::Bind() { - m_Context->GetDeviceContext()->VSSetConstantBuffers(m_Index, 1u, m_Buffer.GetAddressOf()); + m_context->GetDeviceContext()->VSSetConstantBuffers(m_index, 1u, m_buffer.GetAddressOf()); } void *dxConstantBuffer::Map() { - m_Context->GetDeviceContext()->VSSetConstantBuffers(m_Index, 1u, m_Buffer.GetAddressOf()); - m_Context->GetDeviceContext()->Map(m_Buffer.Get(), NULL, D3D11_MAP_WRITE_DISCARD, NULL, &m_Map); - return m_Map.pData; + m_context->GetDeviceContext()->VSSetConstantBuffers(m_index, 1u, m_buffer.GetAddressOf()); + m_context->GetDeviceContext()->Map(m_buffer.Get(), NULL, D3D11_MAP_WRITE_DISCARD, NULL, &m_map); + return m_map.pData; } void dxConstantBuffer::UnMap() { - m_Context->GetDeviceContext()->Unmap(m_Buffer.Get(), NULL); + m_context->GetDeviceContext()->Unmap(m_buffer.Get(), NULL); } //======================================== CONSTANT_BUFFER //========================================// @@ -54,10 +54,10 @@ dxVertexBuffer::dxVertexBuffer( unsigned int count, Ref sharedContext ) - : m_Context(sharedContext) - , m_Buffer(nullptr) - , m_Map {} - , m_Stride(stride) + : m_context(sharedContext) + , m_buffer(nullptr) + , m_map {} + , m_stride(stride) { // buffer desc D3D11_BUFFER_DESC bDesc = {}; @@ -71,7 +71,7 @@ dxVertexBuffer::dxVertexBuffer( // create buffer HRESULT hr; - DXC(m_Context->GetDevice()->CreateBuffer(&bDesc, nullptr, &m_Buffer)); + DXC(m_context->GetDevice()->CreateBuffer(&bDesc, nullptr, &m_buffer)); } dxVertexBuffer::~dxVertexBuffer() @@ -81,20 +81,20 @@ dxVertexBuffer::~dxVertexBuffer() void *dxVertexBuffer::Map() { - m_Context->GetDeviceContext()->Map(m_Buffer.Get(), NULL, D3D11_MAP_WRITE_DISCARD, NULL, &m_Map); - return m_Map.pData; + m_context->GetDeviceContext()->Map(m_buffer.Get(), NULL, D3D11_MAP_WRITE_DISCARD, NULL, &m_map); + return m_map.pData; } void dxVertexBuffer::UnMap() { - m_Context->GetDeviceContext()->Unmap(m_Buffer.Get(), NULL); + m_context->GetDeviceContext()->Unmap(m_buffer.Get(), NULL); } void dxVertexBuffer::Bind() { static const unsigned int offset = 0u; - m_Context->GetDeviceContext() - ->IASetVertexBuffers(0u, 1u, m_Buffer.GetAddressOf(), &m_Stride, &offset); + m_context->GetDeviceContext() + ->IASetVertexBuffers(0u, 1u, m_buffer.GetAddressOf(), &m_stride, &offset); } void dxVertexBuffer::UnBind() @@ -102,7 +102,7 @@ void dxVertexBuffer::UnBind() static const unsigned int offset = 0u; static ID3D11Buffer *buffer = nullptr; - m_Context->GetDeviceContext()->IASetVertexBuffers(0u, 1u, &buffer, &m_Stride, &offset); + m_context->GetDeviceContext()->IASetVertexBuffers(0u, 1u, &buffer, &m_stride, &offset); } //================================================== VERTEX_BUFFER //==================================================// @@ -113,8 +113,8 @@ dxIndexBuffer::dxIndexBuffer( unsigned int count, Ref sharedContext ) - : m_Context(sharedContext) - , m_Buffer(nullptr) + : m_context(sharedContext) + , m_buffer(nullptr) { // generate indices if not provided bool hasIndices = !!indices; @@ -159,7 +159,7 @@ dxIndexBuffer::dxIndexBuffer( // create buffer HRESULT hr; - DXC(m_Context->GetDevice()->CreateBuffer(&bDesc, &sDesc, &m_Buffer)); + DXC(m_context->GetDevice()->CreateBuffer(&bDesc, &sDesc, &m_buffer)); // delete indices if (!hasIndices) @@ -173,7 +173,7 @@ dxIndexBuffer::~dxIndexBuffer() void dxIndexBuffer::Bind() { - m_Context->GetDeviceContext()->IASetIndexBuffer(m_Buffer.Get(), DXGI_FORMAT_R32_UINT, 0u); + m_context->GetDeviceContext()->IASetIndexBuffer(m_buffer.Get(), DXGI_FORMAT_R32_UINT, 0u); } void dxIndexBuffer::UnBind() @@ -181,7 +181,7 @@ void dxIndexBuffer::UnBind() static const unsigned int offset = 0u; static ID3D11Buffer *buffer = nullptr; - m_Context->GetDeviceContext()->IASetIndexBuffer(buffer, DXGI_FORMAT_R32_UINT, offset); + m_context->GetDeviceContext()->IASetIndexBuffer(buffer, DXGI_FORMAT_R32_UINT, offset); } //======================================== INDEX_BUFFER ========================================// diff --git a/modules/engine/src/platform/graphics/directx/framebuffers.cpp b/modules/engine/src/platform/graphics/directx/framebuffers.cpp index b236307..2709424 100644 --- a/modules/engine/src/platform/graphics/directx/framebuffers.cpp +++ b/modules/engine/src/platform/graphics/directx/framebuffers.cpp @@ -7,13 +7,13 @@ dxFramebuffer::dxFramebuffer( const FramebufferSpecification &specification, Ref sharedContext ) - : m_Context(sharedContext) - , m_Specification(specification) - , m_RenderTargetView(nullptr) - , m_ColorAttachment(nullptr) - , m_DepthStencilAttachment(nullptr) - , m_ShaderResourceView(nullptr) - , m_DepthStencilView(nullptr) + : m_context(sharedContext) + , m_specification(specification) + , m_render_target_view(nullptr) + , m_color_attachment(nullptr) + , m_depth_stencil_attachment(nullptr) + , m_shader_resource_view(nullptr) + , m_depth_stencil_view(nullptr) { HRESULT hr; @@ -29,22 +29,22 @@ dxFramebuffer::dxFramebuffer( t2dDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE; t2dDesc.CPUAccessFlags = NULL; t2dDesc.MiscFlags = NULL; - DXC(m_Context->GetDevice()->CreateTexture2D(&t2dDesc, nullptr, &m_ColorAttachment)); + DXC(m_context->GetDevice()->CreateTexture2D(&t2dDesc, nullptr, &m_color_attachment)); D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; srvDesc.Format = t2dDesc.Format; srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; srvDesc.Texture2D.MipLevels = 1; srvDesc.Texture2D.MostDetailedMip = 0; - DXC(m_Context->GetDevice() - ->CreateShaderResourceView(m_ColorAttachment.Get(), &srvDesc, &m_ShaderResourceView)); + DXC(m_context->GetDevice() + ->CreateShaderResourceView(m_color_attachment.Get(), &srvDesc, &m_shader_resource_view)); D3D11_RENDER_TARGET_VIEW_DESC rtvDesc = {}; rtvDesc.Format = t2dDesc.Format; rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; rtvDesc.Texture2D.MipSlice = 0u; - DXC(m_Context->GetDevice() - ->CreateRenderTargetView(m_ColorAttachment.Get(), &rtvDesc, &m_RenderTargetView)); + DXC(m_context->GetDevice() + ->CreateRenderTargetView(m_color_attachment.Get(), &rtvDesc, &m_render_target_view)); } void dxFramebuffer::BindAsTarget(const glm::vec4 &clearColor) @@ -56,23 +56,23 @@ void dxFramebuffer::BindAsTarget(const glm::vec4 &clearColor) clearColor.a, }; - m_Context->GetDeviceContext() - ->OMSetRenderTargets(1u, m_RenderTargetView.GetAddressOf(), nullptr); - m_Context->GetDeviceContext()->ClearRenderTargetView(m_RenderTargetView.Get(), color); + m_context->GetDeviceContext() + ->OMSetRenderTargets(1u, m_render_target_view.GetAddressOf(), nullptr); + m_context->GetDeviceContext()->ClearRenderTargetView(m_render_target_view.Get(), color); D3D11_VIEWPORT viewport; viewport.TopLeftX = 0; viewport.TopLeftY = 0; - viewport.Width = m_Specification.width; - viewport.Height = m_Specification.height; + viewport.Width = m_specification.width; + viewport.Height = m_specification.height; viewport.MinDepth = 0.0f; viewport.MaxDepth = 1.0f; // set viewport - m_Context->GetDeviceContext()->RSSetViewports(1u, &viewport); + m_context->GetDeviceContext()->RSSetViewports(1u, &viewport); } void dxFramebuffer::BindAsResource() @@ -82,26 +82,26 @@ void dxFramebuffer::BindAsResource() void dxFramebuffer::Resize(const glm::uvec2 &size) { - m_Specification.width = std::clamp(size.x, 1u, 16384u); - m_Specification.height = std::clamp(size.y, 1u, 16384u); + m_specification.width = std::clamp(size.x, 1u, 16384u); + m_specification.height = std::clamp(size.y, 1u, 16384u); D3D11_TEXTURE2D_DESC textureDesc; D3D11_RENDER_TARGET_VIEW_DESC rtvDesc; D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc; - m_ColorAttachment->GetDesc(&textureDesc); - m_RenderTargetView->GetDesc(&rtvDesc); - m_ShaderResourceView->GetDesc(&srvDesc); + m_color_attachment->GetDesc(&textureDesc); + m_render_target_view->GetDesc(&rtvDesc); + m_shader_resource_view->GetDesc(&srvDesc); - textureDesc.Width = m_Specification.width; - textureDesc.Height = m_Specification.height; + textureDesc.Width = m_specification.width; + textureDesc.Height = m_specification.height; HRESULT hr; - DXC(m_Context->GetDevice()->CreateTexture2D(&textureDesc, nullptr, &m_ColorAttachment)); - DXC(m_Context->GetDevice() - ->CreateRenderTargetView(m_ColorAttachment.Get(), &rtvDesc, &m_RenderTargetView)); - DXC(m_Context->GetDevice() - ->CreateShaderResourceView(m_ColorAttachment.Get(), &srvDesc, &m_ShaderResourceView)); + DXC(m_context->GetDevice()->CreateTexture2D(&textureDesc, nullptr, &m_color_attachment)); + DXC(m_context->GetDevice() + ->CreateRenderTargetView(m_color_attachment.Get(), &rtvDesc, &m_render_target_view)); + DXC(m_context->GetDevice() + ->CreateShaderResourceView(m_color_attachment.Get(), &srvDesc, &m_shader_resource_view)); } } // namespace Light diff --git a/modules/engine/src/platform/graphics/directx/graphics_context.cpp b/modules/engine/src/platform/graphics/directx/graphics_context.cpp index a53bcac..6ffab12 100644 --- a/modules/engine/src/platform/graphics/directx/graphics_context.cpp +++ b/modules/engine/src/platform/graphics/directx/graphics_context.cpp @@ -15,13 +15,13 @@ namespace Light { dxGraphicsContext::dxGraphicsContext(GLFWwindow *windowHandle) - : m_WindowHandle(windowHandle) - , m_DebugInterface(nullptr) + : m_window_handle(windowHandle) + , m_debug_interface(nullptr) { // set 'GraphicsAPI'; - m_GraphicsAPI = GraphicsAPI::DirectX; + m_graphics_api = GraphicsAPI::DirectX; - m_SharedContext = std::make_shared(); + m_shared_context = std::make_shared(); // setup stuff SetupDeviceAndSwapChain(windowHandle); @@ -31,7 +31,7 @@ dxGraphicsContext::dxGraphicsContext(GLFWwindow *windowHandle) void dxGraphicsContext::SetupDeviceAndSwapChain(GLFWwindow *windowHandle) { - Ref context = std::static_pointer_cast(m_SharedContext); + Ref context = std::static_pointer_cast(m_shared_context); // swap chain desc DXGI_SWAP_CHAIN_DESC sd = { 0 }; @@ -86,7 +86,7 @@ void dxGraphicsContext::SetupDeviceAndSwapChain(GLFWwindow *windowHandle) void dxGraphicsContext::SetupRenderTargets() { - Ref context = std::static_pointer_cast(m_SharedContext); + Ref context = std::static_pointer_cast(m_shared_context); // set primitive topology context->GetDeviceContext()->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); @@ -107,7 +107,7 @@ void dxGraphicsContext::SetupRenderTargets() void dxGraphicsContext::SetupDebugInterface() { #ifdef LIGHT_DEBUG - Ref context = std::static_pointer_cast(m_SharedContext); + Ref context = std::static_pointer_cast(m_shared_context); HRESULT hr; Microsoft::WRL::ComPtr debugInterface = nullptr; @@ -134,7 +134,7 @@ void dxGraphicsContext::SetupDebugInterface() void dxGraphicsContext::LogDebugData() { - Ref context = std::static_pointer_cast(m_SharedContext); + Ref context = std::static_pointer_cast(m_shared_context); // locals IDXGIDevice *DXGIDevice; diff --git a/modules/engine/src/platform/graphics/directx/render_command.cpp b/modules/engine/src/platform/graphics/directx/render_command.cpp index f0d61c0..c86996a 100644 --- a/modules/engine/src/platform/graphics/directx/render_command.cpp +++ b/modules/engine/src/platform/graphics/directx/render_command.cpp @@ -3,7 +3,7 @@ namespace Light { -dxRenderCommand::dxRenderCommand(Ref sharedContext): m_Context(sharedContext) +dxRenderCommand::dxRenderCommand(Ref sharedContext): m_context(sharedContext) { } @@ -11,42 +11,42 @@ void dxRenderCommand::SwapBuffers() { #ifdef LIGHT_DEBUG HRESULT hr; - if (FAILED(hr = m_Context->GetSwapChain()->Present(1u, 0u))) + if (FAILED(hr = m_context->GetSwapChain()->Present(1u, 0u))) { if (hr == DXGI_ERROR_DEVICE_REMOVED) { LOG(critical, "dxRenderCommand::SwapBuffers: DeviceRemoved:"); - LOG(critical, " {}", m_Context->GetDevice()->GetDeviceRemovedReason()); + LOG(critical, " {}", m_context->GetDevice()->GetDeviceRemovedReason()); throw dxException(hr, __FILE__, __LINE__); } } #else - m_Context->GetSwapChain()->Present(0u, 0u); + m_context->GetSwapChain()->Present(0u, 0u); #endif } void dxRenderCommand::ClearBackBuffer(const glm::vec4 &clearColor) { - m_Context->GetDeviceContext()->ClearRenderTargetView( - m_Context->GetRenderTargetView().Get(), + m_context->GetDeviceContext()->ClearRenderTargetView( + m_context->GetRenderTargetView().Get(), &clearColor[0] ); } void dxRenderCommand::Draw(unsigned int count) { - m_Context->GetDeviceContext()->Draw(count, 0u); + m_context->GetDeviceContext()->Draw(count, 0u); } void dxRenderCommand::DrawIndexed(unsigned int count) { - m_Context->GetDeviceContext()->DrawIndexed(count, 0u, 0u); + m_context->GetDeviceContext()->DrawIndexed(count, 0u, 0u); } void dxRenderCommand::DefaultTargetFramebuffer() { - m_Context->GetDeviceContext() - ->OMSetRenderTargets(1, m_Context->GetRenderTargetView().GetAddressOf(), nullptr); + m_context->GetDeviceContext() + ->OMSetRenderTargets(1, m_context->GetRenderTargetView().GetAddressOf(), nullptr); } void dxRenderCommand::SetViewport( @@ -72,7 +72,7 @@ void dxRenderCommand::SetViewport( viewport.MaxDepth = 1.0f; // set viewport - m_Context->GetDeviceContext()->RSSetViewports(1u, &viewport); + m_context->GetDeviceContext()->RSSetViewports(1u, &viewport); } void dxRenderCommand::SetResolution(unsigned int width, unsigned int height) @@ -81,25 +81,25 @@ void dxRenderCommand::SetResolution(unsigned int width, unsigned int height) // remove render target ID3D11RenderTargetView *nullViews[] = { nullptr }; - m_Context->GetDeviceContext()->OMSetRenderTargets(1u, nullViews, nullptr); - m_Context->GetRenderTargetViewRef().Reset(); + m_context->GetDeviceContext()->OMSetRenderTargets(1u, nullViews, nullptr); + m_context->GetRenderTargetViewRef().Reset(); // resize buffer - DXC(m_Context->GetSwapChain() + DXC(m_context->GetSwapChain() ->ResizeBuffers(0u, width, height, DXGI_FORMAT_R8G8B8A8_UNORM, NULL)); // create render target Microsoft::WRL::ComPtr backBuffer = nullptr; - DXC(m_Context->GetSwapChain()->GetBuffer(0u, __uuidof(ID3D11Resource), &backBuffer)); - DXC(m_Context->GetDevice()->CreateRenderTargetView( + DXC(m_context->GetSwapChain()->GetBuffer(0u, __uuidof(ID3D11Resource), &backBuffer)); + DXC(m_context->GetDevice()->CreateRenderTargetView( backBuffer.Get(), nullptr, - &m_Context->GetRenderTargetViewRef() + &m_context->GetRenderTargetViewRef() )); // set render target - m_Context->GetDeviceContext() - ->OMSetRenderTargets(1u, m_Context->GetRenderTargetView().GetAddressOf(), nullptr); + m_context->GetDeviceContext() + ->OMSetRenderTargets(1u, m_context->GetRenderTargetView().GetAddressOf(), nullptr); } } // namespace Light diff --git a/modules/engine/src/platform/graphics/directx/shader.cpp b/modules/engine/src/platform/graphics/directx/shader.cpp index eabeb05..6185ece 100644 --- a/modules/engine/src/platform/graphics/directx/shader.cpp +++ b/modules/engine/src/platform/graphics/directx/shader.cpp @@ -9,10 +9,10 @@ dxShader::dxShader( BasicFileHandle pixelFile, Ref sharedContext ) - : m_Context(sharedContext) - , m_VertexShader(nullptr) - , m_PixelShader(nullptr) - , m_VertexBlob(nullptr) + : m_context(sharedContext) + , m_vertex_shader(nullptr) + , m_pixel_shader(nullptr) + , m_vertex_blob(nullptr) { Microsoft::WRL::ComPtr ps = nullptr, vsErr = nullptr, psErr = nullptr; @@ -28,7 +28,7 @@ dxShader::dxShader( "vs_4_0", NULL, NULL, - &m_VertexBlob, + &m_vertex_blob, &vsErr ); D3DCompile( @@ -51,14 +51,14 @@ dxShader::dxShader( // create shaders HRESULT hr; - DXC(m_Context->GetDevice()->CreateVertexShader( - m_VertexBlob->GetBufferPointer(), - m_VertexBlob->GetBufferSize(), + DXC(m_context->GetDevice()->CreateVertexShader( + m_vertex_blob->GetBufferPointer(), + m_vertex_blob->GetBufferSize(), NULL, - &m_VertexShader + &m_vertex_shader )); - DXC(m_Context->GetDevice() - ->CreatePixelShader(ps->GetBufferPointer(), ps->GetBufferSize(), NULL, &m_PixelShader)); + DXC(m_context->GetDevice() + ->CreatePixelShader(ps->GetBufferPointer(), ps->GetBufferSize(), NULL, &m_pixel_shader)); } dxShader::~dxShader() @@ -68,14 +68,14 @@ dxShader::~dxShader() void dxShader::Bind() { - m_Context->GetDeviceContext()->VSSetShader(m_VertexShader.Get(), nullptr, 0u); - m_Context->GetDeviceContext()->PSSetShader(m_PixelShader.Get(), nullptr, 0u); + m_context->GetDeviceContext()->VSSetShader(m_vertex_shader.Get(), nullptr, 0u); + m_context->GetDeviceContext()->PSSetShader(m_pixel_shader.Get(), nullptr, 0u); } void dxShader::UnBind() { - m_Context->GetDeviceContext()->VSSetShader(nullptr, nullptr, 0u); - m_Context->GetDeviceContext()->PSSetShader(nullptr, nullptr, 0u); + m_context->GetDeviceContext()->VSSetShader(nullptr, nullptr, 0u); + m_context->GetDeviceContext()->PSSetShader(nullptr, nullptr, 0u); } } // namespace Light diff --git a/modules/engine/src/platform/graphics/directx/texture.cpp b/modules/engine/src/platform/graphics/directx/texture.cpp index ef43c62..138127f 100644 --- a/modules/engine/src/platform/graphics/directx/texture.cpp +++ b/modules/engine/src/platform/graphics/directx/texture.cpp @@ -12,10 +12,10 @@ dxTexture::dxTexture( const std::string &filePath ) : Texture(filePath) - , m_Context(sharedContext) - , m_Texture2D(nullptr) - , m_ShaderResourceView(nullptr) - , m_SamplerState(nullptr) + , m_context(sharedContext) + , m_texture_2d(nullptr) + , m_shader_resource_view(nullptr) + , m_sampler_state(nullptr) { // texture2d desc D3D11_TEXTURE2D_DESC t2dDesc = {}; @@ -38,11 +38,11 @@ dxTexture::dxTexture( // create texture HRESULT hr; - DXC(m_Context->GetDevice()->CreateTexture2D(&t2dDesc, nullptr, &m_Texture2D)); - m_Context->GetDeviceContext() - ->UpdateSubresource(m_Texture2D.Get(), 0u, nullptr, pixels, width * 4u, 0u); + DXC(m_context->GetDevice()->CreateTexture2D(&t2dDesc, nullptr, &m_texture_2d)); + m_context->GetDeviceContext() + ->UpdateSubresource(m_texture_2d.Get(), 0u, nullptr, pixels, width * 4u, 0u); - m_Texture2D->GetDesc(&t2dDesc); + m_texture_2d->GetDesc(&t2dDesc); // shader resource view desc D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; @@ -52,9 +52,9 @@ dxTexture::dxTexture( srvDesc.Texture2D.MipLevels = -1; // create shader resource view - m_Context->GetDevice() - ->CreateShaderResourceView(m_Texture2D.Get(), &srvDesc, &m_ShaderResourceView); - m_Context->GetDeviceContext()->GenerateMips(m_ShaderResourceView.Get()); + m_context->GetDevice() + ->CreateShaderResourceView(m_texture_2d.Get(), &srvDesc, &m_shader_resource_view); + m_context->GetDeviceContext()->GenerateMips(m_shader_resource_view.Get()); // sampler desc D3D11_SAMPLER_DESC sDesc = {}; @@ -67,14 +67,14 @@ dxTexture::dxTexture( sDesc.MaxLOD = D3D11_FLOAT32_MAX; // create sampler - m_Context->GetDevice()->CreateSamplerState(&sDesc, &m_SamplerState); + m_context->GetDevice()->CreateSamplerState(&sDesc, &m_sampler_state); } void dxTexture::Bind(unsigned int slot /* = 0u */) { - m_Context->GetDeviceContext()->PSSetSamplers(slot, 1u, m_SamplerState.GetAddressOf()); - m_Context->GetDeviceContext() - ->PSSetShaderResources(slot, 1u, m_ShaderResourceView.GetAddressOf()); + m_context->GetDeviceContext()->PSSetSamplers(slot, 1u, m_sampler_state.GetAddressOf()); + m_context->GetDeviceContext() + ->PSSetShaderResources(slot, 1u, m_shader_resource_view.GetAddressOf()); } } // namespace Light diff --git a/modules/engine/src/platform/graphics/directx/vertex_layout.cpp b/modules/engine/src/platform/graphics/directx/vertex_layout.cpp index 16f0d97..b64db5d 100644 --- a/modules/engine/src/platform/graphics/directx/vertex_layout.cpp +++ b/modules/engine/src/platform/graphics/directx/vertex_layout.cpp @@ -9,8 +9,8 @@ dxVertexLayout::dxVertexLayout( const std::vector> &elements, Ref sharedContext ) - : m_Context(sharedContext) - , m_InputLayout(nullptr) + : m_context(sharedContext) + , m_input_layout(nullptr) { // occupy space for input elements std::vector inputElementsDesc; @@ -33,12 +33,12 @@ dxVertexLayout::dxVertexLayout( // create input layout (vertex layout) HRESULT hr; - DXC(m_Context->GetDevice()->CreateInputLayout( + DXC(m_context->GetDevice()->CreateInputLayout( &inputElementsDesc[0], inputElementsDesc.size(), dxpShader->GetVertexBlob().Get()->GetBufferPointer(), dxpShader->GetVertexBlob().Get()->GetBufferSize(), - &m_InputLayout + &m_input_layout )); } @@ -49,12 +49,12 @@ dxVertexLayout::~dxVertexLayout() void dxVertexLayout::Bind() { - m_Context->GetDeviceContext()->IASetInputLayout(m_InputLayout.Get()); + m_context->GetDeviceContext()->IASetInputLayout(m_input_layout.Get()); } void dxVertexLayout::UnBind() { - m_Context->GetDeviceContext()->IASetInputLayout(nullptr); + m_context->GetDeviceContext()->IASetInputLayout(nullptr); } DXGI_FORMAT dxVertexLayout::GetDxgiFormat(VertexElementType type) diff --git a/modules/engine/src/platform/graphics/opengl/blender.cpp b/modules/engine/src/platform/graphics/opengl/blender.cpp index 7531d53..6ca4ebc 100644 --- a/modules/engine/src/platform/graphics/opengl/blender.cpp +++ b/modules/engine/src/platform/graphics/opengl/blender.cpp @@ -4,7 +4,7 @@ namespace Light { glBlender::glBlender() - : m_FactorMap { // constants + : m_factor_map { // constants { BlendFactor::ZERO, GL_ZERO }, { BlendFactor::ONE, GL_ONE }, @@ -35,7 +35,7 @@ glBlender::glBlender() void glBlender::Enable(BlendFactor srcFactor, BlendFactor dstFactor) { glEnable(GL_BLEND); - glBlendFunc(m_FactorMap.at(srcFactor), m_FactorMap.at(dstFactor)); + glBlendFunc(m_factor_map.at(srcFactor), m_factor_map.at(dstFactor)); } void glBlender::Disable() diff --git a/modules/engine/src/platform/graphics/opengl/buffers.cpp b/modules/engine/src/platform/graphics/opengl/buffers.cpp index 9c716ee..6f42851 100644 --- a/modules/engine/src/platform/graphics/opengl/buffers.cpp +++ b/modules/engine/src/platform/graphics/opengl/buffers.cpp @@ -5,53 +5,53 @@ namespace Light { //==================== CONSTANT_BUFFER ====================// glConstantBuffer::glConstantBuffer(ConstantBufferIndex index, unsigned int size) - : m_BufferID(NULL) - , m_Index(static_cast(index)) + : m_buffer_id(NULL) + , m_index(static_cast(index)) { - glCreateBuffers(1, &m_BufferID); - glNamedBufferData(m_BufferID, size, nullptr, GL_DYNAMIC_DRAW); + glCreateBuffers(1, &m_buffer_id); + glNamedBufferData(m_buffer_id, size, nullptr, GL_DYNAMIC_DRAW); Bind(); } glConstantBuffer::~glConstantBuffer() { - glDeleteBuffers(1, &m_BufferID); + glDeleteBuffers(1, &m_buffer_id); } void glConstantBuffer::Bind() { - glBindBufferBase(GL_UNIFORM_BUFFER, m_Index, m_BufferID); + glBindBufferBase(GL_UNIFORM_BUFFER, m_index, m_buffer_id); } void *glConstantBuffer::Map() { - void *map = glMapNamedBuffer(m_BufferID, GL_WRITE_ONLY); + void *map = glMapNamedBuffer(m_buffer_id, GL_WRITE_ONLY); return map; } void glConstantBuffer::UnMap() { - glUnmapNamedBuffer(m_BufferID); + glUnmapNamedBuffer(m_buffer_id); } //==================== CONSTANT_BUFFER ====================// //==================== VERTEX_BUFFER ====================// glVertexBuffer::glVertexBuffer(float *vertices, unsigned int stride, unsigned int count) - : m_BufferID(NULL) + : m_buffer_id(NULL) { - glCreateBuffers(1, &m_BufferID); - glNamedBufferData(m_BufferID, stride * count, vertices, GL_DYNAMIC_DRAW); + glCreateBuffers(1, &m_buffer_id); + glNamedBufferData(m_buffer_id, stride * count, vertices, GL_DYNAMIC_DRAW); } glVertexBuffer::~glVertexBuffer() { - glDeleteBuffers(1, &m_BufferID); + glDeleteBuffers(1, &m_buffer_id); } void glVertexBuffer::Bind() { - glBindBuffer(GL_ARRAY_BUFFER, m_BufferID); + glBindBuffer(GL_ARRAY_BUFFER, m_buffer_id); } void glVertexBuffer::UnBind() @@ -61,17 +61,17 @@ void glVertexBuffer::UnBind() void *glVertexBuffer::Map() { - return glMapNamedBuffer(m_BufferID, GL_WRITE_ONLY); + return glMapNamedBuffer(m_buffer_id, GL_WRITE_ONLY); } void glVertexBuffer::UnMap() { - glUnmapNamedBuffer(m_BufferID); + glUnmapNamedBuffer(m_buffer_id); } //==================== VERTEX_BUFFER ====================// //==================== INDEX_BUFFER ====================// -glIndexBuffer::glIndexBuffer(unsigned int *indices, unsigned int count): m_BufferID(NULL) +glIndexBuffer::glIndexBuffer(unsigned int *indices, unsigned int count): m_buffer_id(NULL) { // generate indices if not provided bool hasIndices = !!indices; @@ -103,8 +103,8 @@ glIndexBuffer::glIndexBuffer(unsigned int *indices, unsigned int count): m_Buffe } // create buffer - glCreateBuffers(1, &m_BufferID); - glNamedBufferData(m_BufferID, count * sizeof(unsigned int), indices, GL_STATIC_DRAW); + glCreateBuffers(1, &m_buffer_id); + glNamedBufferData(m_buffer_id, count * sizeof(unsigned int), indices, GL_STATIC_DRAW); // delete indices if (!hasIndices) @@ -113,12 +113,12 @@ glIndexBuffer::glIndexBuffer(unsigned int *indices, unsigned int count): m_Buffe glIndexBuffer::~glIndexBuffer() { - glDeleteBuffers(1, &m_BufferID); + glDeleteBuffers(1, &m_buffer_id); } void glIndexBuffer::Bind() { - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_BufferID); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_buffer_id); } void glIndexBuffer::UnBind() diff --git a/modules/engine/src/platform/graphics/opengl/framebuffers.cpp b/modules/engine/src/platform/graphics/opengl/framebuffers.cpp index 8f16f32..034abab 100644 --- a/modules/engine/src/platform/graphics/opengl/framebuffers.cpp +++ b/modules/engine/src/platform/graphics/opengl/framebuffers.cpp @@ -5,26 +5,26 @@ namespace Light { glFramebuffer::glFramebuffer(const FramebufferSpecification &specification) - : m_Specification(specification) - , m_BufferID(NULL) - , m_ColorAttachmentID(NULL) - , m_DepthStencilAttachmentID(NULL) + : m_specification(specification) + , m_buffer_id(NULL) + , m_color_attachment_id(NULL) + , m_depth_stencil_attachment_id(NULL) { Resize({ specification.width, specification.height }); } glFramebuffer::~glFramebuffer() { - glDeleteFramebuffers(1, &m_BufferID); - glDeleteTextures(1, &m_ColorAttachmentID); - // glDeleteTextures(1, &m_DepthStencilAttachmentID); + glDeleteFramebuffers(1, &m_buffer_id); + glDeleteTextures(1, &m_color_attachment_id); + // glDeleteTextures(1, &m_depth_stencil_attachment_id); } void glFramebuffer::BindAsTarget(const glm::vec4 &clearColor) { // #todo: use viewport instead of default x=0, y=0 - glBindFramebuffer(GL_FRAMEBUFFER, m_BufferID); - glViewport(0, 0, m_Specification.width, m_Specification.height); + glBindFramebuffer(GL_FRAMEBUFFER, m_buffer_id); + glViewport(0, 0, m_specification.width, m_specification.height); glClearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a); glClear(GL_COLOR_BUFFER_BIT); @@ -37,53 +37,53 @@ void glFramebuffer::BindAsResource() void glFramebuffer::Resize(const glm::uvec2 &size) { - if (m_BufferID) + if (m_buffer_id) { - glDeleteFramebuffers(1, &m_BufferID); - glDeleteTextures(1, &m_ColorAttachmentID); - // glDeleteTextures(1, &m_DepthStencilAttachmentID); + glDeleteFramebuffers(1, &m_buffer_id); + glDeleteTextures(1, &m_color_attachment_id); + // glDeleteTextures(1, &m_depth_stencil_attachment_id); } - m_Specification.width = std::clamp(size.x, 1u, (unsigned int)GL_MAX_TEXTURE_SIZE); - m_Specification.height = std::clamp(size.y, 1u, (unsigned int)GL_MAX_TEXTURE_SIZE); + m_specification.width = std::clamp(size.x, 1u, (unsigned int)GL_MAX_TEXTURE_SIZE); + m_specification.height = std::clamp(size.y, 1u, (unsigned int)GL_MAX_TEXTURE_SIZE); - glCreateFramebuffers(1, &m_BufferID); - glBindFramebuffer(GL_FRAMEBUFFER, m_BufferID); + glCreateFramebuffers(1, &m_buffer_id); + glBindFramebuffer(GL_FRAMEBUFFER, m_buffer_id); // create color attachment - glCreateTextures(GL_TEXTURE_2D, 1, &m_ColorAttachmentID); - glBindTexture(GL_TEXTURE_2D, m_ColorAttachmentID); + glCreateTextures(GL_TEXTURE_2D, 1, &m_color_attachment_id); + glBindTexture(GL_TEXTURE_2D, m_color_attachment_id); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, - m_Specification.width, - m_Specification.height, + m_specification.width, + m_specification.height, NULL, GL_RGBA, GL_UNSIGNED_BYTE, nullptr ); - glTextureParameteri(m_ColorAttachmentID, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTextureParameteri(m_ColorAttachmentID, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTextureParameteri(m_color_attachment_id, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTextureParameteri(m_color_attachment_id, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, - m_ColorAttachmentID, + m_color_attachment_id, 0 ); - // glTextureStorage2D(m_ColorAttachmentID, 0, GL_RGBA8, m_Specification.width, - // m_Specification.height); + // glTextureStorage2D(m_color_attachment_id, 0, GL_RGBA8, m_specification.width, + // m_specification.height); - // glCreateTextures(GL_TEXTURE_2D, 1, &m_DepthStencilAttachmentID); - // glBindTexture(GL_TEXTURE_2D, m_DepthStencilAttachmentID); - // glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, m_Specification.width, - // m_Specification.height, NULL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, nullptr); - // // glTextureStorage2D(m_DepthStencilAttachmentID, 0, GL_DEPTH24_STENCIL8, - // m_Specification.width, m_Specification.height); glFramebufferTexture2D(GL_FRAMEBUFFER, - // GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_DepthStencilAttachmentID, 0); + // glCreateTextures(GL_TEXTURE_2D, 1, &m_depth_stencil_attachment_id); + // glBindTexture(GL_TEXTURE_2D, m_depth_stencil_attachment_id); + // glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, m_specification.width, + // m_specification.height, NULL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, nullptr); + // // glTextureStorage2D(m_depth_stencil_attachment_id, 0, GL_DEPTH24_STENCIL8, + // m_specification.width, m_specification.height); glFramebufferTexture2D(GL_FRAMEBUFFER, + // GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_depth_stencil_attachment_id, 0); ASSERT( (glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE), diff --git a/modules/engine/src/platform/graphics/opengl/graphics_context.cpp b/modules/engine/src/platform/graphics/opengl/graphics_context.cpp index d4a6e68..f942ab7 100644 --- a/modules/engine/src/platform/graphics/opengl/graphics_context.cpp +++ b/modules/engine/src/platform/graphics/opengl/graphics_context.cpp @@ -14,10 +14,10 @@ namespace Light { -glGraphicsContext::glGraphicsContext(GLFWwindow *windowHandle): m_WindowHandle(windowHandle) +glGraphicsContext::glGraphicsContext(GLFWwindow *windowHandle): m_window_handle(windowHandle) { // set 'GraphicsAPI' - m_GraphicsAPI = GraphicsAPI::OpenGL; + m_graphics_api = GraphicsAPI::OpenGL; // make context current glfwMakeContextCurrent(windowHandle); diff --git a/modules/engine/src/platform/graphics/opengl/render_command.cpp b/modules/engine/src/platform/graphics/opengl/render_command.cpp index 49156f3..29eb854 100644 --- a/modules/engine/src/platform/graphics/opengl/render_command.cpp +++ b/modules/engine/src/platform/graphics/opengl/render_command.cpp @@ -6,13 +6,13 @@ namespace Light { -glRenderCommand::glRenderCommand(GLFWwindow *windowHandle): m_WindowHandle(windowHandle) +glRenderCommand::glRenderCommand(GLFWwindow *windowHandle): m_window_handle(windowHandle) { } void glRenderCommand::SwapBuffers() { - glfwSwapBuffers(m_WindowHandle); + glfwSwapBuffers(m_window_handle); } void glRenderCommand::ClearBackBuffer(const glm::vec4 &clearColor) diff --git a/modules/engine/src/platform/graphics/opengl/shader.cpp b/modules/engine/src/platform/graphics/opengl/shader.cpp index a6ce095..a00ed03 100644 --- a/modules/engine/src/platform/graphics/opengl/shader.cpp +++ b/modules/engine/src/platform/graphics/opengl/shader.cpp @@ -6,10 +6,10 @@ namespace Light { -glShader::glShader(BasicFileHandle vertexFile, BasicFileHandle pixelFile): m_ShaderID(0u) +glShader::glShader(BasicFileHandle vertexFile, BasicFileHandle pixelFile): m_shader_id(0u) { // create - m_ShaderID = glCreateProgram(); + m_shader_id = glCreateProgram(); std::string vertexSource(vertexFile.GetData(), vertexFile.GetData() + vertexFile.GetSize()); std::string pixelSource(pixelFile.GetData(), pixelFile.GetData() + pixelFile.GetSize()); @@ -18,11 +18,11 @@ glShader::glShader(BasicFileHandle vertexFile, BasicFileHandle pixelFile): m_Sha unsigned int pixelShader = CompileShader(pixelSource, Shader::Stage::PIXEL); // attach shaders - glAttachShader(m_ShaderID, vertexShader); - glAttachShader(m_ShaderID, pixelShader); + glAttachShader(m_shader_id, vertexShader); + glAttachShader(m_shader_id, pixelShader); // link shader program - glLinkProgram(m_ShaderID); + glLinkProgram(m_shader_id); // delete shaders (free memory) glDeleteShader(vertexShader); @@ -31,12 +31,12 @@ glShader::glShader(BasicFileHandle vertexFile, BasicFileHandle pixelFile): m_Sha glShader::~glShader() { - glDeleteProgram(m_ShaderID); + glDeleteProgram(m_shader_id); } void glShader::Bind() { - glUseProgram(m_ShaderID); + glUseProgram(m_shader_id); } void glShader::UnBind() diff --git a/modules/engine/src/platform/graphics/opengl/texture.cpp b/modules/engine/src/platform/graphics/opengl/texture.cpp index 61d0cdd..f5aaa95 100644 --- a/modules/engine/src/platform/graphics/opengl/texture.cpp +++ b/modules/engine/src/platform/graphics/opengl/texture.cpp @@ -11,16 +11,16 @@ glTexture::glTexture( const std::string &filePath ) : Texture(filePath) - , m_TextureID(NULL) + , m_texture_id(NULL) { // create texture - glCreateTextures(GL_TEXTURE_2D, 1, &m_TextureID); + glCreateTextures(GL_TEXTURE_2D, 1, &m_texture_id); // set texture parameters - glTextureParameteri(m_TextureID, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTextureParameteri(m_TextureID, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTextureParameteri(m_TextureID, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTextureParameteri(m_TextureID, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTextureParameteri(m_texture_id, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTextureParameteri(m_texture_id, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTextureParameteri(m_texture_id, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTextureParameteri(m_texture_id, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // determine formats unsigned int format = components == 4u ? GL_RGBA : @@ -58,18 +58,18 @@ glTexture::glTexture( glTexture::~glTexture() { - glDeleteTextures(1, &m_TextureID); + glDeleteTextures(1, &m_texture_id); } void glTexture::Bind(unsigned int slot /* = 0u */) { glActiveTexture(GL_TEXTURE0 + slot); - glBindTexture(GL_TEXTURE_2D, m_TextureID); + glBindTexture(GL_TEXTURE_2D, m_texture_id); } void *glTexture::GetTexture() { - return (void *)(intptr_t)m_TextureID; + return (void *)(intptr_t)m_texture_id; } } // namespace Light diff --git a/modules/engine/src/platform/graphics/opengl/user_interface.cpp b/modules/engine/src/platform/graphics/opengl/user_interface.cpp index 2bc6567..4b317a0 100644 --- a/modules/engine/src/platform/graphics/opengl/user_interface.cpp +++ b/modules/engine/src/platform/graphics/opengl/user_interface.cpp @@ -12,7 +12,7 @@ void glUserInterface::PlatformImplementation( Ref sharedContext ) { - m_WindowHandle = windowHandle; + m_window_handle = windowHandle; ImGui_ImplGlfw_InitForOpenGL(windowHandle, false); ImGui_ImplOpenGL3_Init(); @@ -45,7 +45,7 @@ void glUserInterface::End() ImGui::UpdatePlatformWindows(); ImGui::RenderPlatformWindowsDefault(); - glfwMakeContextCurrent(m_WindowHandle); + glfwMakeContextCurrent(m_window_handle); } void glUserInterface::LogDebugData() diff --git a/modules/engine/src/platform/graphics/opengl/vertex_layout.cpp b/modules/engine/src/platform/graphics/opengl/vertex_layout.cpp index 57b032c..18bf3f3 100644 --- a/modules/engine/src/platform/graphics/opengl/vertex_layout.cpp +++ b/modules/engine/src/platform/graphics/opengl/vertex_layout.cpp @@ -8,7 +8,7 @@ glVertexLayout::glVertexLayout( Ref buffer, const std::vector> &elements ) - : m_ArrayID(NULL) + : m_array_id(NULL) { // check ASSERT( @@ -30,7 +30,7 @@ glVertexLayout::glVertexLayout( } // create vertex array - glCreateVertexArrays(1, &m_ArrayID); + glCreateVertexArrays(1, &m_array_id); // bind buffer and array buffer->Bind(); @@ -54,12 +54,12 @@ glVertexLayout::glVertexLayout( glVertexLayout::~glVertexLayout() { - glDeleteVertexArrays(1, &m_ArrayID); + glDeleteVertexArrays(1, &m_array_id); } void glVertexLayout::Bind() { - glBindVertexArray(m_ArrayID); + glBindVertexArray(m_array_id); } void glVertexLayout::UnBind() diff --git a/modules/engine/src/platform/os/linux/l_window.cpp b/modules/engine/src/platform/os/linux/l_window.cpp index 2b7e2b8..fb601e1 100644 --- a/modules/engine/src/platform/os/linux/l_window.cpp +++ b/modules/engine/src/platform/os/linux/l_window.cpp @@ -15,8 +15,8 @@ Scope Window::Create(std::function callback) } lWindow::lWindow(std::function callback) - : m_Handle(nullptr) - , m_EventCallback(callback) + : m_handle(nullptr) + , m_event_callback(callback) { // init glfw ASSERT(glfwInit(), "lWindow::lWindow: failed to initialize 'glfw'"); @@ -27,21 +27,21 @@ lWindow::lWindow(std::function callback) glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - m_Handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr); - ASSERT(m_Handle, "lWindow::lWindow: failed to create 'GLFWwindow'"); + m_handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr); + ASSERT(m_handle, "lWindow::lWindow: failed to create 'GLFWwindow'"); // bind event stuff - glfwSetWindowUserPointer(m_Handle, &m_EventCallback); + glfwSetWindowUserPointer(m_handle, &m_event_callback); BindGlfwEvents(); // create graphics context - m_GraphicsContext = GraphicsContext::Create(GraphicsAPI::OpenGL, m_Handle); - ASSERT(m_GraphicsContext, "lWindow::lWindow: failed to create 'GraphicsContext'"); + m_graphics_context = GraphicsContext::Create(GraphicsAPI::OpenGL, m_handle); + ASSERT(m_graphics_context, "lWindow::lWindow: failed to create 'GraphicsContext'"); } lWindow::~lWindow() { - glfwDestroyWindow(m_Handle); + glfwDestroyWindow(m_handle); } void lWindow::PollEvents() @@ -63,16 +63,16 @@ void lWindow::OnEvent(const Event &event) void lWindow::OnWindowResize(const WindowResizedEvent &event) { - m_Properties.size = event.GetSize(); + m_properties.size = event.GetSize(); } void lWindow:: SetProperties(const WindowProperties &properties, bool overrideVisibility /* = false */) { // save the visibility status and re-assign if 'overrideVisibility' is false - bool visible = overrideVisibility ? properties.visible : m_Properties.visible; - m_Properties = properties; - m_Properties.visible = visible; + bool visible = overrideVisibility ? properties.visible : m_properties.visible; + m_properties = properties; + m_properties.visible = visible; // set properties SetTitle(properties.title); @@ -83,46 +83,46 @@ void lWindow:: void lWindow::SetTitle(const std::string &title) { - m_Properties.title = title; + m_properties.title = title; - glfwSetWindowTitle(m_Handle, title.c_str()); + glfwSetWindowTitle(m_handle, title.c_str()); } void lWindow::SetSize(const glm::uvec2 &size, bool additive /* = false */) { - m_Properties.size.x = size.x == 0u ? m_Properties.size.x : - additive ? m_Properties.size.x + size.x : + m_properties.size.x = size.x == 0u ? m_properties.size.x : + additive ? m_properties.size.x + size.x : size.x; - m_Properties.size.y = size.y == 0u ? m_Properties.size.y : - additive ? m_Properties.size.y + size.y : + m_properties.size.y = size.y == 0u ? m_properties.size.y : + additive ? m_properties.size.y + size.y : size.y; - glfwSetWindowSize(m_Handle, size.x, size.y); + glfwSetWindowSize(m_handle, size.x, size.y); } void lWindow::SetVSync(bool vsync, bool toggle /* = false */) { - m_Properties.vsync = toggle ? !m_Properties.vsync : vsync; + m_properties.vsync = toggle ? !m_properties.vsync : vsync; - glfwSwapInterval(m_Properties.vsync); + glfwSwapInterval(m_properties.vsync); } void lWindow::SetVisibility(bool visible, bool toggle) { - m_Properties.visible = toggle ? !m_Properties.visible : visible; + m_properties.visible = toggle ? !m_properties.visible : visible; - if (m_Properties.visible) - glfwShowWindow(m_Handle); + if (m_properties.visible) + glfwShowWindow(m_handle); else - glfwHideWindow(m_Handle); + glfwHideWindow(m_handle); } void lWindow::BindGlfwEvents() { //============================== MOUSE_EVENTS ==============================// /* cursor position */ - glfwSetCursorPosCallback(m_Handle, [](GLFWwindow *window, double xpos, double ypos) { + glfwSetCursorPosCallback(m_handle, [](GLFWwindow *window, double xpos, double ypos) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -131,7 +131,7 @@ void lWindow::BindGlfwEvents() }); /* mouse button */ - glfwSetMouseButtonCallback(m_Handle, [](GLFWwindow *window, int button, int action, int mods) { + glfwSetMouseButtonCallback(m_handle, [](GLFWwindow *window, int button, int action, int mods) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -148,7 +148,7 @@ void lWindow::BindGlfwEvents() }); /* scroll */ - glfwSetScrollCallback(m_Handle, [](GLFWwindow *window, double xoffset, double yoffset) { + glfwSetScrollCallback(m_handle, [](GLFWwindow *window, double xoffset, double yoffset) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -160,7 +160,7 @@ void lWindow::BindGlfwEvents() //============================== KEYBOARD_EVENTS ==============================// /* key */ glfwSetKeyCallback( - m_Handle, + m_handle, [](GLFWwindow *window, int key, int scancode, int action, int mods) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -178,7 +178,7 @@ void lWindow::BindGlfwEvents() } ); /* char */ - glfwSetCharCallback(m_Handle, [](GLFWwindow *window, unsigned int character) { + glfwSetCharCallback(m_handle, [](GLFWwindow *window, unsigned int character) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -190,7 +190,7 @@ void lWindow::BindGlfwEvents() //============================== WINDOW_EVENTS ==============================// /* window position */ - glfwSetWindowPosCallback(m_Handle, [](GLFWwindow *window, int xpos, int ypos) { + glfwSetWindowPosCallback(m_handle, [](GLFWwindow *window, int xpos, int ypos) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); WindowMovedEvent event(xpos, ypos); @@ -199,7 +199,7 @@ void lWindow::BindGlfwEvents() }); /* window size */ - glfwSetWindowSizeCallback(m_Handle, [](GLFWwindow *window, int width, int height) { + glfwSetWindowSizeCallback(m_handle, [](GLFWwindow *window, int width, int height) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); WindowResizedEvent event(width, height); @@ -208,7 +208,7 @@ void lWindow::BindGlfwEvents() }); /* window close */ - glfwSetWindowCloseCallback(m_Handle, [](GLFWwindow *window) { + glfwSetWindowCloseCallback(m_handle, [](GLFWwindow *window) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); WindowClosedEvent event; @@ -217,7 +217,7 @@ void lWindow::BindGlfwEvents() }); /* window focus */ - glfwSetWindowFocusCallback(m_Handle, [](GLFWwindow *window, int focus) { + glfwSetWindowFocusCallback(m_handle, [](GLFWwindow *window, int focus) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); diff --git a/modules/engine/src/platform/os/windows/w_window.cpp b/modules/engine/src/platform/os/windows/w_window.cpp index 7ac0139..cfe6204 100644 --- a/modules/engine/src/platform/os/windows/w_window.cpp +++ b/modules/engine/src/platform/os/windows/w_window.cpp @@ -22,8 +22,8 @@ Scope Window::Create(std::function callback) } wWindow::wWindow(std::function callback) - : m_Handle(nullptr) - , m_EventCallback(callback) + : m_handle(nullptr) + , m_event_callback(callback) { // init glfw ASSERT(glfwInit(), "wWindow::wWindow: failed to initialize 'glfw'"); @@ -34,21 +34,21 @@ wWindow::wWindow(std::function callback) glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - m_Handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr); - ASSERT(m_Handle, "wWindow::wWindow: glfwCreateWindow: failed to create 'GLFWwindow'"); + m_handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr); + ASSERT(m_handle, "wWindow::wWindow: glfwCreateWindow: failed to create 'GLFWwindow'"); // bind event stuff - glfwSetWindowUserPointer(m_Handle, &m_EventCallback); + glfwSetWindowUserPointer(m_handle, &m_event_callback); BindGlfwEvents(); // create graphics context - m_GraphicsContext = GraphicsContext::Create(GraphicsAPI::DirectX, m_Handle); - ASSERT(m_GraphicsContext, "wWindow::wWindow: failed to create 'GraphicsContext'"); + m_graphics_context = GraphicsContext::Create(GraphicsAPI::DirectX, m_handle); + ASSERT(m_graphics_context, "wWindow::wWindow: failed to create 'GraphicsContext'"); } wWindow::~wWindow() { - glfwDestroyWindow(m_Handle); + glfwDestroyWindow(m_handle); } void wWindow::PollEvents() @@ -70,16 +70,16 @@ void wWindow::OnEvent(const Event &event) void wWindow::OnWindowResize(const WindowResizedEvent &event) { - m_Properties.size = event.GetSize(); + m_properties.size = event.GetSize(); } void wWindow:: SetProperties(const WindowProperties &properties, bool overrideVisiblity /* = false */) { // save the visibility status and re-assign if 'overrideVisibility' is false - bool visible = overrideVisiblity ? properties.visible : m_Properties.visible; - m_Properties = properties; - m_Properties.visible = visible; + bool visible = overrideVisiblity ? properties.visible : m_properties.visible; + m_properties = properties; + m_properties.visible = visible; // set properties SetTitle(properties.title); @@ -90,46 +90,46 @@ void wWindow:: void wWindow::SetTitle(const std::string &title) { - m_Properties.title = title; + m_properties.title = title; - glfwSetWindowTitle(m_Handle, m_Properties.title.c_str()); + glfwSetWindowTitle(m_handle, m_properties.title.c_str()); } void wWindow::SetSize(const glm::uvec2 &size, bool additive /* = false */) { - m_Properties.size.x = size.x == 0u ? m_Properties.size.x : - additive ? m_Properties.size.x + size.x : + m_properties.size.x = size.x == 0u ? m_properties.size.x : + additive ? m_properties.size.x + size.x : size.x; - m_Properties.size.y = size.y == 0u ? m_Properties.size.y : - additive ? m_Properties.size.y + size.y : + m_properties.size.y = size.y == 0u ? m_properties.size.y : + additive ? m_properties.size.y + size.y : size.y; - glfwSetWindowSize(m_Handle, size.x, size.y); + glfwSetWindowSize(m_handle, size.x, size.y); } void wWindow::SetVSync(bool vsync, bool toggle /* = false */) { - m_Properties.vsync = toggle ? !m_Properties.vsync : vsync; + m_properties.vsync = toggle ? !m_properties.vsync : vsync; - glfwSwapInterval(m_Properties.vsync); + glfwSwapInterval(m_properties.vsync); } void wWindow::SetVisibility(bool visible, bool toggle) { - m_Properties.visible = toggle ? !m_Properties.visible : visible; + m_properties.visible = toggle ? !m_properties.visible : visible; - if (m_Properties.visible) - glfwShowWindow(m_Handle); + if (m_properties.visible) + glfwShowWindow(m_handle); else - glfwHideWindow(m_Handle); + glfwHideWindow(m_handle); } void wWindow::BindGlfwEvents() { //============================== MOUSE_EVENTS ==============================// /* cursor position */ - glfwSetCursorPosCallback(m_Handle, [](GLFWwindow *window, double xpos, double ypos) { + glfwSetCursorPosCallback(m_handle, [](GLFWwindow *window, double xpos, double ypos) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -138,7 +138,7 @@ void wWindow::BindGlfwEvents() }); /* mouse button */ - glfwSetMouseButtonCallback(m_Handle, [](GLFWwindow *window, int button, int action, int mods) { + glfwSetMouseButtonCallback(m_handle, [](GLFWwindow *window, int button, int action, int mods) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -155,7 +155,7 @@ void wWindow::BindGlfwEvents() }); /* scroll */ - glfwSetScrollCallback(m_Handle, [](GLFWwindow *window, double xoffset, double yoffset) { + glfwSetScrollCallback(m_handle, [](GLFWwindow *window, double xoffset, double yoffset) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -167,7 +167,7 @@ void wWindow::BindGlfwEvents() //============================== KEYBOARD_EVENTS ==============================// /* key */ glfwSetKeyCallback( - m_Handle, + m_handle, [](GLFWwindow *window, int key, int scancode, int action, int mods) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -185,7 +185,7 @@ void wWindow::BindGlfwEvents() } ); /* char */ - glfwSetCharCallback(m_Handle, [](GLFWwindow *window, unsigned int character) { + glfwSetCharCallback(m_handle, [](GLFWwindow *window, unsigned int character) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); @@ -197,7 +197,7 @@ void wWindow::BindGlfwEvents() //============================== WINDOW_EVENTS ==============================// /* window position */ - glfwSetWindowPosCallback(m_Handle, [](GLFWwindow *window, int xpos, int ypos) { + glfwSetWindowPosCallback(m_handle, [](GLFWwindow *window, int xpos, int ypos) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); WindowMovedEvent event(xpos, ypos); @@ -206,7 +206,7 @@ void wWindow::BindGlfwEvents() }); /* window size */ - glfwSetWindowSizeCallback(m_Handle, [](GLFWwindow *window, int width, int height) { + glfwSetWindowSizeCallback(m_handle, [](GLFWwindow *window, int width, int height) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); WindowResizedEvent event(width, height); @@ -215,7 +215,7 @@ void wWindow::BindGlfwEvents() }); /* window close */ - glfwSetWindowCloseCallback(m_Handle, [](GLFWwindow *window) { + glfwSetWindowCloseCallback(m_handle, [](GLFWwindow *window) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); WindowClosedEvent event; @@ -224,7 +224,7 @@ void wWindow::BindGlfwEvents() }); /* window focus */ - glfwSetWindowFocusCallback(m_Handle, [](GLFWwindow *window, int focus) { + glfwSetWindowFocusCallback(m_handle, [](GLFWwindow *window, int focus) { std::function callback = *(std::function *) glfwGetWindowUserPointer(window); diff --git a/modules/engine/src/scene/entity.cpp b/modules/engine/src/scene/entity.cpp index 5082019..5079f3d 100644 --- a/modules/engine/src/scene/entity.cpp +++ b/modules/engine/src/scene/entity.cpp @@ -3,7 +3,7 @@ namespace Light { -Entity::Entity(entt::entity handle, Scene *scene): m_Handle(handle), m_Scene(scene) +Entity::Entity(entt::entity handle, Scene *scene): m_handle(handle), m_scene(scene) { } diff --git a/modules/engine/src/scene/scene.cpp b/modules/engine/src/scene/scene.cpp index 90ed915..cdf2ee9 100644 --- a/modules/engine/src/scene/scene.cpp +++ b/modules/engine/src/scene/scene.cpp @@ -6,7 +6,7 @@ namespace Light { -Scene::Scene(): m_Registry() +Scene::Scene(): m_registry() { } @@ -18,7 +18,7 @@ void Scene::OnCreate() { /* native scripts */ { - m_Registry.view().each([](NativeScriptComponent &nsc) { + m_registry.view().each([](NativeScriptComponent &nsc) { if (nsc.instance == nullptr) { nsc.instance = nsc.CreateInstance(); @@ -32,7 +32,7 @@ void Scene::OnUpdate(float deltaTime) { /* native scripts */ { - m_Registry.view().each([=](NativeScriptComponent &nsc) { + m_registry.view().each([=](NativeScriptComponent &nsc) { nsc.instance->OnUpdate(deltaTime); }); } @@ -45,7 +45,7 @@ void Scene::OnRender(const Ref &targetFrameBuffer /* = nullptr */) /* scene camera */ { - m_Registry.group(entt::get) + m_registry.group(entt::get) .each([&](TransformComponent &transformComp, CameraComponent &cameraComp) { if (cameraComp.isPrimary) { @@ -61,7 +61,7 @@ void Scene::OnRender(const Ref &targetFrameBuffer /* = nullptr */) { Renderer::BeginScene(sceneCamera, *sceneCameraTransform, targetFrameBuffer); - m_Registry.group(entt::get) + m_registry.group(entt::get) .each([](TransformComponent &transformComp, SpriteRendererComponent &spriteRendererComp) { Renderer::DrawQuad( @@ -84,12 +84,12 @@ Entity Scene::CreateEntity(const std::string &name, const TransformComponent &tr Entity Scene::GetEntityByTag(const std::string &tag) { // TagComponent tagComp(tag); - // entt::entity entity = entt::to_entity(m_Registry, tagComp); + // entt::entity entity = entt::to_entity(m_registry, tagComp); Entity entity; - m_Registry.view().each([&](TagComponent &tagComp) { + m_registry.view().each([&](TagComponent &tagComp) { // if (tagComp.tag == tag) - // entity = Entity(entt::to_entity(m_Registry, tagComp), this); + // entity = Entity(entt::to_entity(m_registry, tagComp), this); }); if (entity.IsValid()) @@ -107,7 +107,7 @@ Entity Scene::CreateEntityWithUUID( const TransformComponent &transform ) { - Entity entity { m_Registry.create(), this }; + Entity entity { m_registry.create(), this }; entity.AddComponent(name); entity.AddComponent(transform); entity.AddComponent(uuid); diff --git a/modules/engine/src/time/timer.cpp b/modules/engine/src/time/timer.cpp index 6722d78..7674f8a 100644 --- a/modules/engine/src/time/timer.cpp +++ b/modules/engine/src/time/timer.cpp @@ -2,19 +2,19 @@ namespace Light { -Timer::Timer(): m_Start(std::chrono::steady_clock::now()) +Timer::Timer(): m_start(std::chrono::steady_clock::now()) { } -DeltaTimer::DeltaTimer(): m_PreviousFrame(NULL), m_DeltaTime(60.0f / 1000.0f) +DeltaTimer::DeltaTimer(): m_previous_frame(NULL), m_delta_time(60.0f / 1000.0f) { } void DeltaTimer::Update() { float currentFrame = timer.GetElapsedTime(); - m_DeltaTime = currentFrame - m_PreviousFrame; - m_PreviousFrame = currentFrame; + m_delta_time = currentFrame - m_previous_frame; + m_previous_frame = currentFrame; } } // namespace Light diff --git a/modules/engine/src/user_interface/user_interface.cpp b/modules/engine/src/user_interface/user_interface.cpp index 7bb2b86..6ee1cd8 100644 --- a/modules/engine/src/user_interface/user_interface.cpp +++ b/modules/engine/src/user_interface/user_interface.cpp @@ -45,7 +45,7 @@ Scope UserInterface::Create( } UserInterface::UserInterface() - : m_DockspaceFlags( + : m_dockspace_flags( ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus @@ -129,7 +129,7 @@ void UserInterface::DockspaceBegin() ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); - ImGui::Begin("Dockspace", (bool *)0, s_Context->m_DockspaceFlags); + ImGui::Begin("Dockspace", (bool *)0, s_Context->m_dockspace_flags); ImGui::PopStyleVar(3); ImGuiStyle &style = ImGui::GetStyle(); diff --git a/modules/engine/src/utils/file_manager.cpp b/modules/engine/src/utils/file_manager.cpp index 42e575e..cf4238e 100644 --- a/modules/engine/src/utils/file_manager.cpp +++ b/modules/engine/src/utils/file_manager.cpp @@ -11,19 +11,19 @@ BasicFileHandle::BasicFileHandle( const std::string &name, const std::string &extension ) - : m_Data(data) - , m_Size(size) - , m_Path(path) - , m_Name(name) - , m_Extension(extension) + : m_data(data) + , m_size(size) + , m_path(path) + , m_name(name) + , m_extension(extension) { } void BasicFileHandle::Release() { - delete m_Data; - m_Data = nullptr; - m_Size = 0ull; + delete m_data; + m_data = nullptr; + m_size = 0ull; } @@ -101,9 +101,9 @@ ImageFileHandle FileManager::ReadImageFile(const std::string &path, int32_t desi void ImageFileHandle::Release() { - stbi_image_free(reinterpret_cast(m_Data)); - m_Data = nullptr; - m_Size = 0ull; + stbi_image_free(reinterpret_cast(m_data)); + m_data = nullptr; + m_size = 0ull; } diff --git a/modules/engine/src/utils/resource_manager.cpp b/modules/engine/src/utils/resource_manager.cpp index 05789d0..085ab4c 100644 --- a/modules/engine/src/utils/resource_manager.cpp +++ b/modules/engine/src/utils/resource_manager.cpp @@ -13,7 +13,7 @@ Scope ResourceManager::Create() return MakeScope(new ResourceManager()); } -ResourceManager::ResourceManager(): m_Shaders {}, m_Textures {} +ResourceManager::ResourceManager(): m_shaders {}, m_textures {} { ASSERT(!s_Context, "Repeated singleton construction"); s_Context = this; @@ -39,7 +39,7 @@ void ResourceManager::LoadShaderImpl( ASSERT(pixelFile.IsValid(), "Failed to read vertex file: {}", pixelPath); // create shader - m_Shaders[name] = Ref( + m_shaders[name] = Ref( Shader::Create(vertexFile, pixelFile, GraphicsContext::GetSharedContext()) ); @@ -60,7 +60,7 @@ void ResourceManager::LoadTextureImpl( ImageFileHandle imgFile = FileManager::ReadImageFile(path, desiredComponents); // create texture - m_Textures[name] = Ref(Texture::Create( + m_textures[name] = Ref(Texture::Create( imgFile.GetWidth(), imgFile.GetHeight(), imgFile.GetComponents(), @@ -75,13 +75,13 @@ void ResourceManager::LoadTextureImpl( void ResourceManager::ReleaseTextureImpl(const std::string &name) { - if (!m_Textures[name]) + if (!m_textures[name]) { LOG(warn, "Failed to find texture named: {}", name); return; } - m_Textures[name] = nullptr; + m_textures[name] = nullptr; } } // namespace Light diff --git a/modules/engine/src/utils/serializer.cpp b/modules/engine/src/utils/serializer.cpp index ed45959..dd4818a 100644 --- a/modules/engine/src/utils/serializer.cpp +++ b/modules/engine/src/utils/serializer.cpp @@ -72,7 +72,7 @@ static YAML::Emitter &operator<<(YAML::Emitter &out, const glm::vec4 &v) return out; } -SceneSerializer::SceneSerializer(const Ref &scene): m_Scene(scene) +SceneSerializer::SceneSerializer(const Ref &scene): m_scene(scene) { } @@ -83,9 +83,9 @@ void SceneSerializer::Serialize(const std::string &filePath) out << YAML::Key << "Scene" << YAML::Value << "Untitled"; out << YAML::Key << "Entities" << YAML::Value << YAML::BeginSeq; - for (auto [entityID, storage] : m_Scene->m_Registry.storage()) + for (auto [entityID, storage] : m_scene->m_registry.storage()) { - Entity entity = { static_cast(entityID), m_Scene.get() }; + Entity entity = { static_cast(entityID), m_scene.get() }; if (!entity.IsValid()) return; @@ -134,7 +134,7 @@ bool SceneSerializer::Deserialize(const std::string &filePath) LOG(trace, "Deserialized entity '{}' : '{}'", uuid, name); - Entity deserializedEntity = m_Scene->CreateEntityWithUUID(name, uuid); + Entity deserializedEntity = m_scene->CreateEntityWithUUID(name, uuid); TagComponent gg = deserializedEntity.GetComponent(); LOG(trace, gg.tag); diff --git a/modules/mirror/include/mirror/editor_layer.hpp b/modules/mirror/include/mirror/editor_layer.hpp index 3d5e595..53d04a7 100644 --- a/modules/mirror/include/mirror/editor_layer.hpp +++ b/modules/mirror/include/mirror/editor_layer.hpp @@ -11,23 +11,23 @@ namespace Light { class EditorLayer: public Layer { private: - std::string m_SceneDir; + std::string m_scene_dir; // #todo: add camera controller class to the engine - glm::vec2 m_Direction; - float m_Speed = 1000.0f; + glm::vec2 m_direction; + float m_speed = 1000.0f; - Ref m_Scene; + Ref m_scene; - Ref m_SceneHierarchyPanel; - Ref m_PropertiesPanel; - Ref m_ContentBrowserPanel; + Ref m_sceneHierarchyPanel; + Ref m_properties_panel; + Ref m_content_browser_panel; - Ref m_Framebuffer; + Ref m_framebuffer; - Entity m_CameraEntity; + Entity m_camera_entity; - ImVec2 m_AvailableContentRegionPrev; + ImVec2 m_available_content_region_prev; public: EditorLayer(const std::string &name); diff --git a/modules/mirror/include/mirror/panel/asset_browser.hpp b/modules/mirror/include/mirror/panel/asset_browser.hpp index 24f30ab..11915ae 100644 --- a/modules/mirror/include/mirror/panel/asset_browser.hpp +++ b/modules/mirror/include/mirror/panel/asset_browser.hpp @@ -24,19 +24,19 @@ public: void OnUserInterfaceUpdate(); private: - std::filesystem::path m_CurrentDirectory; - const std::filesystem::path m_AssetsPath; + std::filesystem::path m_current_directory; + const std::filesystem::path m_assets_path; // TODO: Save configuration - uint32_t m_FileSize = 128u; - uint32_t m_FilePadding = 8u; + uint32_t m_file_size = 128u; + uint32_t m_file_padding = 8u; - Ref m_ActiveScene; + Ref m_active_scene; - Ref m_DirectoryTexture; - Ref m_SceneTexture; - Ref m_ImageTexture; - Ref m_TextTexture; + Ref m_directory_texture; + Ref m_scene_texture; + Ref m_image_texture; + Ref m_text_texture; }; } // namespace Light diff --git a/modules/mirror/include/mirror/panel/properties.hpp b/modules/mirror/include/mirror/panel/properties.hpp index d255fe3..99054a0 100644 --- a/modules/mirror/include/mirror/panel/properties.hpp +++ b/modules/mirror/include/mirror/panel/properties.hpp @@ -8,7 +8,7 @@ namespace Light { class PropertiesPanel: public Panel { private: - Entity m_EntityContext; + Entity m_entity_context; public: PropertiesPanel() = default; diff --git a/modules/mirror/include/mirror/panel/scene_hierarchy.hpp b/modules/mirror/include/mirror/panel/scene_hierarchy.hpp index d8362df..35f5cc2 100644 --- a/modules/mirror/include/mirror/panel/scene_hierarchy.hpp +++ b/modules/mirror/include/mirror/panel/scene_hierarchy.hpp @@ -12,9 +12,9 @@ class PropertiesPanel; class SceneHierarchyPanel: public Panel { private: - Ref m_Context; - Ref m_PropertiesPanelContext; - Entity m_SelectionContext; + Ref m_context; + Ref m_properties_panel_context; + Entity m_selection_context; public: SceneHierarchyPanel(); diff --git a/modules/mirror/src/editor_layer.cpp b/modules/mirror/src/editor_layer.cpp index d69fae6..1cf94cb 100644 --- a/modules/mirror/src/editor_layer.cpp +++ b/modules/mirror/src/editor_layer.cpp @@ -3,23 +3,23 @@ namespace Light { -EditorLayer::EditorLayer(const std::string &name): Layer(name), m_SceneDir("") +EditorLayer::EditorLayer(const std::string &name): Layer(name), m_scene_dir("") { - m_Scene = CreateRef(); + m_scene = CreateRef(); - m_PropertiesPanel = CreateRef(); - m_SceneHierarchyPanel = CreateRef(m_Scene, m_PropertiesPanel); - m_ContentBrowserPanel = CreateRef(m_Scene); + m_properties_panel = CreateRef(); + m_sceneHierarchyPanel = CreateRef(m_scene, m_properties_panel); + m_content_browser_panel = CreateRef(m_scene); - m_Framebuffer = Framebuffer::Create({ 1, 1, 1 }, GraphicsContext::GetSharedContext()); + m_framebuffer = Framebuffer::Create({ 1, 1, 1 }, GraphicsContext::GetSharedContext()); - if (m_SceneDir.empty()) + if (m_scene_dir.empty()) { - m_CameraEntity = m_Scene->CreateEntity("Camera"); - m_CameraEntity.AddComponent(SceneCamera(), true); + m_camera_entity = m_scene->CreateEntity("Camera"); + m_camera_entity.AddComponent(SceneCamera(), true); ResourceManager::LoadTexture("Awesomeface", "Assets/Textures/awesomeface.png"); - Entity entity = m_Scene->CreateEntity("Awesomeface", {}); + Entity entity = m_scene->CreateEntity("Awesomeface", {}); entity.AddComponent( ResourceManager::GetTexture("Awesomeface"), glm::vec4 { 0.0f, 1.0f, 1.0f, 1.0f } @@ -27,36 +27,36 @@ EditorLayer::EditorLayer(const std::string &name): Layer(name), m_SceneDir("") } else { - SceneSerializer serializer(m_Scene); - ASSERT(serializer.Deserialize(m_SceneDir), "Failed to de-serialize: {}", m_SceneDir); + SceneSerializer serializer(m_scene); + ASSERT(serializer.Deserialize(m_scene_dir), "Failed to de-serialize: {}", m_scene_dir); - // m_CameraEntity = m_Scene->GetEntityByTag("Game Camera"); + // m_camera_entity = m_scene->GetEntityByTag("Game Camera"); } } EditorLayer::~EditorLayer() { - if (!m_SceneDir.empty()) + if (!m_scene_dir.empty()) { - SceneSerializer serializer(m_Scene); - serializer.Serialize(m_SceneDir); + SceneSerializer serializer(m_scene); + serializer.Serialize(m_scene_dir); } } void EditorLayer::OnUpdate(float deltaTime) { - m_Scene->OnUpdate(deltaTime); + m_scene->OnUpdate(deltaTime); - m_Direction.x = Input::GetKeyboardKey(Key::A) ? -1.0f : + m_direction.x = Input::GetKeyboardKey(Key::A) ? -1.0f : Input::GetKeyboardKey(Key::D) ? 1.0f : 0.0f; - m_Direction.y = Input::GetKeyboardKey(Key::S) ? -1.0f : + m_direction.y = Input::GetKeyboardKey(Key::S) ? -1.0f : Input::GetKeyboardKey(Key::W) ? 1.0f : 0.0f; - auto &cameraTranslation = m_CameraEntity.GetComponent().translation; - cameraTranslation += glm::vec3(m_Direction * m_Speed * deltaTime, 0.0f); + auto &cameraTranslation = m_camera_entity.GetComponent().translation; + cameraTranslation += glm::vec3(m_direction * m_speed * deltaTime, 0.0f); if (Input::GetKeyboardKey(Key::Escape)) Application::Quit(); @@ -64,7 +64,7 @@ void EditorLayer::OnUpdate(float deltaTime) void EditorLayer::OnRender() { - m_Scene->OnRender(m_Framebuffer); + m_scene->OnRender(m_framebuffer); } void EditorLayer::OnUserInterfaceUpdate() @@ -77,20 +77,20 @@ void EditorLayer::OnUserInterfaceUpdate() Input::ReceiveGameEvents(ImGui::IsWindowFocused()); ImVec2 regionAvail = ImGui::GetContentRegionAvail(); - if (m_AvailableContentRegionPrev != regionAvail) + if (m_available_content_region_prev != regionAvail) { - m_Framebuffer->Resize({ regionAvail.x, regionAvail.y }); - auto &camera = m_CameraEntity.GetComponent().camera; + m_framebuffer->Resize({ regionAvail.x, regionAvail.y }); + auto &camera = m_camera_entity.GetComponent().camera; camera.SetViewportSize(regionAvail.x, regionAvail.y); - m_AvailableContentRegionPrev = regionAvail; + m_available_content_region_prev = regionAvail; } if (GraphicsContext::GetGraphicsAPI() == GraphicsAPI::DirectX) - ImGui::Image(m_Framebuffer->GetColorAttachment(), regionAvail); + ImGui::Image(m_framebuffer->GetColorAttachment(), regionAvail); else ImGui::Image( - m_Framebuffer->GetColorAttachment(), + m_framebuffer->GetColorAttachment(), regionAvail, ImVec2(0, 1), ImVec2(1, 0) @@ -99,9 +99,9 @@ void EditorLayer::OnUserInterfaceUpdate() ImGui::End(); // Panels - m_SceneHierarchyPanel->OnUserInterfaceUpdate(); - m_PropertiesPanel->OnUserInterfaceUpdate(); - m_ContentBrowserPanel->OnUserInterfaceUpdate(); + m_sceneHierarchyPanel->OnUserInterfaceUpdate(); + m_properties_panel->OnUserInterfaceUpdate(); + m_content_browser_panel->OnUserInterfaceUpdate(); UserInterface::DockspaceEnd(); } diff --git a/modules/mirror/src/mirror.cpp b/modules/mirror/src/mirror.cpp index eae76dc..ee14cb7 100644 --- a/modules/mirror/src/mirror.cpp +++ b/modules/mirror/src/mirror.cpp @@ -19,7 +19,7 @@ public: properties.size = glm::uvec2(1280u, 720u); properties.vsync = true; - m_Window->SetProperties(properties); + m_window->SetProperties(properties); // Attach the sandbox layer LayerStack::EmplaceLayer(("MirrorLayer")); diff --git a/modules/mirror/src/panel/asset_browser.cpp b/modules/mirror/src/panel/asset_browser.cpp index c0f889b..34f3d59 100644 --- a/modules/mirror/src/panel/asset_browser.cpp +++ b/modules/mirror/src/panel/asset_browser.cpp @@ -6,19 +6,19 @@ namespace Light { AssetBrowserPanel::AssetBrowserPanel(Ref activeScene) - : m_CurrentDirectory("Assets") - , m_AssetsPath("Assets") - , m_ActiveScene(activeScene) + : m_current_directory("Assets") + , m_assets_path("Assets") + , m_active_scene(activeScene) { ResourceManager::LoadTexture("_Assets_Directory", "EngineResources/Icons/Asset_Directory.png"); ResourceManager::LoadTexture("_Assets_Scene", "EngineResources/Icons/Asset_Scene.png"); ResourceManager::LoadTexture("_Assets_Image", "EngineResources/Icons/Asset_Image.png"); ResourceManager::LoadTexture("_Assets_Text", "EngineResources/Icons/Asset_Text.png"); - m_DirectoryTexture = ResourceManager::GetTexture("_Assets_Directory"); - m_SceneTexture = ResourceManager::GetTexture("_Assets_Scene"); - m_ImageTexture = ResourceManager::GetTexture("_Assets_Image"); - m_TextTexture = ResourceManager::GetTexture("_Assets_Text"); + m_directory_texture = ResourceManager::GetTexture("_Assets_Directory"); + m_scene_texture = ResourceManager::GetTexture("_Assets_Scene"); + m_image_texture = ResourceManager::GetTexture("_Assets_Image"); + m_text_texture = ResourceManager::GetTexture("_Assets_Text"); } void AssetBrowserPanel::OnUserInterfaceUpdate() @@ -26,16 +26,16 @@ void AssetBrowserPanel::OnUserInterfaceUpdate() ImGui::Begin("Content Browser"); // Parent directory button - if (m_CurrentDirectory != std::filesystem::path("Assets")) + if (m_current_directory != std::filesystem::path("Assets")) { if (ImGui::Button(" <-- ")) { - m_CurrentDirectory = m_CurrentDirectory.parent_path(); + m_current_directory = m_current_directory.parent_path(); } } ImVec2 regionAvail = ImGui::GetContentRegionAvail(); - uint32_t cellSize = m_FileSize + m_FilePadding; + uint32_t cellSize = m_file_size + m_file_padding; uint32_t columnCount = std::clamp( static_cast(std::floor(regionAvail.x / cellSize)), 1u, @@ -44,8 +44,8 @@ void AssetBrowserPanel::OnUserInterfaceUpdate() if (ImGui::BeginTable("ContentBrowser", columnCount)) { - m_DirectoryTexture->Bind(0u); - for (auto &dirEntry : std::filesystem::directory_iterator(m_CurrentDirectory)) + m_directory_texture->Bind(0u); + for (auto &dirEntry : std::filesystem::directory_iterator(m_current_directory)) { const auto &path = dirEntry.path(); std::string extension = dirEntry.path().extension().string(); @@ -77,8 +77,8 @@ void AssetBrowserPanel::OnUserInterfaceUpdate() // Directory case AssetType::Directory: if (ImGui::ImageButton( - m_DirectoryTexture->GetTexture(), - ImVec2(m_FileSize, m_FileSize), + m_directory_texture->GetTexture(), + ImVec2(m_file_size, m_file_size), ImVec2 { 0.0f, 0.0f }, ImVec2 { 1.0f, 1.0f }, 0, @@ -86,15 +86,15 @@ void AssetBrowserPanel::OnUserInterfaceUpdate() ImVec4 { 1.0f, 1.0f, 1.0f, 1.0f } )) { - m_CurrentDirectory /= path.filename(); + m_current_directory /= path.filename(); } break; // Scene case AssetType::Scene: if (ImGui::ImageButton( - m_SceneTexture->GetTexture(), - ImVec2(m_FileSize, m_FileSize), + m_scene_texture->GetTexture(), + ImVec2(m_file_size, m_file_size), ImVec2 { 0.0f, 0.0f }, ImVec2 { 1.0f, 1.0f }, 0, @@ -102,7 +102,7 @@ void AssetBrowserPanel::OnUserInterfaceUpdate() ImVec4 { 1.0f, 1.0f, 1.0f, 1.0f } )) { - SceneSerializer serializer(m_ActiveScene); + SceneSerializer serializer(m_active_scene); LOG(info, "Attempting to deserialize: {}", path.string()); serializer.Deserialize(path.string()); } @@ -111,8 +111,8 @@ void AssetBrowserPanel::OnUserInterfaceUpdate() // Image case AssetType::Image: if (ImGui::ImageButton( - m_ImageTexture->GetTexture(), - ImVec2(m_FileSize, m_FileSize), + m_image_texture->GetTexture(), + ImVec2(m_file_size, m_file_size), ImVec2 { 0.0f, 0.0f }, ImVec2 { 1.0f, 1.0f }, 0, @@ -126,8 +126,8 @@ void AssetBrowserPanel::OnUserInterfaceUpdate() // Text case AssetType::Text: if (ImGui::ImageButton( - m_TextTexture->GetTexture(), - ImVec2(m_FileSize, m_FileSize), + m_text_texture->GetTexture(), + ImVec2(m_file_size, m_file_size), ImVec2 { 0.0f, 0.0f }, ImVec2 { 1.0f, 1.0f }, 0, diff --git a/modules/mirror/src/panel/properties.cpp b/modules/mirror/src/panel/properties.cpp index 9125c6c..7e22d74 100644 --- a/modules/mirror/src/panel/properties.cpp +++ b/modules/mirror/src/panel/properties.cpp @@ -12,11 +12,11 @@ void PropertiesPanel::OnUserInterfaceUpdate() { ImGui::Begin("Properties"); - if (m_EntityContext.IsValid()) + if (m_entity_context.IsValid()) { - if (m_EntityContext.HasComponent()) + if (m_entity_context.HasComponent()) { - auto &tagComponent = m_EntityContext.GetComponent(); + auto &tagComponent = m_entity_context.GetComponent(); char buffer[256]; memset(buffer, 0, sizeof(buffer)); @@ -37,22 +37,22 @@ void PropertiesPanel::OnUserInterfaceUpdate() if (ImGui::Selectable( "SpriteRenderer", false, - m_EntityContext.HasComponent() ? + m_entity_context.HasComponent() ? ImGuiSelectableFlags_Disabled : NULL )) - m_EntityContext.AddComponent( + m_entity_context.AddComponent( Light::ResourceManager::GetTexture("awesomeface") ); if (ImGui::Selectable( "Camera", false, - m_EntityContext.HasComponent() ? + m_entity_context.HasComponent() ? ImGuiSelectableFlags_Disabled : NULL )) - m_EntityContext.AddComponent(); + m_entity_context.AddComponent(); ImGui::EndPopup(); } @@ -60,7 +60,7 @@ void PropertiesPanel::OnUserInterfaceUpdate() DrawComponent( "Transform Component", - m_EntityContext, + m_entity_context, [&](auto &transformComponent) { DrawVec3Control("Translation", transformComponent.translation); } @@ -68,7 +68,7 @@ void PropertiesPanel::OnUserInterfaceUpdate() DrawComponent( "SpriteRenderer Component", - m_EntityContext, + m_entity_context, [&](auto &spriteRendererComponent) { ImGui::ColorEdit4("Color", &spriteRendererComponent.tint[0]); } @@ -76,7 +76,7 @@ void PropertiesPanel::OnUserInterfaceUpdate() DrawComponent( "Camera Component", - m_EntityContext, + m_entity_context, [&](auto &cameraComponent) { auto &camera = cameraComponent.camera; @@ -147,7 +147,7 @@ void PropertiesPanel::OnUserInterfaceUpdate() void PropertiesPanel::SetEntityContext(Entity entity) { - m_EntityContext = entity; + m_entity_context = entity; } void PropertiesPanel::DrawVec3Control( diff --git a/modules/mirror/src/panel/scene_hierarchy.cpp b/modules/mirror/src/panel/scene_hierarchy.cpp index 404f559..59cd9b4 100644 --- a/modules/mirror/src/panel/scene_hierarchy.cpp +++ b/modules/mirror/src/panel/scene_hierarchy.cpp @@ -7,28 +7,28 @@ namespace Light { SceneHierarchyPanel::SceneHierarchyPanel() - : m_Context(nullptr) - , m_PropertiesPanelContext(nullptr) - , m_SelectionContext() + : m_context(nullptr) + , m_properties_panel_context(nullptr) + , m_selection_context() { } SceneHierarchyPanel:: SceneHierarchyPanel(Ref context, Ref propertiesPanel /* = nullptr */) - : m_Context(context) - , m_PropertiesPanelContext(propertiesPanel) + : m_context(context) + , m_properties_panel_context(propertiesPanel) { } void SceneHierarchyPanel::OnUserInterfaceUpdate() { - if (m_Context) + if (m_context) { ImGui::Begin("Hierarchy"); - for (auto entityID : m_Context->m_Registry.view()) + for (auto entityID : m_context->m_registry.view()) { - Entity entity(static_cast(entityID), m_Context.get()); + Entity entity(static_cast(entityID), m_context.get()); const std::string &tag = entity.GetComponent(); DrawNode(entity, tag); @@ -42,22 +42,22 @@ void SceneHierarchyPanel:: SetContext(Ref context, Ref propertiesPanel /* = nullptr */) { if (propertiesPanel) - m_PropertiesPanelContext = propertiesPanel; + m_properties_panel_context = propertiesPanel; - m_Context = context; + m_context = context; } void SceneHierarchyPanel::DrawNode(Entity entity, const std::string &label) { - ImGuiTreeNodeFlags flags = (m_SelectionContext == entity ? ImGuiTreeNodeFlags_Selected : NULL) + ImGuiTreeNodeFlags flags = (m_selection_context == entity ? ImGuiTreeNodeFlags_Selected : NULL) | ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_SpanFullWidth; bool expanded = ImGui::TreeNodeEx((void *)(uint64_t)(uint32_t)(entity), flags, label.c_str()); if (ImGui::IsItemClicked()) { - m_SelectionContext = entity; - m_PropertiesPanelContext->SetEntityContext(entity); + m_selection_context = entity; + m_properties_panel_context->SetEntityContext(entity); } if (expanded)