Compare commits

..

No commits in common. "9c628b1e68cea9f468005e35b05f5aefe98ca3a0" and "7ff3b41c04236046b96b14eb971654129d7b37ce" have entirely different histories.

20 changed files with 43 additions and 52 deletions

View file

@ -239,6 +239,7 @@ misc-header-include-cycle,
misc-definitions-in-headers,
misc-coroutine-hostile-raii,
misc-const-correctness,
misc-confusable-identifiers,
hicpp-signed-bitwise,
hicpp-no-assembler,

View file

@ -52,7 +52,7 @@ Application::Application(): m_window(nullptr)
m_renderer = Renderer::create(
(GLFWwindow *)m_window->get_handle(),
lt::GraphicsContext::get_shared_context(),
m_graphics_context->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(),
lt::GraphicsContext::get_shared_context()
m_graphics_context->get_shared_context()
);
m_layer_stack = create_scope<LayerStack>();

View file

@ -131,7 +131,7 @@ public:
return "TextLoader";
}
[[nodiscard]] auto load(const std::filesystem::path& file_path) const -> Assets::TextAsset::PackageData
[[nodiscard]] auto load(std::filesystem::path file_path) const -> Assets::TextAsset::PackageData
{
auto stream = std::ifstream { file_path, std::ios::binary };
if (!stream.good())

View file

@ -35,19 +35,19 @@ public:
void set_viewport_size(unsigned int width, unsigned int height);
void set_projection_type(ProjectionType projection_type);
void set_projection_type(ProjectionType projectionType);
void set_orthographic_size(float size);
void set_orthographic_far_plane(float far_plane);
void set_orthographic_far_plane(float farPlane);
void set_orthographic_near_plane(float near_plane);
void set_orthographic_near_plane(float nearPlane);
void set_perspective_vertical_fov(float vertical_fov);
void set_perspective_vertical_fov(float verticalFov);
void set_perspective_far_plane(float far_plane);
void set_perspective_far_plane(float farPlane);
void set_perspective_near_plane(float near_plane);
void set_perspective_near_plane(float nearPlane);
[[nodiscard]] auto get_orthographic_size() const -> float
{

View file

@ -2,7 +2,7 @@
namespace lt {
enum class EventType : uint8_t
enum class EventType
{
None = 0,
@ -24,7 +24,7 @@ enum class EventType : uint8_t
WindowGainFocus,
};
enum EventCategory : uint8_t
enum EventCategory
{
None = 0,

View file

@ -24,10 +24,7 @@ public:
return ss.str();
}
[[nodiscard]] auto get_event_type() const -> EventType override
{
return ::lt::EventType::KeyPressed;
}
event_type(KeyPressed);
event_category(InputEventCategory | KeyboardEventCategory);

View file

@ -8,7 +8,7 @@ namespace lt {
class glBlender: public Blender
{
public:
~glBlender() override = default;
virtual ~glBlender() = default;
glBlender();
void enable(BlendFactor srcFactor, BlendFactor dstFactor) override;

View file

@ -10,7 +10,7 @@ class glConstantBuffer: public ConstantBuffer
public:
glConstantBuffer(ConstantBufferIndex index, unsigned int size);
~glConstantBuffer() override;
virtual ~glConstantBuffer();
void bind() override;

View file

@ -10,7 +10,7 @@ class glFramebuffer: public Framebuffer
public:
glFramebuffer(const FramebufferSpecification &specification);
~glFramebuffer() override;
virtual ~glFramebuffer();
void bind_as_target(const glm::vec4 &clearColor) override;

View file

@ -16,7 +16,7 @@ class Shader;
class QuadRendererProgram: RendererProgram
{
public:
~QuadRendererProgram() override = default;
virtual ~QuadRendererProgram() = default;
struct QuadVertexData
{
glm::vec4 position;
@ -25,7 +25,7 @@ public:
};
QuadRendererProgram(
unsigned int max_vertices,
unsigned int maxVertices,
const Ref<SharedContext> &shared_context,
Ref<Shader> shader
);

View file

@ -25,7 +25,7 @@ public:
};
TextureRendererProgram(
unsigned int max_vertices,
unsigned int maxVertices,
const Ref<SharedContext> &shared_context,
Ref<Shader> shader
);

View file

@ -16,7 +16,7 @@ class SharedContext;
class TintedTextureRendererProgram: RendererProgram
{
public:
~TintedTextureRendererProgram() override = default;
virtual ~TintedTextureRendererProgram() = default;
struct TintedTextureVertexData
{
glm::vec4 position;
@ -27,8 +27,8 @@ public:
};
TintedTextureRendererProgram(
unsigned int max_vertices,
const Ref<SharedContext> &shared_context,
unsigned int maxVertices,
const Ref<SharedContext> &sharedContext,
Ref<Shader> shader
);

View file

@ -42,8 +42,8 @@ public:
};
static auto create(
GLFWwindow *windowHandle,
Ref<SharedContext> sharedContext,
GLFWwindow *window_handle,
Ref<SharedContext> shared_context,
CreateInfo create_info
) -> Scope<Renderer>;
@ -67,13 +67,9 @@ public:
s_context->draw_quad_impl(position, size, std::move(texture));
}
static void draw_quad(
const glm::mat4 &transform,
const glm::vec4 &tint,
const Ref<Texture> &texture
)
static void draw_quad(const glm::mat4 &transform, const glm::vec4 &tint, Ref<Texture> texture)
{
s_context->draw_quad_impl(transform, tint, texture);
s_context->draw_quad_impl(transform, tint, std::move(texture));
}
static void draw_quad(const glm::mat4 &transform, const glm::vec4 &tint)
@ -81,9 +77,9 @@ public:
s_context->draw_quad_impl(transform, tint);
}
static void draw_quad(const glm::mat4 &transform, const Ref<Texture> &texture)
static void draw_quad(const glm::mat4 &transform, Ref<Texture> texture)
{
s_context->draw_quad_impl(transform, texture);
s_context->draw_quad_impl(transform, std::move(texture));
}
static void begin_scene(
@ -127,11 +123,7 @@ private:
bool m_should_clear_backbuffer { false };
Renderer(
GLFWwindow *window_handle,
const Ref<SharedContext> &shared_context,
CreateInfo create_info
);
Renderer(GLFWwindow *windowHandle, Ref<SharedContext> sharedContext, CreateInfo create_info);
void draw_quad_impl(
const glm::vec3 &position,

View file

@ -25,8 +25,8 @@ public:
};
static auto create(
const Ref<Assets::TextAsset>& vertex_asset,
const Ref<Assets::TextAsset>& pixel_asset,
Ref<Assets::TextAsset> vertex_asset,
Ref<Assets::TextAsset> pixel_asset,
const Ref<SharedContext> &shared_context
) -> Ref<Shader>;

View file

@ -14,7 +14,7 @@ class Texture
{
public:
static Ref<Texture> create(
const Ref<Assets::TextureAsset>& asset,
Ref<Assets::TextureAsset> asset,
const Ref<SharedContext> &shared_context
);

View file

@ -20,7 +20,7 @@ Renderer *Renderer::s_context = nullptr;
Renderer::Renderer(
GLFWwindow *window_handle,
const Ref<SharedContext>& shared_context,
Ref<SharedContext> shared_context,
CreateInfo create_info
)
: m_quad_renderer(

View file

@ -12,8 +12,8 @@
namespace lt {
/* static */ auto Shader::create(
const Ref<Assets::TextAsset>& vertex_asset,
const Ref<Assets::TextAsset>& pixel_asset,
Ref<Assets::TextAsset> vertex_asset,
Ref<Assets::TextAsset> pixel_asset,
const Ref<SharedContext> &shared_context
) -> Ref<Shader>
{

View file

@ -12,8 +12,8 @@
namespace lt {
/* static */ auto Texture::create(
const Ref<Assets::TextureAsset>& asset,
const Ref<SharedContext> & /*shared_context*/
Ref<Assets::TextureAsset> asset,
const Ref<SharedContext> &shared_context
) -> Ref<Texture>
{
switch (GraphicsContext::get_graphics_api())

View file

@ -12,7 +12,7 @@ class SharedContext;
class UserInterface
{
public:
static auto create(GLFWwindow *windowHandle, Ref<SharedContext> sharedContext)
static auto create(GLFWwindow *window_handle, Ref<SharedContext> shared_context)
-> Scope<UserInterface>;
static void dockspace_begin();
@ -25,7 +25,7 @@ public:
virtual ~UserInterface() = default;
void init(GLFWwindow *windowHandle, Ref<SharedContext> sharedContext);
void init(GLFWwindow *window_handle, Ref<SharedContext> sharedContext);
virtual void platform_implementation(
GLFWwindow *window_handle,

View file

@ -9,7 +9,8 @@
namespace lt {
Window::~Window()
= default;
{
}
auto Window::create(const std::function<void(Event &)> &callback) -> Scope<Window>
{
@ -17,7 +18,7 @@ auto Window::create(const std::function<void(Event &)> &callback) -> Scope<Windo
}
lWindow::lWindow(std::function<void(Event &)> callback)
: m_handle(glfwCreateWindow(1u, 1u, "", nullptr, nullptr)), m_event_callback(std::move(std::move(callback)))
: m_event_callback(std::move(std::move(callback)))
{
// init glfw
ensure(glfwInit(), "lWindow::lWindow: failed to initialize 'glfw'");
@ -28,7 +29,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);