style: apply clang-format v20
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
light7734 2025-07-11 14:05:59 +03:30
parent b6953c2a9e
commit f2c692a118
Signed by: light7734
GPG key ID: 8C30176798F1A6BA
45 changed files with 220 additions and 163 deletions

View file

@ -55,10 +55,13 @@ Application::Application(): m_window(nullptr)
m_graphics_context->get_shared_context(), m_graphics_context->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("LT_ENGINE_RESOURCES_TEXTURE_SHADER" .texture_renderer_shader = AssetManager::get_shader(
"LT_ENGINE_RESOURCES_TEXTURE_SHADER"
),
.tinted_texture_renderer_shader = AssetManager::get_shader(
"LT_ENGINE_RESOURCES_TINTED_"
"TEXTURE_SHADER"
), ),
.tinted_texture_renderer_shader = AssetManager::get_shader("LT_ENGINE_RESOURCES_TINTED_"
"TEXTURE_SHADER"),
} }
); );
ensure(m_graphics_context, "lWindow::lWindow: failed to create 'GraphicsContext'"); ensure(m_graphics_context, "lWindow::lWindow: failed to create 'GraphicsContext'");

View file

@ -31,8 +31,11 @@ public:
TextAsset(const std::filesystem::path &path); TextAsset(const std::filesystem::path &path);
void unpack_blob(BlobMetadata::Tag tag, std::byte *destination, size_t destination_capacity) void unpack_blob(
const; BlobMetadata::Tag tag,
std::byte *destination,
size_t destination_capacity
) const;
[[nodiscard]] auto get_asset_metadata() const -> const Asset::Metadata &; [[nodiscard]] auto get_asset_metadata() const -> const Asset::Metadata &;

View file

@ -95,22 +95,28 @@ void TextAsset::unpack_blob(
case Assets::CompressionType::None: case Assets::CompressionType::None:
if (m_text_blob_metadata.uncompressed_size != m_text_blob_metadata.compressed_size) if (m_text_blob_metadata.uncompressed_size != m_text_blob_metadata.compressed_size)
{ {
throw std::runtime_error("Failed to unpack blob from TextAsset: " throw std::runtime_error(
"compressed/uncompressed size mismatch for no compression " "Failed to unpack blob from TextAsset: "
"type"); "compressed/uncompressed size mismatch for no compression "
"type"
);
} }
if (m_text_blob_metadata.uncompressed_size > destination_capacity) if (m_text_blob_metadata.uncompressed_size > destination_capacity)
{ {
throw std::runtime_error("Failed to unpack blob from TextAsset: " throw std::runtime_error(
"uncompressed_size > destination_capacity, unpacking " "Failed to unpack blob from TextAsset: "
"would result in segfault"); "uncompressed_size > destination_capacity, unpacking "
"would result in segfault"
);
} }
if (!m_stream.is_open()) if (!m_stream.is_open())
{ {
throw std::runtime_error("Failed to unpack blob from TextAsset: ifstream is " throw std::runtime_error(
"closed"); "Failed to unpack blob from TextAsset: ifstream is "
"closed"
);
} }
m_stream.read( m_stream.read(
@ -122,11 +128,13 @@ void TextAsset::unpack_blob(
return; return;
default: default:
throw std::runtime_error(std::format( throw std::runtime_error(
"Failed to unpack blob from TextAsset: unsupported " std::format(
"compression type: {}", "Failed to unpack blob from TextAsset: unsupported "
std::to_underlying(m_text_blob_metadata.compression_type) "compression type: {}",
)); std::to_underlying(m_text_blob_metadata.compression_type)
)
);
} }
} }

View file

@ -96,22 +96,28 @@ void TextureAsset::unpack_blob(
case Assets::CompressionType::None: case Assets::CompressionType::None:
if (m_pixel_blob_metadata.uncompressed_size != m_pixel_blob_metadata.compressed_size) if (m_pixel_blob_metadata.uncompressed_size != m_pixel_blob_metadata.compressed_size)
{ {
throw std::runtime_error("Failed to unpack blob from TextureAsset: " throw std::runtime_error(
"compressed/uncompressed size mismatch for no compression " "Failed to unpack blob from TextureAsset: "
"type"); "compressed/uncompressed size mismatch for no compression "
"type"
);
} }
if (m_pixel_blob_metadata.uncompressed_size > destination_capacity) if (m_pixel_blob_metadata.uncompressed_size > destination_capacity)
{ {
throw std::runtime_error("Failed to unpack blob from TextureAsset: " throw std::runtime_error(
"uncompressed_size > destination_capacity, unpacking " "Failed to unpack blob from TextureAsset: "
"would result in segfault"); "uncompressed_size > destination_capacity, unpacking "
"would result in segfault"
);
} }
if (!m_stream.is_open()) if (!m_stream.is_open())
{ {
throw std::runtime_error("Failed to unpack blob from TextureAsset: ifstream is " throw std::runtime_error(
"closed"); "Failed to unpack blob from TextureAsset: ifstream is "
"closed"
);
} }
m_stream.read( m_stream.read(
@ -123,11 +129,13 @@ void TextureAsset::unpack_blob(
return; return;
default: default:
throw std::runtime_error(std::format( throw std::runtime_error(
"Failed to unpack blob from TextureAsset: unsupported " std::format(
"compression type: {}", "Failed to unpack blob from TextureAsset: unsupported "
std::to_underlying(m_pixel_blob_metadata.compression_type) "compression type: {}",
)); std::to_underlying(m_pixel_blob_metadata.compression_type)
)
);
} }
} }

View file

@ -167,8 +167,8 @@ auto SceneSerializer::deserialize(const std::string &file_path) -> bool
{ {
auto &entitySpriteRendererComponent = deserializedEntity auto &entitySpriteRendererComponent = deserializedEntity
.add_component<SpriteRendererComponent>(); .add_component<SpriteRendererComponent>();
entitySpriteRendererComponent.tint = spriteRendererComponent["Tint"].as<glm::vec4>( entitySpriteRendererComponent.tint = spriteRendererComponent["Tint"]
); .as<glm::vec4>();
auto texturePath = spriteRendererComponent["Texture"].as<std::string>(); auto texturePath = spriteRendererComponent["Texture"].as<std::string>();

View file

@ -37,7 +37,7 @@ enum EventCategory
#define event_type(type) \ #define event_type(type) \
EventType get_event_type() const override \ EventType get_event_type() const override \
{ \ { \
return ::lt::EventType::type; \ return ::lt::EventType::type; \
} }
#define event_category(eCategory) \ #define event_category(eCategory) \

View file

@ -11,11 +11,13 @@ class Mirror: public Application
public: public:
Mirror() Mirror()
{ {
get_window().set_properties(WindowProperties { get_window().set_properties(
.title = "Mirror", WindowProperties {
.size = glm::uvec2(1280u, 720u), .title = "Mirror",
.vsync = true, .size = glm::uvec2(1280u, 720u),
}); .vsync = true,
}
);
get_layer_stack().emplace_layer<EditorLayer>("MirrorLayer"); get_layer_stack().emplace_layer<EditorLayer>("MirrorLayer");
} }

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
namespace lt { namespace lt {
class SharedContext; class SharedContext;
@ -37,8 +36,8 @@ enum class BlendFactor : uint8_t
class Blender class Blender
{ {
public: public:
virtual ~Blender() = default; virtual ~Blender() = default;
static auto create(const Ref<SharedContext>& sharedContext) -> Scope<Blender>; static auto create(const Ref<SharedContext> &sharedContext) -> Scope<Blender>;
virtual void enable(BlendFactor srcFactor, BlendFactor dstFactor) = 0; virtual void enable(BlendFactor srcFactor, BlendFactor dstFactor) = 0;

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
namespace lt { namespace lt {
class SharedContext; class SharedContext;
@ -14,11 +13,11 @@ enum class ConstantBufferIndex
class ConstantBuffer class ConstantBuffer
{ {
public: public:
virtual ~ConstantBuffer() = default; virtual ~ConstantBuffer() = default;
static auto create( static auto create(
ConstantBufferIndex index, ConstantBufferIndex index,
unsigned int size, unsigned int size,
const Ref<SharedContext>& sharedContext const Ref<SharedContext> &sharedContext
) -> Scope<ConstantBuffer>; ) -> Scope<ConstantBuffer>;
virtual auto map() -> void * = 0; virtual auto map() -> void * = 0;
@ -38,7 +37,7 @@ public:
float *vertices, float *vertices,
unsigned int stride, unsigned int stride,
unsigned int count, unsigned int count,
const Ref<SharedContext>& sharedContext const Ref<SharedContext> &sharedContext
) -> Ref<VertexBuffer>; ) -> Ref<VertexBuffer>;
virtual ~VertexBuffer() = default; virtual ~VertexBuffer() = default;
@ -58,8 +57,11 @@ protected:
class IndexBuffer class IndexBuffer
{ {
public: public:
static auto create(unsigned int *indices, unsigned int count, const Ref<SharedContext>& sharedContext) static auto create(
-> Ref<IndexBuffer>; unsigned int *indices,
unsigned int count,
const Ref<SharedContext> &sharedContext
) -> Ref<IndexBuffer>;
virtual ~IndexBuffer() = default; virtual ~IndexBuffer() = default;

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <d3d11.h> #include <d3d11.h>
#include <renderer/buffers.hpp> #include <renderer/buffers.hpp>
#include <wrl.h> #include <wrl.h>

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <d3d11.h> #include <d3d11.h>
#include <renderer/framebuffer.hpp> #include <renderer/framebuffer.hpp>
#include <wrl.h> #include <wrl.h>

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <d3d11.h> #include <d3d11.h>
#include <renderer/graphics_context.hpp> #include <renderer/graphics_context.hpp>
#include <wrl.h> #include <wrl.h>

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <d3d11.h> #include <d3d11.h>
#include <renderer/render_command.hpp> #include <renderer/render_command.hpp>
#include <wrl.h> #include <wrl.h>

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <d3d11.h> #include <d3d11.h>
#include <renderer/shader.hpp> #include <renderer/shader.hpp>
#include <wrl.h> #include <wrl.h>

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <d3d11.h> #include <d3d11.h>
#include <renderer/shared_context.hpp> #include <renderer/shared_context.hpp>
#include <wrl.h> #include <wrl.h>

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <d3d11.h> #include <d3d11.h>
#include <renderer/texture.hpp> #include <renderer/texture.hpp>
#include <wrl.h> #include <wrl.h>

View file

@ -17,8 +17,10 @@ public:
~dxUserInterface(); ~dxUserInterface();
void platform_implementation(GLFWwindow *windowHandle, Ref<SharedContext> sharedContext) void platform_implementation(
override; GLFWwindow *windowHandle,
Ref<SharedContext> sharedContext
) override;
void begin() override; void begin() override;

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <d3d11.h> #include <d3d11.h>
#include <renderer/vertex_layout.hpp> #include <renderer/vertex_layout.hpp>
#include <wrl.h> #include <wrl.h>

View file

@ -9,9 +9,9 @@ class SharedContext;
struct FramebufferSpecification struct FramebufferSpecification
{ {
unsigned int width{}; unsigned int width {};
unsigned int height{}; unsigned int height {};
unsigned int samples = 1; unsigned int samples = 1;
}; };
@ -19,10 +19,10 @@ struct FramebufferSpecification
class Framebuffer class Framebuffer
{ {
public: public:
virtual ~Framebuffer() = default; virtual ~Framebuffer() = default;
static auto create( static auto create(
const FramebufferSpecification &specification, const FramebufferSpecification &specification,
const Ref<SharedContext>& sharedContext const Ref<SharedContext> &sharedContext
) -> Ref<Framebuffer>; ) -> Ref<Framebuffer>;
virtual void bind_as_target(const glm::vec4 &clearColor) = 0; virtual void bind_as_target(const glm::vec4 &clearColor) = 0;

View file

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

View file

@ -22,8 +22,12 @@ public:
void default_target_framebuffer() override; void default_target_framebuffer() override;
void set_viewport(unsigned int x, unsigned int y, unsigned int width, unsigned int height) void set_viewport(
override; unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height
) override;
private: private:
GLFWwindow *m_window_handle; GLFWwindow *m_window_handle;

View file

@ -14,8 +14,10 @@ public:
~glUserInterface() override; ~glUserInterface() override;
void platform_implementation(GLFWwindow *windowHandle, Ref<SharedContext> sharedContext) void platform_implementation(
override; GLFWwindow *windowHandle,
Ref<SharedContext> sharedContext
) override;
void begin() override; void begin() override;

View file

@ -22,7 +22,7 @@ class glVertexLayout: public VertexLayout
{ {
public: public:
glVertexLayout( glVertexLayout(
const Ref<VertexBuffer>& buffer, const Ref<VertexBuffer> &buffer,
const std::vector<std::pair<std::string, VertexElementType>> &elements const std::vector<std::pair<std::string, VertexElementType>> &elements
); );

View file

@ -12,7 +12,7 @@ class SharedContext;
class RenderCommand class RenderCommand
{ {
public: public:
static auto create(GLFWwindow *windowHandle, const Ref<SharedContext>& sharedContext) static auto create(GLFWwindow *windowHandle, const Ref<SharedContext> &sharedContext)
-> Scope<RenderCommand>; -> Scope<RenderCommand>;
RenderCommand(const RenderCommand &) = delete; RenderCommand(const RenderCommand &) = delete;

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
namespace lt { namespace lt {
class SharedContext class SharedContext

View file

@ -17,9 +17,11 @@ auto Blender::create(const Ref<SharedContext> & /*sharedContext*/) -> Scope<Blen
case GraphicsAPI::OpenGL: return create_scope<glBlender>(); case GraphicsAPI::OpenGL: return create_scope<glBlender>();
case GraphicsAPI::DirectX: case GraphicsAPI::DirectX:
lt_win(return create_scope<dxBlender>( lt_win(
std::static_pointer_cast<dxSharedContext>(sharedContext) return create_scope<dxBlender>(
);) std::static_pointer_cast<dxSharedContext>(sharedContext)
);
)
default default
: ensure( : ensure(

View file

@ -23,11 +23,13 @@ auto ConstantBuffer::create(
case GraphicsAPI::OpenGL: return create_scope<glConstantBuffer>(index, size); case GraphicsAPI::OpenGL: return create_scope<glConstantBuffer>(index, size);
case GraphicsAPI::DirectX: case GraphicsAPI::DirectX:
lt_win(return create_scope<dxConstantBuffer>( lt_win(
index, return create_scope<dxConstantBuffer>(
size, index,
std::static_pointer_cast<dxSharedContext>(sharedContext) size,
);) std::static_pointer_cast<dxSharedContext>(sharedContext)
);
)
default default
: ensure( : ensure(
@ -51,12 +53,14 @@ auto VertexBuffer::create(
case GraphicsAPI::OpenGL: return create_ref<glVertexBuffer>(vertices, stride, count); case GraphicsAPI::OpenGL: return create_ref<glVertexBuffer>(vertices, stride, count);
case GraphicsAPI::DirectX: case GraphicsAPI::DirectX:
lt_win(return create_ref<dxVertexBuffer>( lt_win(
vertices, return create_ref<dxVertexBuffer>(
stride, vertices,
count, stride,
std::static_pointer_cast<dxSharedContext>(sharedContext) count,
);) std::static_pointer_cast<dxSharedContext>(sharedContext)
);
)
default default
: ensure( : ensure(
@ -79,11 +83,13 @@ auto IndexBuffer::create(
case GraphicsAPI::OpenGL: return create_ref<glIndexBuffer>(indices, count); case GraphicsAPI::OpenGL: return create_ref<glIndexBuffer>(indices, count);
case GraphicsAPI::DirectX: case GraphicsAPI::DirectX:
lt_win(return create_ref<dxIndexBuffer>( lt_win(
indices, return create_ref<dxIndexBuffer>(
count, indices,
std::dynamic_pointer_cast<dxSharedContext>(sharedContext) count,
);) std::dynamic_pointer_cast<dxSharedContext>(sharedContext)
);
)
default default
: ensure( : ensure(

View file

@ -36,9 +36,11 @@ dxFramebuffer::dxFramebuffer(
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
srvDesc.Texture2D.MipLevels = 1; srvDesc.Texture2D.MipLevels = 1;
srvDesc.Texture2D.MostDetailedMip = 0; srvDesc.Texture2D.MostDetailedMip = 0;
dxc(m_context->get_device() dxc(m_context->get_device()->CreateShaderResourceView(
->CreateShaderResourceView(m_color_attachment.Get(), &srvDesc, &m_shader_resource_view) m_color_attachment.Get(),
); &srvDesc,
&m_shader_resource_view
));
auto rtvDesc = D3D11_RENDER_TARGET_VIEW_DESC {}; auto rtvDesc = D3D11_RENDER_TARGET_VIEW_DESC {};
rtvDesc.Format = t2dDesc.Format; rtvDesc.Format = t2dDesc.Format;
@ -101,9 +103,11 @@ void dxFramebuffer::resize(const glm::uvec2 &size)
dxc(m_context->get_device()->CreateTexture2D(&textureDesc, nullptr, &m_color_attachment)); dxc(m_context->get_device()->CreateTexture2D(&textureDesc, nullptr, &m_color_attachment));
dxc(m_context->get_device() dxc(m_context->get_device()
->CreateRenderTargetView(m_color_attachment.Get(), &rtvDesc, &m_render_target_view)); ->CreateRenderTargetView(m_color_attachment.Get(), &rtvDesc, &m_render_target_view));
dxc(m_context->get_device() dxc(m_context->get_device()->CreateShaderResourceView(
->CreateShaderResourceView(m_color_attachment.Get(), &srvDesc, &m_shader_resource_view) m_color_attachment.Get(),
); &srvDesc,
&m_shader_resource_view
));
} }
} // namespace lt } // namespace lt

View file

@ -94,9 +94,11 @@ void dxGraphicsContext::setup_render_targets()
auto backBuffer = Microsoft::WRL::ComPtr<ID3D11Resource> {}; auto backBuffer = Microsoft::WRL::ComPtr<ID3D11Resource> {};
dxc(context->get_swap_chain()->GetBuffer(0u, __uuidof(ID3D11Resource), &backBuffer)); dxc(context->get_swap_chain()->GetBuffer(0u, __uuidof(ID3D11Resource), &backBuffer));
dxc(context->get_device() dxc(context->get_device()->CreateRenderTargetView(
->CreateRenderTargetView(backBuffer.Get(), nullptr, &context->GetRenderTargetViewRef()) backBuffer.Get(),
); nullptr,
&context->GetRenderTargetViewRef()
));
// set render target view // set render target view
context->get_device_context() context->get_device_context()

View file

@ -59,7 +59,8 @@ dxShader::dxShader(
NULL, NULL,
&m_vertex_shader &m_vertex_shader
)); ));
dxc(m_context->get_device() dxc(
m_context->get_device()
->CreatePixelShader(ps->GetBufferPointer(), ps->GetBufferSize(), NULL, &m_pixel_shader) ->CreatePixelShader(ps->GetBufferPointer(), ps->GetBufferSize(), NULL, &m_pixel_shader)
); );
} }

View file

@ -18,13 +18,15 @@ dxVertexLayout::dxVertexLayout(
// extract elements desc // extract elements desc
for (const auto &element : elements) for (const auto &element : elements)
{ {
inputElementsDesc.emplace_back(D3D11_INPUT_ELEMENT_DESC { element.first.c_str(), inputElementsDesc.emplace_back(
NULL, D3D11_INPUT_ELEMENT_DESC { element.first.c_str(),
get_dxgi_format(element.second), NULL,
0u, get_dxgi_format(element.second),
D3D11_APPEND_ALIGNED_ELEMENT, 0u,
D3D11_INPUT_PER_VERTEX_DATA, D3D11_APPEND_ALIGNED_ELEMENT,
0u }); D3D11_INPUT_PER_VERTEX_DATA,
0u }
);
} }
auto dxpShader = std::dynamic_pointer_cast<dxShader>(shader); auto dxpShader = std::dynamic_pointer_cast<dxShader>(shader);

View file

@ -12,7 +12,7 @@ namespace lt {
auto Framebuffer::create( auto Framebuffer::create(
const FramebufferSpecification &specification, const FramebufferSpecification &specification,
const Ref<SharedContext>& /*sharedContext*/ const Ref<SharedContext> & /*sharedContext*/
) -> Ref<Framebuffer> ) -> Ref<Framebuffer>
{ {
switch (GraphicsContext::get_graphics_api()) switch (GraphicsContext::get_graphics_api())
@ -20,10 +20,12 @@ auto Framebuffer::create(
case GraphicsAPI::OpenGL: return create_ref<glFramebuffer>(specification); case GraphicsAPI::OpenGL: return create_ref<glFramebuffer>(specification);
case GraphicsAPI::DirectX: case GraphicsAPI::DirectX:
lt_win(return create_ref<dxFramebuffer>( lt_win(
specification, return create_ref<dxFramebuffer>(
std::static_pointer_cast<dxSharedContext>(sharedContext) specification,
);); std::static_pointer_cast<dxSharedContext>(sharedContext)
);
);
default: default:
ensure( ensure(

View file

@ -1,33 +1,33 @@
#include <renderer/gl/blender.hpp>
#include <glad/gl.h> #include <glad/gl.h>
#include <renderer/gl/blender.hpp>
namespace lt { namespace lt {
glBlender::glBlender() glBlender::glBlender()
: m_factor_map { // constants : m_factor_map { // constants
{ BlendFactor::ZERO, GL_ZERO }, { BlendFactor::ZERO, GL_ZERO },
{ BlendFactor::ONE, GL_ONE }, { BlendFactor::ONE, GL_ONE },
// source , // source ,
{ BlendFactor::SRC_COLOR, GL_SRC_COLOR }, { BlendFactor::SRC_COLOR, GL_SRC_COLOR },
{ BlendFactor::INVERSE_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR }, { BlendFactor::INVERSE_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR },
{ BlendFactor::SRC_ALPHA, GL_SRC_ALPHA }, { BlendFactor::SRC_ALPHA, GL_SRC_ALPHA },
{ BlendFactor::INVERSE_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA }, { BlendFactor::INVERSE_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA },
// destination , // destination ,
{ BlendFactor::DST_COLOR, GL_DST_COLOR }, { BlendFactor::DST_COLOR, GL_DST_COLOR },
{ BlendFactor::INVERSE_DST_COLOR, GL_ONE_MINUS_DST_COLOR }, { BlendFactor::INVERSE_DST_COLOR, GL_ONE_MINUS_DST_COLOR },
{ BlendFactor::DST_ALPHA, GL_DST_ALPHA }, { BlendFactor::DST_ALPHA, GL_DST_ALPHA },
{ BlendFactor::INVERSE_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA }, { BlendFactor::INVERSE_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA },
// source1 , // source1 ,
{ BlendFactor::SRC1_COLOR, GL_SRC1_COLOR }, { BlendFactor::SRC1_COLOR, GL_SRC1_COLOR },
{ BlendFactor::INVERSE_SRC1_COLOR, GL_ONE_MINUS_SRC1_COLOR }, { BlendFactor::INVERSE_SRC1_COLOR, GL_ONE_MINUS_SRC1_COLOR },
{ BlendFactor::SRC1_ALPHA, GL_SRC1_ALPHA }, { BlendFactor::SRC1_ALPHA, GL_SRC1_ALPHA },
{ BlendFactor::INVERSE_SRC1_ALPHA, GL_ONE_MINUS_SRC_ALPHA } { BlendFactor::INVERSE_SRC1_ALPHA, GL_ONE_MINUS_SRC_ALPHA }
} }
{ {
} }

View file

@ -1,6 +1,6 @@
#include <renderer/gl/framebuffers.hpp>
#include <glad/gl.h> #include <glad/gl.h>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <renderer/gl/framebuffers.hpp>
namespace lt { namespace lt {

View file

@ -1,5 +1,5 @@
#include <renderer/gl/render_command.hpp>
#include <glad/gl.h> #include <glad/gl.h>
#include <renderer/gl/render_command.hpp>
#ifndef DONT_FUCKING_ORDER_THESSE_PLEASE_FOR_THE_LOVE_OF_GOD_CLANG_FORMAT #ifndef DONT_FUCKING_ORDER_THESSE_PLEASE_FOR_THE_LOVE_OF_GOD_CLANG_FORMAT
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#endif #endif

View file

@ -1,5 +1,5 @@
#include <glad/gl.h>
#include <debug/assertions.hpp> #include <debug/assertions.hpp>
#include <glad/gl.h>
#include <renderer/gl/buffers.hpp> #include <renderer/gl/buffers.hpp>
#include <renderer/gl/vertex_layout.hpp> #include <renderer/gl/vertex_layout.hpp>

View file

@ -37,9 +37,10 @@ auto GraphicsContext::create(GraphicsAPI api, GLFWwindow *window_handle) -> Scop
break; break;
// directx // directx
case GraphicsAPI::DirectX: case GraphicsAPI::DirectX:
lt_win(scope_gfx = create_scope<dxGraphicsContext>(window_handle); lt_win(
s_context = scope_gfx.get(); scope_gfx = create_scope<dxGraphicsContext>(window_handle); s_context = scope_gfx.get();
break;) break;
)
default default
: ensure( : ensure(

View file

@ -19,9 +19,11 @@ auto RenderCommand::create(GLFWwindow *windowHandle, const Ref<SharedContext> &
case GraphicsAPI::OpenGL: return create_scope<glRenderCommand>(windowHandle); case GraphicsAPI::OpenGL: return create_scope<glRenderCommand>(windowHandle);
case GraphicsAPI::DirectX: case GraphicsAPI::DirectX:
lt_win(return create_scope<dxRenderCommand>( lt_win(
(std::static_pointer_cast<dxSharedContext>)(sharedContext) return create_scope<dxRenderCommand>(
);) (std::static_pointer_cast<dxSharedContext>)(sharedContext)
);
)
default default
: ensure( : ensure(

View file

@ -1,9 +1,9 @@
#include <camera/scene.hpp> #include <camera/scene.hpp>
#include <debug/assertions.hpp>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <glm/matrix.hpp> #include <glm/matrix.hpp>
#include <input/events/window.hpp> #include <input/events/window.hpp>
#include <debug/assertions.hpp>
#include <renderer/blender.hpp> #include <renderer/blender.hpp>
#include <renderer/buffers.hpp> #include <renderer/buffers.hpp>
#include <renderer/framebuffer.hpp> #include <renderer/framebuffer.hpp>

View file

@ -26,11 +26,13 @@ namespace lt {
return create_ref<glShader>(std::move(vertex_asset), std::move(pixel_asset)); return create_ref<glShader>(std::move(vertex_asset), std::move(pixel_asset));
case GraphicsAPI::DirectX: case GraphicsAPI::DirectX:
lt_win(return create_ref<dxShader>( lt_win(
vertex_asset, return create_ref<dxShader>(
pixel_asset, vertex_asset,
std::static_pointer_cast<dxSharedContext>(sharedContext) pixel_asset,
);); std::static_pointer_cast<dxSharedContext>(sharedContext)
);
);
default: default:
ensure( ensure(

View file

@ -21,14 +21,16 @@ namespace lt {
case GraphicsAPI::OpenGL: return create_ref<glTexture>(std::move(asset)); case GraphicsAPI::OpenGL: return create_ref<glTexture>(std::move(asset));
case GraphicsAPI::DirectX: case GraphicsAPI::DirectX:
lt_win(return create_ref<dxTexture>( lt_win(
width, return create_ref<dxTexture>(
height, width,
components, height,
pixels, components,
std::static_pointer_cast<dxSharedContext>(sharedContext), pixels,
filePath std::static_pointer_cast<dxSharedContext>(sharedContext),
);) filePath
);
)
default default
: ensure( : ensure(

View file

@ -23,11 +23,13 @@ auto VertexLayout::create(
case GraphicsAPI::OpenGL: return create_ref<glVertexLayout>(vertexBuffer, elements); case GraphicsAPI::OpenGL: return create_ref<glVertexLayout>(vertexBuffer, elements);
case GraphicsAPI::DirectX: case GraphicsAPI::DirectX:
lt_win(return create_ref<dxVertexLayout>( lt_win(
shader, return create_ref<dxVertexLayout>(
elements, shader,
std::static_pointer_cast<dxSharedContext>(sharedContext) elements,
);) std::static_pointer_cast<dxSharedContext>(sharedContext)
);
)
default default
: ensure( : ensure(

View file

@ -13,8 +13,10 @@ public:
~glUserInterface() override; ~glUserInterface() override;
void platform_implementation(GLFWwindow *windowHandle, Ref<SharedContext> sharedContext) void platform_implementation(
override; GLFWwindow *windowHandle,
Ref<SharedContext> sharedContext
) override;
void begin() override; void begin() override;

View file

@ -20,8 +20,10 @@ public:
void on_event(const Event &event) override; void on_event(const Event &event) override;
void set_properties(const WindowProperties &properties, bool overrideVisibility = false) void set_properties(
override; const WindowProperties &properties,
bool overrideVisibility = false
) override;
void set_title(const std::string &title) override; void set_title(const std::string &title) override;

View file

@ -136,8 +136,9 @@ void lWindow::bind_glfw_events()
glfwSetMouseButtonCallback( glfwSetMouseButtonCallback(
m_handle, m_handle,
[](GLFWwindow *window, int button, int action, int /*mods*/) { [](GLFWwindow *window, int button, int action, int /*mods*/) {
std::function<void(Event &)> const callback = *(std::function<void(Event &)> *) std::function<void(Event &)> const callback = *(
glfwGetWindowUserPointer(window); std::function<void(Event &)> *
)glfwGetWindowUserPointer(window);
if (action == GLFW_PRESS) if (action == GLFW_PRESS)
{ {