ci: add static_analysis #2
					 28 changed files with 213 additions and 85 deletions
				
			
		| 
						 | 
					@ -239,7 +239,6 @@ misc-header-include-cycle,
 | 
				
			||||||
misc-definitions-in-headers,
 | 
					misc-definitions-in-headers,
 | 
				
			||||||
misc-coroutine-hostile-raii,
 | 
					misc-coroutine-hostile-raii,
 | 
				
			||||||
misc-const-correctness,
 | 
					misc-const-correctness,
 | 
				
			||||||
misc-confusable-identifiers,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
hicpp-signed-bitwise,
 | 
					hicpp-signed-bitwise,
 | 
				
			||||||
hicpp-no-assembler,
 | 
					hicpp-no-assembler,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										25
									
								
								.drone.yml
									
										
									
									
									
								
							
							
						
						
									
										25
									
								
								.drone.yml
									
										
									
									
									
								
							| 
						 | 
					@ -1,6 +1,9 @@
 | 
				
			||||||
kind: pipeline
 | 
					kind: pipeline
 | 
				
			||||||
type: docker
 | 
					type: docker
 | 
				
			||||||
name: clang format
 | 
					name: clang format
 | 
				
			||||||
 | 
					clone:
 | 
				
			||||||
 | 
					  recursive: true
 | 
				
			||||||
 | 
					  submodule_update_remote: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
trigger:
 | 
					trigger:
 | 
				
			||||||
  branch:
 | 
					  branch:
 | 
				
			||||||
| 
						 | 
					@ -24,3 +27,25 @@ steps:
 | 
				
			||||||
      done
 | 
					      done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      echo "✅ All files are properly formatted"
 | 
					      echo "✅ All files are properly formatted"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					kind: pipeline
 | 
				
			||||||
 | 
					type: docker
 | 
				
			||||||
 | 
					name: static analysis
 | 
				
			||||||
 | 
					clone:
 | 
				
			||||||
 | 
					  recursive: true
 | 
				
			||||||
 | 
					  submodule_update_remote: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					trigger:
 | 
				
			||||||
 | 
					  branch:
 | 
				
			||||||
 | 
					  - main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					steps:
 | 
				
			||||||
 | 
					- name: static_analysis
 | 
				
			||||||
 | 
					  image: static_analysis:latest
 | 
				
			||||||
 | 
					  pull: if-not-exists
 | 
				
			||||||
 | 
					  privileged: true
 | 
				
			||||||
 | 
					  commands:
 | 
				
			||||||
 | 
					    - git submodule update --init --recursive
 | 
				
			||||||
 | 
					    - conan build . -s build_type=Release -o enable_static_analysis=True --build=missing
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
cmake_minimum_required(VERSION 4.0)
 | 
					cmake_minimum_required(VERSION 3.14)
 | 
				
			||||||
project(Light)
 | 
					project(Light)
 | 
				
			||||||
set(CMAKE_CXX_STANDARD 23)
 | 
					set(CMAKE_CXX_STANDARD 23)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										3
									
								
								external/CMakeLists.txt
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								external/CMakeLists.txt
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -1,9 +1,6 @@
 | 
				
			||||||
# GLAD #
 | 
					# GLAD #
 | 
				
			||||||
add_subdirectory(./glad)
 | 
					add_subdirectory(./glad)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# IMGUI #
 | 
					 | 
				
			||||||
cmake_minimum_required(VERSION 3.14)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set(MIRROR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../modules/mirror/)
 | 
					set(MIRROR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../modules/mirror/)
 | 
				
			||||||
set(DEPENDENCIES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/)
 | 
					set(DEPENDENCIES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,7 +52,7 @@ Application::Application(): m_window(nullptr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m_renderer = Renderer::create(
 | 
						m_renderer = Renderer::create(
 | 
				
			||||||
	    (GLFWwindow *)m_window->get_handle(),
 | 
						    (GLFWwindow *)m_window->get_handle(),
 | 
				
			||||||
	    m_graphics_context->get_shared_context(),
 | 
						    lt::GraphicsContext::get_shared_context(),
 | 
				
			||||||
	    Renderer::CreateInfo {
 | 
						    Renderer::CreateInfo {
 | 
				
			||||||
	        .quad_renderer_shader = AssetManager::get_shader("LT_ENGINE_RESOURCES_QUAD_SHADER"),
 | 
						        .quad_renderer_shader = AssetManager::get_shader("LT_ENGINE_RESOURCES_QUAD_SHADER"),
 | 
				
			||||||
	        .texture_renderer_shader = AssetManager::get_shader(
 | 
						        .texture_renderer_shader = AssetManager::get_shader(
 | 
				
			||||||
| 
						 | 
					@ -68,7 +68,7 @@ Application::Application(): m_window(nullptr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m_user_interface = UserInterface::create(
 | 
						m_user_interface = UserInterface::create(
 | 
				
			||||||
	    (GLFWwindow *)m_window->get_handle(),
 | 
						    (GLFWwindow *)m_window->get_handle(),
 | 
				
			||||||
	    m_graphics_context->get_shared_context()
 | 
						    lt::GraphicsContext::get_shared_context()
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m_layer_stack = create_scope<LayerStack>();
 | 
						m_layer_stack = create_scope<LayerStack>();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -131,7 +131,7 @@ public:
 | 
				
			||||||
		return "TextLoader";
 | 
							return "TextLoader";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[[nodiscard]] auto load(std::filesystem::path file_path) const -> Assets::TextAsset::PackageData
 | 
						[[nodiscard]] auto load(const std::filesystem::path& file_path) const -> Assets::TextAsset::PackageData
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		auto stream = std::ifstream { file_path, std::ios::binary };
 | 
							auto stream = std::ifstream { file_path, std::ios::binary };
 | 
				
			||||||
		if (!stream.good())
 | 
							if (!stream.good())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,19 +35,19 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void set_viewport_size(unsigned int width, unsigned int height);
 | 
						void set_viewport_size(unsigned int width, unsigned int height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void set_projection_type(ProjectionType projectionType);
 | 
						void set_projection_type(ProjectionType projection_type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void set_orthographic_size(float size);
 | 
						void set_orthographic_size(float size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void set_orthographic_far_plane(float farPlane);
 | 
						void set_orthographic_far_plane(float far_plane);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void set_orthographic_near_plane(float nearPlane);
 | 
						void set_orthographic_near_plane(float near_plane);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void set_perspective_vertical_fov(float verticalFov);
 | 
						void set_perspective_vertical_fov(float vertical_fov);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void set_perspective_far_plane(float farPlane);
 | 
						void set_perspective_far_plane(float far_plane);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void set_perspective_near_plane(float nearPlane);
 | 
						void set_perspective_near_plane(float near_plane);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[[nodiscard]] auto get_orthographic_size() const -> float
 | 
						[[nodiscard]] auto get_orthographic_size() const -> float
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,9 +24,15 @@ public:
 | 
				
			||||||
		return ss.str();
 | 
							return ss.str();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(SetChar);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::SetChar;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(InputEventCategory | KeyboardEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(InputEventCategory | KeyboardEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	const unsigned int m_character;
 | 
						const unsigned int m_character;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum class EventType
 | 
					enum class EventType : uint8_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	None = 0,
 | 
						None = 0,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,7 +24,7 @@ enum class EventType
 | 
				
			||||||
	WindowGainFocus,
 | 
						WindowGainFocus,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum EventCategory
 | 
					enum EventCategory : uint8_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	None = 0,
 | 
						None = 0,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,18 +34,6 @@ enum EventCategory
 | 
				
			||||||
	MouseEventCategory = bit(3),
 | 
						MouseEventCategory = bit(3),
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define event_type(type)                      \
 | 
					 | 
				
			||||||
	EventType get_event_type() const override \
 | 
					 | 
				
			||||||
	{                                         \
 | 
					 | 
				
			||||||
		return ::lt::EventType::type;         \
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define event_category(eCategory)                                   \
 | 
					 | 
				
			||||||
	inline bool has_category(EventCategory category) const override \
 | 
					 | 
				
			||||||
	{                                                               \
 | 
					 | 
				
			||||||
		return (eCategory) & category;                              \
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class Event
 | 
					class Event
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,9 +24,15 @@ public:
 | 
				
			||||||
		return ss.str();
 | 
							return ss.str();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(KeyPressed);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::KeyPressed;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(InputEventCategory | KeyboardEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(InputEventCategory | KeyboardEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	const int m_key;
 | 
						const int m_key;
 | 
				
			||||||
| 
						 | 
					@ -51,9 +57,15 @@ public:
 | 
				
			||||||
		return ss.str();
 | 
							return ss.str();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(KeyRepeated);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::KeyRepeated;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(InputEventCategory | KeyboardEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(InputEventCategory | KeyboardEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	const int m_key;
 | 
						const int m_key;
 | 
				
			||||||
| 
						 | 
					@ -78,9 +90,15 @@ public:
 | 
				
			||||||
		return ss.str();
 | 
							return ss.str();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(KeyReleased);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::KeyReleased;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(InputEventCategory | KeyboardEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(InputEventCategory | KeyboardEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	const int m_key;
 | 
						const int m_key;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,9 +35,15 @@ public:
 | 
				
			||||||
		return ss.str();
 | 
							return ss.str();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(MouseMoved);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::MouseMoved;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(InputEventCategory | MouseEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(InputEventCategory | MouseEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	const glm::vec2 m_position;
 | 
						const glm::vec2 m_position;
 | 
				
			||||||
| 
						 | 
					@ -62,9 +68,15 @@ public:
 | 
				
			||||||
		return ss.str();
 | 
							return ss.str();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(WheelScrolled);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::WheelScrolled;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(InputEventCategory | MouseEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(InputEventCategory | MouseEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	const float m_offset;
 | 
						const float m_offset;
 | 
				
			||||||
| 
						 | 
					@ -89,9 +101,15 @@ public:
 | 
				
			||||||
		return ss.str();
 | 
							return ss.str();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(ButtonPressed);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::ButtonPressed;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(InputEventCategory | MouseEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(InputEventCategory | MouseEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	const int m_button;
 | 
						const int m_button;
 | 
				
			||||||
| 
						 | 
					@ -116,9 +134,15 @@ public:
 | 
				
			||||||
		return ss.str();
 | 
							return ss.str();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(ButtonReleased);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::ButtonReleased;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(InputEventCategory | MouseEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(InputEventCategory | MouseEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	const int m_button;
 | 
						const int m_button;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,9 +14,15 @@ public:
 | 
				
			||||||
		return "WindowClosedEvent";
 | 
							return "WindowClosedEvent";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(WindowClosed);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::WindowClosed;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(WindowEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(WindowEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WindowMovedEvent: public Event
 | 
					class WindowMovedEvent: public Event
 | 
				
			||||||
| 
						 | 
					@ -39,9 +45,15 @@ public:
 | 
				
			||||||
		;
 | 
							;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(WindowMoved);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::WindowMoved;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(WindowEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(WindowEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	const glm::ivec2 m_position;
 | 
						const glm::ivec2 m_position;
 | 
				
			||||||
| 
						 | 
					@ -66,9 +78,15 @@ public:
 | 
				
			||||||
		return ss.str();
 | 
							return ss.str();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(WindowResized);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::WindowResized;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(WindowEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(WindowEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	const glm::uvec2 m_size;
 | 
						const glm::uvec2 m_size;
 | 
				
			||||||
| 
						 | 
					@ -82,9 +100,15 @@ public:
 | 
				
			||||||
		return "WindowLostFocus";
 | 
							return "WindowLostFocus";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(WindowLostFocus);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::WindowLostFocus;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(WindowEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(WindowEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WindowGainFocusEvent: public Event
 | 
					class WindowGainFocusEvent: public Event
 | 
				
			||||||
| 
						 | 
					@ -95,9 +119,15 @@ public:
 | 
				
			||||||
		return "WindowGainFocus";
 | 
							return "WindowGainFocus";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_type(WindowGainFocus);
 | 
						[[nodiscard]] auto get_event_type() const -> EventType override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return ::lt::EventType::WindowGainFocus;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event_category(WindowEventCategory);
 | 
						[[nodiscard]] auto has_category(EventCategory category) const -> bool override
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return static_cast<uint8_t>(WindowEventCategory) & category;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace lt
 | 
					} // namespace lt
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ namespace lt {
 | 
				
			||||||
class glBlender: public Blender
 | 
					class glBlender: public Blender
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	virtual ~glBlender() = default;
 | 
						~glBlender() override = default;
 | 
				
			||||||
	glBlender();
 | 
						glBlender();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void enable(BlendFactor srcFactor, BlendFactor dstFactor) override;
 | 
						void enable(BlendFactor srcFactor, BlendFactor dstFactor) override;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,7 @@ class glConstantBuffer: public ConstantBuffer
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	glConstantBuffer(ConstantBufferIndex index, unsigned int size);
 | 
						glConstantBuffer(ConstantBufferIndex index, unsigned int size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	virtual ~glConstantBuffer();
 | 
						~glConstantBuffer() override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void bind() override;
 | 
						void bind() override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,7 @@ class glFramebuffer: public Framebuffer
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	glFramebuffer(const FramebufferSpecification &specification);
 | 
						glFramebuffer(const FramebufferSpecification &specification);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	virtual ~glFramebuffer();
 | 
						~glFramebuffer() override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void bind_as_target(const glm::vec4 &clearColor) override;
 | 
						void bind_as_target(const glm::vec4 &clearColor) override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@ class Shader;
 | 
				
			||||||
class QuadRendererProgram: RendererProgram
 | 
					class QuadRendererProgram: RendererProgram
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	virtual ~QuadRendererProgram() = default;
 | 
						~QuadRendererProgram() override = default;
 | 
				
			||||||
	struct QuadVertexData
 | 
						struct QuadVertexData
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		glm::vec4 position;
 | 
							glm::vec4 position;
 | 
				
			||||||
| 
						 | 
					@ -25,7 +25,7 @@ public:
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	QuadRendererProgram(
 | 
						QuadRendererProgram(
 | 
				
			||||||
	    unsigned int maxVertices,
 | 
						    unsigned int max_vertices,
 | 
				
			||||||
	    const Ref<SharedContext> &shared_context,
 | 
						    const Ref<SharedContext> &shared_context,
 | 
				
			||||||
	    Ref<Shader> shader
 | 
						    Ref<Shader> shader
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,7 +25,7 @@ public:
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TextureRendererProgram(
 | 
						TextureRendererProgram(
 | 
				
			||||||
	    unsigned int maxVertices,
 | 
						    unsigned int max_vertices,
 | 
				
			||||||
	    const Ref<SharedContext> &shared_context,
 | 
						    const Ref<SharedContext> &shared_context,
 | 
				
			||||||
	    Ref<Shader> shader
 | 
						    Ref<Shader> shader
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@ class SharedContext;
 | 
				
			||||||
class TintedTextureRendererProgram: RendererProgram
 | 
					class TintedTextureRendererProgram: RendererProgram
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	virtual ~TintedTextureRendererProgram() = default;
 | 
						~TintedTextureRendererProgram() override = default;
 | 
				
			||||||
	struct TintedTextureVertexData
 | 
						struct TintedTextureVertexData
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		glm::vec4 position;
 | 
							glm::vec4 position;
 | 
				
			||||||
| 
						 | 
					@ -27,8 +27,8 @@ public:
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TintedTextureRendererProgram(
 | 
						TintedTextureRendererProgram(
 | 
				
			||||||
	    unsigned int maxVertices,
 | 
						    unsigned int max_vertices,
 | 
				
			||||||
	    const Ref<SharedContext> &sharedContext,
 | 
						    const Ref<SharedContext> &shared_context,
 | 
				
			||||||
	    Ref<Shader> shader
 | 
						    Ref<Shader> shader
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,8 +42,8 @@ public:
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static auto create(
 | 
						static auto create(
 | 
				
			||||||
	    GLFWwindow *window_handle,
 | 
						    GLFWwindow *windowHandle,
 | 
				
			||||||
	    Ref<SharedContext> shared_context,
 | 
						    Ref<SharedContext> sharedContext,
 | 
				
			||||||
	    CreateInfo create_info
 | 
						    CreateInfo create_info
 | 
				
			||||||
	) -> Scope<Renderer>;
 | 
						) -> Scope<Renderer>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,9 +67,13 @@ public:
 | 
				
			||||||
		s_context->draw_quad_impl(position, size, std::move(texture));
 | 
							s_context->draw_quad_impl(position, size, std::move(texture));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static void draw_quad(const glm::mat4 &transform, const glm::vec4 &tint, Ref<Texture> texture)
 | 
						static void draw_quad(
 | 
				
			||||||
 | 
						    const glm::mat4 &transform,
 | 
				
			||||||
 | 
						    const glm::vec4 &tint,
 | 
				
			||||||
 | 
						    const Ref<Texture> &texture
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		s_context->draw_quad_impl(transform, tint, std::move(texture));
 | 
							s_context->draw_quad_impl(transform, tint, texture);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static void draw_quad(const glm::mat4 &transform, const glm::vec4 &tint)
 | 
						static void draw_quad(const glm::mat4 &transform, const glm::vec4 &tint)
 | 
				
			||||||
| 
						 | 
					@ -77,9 +81,9 @@ public:
 | 
				
			||||||
		s_context->draw_quad_impl(transform, tint);
 | 
							s_context->draw_quad_impl(transform, tint);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static void draw_quad(const glm::mat4 &transform, Ref<Texture> texture)
 | 
						static void draw_quad(const glm::mat4 &transform, const Ref<Texture> &texture)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		s_context->draw_quad_impl(transform, std::move(texture));
 | 
							s_context->draw_quad_impl(transform, texture);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static void begin_scene(
 | 
						static void begin_scene(
 | 
				
			||||||
| 
						 | 
					@ -123,7 +127,11 @@ private:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool m_should_clear_backbuffer { false };
 | 
						bool m_should_clear_backbuffer { false };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Renderer(GLFWwindow *windowHandle, Ref<SharedContext> sharedContext, CreateInfo create_info);
 | 
						Renderer(
 | 
				
			||||||
 | 
						    GLFWwindow *window_handle,
 | 
				
			||||||
 | 
						    const Ref<SharedContext> &shared_context,
 | 
				
			||||||
 | 
						    CreateInfo create_info
 | 
				
			||||||
 | 
						);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void draw_quad_impl(
 | 
						void draw_quad_impl(
 | 
				
			||||||
	    const glm::vec3 &position,
 | 
						    const glm::vec3 &position,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,8 +25,8 @@ public:
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static auto create(
 | 
						static auto create(
 | 
				
			||||||
	    Ref<Assets::TextAsset> vertex_asset,
 | 
						    const Ref<Assets::TextAsset>& vertex_asset,
 | 
				
			||||||
	    Ref<Assets::TextAsset> pixel_asset,
 | 
						    const Ref<Assets::TextAsset>& pixel_asset,
 | 
				
			||||||
	    const Ref<SharedContext> &shared_context
 | 
						    const Ref<SharedContext> &shared_context
 | 
				
			||||||
	) -> Ref<Shader>;
 | 
						) -> Ref<Shader>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,7 @@ class Texture
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	static Ref<Texture> create(
 | 
						static Ref<Texture> create(
 | 
				
			||||||
	    Ref<Assets::TextureAsset> asset,
 | 
						    const Ref<Assets::TextureAsset>& asset,
 | 
				
			||||||
	    const Ref<SharedContext> &shared_context
 | 
						    const Ref<SharedContext> &shared_context
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ Renderer *Renderer::s_context = nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Renderer::Renderer(
 | 
					Renderer::Renderer(
 | 
				
			||||||
    GLFWwindow *window_handle,
 | 
					    GLFWwindow *window_handle,
 | 
				
			||||||
    Ref<SharedContext> shared_context,
 | 
					    const Ref<SharedContext>& shared_context,
 | 
				
			||||||
    CreateInfo create_info
 | 
					    CreateInfo create_info
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
    : m_quad_renderer(
 | 
					    : m_quad_renderer(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,8 +12,8 @@
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* static */ auto Shader::create(
 | 
					/* static */ auto Shader::create(
 | 
				
			||||||
    Ref<Assets::TextAsset> vertex_asset,
 | 
					    const Ref<Assets::TextAsset>& vertex_asset,
 | 
				
			||||||
    Ref<Assets::TextAsset> pixel_asset,
 | 
					    const Ref<Assets::TextAsset>& pixel_asset,
 | 
				
			||||||
    const Ref<SharedContext> &shared_context
 | 
					    const Ref<SharedContext> &shared_context
 | 
				
			||||||
) -> Ref<Shader>
 | 
					) -> Ref<Shader>
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,8 +12,8 @@
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* static */ auto Texture::create(
 | 
					/* static */ auto Texture::create(
 | 
				
			||||||
    Ref<Assets::TextureAsset> asset,
 | 
					    const Ref<Assets::TextureAsset>& asset,
 | 
				
			||||||
    const Ref<SharedContext> &shared_context
 | 
					    const Ref<SharedContext> & /*shared_context*/
 | 
				
			||||||
) -> Ref<Texture>
 | 
					) -> Ref<Texture>
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	switch (GraphicsContext::get_graphics_api())
 | 
						switch (GraphicsContext::get_graphics_api())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@ class SharedContext;
 | 
				
			||||||
class UserInterface
 | 
					class UserInterface
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	static auto create(GLFWwindow *window_handle, Ref<SharedContext> shared_context)
 | 
						static auto create(GLFWwindow *windowHandle, Ref<SharedContext> sharedContext)
 | 
				
			||||||
	    -> Scope<UserInterface>;
 | 
						    -> Scope<UserInterface>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static void dockspace_begin();
 | 
						static void dockspace_begin();
 | 
				
			||||||
| 
						 | 
					@ -25,7 +25,7 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	virtual ~UserInterface() = default;
 | 
						virtual ~UserInterface() = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void init(GLFWwindow *window_handle, Ref<SharedContext> sharedContext);
 | 
						void init(GLFWwindow *windowHandle, Ref<SharedContext> sharedContext);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	virtual void platform_implementation(
 | 
						virtual void platform_implementation(
 | 
				
			||||||
	    GLFWwindow *window_handle,
 | 
						    GLFWwindow *window_handle,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,8 +9,7 @@
 | 
				
			||||||
namespace lt {
 | 
					namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Window::~Window()
 | 
					Window::~Window()
 | 
				
			||||||
{
 | 
					= default;
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
auto Window::create(const std::function<void(Event &)> &callback) -> Scope<Window>
 | 
					auto Window::create(const std::function<void(Event &)> &callback) -> Scope<Window>
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -18,7 +17,7 @@ auto Window::create(const std::function<void(Event &)> &callback) -> Scope<Windo
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
lWindow::lWindow(std::function<void(Event &)> callback)
 | 
					lWindow::lWindow(std::function<void(Event &)> callback)
 | 
				
			||||||
    : m_event_callback(std::move(std::move(callback)))
 | 
					    : m_handle(glfwCreateWindow(1u, 1u, "", nullptr, nullptr)), m_event_callback(std::move(std::move(callback)))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// init glfw
 | 
						// init glfw
 | 
				
			||||||
	ensure(glfwInit(), "lWindow::lWindow: failed to initialize 'glfw'");
 | 
						ensure(glfwInit(), "lWindow::lWindow: failed to initialize 'glfw'");
 | 
				
			||||||
| 
						 | 
					@ -29,7 +28,7 @@ lWindow::lWindow(std::function<void(Event &)> callback)
 | 
				
			||||||
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
 | 
						glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
 | 
				
			||||||
	glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
 | 
						glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m_handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr);
 | 
						
 | 
				
			||||||
	ensure(m_handle, "lWindow::lWindow: failed to create 'GLFWwindow'");
 | 
						ensure(m_handle, "lWindow::lWindow: failed to create 'GLFWwindow'");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	glfwSetWindowUserPointer(m_handle, &m_event_callback);
 | 
						glfwSetWindowUserPointer(m_handle, &m_event_callback);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,5 +6,4 @@ RUN apk add --no-cache \
 | 
				
			||||||
    findutils \
 | 
					    findutils \
 | 
				
			||||||
    git \
 | 
					    git \
 | 
				
			||||||
    libc6-compat \
 | 
					    libc6-compat \
 | 
				
			||||||
    tar \
 | 
					 | 
				
			||||||
    clang-extra-tools 
 | 
					    clang-extra-tools 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										35
									
								
								tools/ci/images/static_analysis/Dockerfile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								tools/ci/images/static_analysis/Dockerfile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,35 @@
 | 
				
			||||||
 | 
					FROM alpine:latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN apk add --no-cache \
 | 
				
			||||||
 | 
					    bash \
 | 
				
			||||||
 | 
					    clang \
 | 
				
			||||||
 | 
					    llvm \
 | 
				
			||||||
 | 
					    cmake \
 | 
				
			||||||
 | 
					    git \
 | 
				
			||||||
 | 
					    make \
 | 
				
			||||||
 | 
					    g++ \
 | 
				
			||||||
 | 
					    python3 \
 | 
				
			||||||
 | 
					    py3-pip \
 | 
				
			||||||
 | 
					    mesa-dev \
 | 
				
			||||||
 | 
					    mesa-gl \
 | 
				
			||||||
 | 
					    pkgconf \
 | 
				
			||||||
 | 
					    clang-extra-tools 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN pip install --no-cache-dir --break-system-packages conan gitpython \
 | 
				
			||||||
 | 
					    && conan profile detect
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN clang --version  \
 | 
				
			||||||
 | 
					    && conan --version \
 | 
				
			||||||
 | 
					    && pip --version \
 | 
				
			||||||
 | 
					    && cmake --version \
 | 
				
			||||||
 | 
					    && clang --version \
 | 
				
			||||||
 | 
					    && clang-tidy --version
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN git clone 'https://git.light7734.com/light7734/light.git' --recursive \
 | 
				
			||||||
 | 
					    && cd light \
 | 
				
			||||||
 | 
					    && conan install . \
 | 
				
			||||||
 | 
					        -c tools.system.package_manager:mode=install \
 | 
				
			||||||
 | 
					        -o enable_static_analysis=True \
 | 
				
			||||||
 | 
					        --build=missing
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue