mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 14:43:34 +00:00
working
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
|
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/27 21:00:53 by maldavid ### ########.fr */
|
/* Updated: 2024/04/03 15:05:24 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <Core/Graphics.h>
|
#include <Core/Graphics.h>
|
||||||
#include <Platform/Inputs.h>
|
#include <Platform/Inputs.h>
|
||||||
|
#include <Core/DriverLoader.h>
|
||||||
#include <Core/Fps.h>
|
#include <Core/Fps.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
@@ -58,6 +59,7 @@ namespace mlx
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
FpsManager m_fps;
|
FpsManager m_fps;
|
||||||
|
DriverLoader m_driver_loader;
|
||||||
std::list<Texture> m_textures;
|
std::list<Texture> m_textures;
|
||||||
std::vector<std::unique_ptr<GraphicsSupport>> m_graphics;
|
std::vector<std::unique_ptr<GraphicsSupport>> m_graphics;
|
||||||
std::function<int(void*)> f_loop_hook;
|
std::function<int(void*)> f_loop_hook;
|
||||||
|
|||||||
39
runtime/Includes/Core/DriverLoader.h
git.filemode.normal_file
39
runtime/Includes/Core/DriverLoader.h
git.filemode.normal_file
@@ -0,0 +1,39 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* DriverLoader.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/04/02 16:56:10 by maldavid #+# #+# */
|
||||||
|
/* Updated: 2024/04/03 15:02:44 by maldavid ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef __MLX_CORE_DRIVER_LOADER__
|
||||||
|
#define __MLX_CORE_DRIVER_LOADER__
|
||||||
|
|
||||||
|
#include <Drivers/DriverInstance.h>
|
||||||
|
|
||||||
|
namespace mlx
|
||||||
|
{
|
||||||
|
class DriverLoader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DriverLoader() = default;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
inline bool LoadDriver();
|
||||||
|
|
||||||
|
inline void ShutdownAllDrivers();
|
||||||
|
|
||||||
|
~DriverLoader() = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<std::unique_ptr<DriverInstance> > m_instances;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Core/DriverLoader.inl>
|
||||||
|
|
||||||
|
#endif
|
||||||
30
runtime/Includes/Core/DriverLoader.inl
git.filemode.normal_file
30
runtime/Includes/Core/DriverLoader.inl
git.filemode.normal_file
@@ -0,0 +1,30 @@
|
|||||||
|
/* **************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* DriverLoader.inl :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/04/03 14:55:01 by maldavid #+# #+# */
|
||||||
|
/* Updated: 2024/04/03 14:55:01 by maldavid ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* **************************************************************************** */
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <Core/DriverLoader.h>
|
||||||
|
|
||||||
|
namespace mlx
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
bool DriverLoader::LoadDriver()
|
||||||
|
{
|
||||||
|
m_instances.emplace_back(new T)->InitDriver();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DriverLoader::ShutdownAllDrivers()
|
||||||
|
{
|
||||||
|
for(auto& driver : m_instances)
|
||||||
|
driver->ShutdownDriver();
|
||||||
|
m_instances.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
27
runtime/Includes/Core/ImagesManager.h
git.filemode.normal_file
27
runtime/Includes/Core/ImagesManager.h
git.filemode.normal_file
@@ -0,0 +1,27 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ImagesManager.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/04/03 15:11:47 by maldavid #+# #+# */
|
||||||
|
/* Updated: 2024/04/21 15:13:43 by maldavid ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef __MLX_CORE_IMAGES_MANAGER__
|
||||||
|
#define __MLX_CORE_IMAGES_MANAGER__
|
||||||
|
|
||||||
|
namespace mlx
|
||||||
|
{
|
||||||
|
class ImagesManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unordered_set<Texture*> m_textures_registry;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
35
runtime/Includes/Drivers/DriverInstance.h
git.filemode.normal_file
35
runtime/Includes/Drivers/DriverInstance.h
git.filemode.normal_file
@@ -0,0 +1,35 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* DriverInstance.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/04/02 16:57:20 by maldavid #+# #+# */
|
||||||
|
/* Updated: 2024/04/02 17:01:03 by maldavid ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef __MLX_DRIVER_INSTANCE__
|
||||||
|
#define __MLX_DRIVER_INSTANCE__
|
||||||
|
|
||||||
|
namespace mlx
|
||||||
|
{
|
||||||
|
class DriverInstance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DriverInstance() = default;
|
||||||
|
|
||||||
|
virtual bool InitDriver() { m_is_up = true; return true; }
|
||||||
|
virtual void ShutdownDriver() { m_is_up = false; }
|
||||||
|
|
||||||
|
inline bool IsRunning() const noexcept { return m_is_up; }
|
||||||
|
|
||||||
|
virtual ~DriverInstance() = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_is_up = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
34
runtime/Includes/Drivers/GLFW/GLFWDriverInstance.h
git.filemode.normal_file
34
runtime/Includes/Drivers/GLFW/GLFWDriverInstance.h
git.filemode.normal_file
@@ -0,0 +1,34 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* GLFWDriverInstance.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/04/02 17:01:51 by maldavid #+# #+# */
|
||||||
|
/* Updated: 2024/04/02 17:04:12 by maldavid ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef __MLX_GLFW_DRIVER_INSTANCE__
|
||||||
|
#define __MLX_GLFW_DRIVER_INSTANCE__
|
||||||
|
|
||||||
|
#include <Drivers/DriverInstance.h>
|
||||||
|
|
||||||
|
namespace mlx
|
||||||
|
{
|
||||||
|
class GLFWDriverInstance : public DriverInstance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GLFWDriverInstance() = default;
|
||||||
|
|
||||||
|
inline bool InitDriver() override;
|
||||||
|
inline void ShutdownDriver() override;
|
||||||
|
|
||||||
|
~GLFWDriverInstance() override = default;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Drivers/GLFW/GLFWDriverInstance.inl>
|
||||||
|
|
||||||
|
#endif
|
||||||
32
runtime/Includes/Drivers/GLFW/GLFWDriverInstance.inl
git.filemode.normal_file
32
runtime/Includes/Drivers/GLFW/GLFWDriverInstance.inl
git.filemode.normal_file
@@ -0,0 +1,32 @@
|
|||||||
|
/* **************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* GLFWDriverInstance.inl :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/04/02 17:04:23 by maldavid #+# #+# */
|
||||||
|
/* Updated: 2024/04/02 17:04:23 by maldavid ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* **************************************************************************** */
|
||||||
|
|
||||||
|
#include <Drivers/GLFW/GLFWDriverInstance.h>
|
||||||
|
|
||||||
|
namespace mlx
|
||||||
|
{
|
||||||
|
bool GLFWDriverInstance::InitDriver()
|
||||||
|
{
|
||||||
|
glfwSetErrorCallback([]([[maybe_unused]] int code, const char* desc)
|
||||||
|
{
|
||||||
|
FatalError("GLFW Driver Error : %", desc);
|
||||||
|
});
|
||||||
|
glfwInit();
|
||||||
|
DebugLog("GLFW Driver loaded");
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLFWDriverInstance::ShutdownDriver()
|
||||||
|
{
|
||||||
|
glfwTerminate();
|
||||||
|
DebugLog("GLFW Driver shutted down");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/01/25 15:05:05 by maldavid #+# #+# */
|
/* Created: 2023/01/25 15:05:05 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/27 22:11:57 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:11:05 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class C_IBO : public Buffer
|
class ConstantIndexBuffer : public Buffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline void Create(std::uint32_t size, const std::uint16_t* data, const char* name) { Buffer::Create(BufferType::Constant, size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, name, data); }
|
inline void Create(std::uint32_t size, const std::uint16_t* data, const char* name) { Buffer::Create(BufferType::Constant, size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, name, data); }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/06 18:27:38 by maldavid #+# #+# */
|
/* Created: 2022/10/06 18:27:38 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/27 22:18:23 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:23:32 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class VertexBuffer : public Buffer
|
class RAMVertexBuffer : public Buffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline void Create(std::uint32_t size, const void* data, const char* name) { Buffer::Create(BufferType::HighDynamic, size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, name, data); }
|
inline void Create(std::uint32_t size, const void* data, const char* name) { Buffer::Create(BufferType::HighDynamic, size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, name, data); }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/08 19:01:49 by maldavid #+# #+# */
|
/* Created: 2022/10/08 19:01:49 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/27 22:50:52 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:05:15 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ namespace mlx
|
|||||||
std::optional<std::uint32_t> graphics_family;
|
std::optional<std::uint32_t> graphics_family;
|
||||||
std::optional<std::uint32_t> present_family;
|
std::optional<std::uint32_t> present_family;
|
||||||
|
|
||||||
inline bool isComplete() { return graphics_family.has_value() && present_family.has_value(); }
|
inline bool IsComplete() { return graphics_family.has_value() && present_family.has_value(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -1,87 +1,83 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* vk_image.h :+: :+: :+: */
|
/* Image.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/01/25 11:54:21 by maldavid #+# #+# */
|
/* Created: 2023/01/25 11:54:21 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:09:40 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:08:35 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_VK_IMAGE__
|
#ifndef __MLX_VK_IMAGE__
|
||||||
#define __MLX_VK_IMAGE__
|
#define __MLX_VK_IMAGE__
|
||||||
|
|
||||||
#include <renderer/core/cmd_resource.h>
|
#include <Renderer/Core/CommandResource.h>
|
||||||
#include <renderer/command/vk_cmd_buffer.h>
|
#include <Renderer/Command/CommandBuffer.h>
|
||||||
#include <renderer/command/vk_cmd_pool.h>
|
#include <Renderer/Command/CommandPool.h>
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
#include <string>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
std::uint32_t formatSize(VkFormat format);
|
std::uint32_t FormatSize(VkFormat format);
|
||||||
bool isStencilFormat(VkFormat format);
|
bool IsStencilFormat(VkFormat format);
|
||||||
bool isDepthFormat(VkFormat format);
|
bool IsDepthFormat(VkFormat format);
|
||||||
VkFormat bitsToFormat(std::uint32_t bits);
|
VkFormat BitsToFormat(std::uint32_t bits);
|
||||||
VkPipelineStageFlags layoutToAccessMask(VkImageLayout layout, bool isDestination);
|
VkPipelineStageFlags LayoutToAccessMask(VkImageLayout layout, bool is_destination);
|
||||||
|
|
||||||
class Image : public CmdResource
|
class Image : public CommandResource
|
||||||
{
|
{
|
||||||
friend class SwapChain;
|
friend class Swapchain;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Image() = default;
|
Image() = default;
|
||||||
|
|
||||||
inline void create(VkImage image, VkFormat format, std::uint32_t width, std::uint32_t height, VkImageLayout layout = VK_IMAGE_LAYOUT_UNDEFINED) noexcept
|
inline void Create(VkImage image, VkFormat format, std::uint32_t width, std::uint32_t height, VkImageLayout layout = VK_IMAGE_LAYOUT_UNDEFINED) noexcept
|
||||||
{
|
{
|
||||||
_image = image;
|
m_image = image;
|
||||||
_format = format;
|
m_format = format;
|
||||||
_width = width;
|
m_width = width;
|
||||||
_height = height;
|
m_height = height;
|
||||||
_layout = layout;
|
m_layout = layout;
|
||||||
}
|
}
|
||||||
void create(std::uint32_t width, std::uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, const char* name, bool decated_memory = false);
|
void Create(std::uint32_t width, std::uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, const char* name, bool decated_memory = false);
|
||||||
void createImageView(VkImageViewType type, VkImageAspectFlags aspectFlags) noexcept;
|
void CreateImageView(VkImageViewType type, VkImageAspectFlags aspect_flags) noexcept;
|
||||||
void createSampler() noexcept;
|
void CreateSampler() noexcept;
|
||||||
void copyFromBuffer(class Buffer& buffer);
|
void CopyFromBuffer(class Buffer& buffer);
|
||||||
void copyToBuffer(class Buffer& buffer);
|
void CopyToBuffer(class Buffer& buffer);
|
||||||
void transitionLayout(VkImageLayout new_layout, CmdBuffer* cmd = nullptr);
|
void TransitionLayout(VkImageLayout new_layout, CmdBuffer* cmd = nullptr);
|
||||||
virtual void destroy() noexcept;
|
virtual void Destroy() noexcept;
|
||||||
|
|
||||||
inline VkImage get() noexcept { return _image; }
|
inline VkImage Get() noexcept { return m_image; }
|
||||||
inline VkImage operator()() noexcept { return _image; }
|
inline VkImage operator()() noexcept { return m_image; }
|
||||||
inline VkImageView getImageView() const noexcept { return _image_view; }
|
inline VkImageView GetImageView() const noexcept { return m_image_view; }
|
||||||
inline VkFormat getFormat() const noexcept { return _format; }
|
inline VkFormat GetFormat() const noexcept { return m_format; }
|
||||||
inline VkImageTiling getTiling() const noexcept { return _tiling; }
|
inline VkImageTiling GetTiling() const noexcept { return m_tiling; }
|
||||||
inline VkImageLayout getLayout() const noexcept { return _layout; }
|
inline VkImageLayout GetLayout() const noexcept { return m_layout; }
|
||||||
inline VkSampler getSampler() const noexcept { return _sampler; }
|
inline VkSampler GetSampler() const noexcept { return m_sampler; }
|
||||||
inline std::uint32_t getWidth() const noexcept { return _width; }
|
inline std::uint32_t GetWidth() const noexcept { return m_width; }
|
||||||
inline std::uint32_t getHeight() const noexcept { return _height; }
|
inline std::uint32_t GetHeight() const noexcept { return m_height; }
|
||||||
inline bool isInit() const noexcept { return _image != VK_NULL_HANDLE; }
|
inline bool IsInit() const noexcept { return m_image != VK_NULL_HANDLE; }
|
||||||
|
|
||||||
virtual ~Image() = default;
|
virtual ~Image() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void destroySampler() noexcept;
|
void DestroySampler() noexcept;
|
||||||
void destroyImageView() noexcept;
|
void DestroyImageView() noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VmaAllocation _allocation;
|
VmaAllocation m_allocation;
|
||||||
VkImage _image = VK_NULL_HANDLE;
|
VkImage m_image = VK_NULL_HANDLE;
|
||||||
VkImageView _image_view = VK_NULL_HANDLE;
|
VkImageView m_image_view = VK_NULL_HANDLE;
|
||||||
VkSampler _sampler = VK_NULL_HANDLE;
|
VkSampler m_sampler = VK_NULL_HANDLE;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::string _name;
|
std::string m_name;
|
||||||
#endif
|
#endif
|
||||||
VkFormat _format;
|
VkFormat m_format;
|
||||||
VkImageTiling _tiling;
|
VkImageTiling m_tiling;
|
||||||
VkImageLayout _layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
VkImageLayout m_layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
std::uint32_t _width = 0;
|
std::uint32_t m_width = 0;
|
||||||
std::uint32_t _height = 0;
|
std::uint32_t m_height = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* texture.h :+: :+: :+: */
|
/* Texture.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/03/08 02:24:58 by maldavid #+# #+# */
|
/* Created: 2023/03/08 02:24:58 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:09:56 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:11:21 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_TEXTURE__
|
#ifndef __MLX_TEXTURE__
|
||||||
#define __MLX_TEXTURE__
|
#define __MLX_TEXTURE__
|
||||||
|
|
||||||
#include <renderer/images/vk_image.h>
|
#include <Renderer/Images/Image.h>
|
||||||
#include <renderer/descriptors/vk_descriptor_set.h>
|
#include <Renderer/Descriptors/DescriptorSet.h>
|
||||||
#include <renderer/buffers/vk_ibo.h>
|
#include <Renderer/Buffers/IndexBuffer.h>
|
||||||
#include <renderer/buffers/vk_vbo.h>
|
#include <Renderer/Buffers/VertexBuffer.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -25,39 +25,39 @@ namespace mlx
|
|||||||
public:
|
public:
|
||||||
Texture() = default;
|
Texture() = default;
|
||||||
|
|
||||||
void create(std::uint8_t* pixels, std::uint32_t width, std::uint32_t height, VkFormat format, const char* name, bool dedicated_memory = false);
|
void Create(std::uint8_t* pixels, std::uint32_t width, std::uint32_t height, VkFormat format, const char* name, bool dedicated_memory = false);
|
||||||
void render(std::array<VkDescriptorSet, 2>& sets, class Renderer& renderer, int x, int y);
|
void Render(std::array<VkDescriptorSet, 2>& sets, class Renderer& renderer, int x, int y);
|
||||||
void destroy() noexcept override;
|
void Destroy() noexcept override;
|
||||||
|
|
||||||
void setPixel(int x, int y, std::uint32_t color) noexcept;
|
void SetPixel(int x, int y, std::uint32_t color) noexcept;
|
||||||
int getPixel(int x, int y) noexcept;
|
int GetPixel(int x, int y) noexcept;
|
||||||
|
|
||||||
inline void setDescriptor(DescriptorSet&& set) noexcept { _set = set; }
|
inline void SetDescriptor(DescriptorSet&& set) noexcept { m_set = set; }
|
||||||
inline VkDescriptorSet getSet() noexcept { return _set.isInit() ? _set.get() : VK_NULL_HANDLE; }
|
inline VkDescriptorSet GetSet() noexcept { return m_set.isInit() ? m_set.get() : VK_NULL_HANDLE; }
|
||||||
inline void updateSet(int binding) noexcept { _set.writeDescriptor(binding, *this); _has_set_been_updated = true; }
|
inline void UpdateSet(int binding) noexcept { m_set.writeDescriptor(binding, *this); m_has_set_been_updated = true; }
|
||||||
inline bool hasBeenUpdated() const noexcept { return _has_set_been_updated; }
|
inline bool HasBeenUpdated() const noexcept { return m_has_set_been_updated; }
|
||||||
inline constexpr void resetUpdate() noexcept { _has_set_been_updated = false; }
|
inline constexpr void ResetUpdate() noexcept { m_has_set_been_updated = false; }
|
||||||
|
|
||||||
~Texture() = default;
|
~Texture() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void openCPUmap();
|
void OpenCPUmap();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
C_VBO _vbo;
|
ConstantVertexBuffer m_vbo;
|
||||||
C_IBO _ibo;
|
ConstantIndexBuffer m_ibo;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::string _name;
|
std::string m_name;
|
||||||
#endif
|
#endif
|
||||||
DescriptorSet _set;
|
DescriptorSet m_set;
|
||||||
std::vector<std::uint32_t> _cpu_map;
|
std::vector<std::uint32_t> m_cpu_map;
|
||||||
std::optional<Buffer> _buf_map = std::nullopt;
|
std::optional<Buffer> m_buf_map = std::nullopt;
|
||||||
void* _map = nullptr;
|
void* m_map = nullptr;
|
||||||
bool _has_been_modified = false;
|
bool m_has_been_modified = false;
|
||||||
bool _has_set_been_updated = false;
|
bool m_has_set_been_updated = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
Texture stbTextureLoad(std::filesystem::path file, int* w, int* h);
|
Texture StbTextureLoad(std::filesystem::path file, int* w, int* h);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* texture_atlas.h :+: :+: :+: */
|
/* TextureAtlas.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/07 16:36:33 by maldavid #+# #+# */
|
/* Created: 2023/04/07 16:36:33 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:09:50 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:12:13 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_TEXTURE_ATLAS__
|
#ifndef __MLX_TEXTURE_ATLAS__
|
||||||
#define __MLX_TEXTURE_ATLAS__
|
#define __MLX_TEXTURE_ATLAS__
|
||||||
|
|
||||||
#include <renderer/images/texture.h>
|
#include <Renderer/Images/Texture.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -22,22 +22,22 @@ namespace mlx
|
|||||||
public:
|
public:
|
||||||
TextureAtlas() = default;
|
TextureAtlas() = default;
|
||||||
|
|
||||||
void create(std::uint8_t* pixels, std::uint32_t width, std::uint32_t height, VkFormat format, const char* name, bool dedicated_memory = false);
|
void Create(std::uint8_t* pixels, std::uint32_t width, std::uint32_t height, VkFormat format, const char* name, bool dedicated_memory = false);
|
||||||
void render(class Renderer& renderer, int x, int y, std::uint32_t ibo_size) const;
|
void Render(class Renderer& renderer, int x, int y, std::uint32_t ibo_size) const;
|
||||||
void destroy() noexcept override;
|
void Destroy() noexcept override;
|
||||||
|
|
||||||
inline void setDescriptor(DescriptorSet&& set) noexcept { _set = set; }
|
inline void SetDescriptor(DescriptorSet&& set) noexcept { m_set = set; }
|
||||||
inline VkDescriptorSet getVkSet() noexcept { return _set.isInit() ? _set.get() : VK_NULL_HANDLE; }
|
inline VkDescriptorSet GetVkSet() noexcept { return m_set.isInit() ? m_set.get() : VK_NULL_HANDLE; }
|
||||||
inline DescriptorSet getSet() noexcept { return _set; }
|
inline DescriptorSet GetSet() noexcept { return m_set; }
|
||||||
inline void updateSet(int binding) noexcept { _set.writeDescriptor(binding, *this); _has_been_updated = true; }
|
inline void UpdateSet(int binding) noexcept { m_set.writeDescriptor(binding, *this); m_has_been_updated = true; }
|
||||||
inline bool hasBeenUpdated() const noexcept { return _has_been_updated; }
|
inline bool HasBeenUpdated() const noexcept { return m_has_been_updated; }
|
||||||
inline constexpr void resetUpdate() noexcept { _has_been_updated = false; }
|
inline constexpr void ResetUpdate() noexcept { m_has_been_updated = false; }
|
||||||
|
|
||||||
~TextureAtlas() = default;
|
~TextureAtlas() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DescriptorSet _set;
|
DescriptorSet m_set;
|
||||||
bool _has_been_updated = false;
|
bool m_has_been_updated = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,43 +1,43 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* texture_descriptor.h :+: :+: :+: */
|
/* TextureDescriptor.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/01/11 01:00:13 by maldavid #+# #+# */
|
/* Created: 2024/01/11 01:00:13 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/01/11 01:21:52 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:13:23 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_TEXTURE_DESCRIPTOR__
|
#ifndef __MLX_TEXTURE_DESCRIPTOR__
|
||||||
#define __MLX_TEXTURE_DESCRIPTOR__
|
#define __MLX_TEXTURE_DESCRIPTOR__
|
||||||
|
|
||||||
#include <renderer/images/texture.h>
|
#include <Renderer/Images/Texture.h>
|
||||||
#include <renderer/core/drawable_resource.h>
|
#include <Renderer/Core/DrawableResource.h>
|
||||||
#include <utils/combine_hash.h>
|
#include <Utils/CombineHash.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
struct TextureRenderDescriptor : public DrawableResource
|
struct TextureRenderDescriptor : public DrawableResource
|
||||||
{
|
{
|
||||||
Texture* texture;
|
NonOwningPtr<Texture> texture;
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
TextureRenderDescriptor(Texture* _texture, int _x, int _y) : texture(_texture), x(_x), y(_y) {}
|
TextureRenderDescriptor(NonOwningPtr<Texture> _texture, int _x, int _y) : texture(_texture), x(_x), y(_y) {}
|
||||||
inline bool operator==(const TextureRenderDescriptor& rhs) const { return texture == rhs.texture && x == rhs.x && y == rhs.y; }
|
inline bool operator==(const TextureRenderDescriptor& rhs) const { return texture == rhs.texture && x == rhs.x && y == rhs.y; }
|
||||||
inline void render(std::array<VkDescriptorSet, 2>& sets, class Renderer& renderer) override
|
inline void Render(std::array<VkDescriptorSet, 2>& sets, class Renderer& renderer) override
|
||||||
{
|
{
|
||||||
if(!texture->isInit())
|
if(!texture->IsInit())
|
||||||
return;
|
return;
|
||||||
texture->render(sets, renderer, x, y);
|
texture->Render(sets, renderer, x, y);
|
||||||
}
|
}
|
||||||
inline void resetUpdate() override
|
inline void ResetUpdate() override
|
||||||
{
|
{
|
||||||
if(!texture->isInit())
|
if(!texture->IsInit())
|
||||||
return;
|
return;
|
||||||
texture->resetUpdate();
|
texture->ResetUpdate();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ namespace std
|
|||||||
std::size_t operator()(const mlx::TextureRenderDescriptor& d) const noexcept
|
std::size_t operator()(const mlx::TextureRenderDescriptor& d) const noexcept
|
||||||
{
|
{
|
||||||
std::size_t hash = 0;
|
std::size_t hash = 0;
|
||||||
mlx::hashCombine(hash, d.texture, d.x, d.y);
|
mlx::HashCombine(hash, d.texture, d.x, d.y);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* texture_manager.h :+: :+: :+: */
|
/* TextureManager.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/01/11 00:56:15 by maldavid #+# #+# */
|
/* Created: 2024/01/11 00:56:15 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:09:45 by maldavid ### ########.fr */
|
/* Updated: 2024/04/03 16:24:51 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_TEXTURE_MANAGER__
|
#ifndef __MLX_TEXTURE_MANAGER__
|
||||||
#define __MLX_TEXTURE_MANAGER__
|
#define __MLX_TEXTURE_MANAGER__
|
||||||
|
|
||||||
#include <renderer/images/texture_descriptor.h>
|
#include <Renderer/Images/TextureDescriptor.h>
|
||||||
#include <core/profiler.h>
|
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -23,19 +22,19 @@ namespace mlx
|
|||||||
public:
|
public:
|
||||||
TextureManager() = default;
|
TextureManager() = default;
|
||||||
|
|
||||||
inline void clear() { _texture_descriptors.clear(); }
|
inline void Clear() { m_texture_descriptors.clear(); }
|
||||||
|
|
||||||
inline std::pair<DrawableResource*, bool> registerTexture(Texture* texture, int x, int y)
|
inline std::pair<NonOwningPtr<DrawableResource>, bool> RegisterTexture(NonOwningPtr<Texture> texture, int x, int y)
|
||||||
{
|
{
|
||||||
MLX_PROFILE_FUNCTION();
|
MLX_PROFILE_FUNCTION();
|
||||||
auto res = _texture_descriptors.emplace(texture, x, y);
|
auto res = m_texture_descriptors.emplace(texture, x, y);
|
||||||
return std::make_pair(static_cast<DrawableResource*>(&const_cast<TextureRenderDescriptor&>(*res.first)), res.second);
|
return std::make_pair(static_cast<DrawableResource*>(&const_cast<TextureRenderDescriptor&>(*res.first)), res.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isTextureKnown(Texture* texture) noexcept
|
inline bool IsTextureKnown(NonOwningPtr<Texture> texture) noexcept
|
||||||
{
|
{
|
||||||
MLX_PROFILE_FUNCTION();
|
MLX_PROFILE_FUNCTION();
|
||||||
for(const auto& desc : _texture_descriptors)
|
for(const auto& desc : m_texture_descriptors)
|
||||||
{
|
{
|
||||||
if(desc.texture == texture)
|
if(desc.texture == texture)
|
||||||
return true;
|
return true;
|
||||||
@@ -43,13 +42,13 @@ namespace mlx
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void eraseTextures(Texture* texture)
|
inline void EraseTextures(NonOwningPtr<Texture> texture)
|
||||||
{
|
{
|
||||||
MLX_PROFILE_FUNCTION();
|
MLX_PROFILE_FUNCTION();
|
||||||
for(auto it = _texture_descriptors.begin(); it != _texture_descriptors.end();)
|
for(auto it = m_texture_descriptors.begin(); it != m_texture_descriptors.end();)
|
||||||
{
|
{
|
||||||
if(it->texture == texture)
|
if(it->texture == texture)
|
||||||
it = _texture_descriptors.erase(it);
|
it = m_texture_descriptors.erase(it);
|
||||||
else
|
else
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
@@ -58,7 +57,7 @@ namespace mlx
|
|||||||
~TextureManager() = default;
|
~TextureManager() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_set<TextureRenderDescriptor> _texture_descriptors;
|
std::unordered_set<TextureRenderDescriptor> m_texture_descriptors;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* pipeline.h :+: :+: :+: */
|
/* Pipeline.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/12/18 21:23:52 by maldavid #+# #+# */
|
/* Created: 2022/12/18 21:23:52 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:09:01 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:15:38 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __PIPELINE__
|
#ifndef __PIPELINE__
|
||||||
#define __PIPELINE__
|
#define __PIPELINE__
|
||||||
|
|
||||||
#include <renderer/command/vk_cmd_buffer.h>
|
#include <Renderer/Command/CommandBuffer.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -21,16 +21,16 @@ namespace mlx
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(class Renderer& renderer);
|
void init(class Renderer& renderer);
|
||||||
void destroy() noexcept;
|
void Destroy() noexcept;
|
||||||
|
|
||||||
inline void bindPipeline(CmdBuffer& command_buffer) noexcept { vkCmdBindPipeline(command_buffer.get(), VK_PIPELINE_BIND_POINT_GRAPHICS, _graphics_pipeline); }
|
inline void BindPipeline(CommandBuffer& command_buffer) noexcept { vkCmdBindPipeline(command_buffer.Get(), VK_PIPELINE_BIND_POINT_GRAPHICS, m_graphics_pipeline); }
|
||||||
|
|
||||||
inline const VkPipeline& getPipeline() const noexcept { return _graphics_pipeline; }
|
inline const VkPipeline& GetPipeline() const noexcept { return m_graphics_pipeline; }
|
||||||
inline const VkPipelineLayout& getPipelineLayout() const noexcept { return _pipeline_layout; }
|
inline const VkPipelineLayout& GetPipelineLayout() const noexcept { return m_pipeline_layout; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VkPipeline _graphics_pipeline = VK_NULL_HANDLE;
|
VkPipeline m_graphics_pipeline = VK_NULL_HANDLE;
|
||||||
VkPipelineLayout _pipeline_layout = VK_NULL_HANDLE;
|
VkPipelineLayout m_pipeline_layout = VK_NULL_HANDLE;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* pixel_put.h :+: :+: :+: */
|
/* PixelPut.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/03/31 13:18:50 by maldavid #+# #+# */
|
/* Created: 2023/03/31 13:18:50 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:07:56 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:28:46 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_PIXEL_PUT__
|
#ifndef __MLX_PIXEL_PUT__
|
||||||
#define __MLX_PIXEL_PUT__
|
#define __MLX_PIXEL_PUT__
|
||||||
|
|
||||||
#include <renderer/images/texture.h>
|
#include <Renderer/Images/Texture.h>
|
||||||
#include <renderer/descriptors/vk_descriptor_set.h>
|
#include <Renderer/Descriptors/DescriptorSet.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -23,25 +23,25 @@ namespace mlx
|
|||||||
public:
|
public:
|
||||||
PixelPutPipeline() = default;
|
PixelPutPipeline() = default;
|
||||||
|
|
||||||
void init(std::uint32_t width, std::uint32_t height, class Renderer& renderer) noexcept;
|
void Init(std::uint32_t width, std::uint32_t height, class Renderer& renderer) noexcept;
|
||||||
|
|
||||||
void setPixel(int x, int y, std::uint32_t color) noexcept;
|
void SetPixel(int x, int y, std::uint32_t color) noexcept;
|
||||||
void render(std::array<VkDescriptorSet, 2>& sets, class Renderer& renderer) noexcept;
|
void Render(std::array<VkDescriptorSet, 2>& sets, class Renderer& renderer) noexcept;
|
||||||
|
|
||||||
void clear();
|
void Clear();
|
||||||
void destroy() noexcept;
|
void Destroy() noexcept;
|
||||||
|
|
||||||
~PixelPutPipeline();
|
~PixelPutPipeline();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Texture _texture;
|
Texture m_texture;
|
||||||
Buffer _buffer;
|
Buffer m_buffer;
|
||||||
// using vector as CPU map and not directly writting to mapped buffer to improve performances
|
// using vector as CPU map and not directly writting to mapped buffer to improve performances
|
||||||
std::vector<std::uint32_t> _cpu_map;
|
std::vector<std::uint32_t> m_cpu_map;
|
||||||
void* _buffer_map = nullptr;
|
void* m_buffer_map = nullptr;
|
||||||
std::uint32_t _width = 0;
|
std::uint32_t m_width = 0;
|
||||||
std::uint32_t _height = 0;
|
std::uint32_t m_height = 0;
|
||||||
bool _has_been_modified = true;
|
bool m_has_been_modified = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +1,30 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* renderer.h :+: :+: :+: */
|
/* Renderer.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/12/18 17:14:45 by maldavid #+# #+# */
|
/* Created: 2022/12/18 17:14:45 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/27 00:31:28 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:36:05 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __RENDERER__
|
#ifndef __RENDERER__
|
||||||
#define __RENDERER__
|
#define __RENDERER__
|
||||||
|
|
||||||
#include <renderer/buffers/vk_ubo.h>
|
#include <Renderer/Buffers/UniformBuffer.h>
|
||||||
#include <renderer/core/vk_surface.h>
|
#include <Renderer/Core/Surface.h>
|
||||||
#include <renderer/core/render_core.h>
|
#include <Renderer/Core/RenderCore.h>
|
||||||
#include <renderer/core/vk_semaphore.h>
|
#include <Renderer/Core/Semaphore.h>
|
||||||
#include <renderer/pipeline/pipeline.h>
|
#include <Renderer/Pipeline/Pipeline.h>
|
||||||
#include <renderer/command/cmd_manager.h>
|
#include <Renderer/Command/CommandManager.h>
|
||||||
#include <renderer/swapchain/vk_swapchain.h>
|
#include <Renderer/Swapchain/Swapchain.h>
|
||||||
#include <renderer/renderpass/vk_render_pass.h>
|
#include <Renderer/Renderpass/RenderPass.h>
|
||||||
#include <renderer/renderpass/vk_framebuffer.h>
|
#include <Renderer/Renderpass/FrameBuffer.h>
|
||||||
#include <renderer/descriptors/vk_descriptor_set.h>
|
#include <Renderer/Descriptors/DescriptorSet.h>
|
||||||
#include <renderer/descriptors/vk_descriptor_pool.h>
|
#include <Renderer/Descriptors/DescriptorPool.h>
|
||||||
#include <renderer/descriptors/vk_descriptor_set_layout.h>
|
#include <Renderer/Descriptors/DescriptorSetLayout.h>
|
||||||
|
|
||||||
#include <core/errors.h>
|
|
||||||
#include <mlx_profile.h>
|
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -41,36 +36,36 @@ namespace mlx
|
|||||||
|
|
||||||
Vertex(glm::vec2 _pos, glm::vec4 _color, glm::vec2 _uv) : pos(std::move(_pos)), color(std::move(_color)), uv(std::move(_uv)) {}
|
Vertex(glm::vec2 _pos, glm::vec4 _color, glm::vec2 _uv) : pos(std::move(_pos)), color(std::move(_color)), uv(std::move(_uv)) {}
|
||||||
|
|
||||||
static VkVertexInputBindingDescription getBindingDescription()
|
static VkVertexInputBindingDescription GetBindingDescription()
|
||||||
{
|
{
|
||||||
VkVertexInputBindingDescription bindingDescription{};
|
VkVertexInputBindingDescription binding_description{};
|
||||||
bindingDescription.binding = 0;
|
binding_description.binding = 0;
|
||||||
bindingDescription.stride = sizeof(Vertex);
|
binding_description.stride = sizeof(Vertex);
|
||||||
bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
|
binding_description.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
|
||||||
|
|
||||||
return bindingDescription;
|
return binding_description;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::array<VkVertexInputAttributeDescription, 3> getAttributeDescriptions()
|
static std::array<VkVertexInputAttributeDescription, 3> GetAttributeDescriptions()
|
||||||
{
|
{
|
||||||
std::array<VkVertexInputAttributeDescription, 3> attributeDescriptions;
|
std::array<VkVertexInputAttributeDescription, 3> attribute_descriptions;
|
||||||
|
|
||||||
attributeDescriptions[0].binding = 0;
|
attribute_descriptions[0].binding = 0;
|
||||||
attributeDescriptions[0].location = 0;
|
attribute_descriptions[0].location = 0;
|
||||||
attributeDescriptions[0].format = VK_FORMAT_R32G32_SFLOAT;
|
attribute_descriptions[0].format = VK_FORMAT_R32G32_SFLOAT;
|
||||||
attributeDescriptions[0].offset = offsetof(Vertex, pos);
|
attribute_descriptions[0].offset = offsetof(Vertex, pos);
|
||||||
|
|
||||||
attributeDescriptions[1].binding = 0;
|
attribute_descriptions[1].binding = 0;
|
||||||
attributeDescriptions[1].location = 1;
|
attribute_descriptions[1].location = 1;
|
||||||
attributeDescriptions[1].format = VK_FORMAT_R32G32B32A32_SFLOAT;
|
attribute_descriptions[1].format = VK_FORMAT_R32G32B32A32_SFLOAT;
|
||||||
attributeDescriptions[1].offset = offsetof(Vertex, color);
|
attribute_descriptions[1].offset = offsetof(Vertex, color);
|
||||||
|
|
||||||
attributeDescriptions[2].binding = 0;
|
attribute_descriptions[2].binding = 0;
|
||||||
attributeDescriptions[2].location = 2;
|
attribute_descriptions[2].location = 2;
|
||||||
attributeDescriptions[2].format = VK_FORMAT_R32G32_SFLOAT;
|
attribute_descriptions[2].format = VK_FORMAT_R32G32_SFLOAT;
|
||||||
attributeDescriptions[2].offset = offsetof(Vertex, uv);
|
attribute_descriptions[2].offset = offsetof(Vertex, uv);
|
||||||
|
|
||||||
return attributeDescriptions;
|
return attribute_descriptions;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -79,63 +74,63 @@ namespace mlx
|
|||||||
public:
|
public:
|
||||||
Renderer() = default;
|
Renderer() = default;
|
||||||
|
|
||||||
void init(class Texture* render_target);
|
void Init(NonOwningPtr<class Texture> render_target);
|
||||||
|
|
||||||
bool beginFrame();
|
bool BeginFrame();
|
||||||
void endFrame();
|
void EndFrame();
|
||||||
|
|
||||||
void destroy();
|
void Destroy();
|
||||||
|
|
||||||
inline class Window* getWindow() { return _window; }
|
inline NonOwningPtr<class Window> GetWindow() { return m_window; }
|
||||||
inline void setWindow(class Window* window) { _window = window; }
|
inline void SetWindow(NonOwningPtr<class Window> window) { m_window = window; }
|
||||||
|
|
||||||
inline Surface& getSurface() noexcept { return _surface; }
|
inline Surface& GetSurface() noexcept { return m_surface; }
|
||||||
inline CmdPool& getCmdPool() noexcept { return _cmd.getCmdPool(); }
|
inline CmdPool& GetCmdPool() noexcept { return m_cmd.GetCmdPool(); }
|
||||||
inline UBO* getUniformBuffer() noexcept { return _uniform_buffer.get(); }
|
inline NonOwningPtr<UniformBuffer> GetUniformBuffer() noexcept { return m_uniform_buffer.get(); }
|
||||||
inline SwapChain& getSwapChain() noexcept { return _swapchain; }
|
inline SwapChain& GetSwapChain() noexcept { return m_swapchain; }
|
||||||
inline Semaphore& getSemaphore(int i) noexcept { return _semaphores[i]; }
|
inline Semaphore& GetSemaphore(int i) noexcept { return m_semaphores[i]; }
|
||||||
inline RenderPass& getRenderPass() noexcept { return _pass; }
|
inline RenderPass& GetRenderPass() noexcept { return m_pass; }
|
||||||
inline GraphicPipeline& getPipeline() noexcept { return _pipeline; }
|
inline GraphicPipeline& GetPipeline() noexcept { return m_pipeline; }
|
||||||
inline CmdBuffer& getCmdBuffer(int i) noexcept { return _cmd.getCmdBuffer(i); }
|
inline CmdBuffer& GetCmdBuffer(int i) noexcept { return m_cmd.GetCmdBuffer(i); }
|
||||||
inline CmdBuffer& getActiveCmdBuffer() noexcept { return _cmd.getCmdBuffer(_current_frame_index); }
|
inline CmdBuffer& GetActiveCmdBuffer() noexcept { return m_cmd.GetCmdBuffer(m_current_frame_index); }
|
||||||
inline FrameBuffer& getFrameBuffer(int i) noexcept { return _framebuffers[i]; }
|
inline FrameBuffer& GetFrameBuffer(int i) noexcept { return m_framebuffers[i]; }
|
||||||
inline DescriptorSet& getVertDescriptorSet() noexcept { return _vert_set; }
|
inline DescriptorSet& GetVertDescriptorSet() noexcept { return m_vert_set; }
|
||||||
inline DescriptorSet& getFragDescriptorSet() noexcept { return _frag_set; }
|
inline DescriptorSet& GetFragDescriptorSet() noexcept { return m_frag_set; }
|
||||||
inline DescriptorSetLayout& getVertDescriptorSetLayout() noexcept { return _vert_layout; }
|
inline DescriptorSetLayout& GetVertDescriptorSetLayout() noexcept { return m_vert_layout; }
|
||||||
inline DescriptorSetLayout& getFragDescriptorSetLayout() noexcept { return _frag_layout; }
|
inline DescriptorSetLayout& GetFragDescriptorSetLayout() noexcept { return m_frag_layout; }
|
||||||
inline std::uint32_t getActiveImageIndex() noexcept { return _current_frame_index; }
|
inline std::uint32_t GetActiveImageIndex() noexcept { return m_current_frame_index; }
|
||||||
inline std::uint32_t getImageIndex() noexcept { return _image_index; }
|
inline std::uint32_t GetImageIndex() noexcept { return m_image_index; }
|
||||||
|
|
||||||
constexpr inline void requireFrameBufferResize() noexcept { _framebuffer_resized = true; }
|
constexpr inline void RequireFrameBufferResize() noexcept { m_framebuffer_resized = true; }
|
||||||
|
|
||||||
~Renderer() = default;
|
~Renderer() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void recreateRenderData();
|
void RecreateRenderData();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GraphicPipeline _pipeline;
|
GraphicPipeline m_pipeline;
|
||||||
CmdManager _cmd;
|
CmdManager m_cmd;
|
||||||
RenderPass _pass;
|
RenderPass m_pass;
|
||||||
Surface _surface;
|
Surface m_surface;
|
||||||
SwapChain _swapchain;
|
SwapChain m_swapchain;
|
||||||
std::array<Semaphore, MAX_FRAMES_IN_FLIGHT> _semaphores;
|
std::array<Semaphore, MAX_FRAMES_IN_FLIGHT> m_semaphores;
|
||||||
std::vector<FrameBuffer> _framebuffers;
|
std::vector<FrameBuffer> m_framebuffers;
|
||||||
|
|
||||||
DescriptorSetLayout _vert_layout;
|
DescriptorSetLayout m_vert_layout;
|
||||||
DescriptorSetLayout _frag_layout;
|
DescriptorSetLayout m_frag_layout;
|
||||||
|
|
||||||
DescriptorSet _vert_set;
|
DescriptorSet m_vert_set;
|
||||||
DescriptorSet _frag_set;
|
DescriptorSet m_frag_set;
|
||||||
|
|
||||||
std::unique_ptr<UBO> _uniform_buffer;
|
std::unique_ptr<UniformBuffer> m_uniform_buffer;
|
||||||
|
|
||||||
class Window* _window = nullptr;
|
NonOwningPtr<class Window> m_window;
|
||||||
class Texture* _render_target = nullptr;
|
NonOwningPtr<class Texture> m_render_target;
|
||||||
|
|
||||||
std::uint32_t _current_frame_index = 0;
|
std::uint32_t m_current_frame_index = 0;
|
||||||
std::uint32_t _image_index = 0;
|
std::uint32_t m_image_index = 0;
|
||||||
bool _framebuffer_resized = false;
|
bool m_framebuffer_resized = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* vk_framebuffer.h :+: :+: :+: */
|
/* FrameBuffer.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/06 18:19:44 by maldavid #+# #+# */
|
/* Created: 2022/10/06 18:19:44 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:08:37 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:16:02 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -18,18 +18,18 @@ namespace mlx
|
|||||||
class FrameBuffer
|
class FrameBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(class RenderPass& renderpass, class Image& image);
|
void Init(class RenderPass& renderpass, class Image& image);
|
||||||
void destroy() noexcept;
|
void Destroy() noexcept;
|
||||||
|
|
||||||
inline VkFramebuffer& operator()() noexcept { return _framebuffer; }
|
inline VkFramebuffer& operator()() noexcept { return m_framebuffer; }
|
||||||
inline VkFramebuffer& get() noexcept { return _framebuffer; }
|
inline VkFramebuffer& Get() noexcept { return m_framebuffer; }
|
||||||
inline std::uint32_t getWidth() const noexcept { return _width; }
|
inline std::uint32_t GetWidth() const noexcept { return m_width; }
|
||||||
inline std::uint32_t getHeight() const noexcept { return _height; }
|
inline std::uint32_t GetHeight() const noexcept { return m_height; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VkFramebuffer _framebuffer = VK_NULL_HANDLE;
|
VkFramebuffer m_framebuffer = VK_NULL_HANDLE;
|
||||||
std::uint32_t _width = 0;
|
std::uint32_t m_width = 0;
|
||||||
std::uint32_t _height = 0;
|
std::uint32_t m_height = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* vk_render_pass.h :+: :+: :+: */
|
/* RenderPass.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/06 18:22:00 by maldavid #+# #+# */
|
/* Created: 2022/10/06 18:22:00 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:08:30 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:16:44 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -18,18 +18,18 @@ namespace mlx
|
|||||||
class RenderPass
|
class RenderPass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(VkFormat attachement_format, VkImageLayout layout);
|
void Init(VkFormat attachement_format, VkImageLayout layout);
|
||||||
void destroy() noexcept;
|
void Destroy() noexcept;
|
||||||
|
|
||||||
void begin(class CmdBuffer& cmd, class FrameBuffer& fb);
|
void Begin(class CmommandBuffer& cmd, class FrameBuffer& fb);
|
||||||
void end(class CmdBuffer& cmd);
|
void End(class CommandBuffer& cmd);
|
||||||
|
|
||||||
inline VkRenderPass& operator()() noexcept { return _render_pass; }
|
inline VkRenderPass& operator()() noexcept { return m_render_pass; }
|
||||||
inline VkRenderPass& get() noexcept { return _render_pass; }
|
inline VkRenderPass& Get() noexcept { return m_render_pass; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VkRenderPass _render_pass = VK_NULL_HANDLE;
|
VkRenderPass m_render_pass = VK_NULL_HANDLE;
|
||||||
bool _is_running = false;
|
bool m_is_running = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* vk_swapchain.h :+: :+: :+: */
|
/* Swapchain.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/06 18:23:27 by maldavid #+# #+# */
|
/* Created: 2022/10/06 18:23:27 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:08:26 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:18:15 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_VK_SWAPCHAIN__
|
#ifndef __MLX_VK_SWAPCHAIN__
|
||||||
#define __MLX_VK_SWAPCHAIN__
|
#define __MLX_VK_SWAPCHAIN__
|
||||||
|
|
||||||
#include <renderer/images/vk_image.h>
|
#include <Renderer/Images/Image.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -34,31 +34,31 @@ namespace mlx
|
|||||||
public:
|
public:
|
||||||
SwapChain() = default;
|
SwapChain() = default;
|
||||||
|
|
||||||
void init(class Renderer* renderer);
|
void Init(NonOwningPtr<class Renderer> renderer);
|
||||||
void recreate();
|
void Recreate();
|
||||||
void destroy() noexcept;
|
void Destroy() noexcept;
|
||||||
|
|
||||||
SwapChainSupportDetails querySwapChainSupport(VkPhysicalDevice device);
|
SwapChainSupportDetails QuerySwapChainSupport(VkPhysicalDevice device);
|
||||||
VkExtent2D chooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities);
|
VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities);
|
||||||
VkPresentModeKHR chooseSwapPresentMode([[maybe_unused]] const std::vector<VkPresentModeKHR> &availablePresentModes);
|
VkPresentModeKHR ChooseSwapPresentMode([[maybe_unused]] const std::vector<VkPresentModeKHR> &available_present_modes);
|
||||||
|
|
||||||
inline VkSwapchainKHR get() noexcept { return _swapchain; }
|
inline VkSwapchainKHR Get() noexcept { return m_swapchain; }
|
||||||
inline VkSwapchainKHR operator()() noexcept { return _swapchain; }
|
inline VkSwapchainKHR operator()() noexcept { return m_swapchain; }
|
||||||
inline std::size_t getImagesNumber() const noexcept { return _images.size(); }
|
inline std::size_t GetImagesNumber() const noexcept { return m_images.size(); }
|
||||||
inline Image& getImage(std::size_t i) noexcept { return _images[i]; }
|
inline Image& GetImage(std::size_t i) noexcept { return m_images[i]; }
|
||||||
inline SwapChainSupportDetails getSupport() noexcept { return _swapchain_support; }
|
inline SwapChainSupportDetails GetSupport() noexcept { return m_swapchain_support; }
|
||||||
inline VkExtent2D getExtent() noexcept { return _extent; }
|
inline VkExtent2D GetExtent() noexcept { return m_extent; }
|
||||||
inline VkFormat getImagesFormat() const noexcept { return _swapchain_image_format; }
|
inline VkFormat GetImagesFormat() const noexcept { return m_swapchain_image_format; }
|
||||||
|
|
||||||
~SwapChain() = default;
|
~SwapChain() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SwapChainSupportDetails _swapchain_support;
|
SwapChainSupportDetails m_swapchain_support;
|
||||||
VkSwapchainKHR _swapchain;
|
VkSwapchainKHR m_swapchain;
|
||||||
std::vector<Image> _images;
|
std::vector<Image> m_images;
|
||||||
VkFormat _swapchain_image_format;
|
VkFormat m_swapchain_image_format;
|
||||||
VkExtent2D _extent;
|
VkExtent2D m_extent;
|
||||||
class Renderer* _renderer = nullptr;
|
NonOwningPtr<class Renderer> m_renderer;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,52 +1,54 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* font.h :+: :+: :+: */
|
/* Font.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/12/11 21:17:04 by kbz_8 #+# #+# */
|
/* Created: 2023/12/11 21:17:04 by kbz_8 #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:08:21 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:19:39 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_FONT__
|
#ifndef __MLX_FONT__
|
||||||
#define __MLX_FONT__
|
#define __MLX_FONT__
|
||||||
|
|
||||||
#include <renderer/images/texture_atlas.h>
|
#include <Renderer/Images/TextureAtlas.h>
|
||||||
#include <utils/combine_hash.h>
|
#include <Utils/CombineHash.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class Font
|
class Font
|
||||||
{
|
{
|
||||||
friend class FontLibrary;
|
friend class FontLibrary;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Font() = delete;
|
Font() = delete;
|
||||||
Font(class Renderer& renderer, const std::filesystem::path& path, float scale);
|
Font(class Renderer& renderer, const std::filesystem::path& path, float scale);
|
||||||
Font(class Renderer& renderer, const std::string& name, const std::vector<std::uint8_t>& ttf_data, float scale);
|
Font(class Renderer& renderer, const std::string& name, const std::vector<std::uint8_t>& ttf_data, float scale);
|
||||||
|
|
||||||
inline const std::string& getName() const { return _name; }
|
inline const std::string& GetName() const { return m_name; }
|
||||||
inline float getScale() const noexcept { return _scale; }
|
inline float GetScale() const noexcept { return m_scale; }
|
||||||
inline const std::array<stbtt_packedchar, 96>& getCharData() const { return _cdata; }
|
inline const std::array<stbtt_packedchar, 96>& GetCharData() const { return m_cdata; }
|
||||||
inline const TextureAtlas& getAtlas() const noexcept { return _atlas; }
|
inline const TextureAtlas& GetAtlas() const noexcept { return m_atlas; }
|
||||||
inline bool operator==(const Font& rhs) const { return rhs._name == _name && rhs._scale == _scale; }
|
inline bool operator==(const Font& rhs) const { return rhs._name == m_name && rhs._scale == m_scale; }
|
||||||
inline bool operator!=(const Font& rhs) const { return rhs._name != _name || rhs._scale != _scale; }
|
inline bool operator!=(const Font& rhs) const { return rhs._name != m_name || rhs._scale != m_scale; }
|
||||||
void destroy();
|
|
||||||
|
void Destroy();
|
||||||
|
|
||||||
~Font();
|
~Font();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void buildFont();
|
void BuildFont();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::array<stbtt_packedchar, 96> _cdata;
|
std::array<stbtt_packedchar, 96> m_cdata;
|
||||||
TextureAtlas _atlas;
|
TextureAtlas m_atlas;
|
||||||
std::variant<std::filesystem::path, std::vector<std::uint8_t>> _build_data;
|
std::variant<std::filesystem::path, std::vector<std::uint8_t>> m_build_data;
|
||||||
std::string _name;
|
std::string m_name;
|
||||||
class Renderer& _renderer;
|
class Renderer& m_renderer;
|
||||||
float _scale = 0;
|
float m_scale = 0;
|
||||||
bool _is_init = false;
|
bool m_is_init = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* font_library.h :+: :+: :+: */
|
/* FontLibrary.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/01/18 09:26:03 by maldavid #+# #+# */
|
/* Created: 2024/01/18 09:26:03 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:08:18 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:21:53 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_FONT_LIBRARY__
|
#ifndef __MLX_FONT_LIBRARY__
|
||||||
#define __MLX_FONT_LIBRARY__
|
#define __MLX_FONT_LIBRARY__
|
||||||
|
|
||||||
#include <renderer/texts/font.h>
|
#include <Renderer/Texts/Font.h>
|
||||||
#include <renderer/core/render_core.h>
|
#include <Renderer/Core/RenderCore.h>
|
||||||
#include <utils/singleton.h>
|
#include <Utils/Singleton.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -27,20 +27,20 @@ namespace mlx
|
|||||||
friend class Singleton<FontLibrary>;
|
friend class Singleton<FontLibrary>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<class Font> getFontData(FontID id);
|
std::shared_ptr<class Font> GetFontData(FontID id);
|
||||||
FontID addFontToLibrary(std::shared_ptr<Font> font);
|
FontID AddFontToLibrary(std::shared_ptr<Font> font);
|
||||||
void removeFontFromLibrary(FontID id);
|
void RemoveFontFromLibrary(FontID id);
|
||||||
|
|
||||||
void clearLibrary();
|
void ClearLibrary();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FontLibrary() = default;
|
FontLibrary() = default;
|
||||||
~FontLibrary() = default;
|
~FontLibrary() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_map<FontID, std::shared_ptr<class Font>> _cache;
|
std::unordered_map<FontID, std::shared_ptr<class Font>> m_cache;
|
||||||
std::vector<FontID> _invalid_ids;
|
std::vector<FontID> m_invalid_ids;
|
||||||
FontID _current_id = 1;
|
FontID m_current_id = 1;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* text.h :+: :+: :+: */
|
/* Text.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/01/11 00:09:04 by maldavid #+# #+# */
|
/* Created: 2024/01/11 00:09:04 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:08:15 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:23:50 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_TEXT__
|
#ifndef __MLX_TEXT__
|
||||||
#define __MLX_TEXT__
|
#define __MLX_TEXT__
|
||||||
|
|
||||||
#include <renderer/texts/font.h>
|
#include <Renderer/Texts/Font.h>
|
||||||
#include <renderer/texts/font_library.h>
|
#include <Renderer/Texts/FontLibrary.h>
|
||||||
#include <renderer/buffers/vk_ibo.h>
|
#include <Renderer/Buffers/IndexBuffer.h>
|
||||||
#include <renderer/buffers/vk_vbo.h>
|
#include <Renderer/Buffers/VertexBuffer.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -25,24 +25,24 @@ namespace mlx
|
|||||||
public:
|
public:
|
||||||
Text() = default;
|
Text() = default;
|
||||||
|
|
||||||
void init(std::string text, FontID font, std::uint32_t color, std::vector<Vertex> vbo_data, std::vector<std::uint16_t> ibo_data);
|
void Init(std::string text, FontID font, std::uint32_t color, std::vector<Vertex> vbo_data, std::vector<std::uint16_t> ibo_data);
|
||||||
void bind(class Renderer& renderer) noexcept;
|
void Bind(class Renderer& renderer) noexcept;
|
||||||
inline FontID getFontInUse() const noexcept { return _font; }
|
inline FontID GetFontInUse() const noexcept { return m_font; }
|
||||||
void updateVertexData(int frame, std::vector<Vertex> vbo_data);
|
void UpdateVertexData(int frame, std::vector<Vertex> vbo_data);
|
||||||
inline std::uint32_t getIBOsize() noexcept { return _ibo.getSize(); }
|
inline std::uint32_t GetIBOsize() noexcept { return m_ibo.GetSize(); }
|
||||||
inline const std::string& getText() const { return _text; }
|
inline const std::string& GetText() const { return m_text; }
|
||||||
inline std::uint32_t getColor() const noexcept { return _color; }
|
inline std::uint32_t GetColor() const noexcept { return m_color; }
|
||||||
void destroy() noexcept;
|
void Destroy() noexcept;
|
||||||
|
|
||||||
~Text();
|
~Text();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::array<D_VBO, MAX_FRAMES_IN_FLIGHT> _vbo;
|
std::array<DeviceVertexBuffer, MAX_FRAMES_IN_FLIGHT> m_vbo;
|
||||||
C_IBO _ibo;
|
ConstantIndexBuffer m_ibo;
|
||||||
std::string _text;
|
std::string m_text;
|
||||||
std::uint32_t _color;
|
std::uint32_t m_color;
|
||||||
FontID _font = nullfont;
|
FontID m_font = nullfont;
|
||||||
bool _is_init = false;
|
bool m_is_init = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* text_descriptor.h :+: :+: :+: */
|
/* TextDescriptor.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/01/11 00:13:34 by maldavid #+# #+# */
|
/* Created: 2024/01/11 00:13:34 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:08:11 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:25:09 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_TEXT_DESCRIPTOR__
|
#ifndef __MLX_TEXT_DESCRIPTOR__
|
||||||
#define __MLX_TEXT_DESCRIPTOR__
|
#define __MLX_TEXT_DESCRIPTOR__
|
||||||
|
|
||||||
#include <utils/combine_hash.h>
|
#include <Utils/CombineHash.h>
|
||||||
#include <renderer/core/drawable_resource.h>
|
#include <Renderer/Core/DrawableResource.h>
|
||||||
#include <renderer/texts/text_library.h>
|
#include <Renderer/Texts/TextLibrary.h>
|
||||||
#include <renderer/texts/font_library.h>
|
#include <Renderer/Texts/FontLibrary.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -33,15 +33,15 @@ namespace mlx
|
|||||||
public:
|
public:
|
||||||
TextDrawDescriptor(std::string text, std::uint32_t _color, int _x, int _y);
|
TextDrawDescriptor(std::string text, std::uint32_t _color, int _x, int _y);
|
||||||
|
|
||||||
void init(FontID font) noexcept;
|
void Init(FontID font) noexcept;
|
||||||
bool operator==(const TextDrawDescriptor& rhs) const { return _text == rhs._text && x == rhs.x && y == rhs.y && color == rhs.color; }
|
bool operator==(const TextDrawDescriptor& rhs) const { return m_text == rhs.m_text && x == rhs.x && y == rhs.y && color == rhs.color; }
|
||||||
void render(std::array<VkDescriptorSet, 2>& sets, Renderer& renderer) override;
|
void Render(std::array<VkDescriptorSet, 2>& sets, Renderer& renderer) override;
|
||||||
void resetUpdate() override;
|
void ResetUpdate() override;
|
||||||
|
|
||||||
TextDrawDescriptor() = default;
|
TextDrawDescriptor() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _text;
|
std::string m_text;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ namespace std
|
|||||||
std::size_t operator()(const mlx::TextDrawDescriptor& d) const noexcept
|
std::size_t operator()(const mlx::TextDrawDescriptor& d) const noexcept
|
||||||
{
|
{
|
||||||
std::size_t hash = 0;
|
std::size_t hash = 0;
|
||||||
mlx::hashCombine(hash, d.x, d.y, d.color, d._text);
|
mlx::HashCombine(hash, d.x, d.y, d.color, d.m_text);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* text_library.h :+: :+: :+: */
|
/* TextLibrary.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/10 11:52:30 by maldavid #+# #+# */
|
/* Created: 2023/04/10 11:52:30 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:08:03 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:26:10 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_TEXT_LIBRARY__
|
#ifndef __MLX_TEXT_LIBRARY__
|
||||||
#define __MLX_TEXT_LIBRARY__
|
#define __MLX_TEXT_LIBRARY__
|
||||||
|
|
||||||
#include <renderer/buffers/vk_vbo.h>
|
#include <Renderer/Buffers/VertexBuffer.h>
|
||||||
#include <renderer/buffers/vk_ibo.h>
|
#include <Renderer/Buffers/IndexBuffer.h>
|
||||||
#include <renderer/texts/font.h>
|
#include <Renderer/Texts/Font.h>
|
||||||
#include <renderer/core/render_core.h>
|
#include <Renderer/Core/RenderCore.h>
|
||||||
#include <utils/singleton.h>
|
#include <Utils/Singleton.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -29,19 +29,19 @@ namespace mlx
|
|||||||
friend class Singleton<TextLibrary>;
|
friend class Singleton<TextLibrary>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<class Text> getTextData(TextID id);
|
std::shared_ptr<class Text> GetTextData(TextID id);
|
||||||
TextID addTextToLibrary(std::shared_ptr<Text> text);
|
TextID AddTextToLibrary(std::shared_ptr<Text> text);
|
||||||
void removeTextFromLibrary(TextID id);
|
void RemoveTextFromLibrary(TextID id);
|
||||||
|
|
||||||
void clearLibrary();
|
void ClearLibrary();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TextLibrary() = default;
|
TextLibrary() = default;
|
||||||
~TextLibrary() = default;
|
~TextLibrary() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_map<TextID, std::shared_ptr<class Text>> _cache;
|
std::unordered_map<TextID, std::shared_ptr<class Text>> m_cache;
|
||||||
TextID _current_id = 1;
|
TextID m_current_id = 1;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* text_manager.h :+: :+: :+: */
|
/* TextManager.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/06 16:24:11 by maldavid #+# #+# */
|
/* Created: 2023/04/06 16:24:11 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/25 19:08:00 by maldavid ### ########.fr */
|
/* Updated: 2024/03/28 22:27:32 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_TEXT_MANAGER__
|
#ifndef __MLX_TEXT_MANAGER__
|
||||||
#define __MLX_TEXT_MANAGER__
|
#define __MLX_TEXT_MANAGER__
|
||||||
|
|
||||||
#include <renderer/renderer.h>
|
#include <Renderer/Renderer.h>
|
||||||
#include <renderer/images/texture_atlas.h>
|
#include <Renderer/Images/TextureAtlas.h>
|
||||||
#include <renderer/texts/text_descriptor.h>
|
#include <Renderer/Texts/TextDescriptor.h>
|
||||||
#include <renderer/texts/text_library.h>
|
#include <Renderer/Texts/TextLibrary.h>
|
||||||
#include <renderer/texts/font_library.h>
|
#include <Renderer/Texts/FontLibrary.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -26,17 +26,17 @@ namespace mlx
|
|||||||
public:
|
public:
|
||||||
TextManager() = default;
|
TextManager() = default;
|
||||||
|
|
||||||
void init(Renderer& renderer) noexcept;
|
void Init(Renderer& renderer) noexcept;
|
||||||
std::pair<DrawableResource*, bool> registerText(int x, int y, std::uint32_t color, std::string str);
|
std::pair<NonOwningPtr<DrawableResource>, bool> RegisterText(int x, int y, std::uint32_t color, std::string str);
|
||||||
inline void clear() { _text_descriptors.clear(); }
|
inline void Clear() { m_text_descriptors.clear(); }
|
||||||
void loadFont(Renderer& renderer, const std::filesystem::path& filepath, float scale);
|
void LoadFont(Renderer& renderer, const std::filesystem::path& filepath, float scale);
|
||||||
void destroy() noexcept;
|
void Destroy() noexcept;
|
||||||
|
|
||||||
~TextManager() = default;
|
~TextManager() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_set<TextDrawDescriptor> _text_descriptors;
|
std::unordered_set<TextDrawDescriptor> m_text_descriptors;
|
||||||
FontID _font_in_use = nullfont;
|
FontID m_font_in_use = nullfont;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/04 22:10:52 by maldavid #+# #+# */
|
/* Created: 2022/10/04 22:10:52 by maldavid #+# #+# */
|
||||||
/* Updated: 2024/03/27 17:43:18 by maldavid ### ########.fr */
|
/* Updated: 2024/04/02 17:06:34 by maldavid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -17,9 +17,7 @@
|
|||||||
#include <renderer/texts/font_library.h>
|
#include <renderer/texts/font_library.h>
|
||||||
#include <renderer/images/texture.h>
|
#include <renderer/images/texture.h>
|
||||||
#include <renderer/core/render_core.h>
|
#include <renderer/core/render_core.h>
|
||||||
#include <core/errors.h>
|
#include <Core/memory.h>
|
||||||
#include <mlx_profile.h>
|
|
||||||
#include <core/memory.h>
|
|
||||||
#include <Core/EventBus.h>
|
#include <Core/EventBus.h>
|
||||||
|
|
||||||
namespace mlx::core
|
namespace mlx::core
|
||||||
@@ -32,11 +30,6 @@ namespace mlx::core
|
|||||||
}, "__internal_application" });
|
}, "__internal_application" });
|
||||||
|
|
||||||
_fps.init();
|
_fps.init();
|
||||||
glfwSetErrorCallback([]([[maybe_unused]] int code, const char* desc)
|
|
||||||
{
|
|
||||||
error::report(e_kind::fatal_error, "GLFW error : %s", desc);
|
|
||||||
});
|
|
||||||
glfwInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::run() noexcept
|
void Application::run() noexcept
|
||||||
@@ -111,6 +104,5 @@ namespace mlx::core
|
|||||||
{
|
{
|
||||||
TextLibrary::get().clearLibrary();
|
TextLibrary::get().clearLibrary();
|
||||||
FontLibrary::get().clearLibrary();
|
FontLibrary::get().clearLibrary();
|
||||||
glfwTerminate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user