mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 14:43:34 +00:00
starting to fix compilation issues
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
Error("invalid image ptr (NULL)"); \
|
||||
retval; \
|
||||
} \
|
||||
else if(m_image_registry.Find(img)) \
|
||||
else if(!m_image_registry.IsTextureKnown(img)) \
|
||||
{ \
|
||||
Error("invalid image ptr"); \
|
||||
retval; \
|
||||
@@ -29,8 +29,8 @@ namespace mlx
|
||||
{
|
||||
void Application::GetMousePos(int* x, int* y) noexcept
|
||||
{
|
||||
*x = p_in->GetX();
|
||||
*y = p_in->GetY();
|
||||
*x = m_in.GetX();
|
||||
*y = m_in.GetY();
|
||||
}
|
||||
|
||||
void Application::MouseMove(Handle win, int x, int y) noexcept
|
||||
@@ -69,11 +69,7 @@ namespace mlx
|
||||
void* Application::NewGraphicsSuport(std::size_t w, std::size_t h, const char* title)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
auto it = std::find_if(m_textures.begin(), m_textures.end(), [=](const Texture& texture)
|
||||
{
|
||||
return &texture == reinterpret_cast<Texture*>(const_cast<char*>(title));
|
||||
});
|
||||
if(it != _textures.end())
|
||||
if(m_image_registry.IsTextureKnown(reinterpret_cast<Texture*>(const_cast<char*>(title))))
|
||||
m_graphics.emplace_back(std::make_unique<GraphicsSupport>(w, h, reinterpret_cast<Texture*>(const_cast<char*>(title)), m_graphics.size()));
|
||||
else
|
||||
{
|
||||
@@ -92,7 +88,7 @@ namespace mlx
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
CHECK_WINDOW_PTR(win);
|
||||
m_graphics[*static_cast<int*>(win)]->ClearRenderData();
|
||||
m_graphics[*static_cast<int*>(win)]->ResetRenderData();
|
||||
}
|
||||
|
||||
void Application::DestroyGraphicsSupport(Handle win)
|
||||
@@ -177,6 +173,6 @@ namespace mlx
|
||||
|
||||
void Application::LoopEnd() noexcept
|
||||
{
|
||||
p_in->Finish();
|
||||
m_in.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace mlx
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
p_scene->ResetSprites();
|
||||
m_images_registry.Clear();
|
||||
}
|
||||
|
||||
void GraphicsSupport::PixelPut(int x, int y, std::uint32_t color) noexcept
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace mlx
|
||||
std::shared_ptr<Texture> p_texture;
|
||||
std::shared_ptr<Mesh> p_mesh;
|
||||
Vec4f m_color = Vec4f{ 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
Vec3f m_position = Vec4f{ 0.0f, 0.0f, 0.0f };
|
||||
Vec3f m_position = Vec3f{ 0.0f, 0.0f, 0.0f };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#ifndef __SCOP_ANGLES__
|
||||
#define __SCOP_ANGLES__
|
||||
#ifndef __MLX_ANGLES__
|
||||
#define __MLX_ANGLES__
|
||||
|
||||
#include <Maths/Enums.h>
|
||||
#include <utility>
|
||||
#include <string>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T> struct EulerAngles;
|
||||
template<typename T> struct Quat;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
#pragma once
|
||||
#include <Maths/Angles.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
#include <Maths/Constants.h>
|
||||
#include <Maths/MathsUtils.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
namespace Internal
|
||||
{
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
#ifndef __SCOP_MATHS_CONSTANTS__
|
||||
#define __SCOP_MATHS_CONSTANTS__
|
||||
#ifndef __MLX_MATHS_CONSTANTS__
|
||||
#define __MLX_MATHS_CONSTANTS__
|
||||
|
||||
#include <climits>
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T> constexpr std::size_t BitCount = CHAR_BIT * sizeof(T);
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef __SCOPE_MATHS_ENUMS__
|
||||
#define __SCOPE_MATHS_ENUMS__
|
||||
#ifndef __MLX_MATHS_ENUMS__
|
||||
#define __MLX_MATHS_ENUMS__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
enum class AngleUnit
|
||||
{
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#ifndef __SCOP_EULER_ANGLES__
|
||||
#define __SCOP_EULER_ANGLES__
|
||||
|
||||
#include <string>
|
||||
#ifndef __MLX_EULER_ANGLES__
|
||||
#define __MLX_EULER_ANGLES__
|
||||
|
||||
#include <Maths/Angles.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T>
|
||||
struct EulerAngles
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <Maths/EulerAngles.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T>
|
||||
constexpr EulerAngles<T>::EulerAngles(DegreeAngle<T> P, DegreeAngle<T> Y, DegreeAngle<T> R) :
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
#ifndef __SCOP_MAT4__
|
||||
#define __SCOP_MAT4__
|
||||
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#ifndef __MLX_MAT4__
|
||||
#define __MLX_MAT4__
|
||||
|
||||
#include <Maths/Angles.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T> struct Vec2;
|
||||
template<typename T> struct Vec3;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include <Maths/Mat4.h>
|
||||
|
||||
#include <Core/Logs.h>
|
||||
#include <Maths/EulerAngles.h>
|
||||
#include <Maths/Quaternions.h>
|
||||
#include <Maths/Vec2.h>
|
||||
@@ -9,10 +8,7 @@
|
||||
#include <Maths/Vec4.h>
|
||||
#include <Maths/MathsUtils.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T>
|
||||
constexpr Mat4<T>::Mat4(T r11, T r12, T r13, T r14,
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef __SCOP_MATHS_UTILS__
|
||||
#define __SCOP_MATHS_UTILS__
|
||||
#ifndef __MLX_MATHS_UTILS__
|
||||
#define __MLX_MATHS_UTILS__
|
||||
|
||||
#include <concepts>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T>
|
||||
[[nodiscard]] constexpr T Mod(T x, T y) noexcept;
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#pragma once
|
||||
#include <Maths/MathsUtils.h>
|
||||
|
||||
#include <type_traits>
|
||||
#include <cmath>
|
||||
|
||||
#include <Maths/Constants.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T>
|
||||
[[nodiscard]] constexpr T Mod(T x, T y) noexcept
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef __SCOP_QUATERNIONS__
|
||||
#define __SCOP_QUATERNIONS__
|
||||
#ifndef __MLX_QUATERNIONS__
|
||||
#define __MLX_QUATERNIONS__
|
||||
|
||||
#include <Maths/Angles.h>
|
||||
#include <Maths/Vec3.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T>
|
||||
struct Quat
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <Maths/Quaternions.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T>
|
||||
constexpr Quat<T>::Quat(T W, T X, T Y, T Z) : w(W), x(X), y(Y), z(Z)
|
||||
@@ -46,7 +46,7 @@ namespace Scop
|
||||
RadianAngle<T> Quat<T>::AngleBetween(const Quat& quat) const
|
||||
{
|
||||
T alpha = Vec3<T>::DotProduct(Vec3<T>(x, y, z), Vec3<T>(quat.x, quat.y, quat.z));
|
||||
return std::acos(Scop::Clamp(alpha, T(-1.0), T(1.0)));
|
||||
return std::acos(mlx::Clamp(alpha, T(-1.0), T(1.0)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -366,10 +366,10 @@ namespace Scop
|
||||
constexpr Quat<T> Quat<T>::Lerp(const Quat& from, const Quat& to, T interpolation)
|
||||
{
|
||||
Quat interpolated;
|
||||
interpolated.w = Scop::Lerp(from.w, to.w, interpolation);
|
||||
interpolated.x = Scop::Lerp(from.x, to.x, interpolation);
|
||||
interpolated.y = Scop::Lerp(from.y, to.y, interpolation);
|
||||
interpolated.z = Scop::Lerp(from.z, to.z, interpolation);
|
||||
interpolated.w = mlx::Lerp(from.w, to.w, interpolation);
|
||||
interpolated.x = mlx::Lerp(from.x, to.x, interpolation);
|
||||
interpolated.y = mlx::Lerp(from.y, to.y, interpolation);
|
||||
interpolated.z = mlx::Lerp(from.z, to.z, interpolation);
|
||||
|
||||
return interpolated;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
#ifndef __SCOP_VEC2__
|
||||
#define __SCOP_VEC2__
|
||||
#ifndef __MLX_VEC2__
|
||||
#define __MLX_VEC2__
|
||||
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#include <cstdint>
|
||||
#include <cmath>
|
||||
|
||||
#include <Core/Logs.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template <typename T> class Vec3;
|
||||
template <typename T> class Vec4;
|
||||
template <typename T> struct Vec3;
|
||||
template <typename T> struct Vec4;
|
||||
|
||||
template <typename T>
|
||||
struct Vec2
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Maths/Vec2.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T>
|
||||
constexpr Vec2<T>::Vec2(T X, T Y) : x(X), y(Y) {}
|
||||
@@ -116,14 +115,14 @@ namespace Scop
|
||||
template<typename T>
|
||||
constexpr T& Vec2<T>::operator[](std::size_t i)
|
||||
{
|
||||
Scop::Assert(i < 2, "index out of range");
|
||||
mlx::Assert(i < 2, "index out of range");
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr T Vec2<T>::operator[](std::size_t i) const
|
||||
{
|
||||
Scop::Assert(i < 2, "index out of range");
|
||||
mlx::Assert(i < 2, "index out of range");
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
#ifndef __SCOP_VEC3__
|
||||
#define __SCOP_VEC3__
|
||||
#ifndef __MLX_VEC3__
|
||||
#define __MLX_VEC3__
|
||||
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#include <cstdint>
|
||||
#include <cmath>
|
||||
|
||||
#include <Core/Logs.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T> class Vec2;
|
||||
template<typename T> class Vec4;
|
||||
template<typename T> struct Vec2;
|
||||
template<typename T> struct Vec4;
|
||||
|
||||
template<typename T>
|
||||
struct Vec3
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Maths/Vec3.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T>
|
||||
constexpr Vec3<T>::Vec3(T X, T Y, T Z) : x(X), y(Y), z(Z) {}
|
||||
@@ -145,14 +144,14 @@ namespace Scop
|
||||
template<typename T>
|
||||
constexpr T& Vec3<T>::operator[](std::size_t i)
|
||||
{
|
||||
Scop::Assert(i < 3, "index out of range");
|
||||
mlx::Assert(i < 3, "index out of range");
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr const T& Vec3<T>::operator[](std::size_t i) const
|
||||
{
|
||||
Scop::Assert(i < 3, "index out of range");
|
||||
mlx::Assert(i < 3, "index out of range");
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
#ifndef __SCOP_VEC4__
|
||||
#define __SCOP_VEC4__
|
||||
#ifndef __MLX_VEC4__
|
||||
#define __MLX_VEC4__
|
||||
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#include <cstdint>
|
||||
#include <cmath>
|
||||
|
||||
#include <Core/Logs.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T> class Vec2;
|
||||
template<typename T> class Vec3;
|
||||
template<typename T> struct Vec2;
|
||||
template<typename T> struct Vec3;
|
||||
|
||||
template<typename T>
|
||||
struct Vec4
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Maths/Vec4.h>
|
||||
|
||||
namespace Scop
|
||||
namespace mlx
|
||||
{
|
||||
template<typename T>
|
||||
constexpr Vec4<T>::Vec4(T X, T Y, T Z, T W) : x(X), y(Y), z(Z), w(W) {}
|
||||
@@ -120,14 +119,14 @@ namespace Scop
|
||||
template<typename T>
|
||||
constexpr T& Vec4<T>::operator[](std::size_t i)
|
||||
{
|
||||
Scop::Assert(i < 4, "index out of range");
|
||||
mlx::Assert(i < 4, "index out of range");
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr const T& Vec4<T>::operator[](std::size_t i) const
|
||||
{
|
||||
Scop::Assert(i < 4, "index out of range");
|
||||
mlx::Assert(i < 4, "index out of range");
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define __MLX_WINDOW__
|
||||
|
||||
#include <Maths/Vec2.h>
|
||||
#include <Core/SDLManager.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#define Window X11Window // f*ck X11
|
||||
|
||||
#include <mlx_profile.h>
|
||||
#include <mlx.h>
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
#include <iostream>
|
||||
@@ -38,6 +39,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <random>
|
||||
#include <concepts>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
@@ -19,11 +19,11 @@ namespace mlx
|
||||
|
||||
void Swap(GPUBuffer& buffer) noexcept;
|
||||
|
||||
[[nodiscard]] MLX_FORCEINLINE void* GetMap() const noexcept { return m_memory.map; }
|
||||
[[nodiscard]] MLX_FORCEINLINE void* GetMap() const noexcept { return p_map; }
|
||||
[[nodiscard]] MLX_FORCEINLINE VkBuffer Get() const noexcept { return m_buffer; }
|
||||
[[nodiscard]] MLX_FORCEINLINE VkDeviceMemory GetMemory() const noexcept { return m_memory.memory; }
|
||||
[[nodiscard]] MLX_FORCEINLINE VkDeviceSize GetSize() const noexcept { return m_memory.size; }
|
||||
[[nodiscard]] MLX_FORCEINLINE VkDeviceSize GetOffset() const noexcept { return 0; }
|
||||
[[nodiscard]] MLX_FORCEINLINE VmaAllocation GetAllocation() const noexcept { return m_allocation; }
|
||||
[[nodiscard]] MLX_FORCEINLINE VkDeviceSize GetSize() const noexcept { return m_size; }
|
||||
[[nodiscard]] MLX_FORCEINLINE VkDeviceSize GetOffset() const noexcept { return m_offset; }
|
||||
|
||||
[[nodiscard]] inline bool IsInit() const noexcept { return m_buffer != VK_NULL_HANDLE; }
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace mlx
|
||||
virtual void Destroy() noexcept;
|
||||
|
||||
[[nodiscard]] MLX_FORCEINLINE VkImage Get() const noexcept { return m_image; }
|
||||
[[nodiscard]] MLX_FORCEINLINE VkDeviceMemory GetDeviceMemory() const noexcept { return m_memory.memory; }
|
||||
[[nodiscard]] MLX_FORCEINLINE VmaAllocation GetAllocation() const noexcept { return m_allocation; }
|
||||
[[nodiscard]] MLX_FORCEINLINE VkImageView GetImageView() const noexcept { return m_image_view; }
|
||||
[[nodiscard]] MLX_FORCEINLINE VkFormat GetFormat() const noexcept { return m_format; }
|
||||
[[nodiscard]] MLX_FORCEINLINE VkImageTiling GetTiling() const noexcept { return m_tiling; }
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace mlx
|
||||
[[nodiscard]] inline std::size_t& GetPolygonDrawnCounterRef() noexcept { return m_polygons_drawn; }
|
||||
[[nodiscard]] inline std::size_t GetSwapchainImageIndex() const noexcept { return m_swapchain_image_index; }
|
||||
[[nodiscard]] inline std::size_t GetCurrentFrameIndex() const noexcept { return m_current_frame_index; }
|
||||
[[nodiscard]] inline NonOwningPtr<Window> GetWindow() const noexcept { return m_window_ptr; }
|
||||
[[nodiscard]] inline NonOwningPtr<Window> GetWindow() const noexcept { return p_window; }
|
||||
|
||||
MLX_FORCEINLINE constexpr void RequireFramebufferResize() noexcept { m_framebuffers_resize = true; }
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace mlx
|
||||
|
||||
std::array<VkVertexInputAttributeDescription, 2> Vertex::GetAttributeDescriptions()
|
||||
{
|
||||
std::array<VkVertexInputAttributeDescription, 3> attribute_descriptions;
|
||||
std::array<VkVertexInputAttributeDescription, 2> attribute_descriptions;
|
||||
|
||||
attribute_descriptions[0].binding = 0;
|
||||
attribute_descriptions[0].location = 0;
|
||||
|
||||
Reference in New Issue
Block a user