Compare commits

..

2 commits

Author SHA1 Message Date
9c628b1e68
refactor: remove misc-confusable-identifier as it had no way of ignoring namespace lt for light
Some checks failed
continuous-integration/drone/pr Build is failing
2025-07-14 11:32:07 +03:30
efb710ee87
refactor: applied clang-tidy fix-its 2025-07-14 11:31:46 +03:30
20 changed files with 52 additions and 43 deletions

View file

@ -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,

View file

@ -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>();

View file

@ -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())

View file

@ -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
{ {

View file

@ -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,

View file

@ -24,7 +24,10 @@ 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); event_category(InputEventCategory | KeyboardEventCategory);

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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
); );

View file

@ -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
); );

View file

@ -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
); );

View file

@ -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,

View file

@ -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>;

View file

@ -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
); );

View file

@ -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(

View file

@ -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>
{ {

View file

@ -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())

View file

@ -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,

View file

@ -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);