refactor: applied clang-tidy fix-its
This commit is contained in:
		
							parent
							
								
									7ff3b41c04
								
							
						
					
					
						commit
						efb710ee87
					
				
					 19 changed files with 52 additions and 42 deletions
				
			
		|  | @ -52,7 +52,7 @@ Application::Application(): m_window(nullptr) | |||
| 
 | ||||
| 	m_renderer = Renderer::create( | ||||
| 	    (GLFWwindow *)m_window->get_handle(), | ||||
| 	    m_graphics_context->get_shared_context(), | ||||
| 	    lt::GraphicsContext::get_shared_context(), | ||||
| 	    Renderer::CreateInfo { | ||||
| 	        .quad_renderer_shader = AssetManager::get_shader("LT_ENGINE_RESOURCES_QUAD_SHADER"), | ||||
| 	        .texture_renderer_shader = AssetManager::get_shader( | ||||
|  | @ -68,7 +68,7 @@ Application::Application(): m_window(nullptr) | |||
| 
 | ||||
| 	m_user_interface = UserInterface::create( | ||||
| 	    (GLFWwindow *)m_window->get_handle(), | ||||
| 	    m_graphics_context->get_shared_context() | ||||
| 	    lt::GraphicsContext::get_shared_context() | ||||
| 	); | ||||
| 
 | ||||
| 	m_layer_stack = create_scope<LayerStack>(); | ||||
|  |  | |||
|  | @ -131,7 +131,7 @@ public: | |||
| 		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 }; | ||||
| 		if (!stream.good()) | ||||
|  |  | |||
|  | @ -35,19 +35,19 @@ public: | |||
| 
 | ||||
| 	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_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 | ||||
| 	{ | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ | |||
| 
 | ||||
| namespace lt { | ||||
| 
 | ||||
| enum class EventType | ||||
| enum class EventType : uint8_t | ||||
| { | ||||
| 	None = 0, | ||||
| 
 | ||||
|  | @ -24,7 +24,7 @@ enum class EventType | |||
| 	WindowGainFocus, | ||||
| }; | ||||
| 
 | ||||
| enum EventCategory | ||||
| enum EventCategory : uint8_t | ||||
| { | ||||
| 	None = 0, | ||||
| 
 | ||||
|  |  | |||
|  | @ -24,7 +24,10 @@ public: | |||
| 		return ss.str(); | ||||
| 	} | ||||
| 
 | ||||
| 	event_type(KeyPressed); | ||||
| 	[[nodiscard]] auto get_event_type() const -> EventType override | ||||
| 	{ | ||||
| 		return ::lt::EventType::KeyPressed; | ||||
| 	} | ||||
| 
 | ||||
| 	event_category(InputEventCategory | KeyboardEventCategory); | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ namespace lt { | |||
| class glBlender: public Blender | ||||
| { | ||||
| public: | ||||
| 	virtual ~glBlender() = default; | ||||
| 	~glBlender() override = default; | ||||
| 	glBlender(); | ||||
| 
 | ||||
| 	void enable(BlendFactor srcFactor, BlendFactor dstFactor) override; | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ class glConstantBuffer: public ConstantBuffer | |||
| public: | ||||
| 	glConstantBuffer(ConstantBufferIndex index, unsigned int size); | ||||
| 
 | ||||
| 	virtual ~glConstantBuffer(); | ||||
| 	~glConstantBuffer() override; | ||||
| 
 | ||||
| 	void bind() override; | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ class glFramebuffer: public Framebuffer | |||
| public: | ||||
| 	glFramebuffer(const FramebufferSpecification &specification); | ||||
| 
 | ||||
| 	virtual ~glFramebuffer(); | ||||
| 	~glFramebuffer() override; | ||||
| 
 | ||||
| 	void bind_as_target(const glm::vec4 &clearColor) override; | ||||
| 
 | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ class Shader; | |||
| class QuadRendererProgram: RendererProgram | ||||
| { | ||||
| public: | ||||
| 	virtual ~QuadRendererProgram() = default; | ||||
| 	~QuadRendererProgram() override = default; | ||||
| 	struct QuadVertexData | ||||
| 	{ | ||||
| 		glm::vec4 position; | ||||
|  | @ -25,7 +25,7 @@ public: | |||
| 	}; | ||||
| 
 | ||||
| 	QuadRendererProgram( | ||||
| 	    unsigned int maxVertices, | ||||
| 	    unsigned int max_vertices, | ||||
| 	    const Ref<SharedContext> &shared_context, | ||||
| 	    Ref<Shader> shader | ||||
| 	); | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ public: | |||
| 	}; | ||||
| 
 | ||||
| 	TextureRendererProgram( | ||||
| 	    unsigned int maxVertices, | ||||
| 	    unsigned int max_vertices, | ||||
| 	    const Ref<SharedContext> &shared_context, | ||||
| 	    Ref<Shader> shader | ||||
| 	); | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ class SharedContext; | |||
| class TintedTextureRendererProgram: RendererProgram | ||||
| { | ||||
| public: | ||||
| 	virtual ~TintedTextureRendererProgram() = default; | ||||
| 	~TintedTextureRendererProgram() override = default; | ||||
| 	struct TintedTextureVertexData | ||||
| 	{ | ||||
| 		glm::vec4 position; | ||||
|  | @ -27,8 +27,8 @@ public: | |||
| 	}; | ||||
| 
 | ||||
| 	TintedTextureRendererProgram( | ||||
| 	    unsigned int maxVertices, | ||||
| 	    const Ref<SharedContext> &sharedContext, | ||||
| 	    unsigned int max_vertices, | ||||
| 	    const Ref<SharedContext> &shared_context, | ||||
| 	    Ref<Shader> shader | ||||
| 	); | ||||
| 
 | ||||
|  |  | |||
|  | @ -42,8 +42,8 @@ public: | |||
| 	}; | ||||
| 
 | ||||
| 	static auto create( | ||||
| 	    GLFWwindow *window_handle, | ||||
| 	    Ref<SharedContext> shared_context, | ||||
| 	    GLFWwindow *windowHandle, | ||||
| 	    Ref<SharedContext> sharedContext, | ||||
| 	    CreateInfo create_info | ||||
| 	) -> Scope<Renderer>; | ||||
| 
 | ||||
|  | @ -67,9 +67,13 @@ public: | |||
| 		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) | ||||
|  | @ -77,9 +81,9 @@ public: | |||
| 		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( | ||||
|  | @ -123,7 +127,11 @@ private: | |||
| 
 | ||||
| 	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( | ||||
| 	    const glm::vec3 &position, | ||||
|  |  | |||
|  | @ -25,8 +25,8 @@ public: | |||
| 	}; | ||||
| 
 | ||||
| 	static auto create( | ||||
| 	    Ref<Assets::TextAsset> vertex_asset, | ||||
| 	    Ref<Assets::TextAsset> pixel_asset, | ||||
| 	    const Ref<Assets::TextAsset>& vertex_asset, | ||||
| 	    const Ref<Assets::TextAsset>& pixel_asset, | ||||
| 	    const Ref<SharedContext> &shared_context | ||||
| 	) -> Ref<Shader>; | ||||
| 
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class Texture | |||
| { | ||||
| public: | ||||
| 	static Ref<Texture> create( | ||||
| 	    Ref<Assets::TextureAsset> asset, | ||||
| 	    const Ref<Assets::TextureAsset>& asset, | ||||
| 	    const Ref<SharedContext> &shared_context | ||||
| 	); | ||||
| 
 | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ Renderer *Renderer::s_context = nullptr; | |||
| 
 | ||||
| Renderer::Renderer( | ||||
|     GLFWwindow *window_handle, | ||||
|     Ref<SharedContext> shared_context, | ||||
|     const Ref<SharedContext>& shared_context, | ||||
|     CreateInfo create_info | ||||
| ) | ||||
|     : m_quad_renderer( | ||||
|  |  | |||
|  | @ -12,8 +12,8 @@ | |||
| namespace lt { | ||||
| 
 | ||||
| /* static */ auto Shader::create( | ||||
|     Ref<Assets::TextAsset> vertex_asset, | ||||
|     Ref<Assets::TextAsset> pixel_asset, | ||||
|     const Ref<Assets::TextAsset>& vertex_asset, | ||||
|     const Ref<Assets::TextAsset>& pixel_asset, | ||||
|     const Ref<SharedContext> &shared_context | ||||
| ) -> Ref<Shader> | ||||
| { | ||||
|  |  | |||
|  | @ -12,8 +12,8 @@ | |||
| namespace lt { | ||||
| 
 | ||||
| /* static */ auto Texture::create( | ||||
|     Ref<Assets::TextureAsset> asset, | ||||
|     const Ref<SharedContext> &shared_context | ||||
|     const Ref<Assets::TextureAsset>& asset, | ||||
|     const Ref<SharedContext> & /*shared_context*/ | ||||
| ) -> Ref<Texture> | ||||
| { | ||||
| 	switch (GraphicsContext::get_graphics_api()) | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ class SharedContext; | |||
| class UserInterface | ||||
| { | ||||
| public: | ||||
| 	static auto create(GLFWwindow *window_handle, Ref<SharedContext> shared_context) | ||||
| 	static auto create(GLFWwindow *windowHandle, Ref<SharedContext> sharedContext) | ||||
| 	    -> Scope<UserInterface>; | ||||
| 
 | ||||
| 	static void dockspace_begin(); | ||||
|  | @ -25,7 +25,7 @@ public: | |||
| 
 | ||||
| 	virtual ~UserInterface() = default; | ||||
| 
 | ||||
| 	void init(GLFWwindow *window_handle, Ref<SharedContext> sharedContext); | ||||
| 	void init(GLFWwindow *windowHandle, Ref<SharedContext> sharedContext); | ||||
| 
 | ||||
| 	virtual void platform_implementation( | ||||
| 	    GLFWwindow *window_handle, | ||||
|  |  | |||
|  | @ -9,8 +9,7 @@ | |||
| namespace lt { | ||||
| 
 | ||||
| Window::~Window() | ||||
| { | ||||
| } | ||||
| = default; | ||||
| 
 | ||||
| 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) | ||||
|     : 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
 | ||||
| 	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_VISIBLE, GLFW_FALSE); | ||||
| 
 | ||||
| 	m_handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr); | ||||
| 	 | ||||
| 	ensure(m_handle, "lWindow::lWindow: failed to create 'GLFWwindow'"); | ||||
| 
 | ||||
| 	glfwSetWindowUserPointer(m_handle, &m_event_callback); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue