style: apply clang-format v20
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b6953c2a9e
commit
f2c692a118
45 changed files with 220 additions and 163 deletions
|
@ -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'");
|
||||||
|
|
|
@ -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 &;
|
||||||
|
|
||||||
|
|
|
@ -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(
|
||||||
|
"Failed to unpack blob from TextAsset: "
|
||||||
"compressed/uncompressed size mismatch for no compression "
|
"compressed/uncompressed size mismatch for no compression "
|
||||||
"type");
|
"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(
|
||||||
|
"Failed to unpack blob from TextAsset: "
|
||||||
"uncompressed_size > destination_capacity, unpacking "
|
"uncompressed_size > destination_capacity, unpacking "
|
||||||
"would result in segfault");
|
"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(
|
||||||
|
std::format(
|
||||||
"Failed to unpack blob from TextAsset: unsupported "
|
"Failed to unpack blob from TextAsset: unsupported "
|
||||||
"compression type: {}",
|
"compression type: {}",
|
||||||
std::to_underlying(m_text_blob_metadata.compression_type)
|
std::to_underlying(m_text_blob_metadata.compression_type)
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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(
|
||||||
|
"Failed to unpack blob from TextureAsset: "
|
||||||
"compressed/uncompressed size mismatch for no compression "
|
"compressed/uncompressed size mismatch for no compression "
|
||||||
"type");
|
"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(
|
||||||
|
"Failed to unpack blob from TextureAsset: "
|
||||||
"uncompressed_size > destination_capacity, unpacking "
|
"uncompressed_size > destination_capacity, unpacking "
|
||||||
"would result in segfault");
|
"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(
|
||||||
|
std::format(
|
||||||
"Failed to unpack blob from TextureAsset: unsupported "
|
"Failed to unpack blob from TextureAsset: unsupported "
|
||||||
"compression type: {}",
|
"compression type: {}",
|
||||||
std::to_underlying(m_pixel_blob_metadata.compression_type)
|
std::to_underlying(m_pixel_blob_metadata.compression_type)
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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>();
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,13 @@ class Mirror: public Application
|
||||||
public:
|
public:
|
||||||
Mirror()
|
Mirror()
|
||||||
{
|
{
|
||||||
get_window().set_properties(WindowProperties {
|
get_window().set_properties(
|
||||||
|
WindowProperties {
|
||||||
.title = "Mirror",
|
.title = "Mirror",
|
||||||
.size = glm::uvec2(1280u, 720u),
|
.size = glm::uvec2(1280u, 720u),
|
||||||
.vsync = true,
|
.vsync = true,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
get_layer_stack().emplace_layer<EditorLayer>("MirrorLayer");
|
get_layer_stack().emplace_layer<EditorLayer>("MirrorLayer");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace lt {
|
namespace lt {
|
||||||
|
|
||||||
class SharedContext;
|
class SharedContext;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace lt {
|
namespace lt {
|
||||||
|
|
||||||
class SharedContext;
|
class SharedContext;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace lt {
|
namespace lt {
|
||||||
|
|
||||||
class SharedContext
|
class SharedContext
|
||||||
|
|
|
@ -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(
|
||||||
|
return create_scope<dxBlender>(
|
||||||
std::static_pointer_cast<dxSharedContext>(sharedContext)
|
std::static_pointer_cast<dxSharedContext>(sharedContext)
|
||||||
);)
|
);
|
||||||
|
)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: ensure(
|
||||||
|
|
|
@ -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(
|
||||||
|
return create_scope<dxConstantBuffer>(
|
||||||
index,
|
index,
|
||||||
size,
|
size,
|
||||||
std::static_pointer_cast<dxSharedContext>(sharedContext)
|
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(
|
||||||
|
return create_ref<dxVertexBuffer>(
|
||||||
vertices,
|
vertices,
|
||||||
stride,
|
stride,
|
||||||
count,
|
count,
|
||||||
std::static_pointer_cast<dxSharedContext>(sharedContext)
|
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(
|
||||||
|
return create_ref<dxIndexBuffer>(
|
||||||
indices,
|
indices,
|
||||||
count,
|
count,
|
||||||
std::dynamic_pointer_cast<dxSharedContext>(sharedContext)
|
std::dynamic_pointer_cast<dxSharedContext>(sharedContext)
|
||||||
);)
|
);
|
||||||
|
)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: ensure(
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(
|
||||||
|
D3D11_INPUT_ELEMENT_DESC { element.first.c_str(),
|
||||||
NULL,
|
NULL,
|
||||||
get_dxgi_format(element.second),
|
get_dxgi_format(element.second),
|
||||||
0u,
|
0u,
|
||||||
D3D11_APPEND_ALIGNED_ELEMENT,
|
D3D11_APPEND_ALIGNED_ELEMENT,
|
||||||
D3D11_INPUT_PER_VERTEX_DATA,
|
D3D11_INPUT_PER_VERTEX_DATA,
|
||||||
0u });
|
0u }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dxpShader = std::dynamic_pointer_cast<dxShader>(shader);
|
auto dxpShader = std::dynamic_pointer_cast<dxShader>(shader);
|
||||||
|
|
|
@ -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(
|
||||||
|
return create_ref<dxFramebuffer>(
|
||||||
specification,
|
specification,
|
||||||
std::static_pointer_cast<dxSharedContext>(sharedContext)
|
std::static_pointer_cast<dxSharedContext>(sharedContext)
|
||||||
););
|
);
|
||||||
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ensure(
|
ensure(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include <renderer/gl/blender.hpp>
|
|
||||||
#include <glad/gl.h>
|
#include <glad/gl.h>
|
||||||
|
#include <renderer/gl/blender.hpp>
|
||||||
|
|
||||||
namespace lt {
|
namespace lt {
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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(
|
||||||
|
return create_scope<dxRenderCommand>(
|
||||||
(std::static_pointer_cast<dxSharedContext>)(sharedContext)
|
(std::static_pointer_cast<dxSharedContext>)(sharedContext)
|
||||||
);)
|
);
|
||||||
|
)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: ensure(
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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(
|
||||||
|
return create_ref<dxShader>(
|
||||||
vertex_asset,
|
vertex_asset,
|
||||||
pixel_asset,
|
pixel_asset,
|
||||||
std::static_pointer_cast<dxSharedContext>(sharedContext)
|
std::static_pointer_cast<dxSharedContext>(sharedContext)
|
||||||
););
|
);
|
||||||
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ensure(
|
ensure(
|
||||||
|
|
|
@ -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(
|
||||||
|
return create_ref<dxTexture>(
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
components,
|
components,
|
||||||
pixels,
|
pixels,
|
||||||
std::static_pointer_cast<dxSharedContext>(sharedContext),
|
std::static_pointer_cast<dxSharedContext>(sharedContext),
|
||||||
filePath
|
filePath
|
||||||
);)
|
);
|
||||||
|
)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: ensure(
|
||||||
|
|
|
@ -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(
|
||||||
|
return create_ref<dxVertexLayout>(
|
||||||
shader,
|
shader,
|
||||||
elements,
|
elements,
|
||||||
std::static_pointer_cast<dxSharedContext>(sharedContext)
|
std::static_pointer_cast<dxSharedContext>(sharedContext)
|
||||||
);)
|
);
|
||||||
|
)
|
||||||
|
|
||||||
default
|
default
|
||||||
: ensure(
|
: ensure(
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue