From 7488b0f28667db2a98faecea8ffcb73ac729818f Mon Sep 17 00:00:00 2001 From: Francisco Miguel Almeida Date: Sat, 13 Jun 2026 11:08:21 +0200 Subject: [PATCH 1/7] vector types: remove superfluous non const swizzle overloads --- engine/native/core/math/types_common.cppm | 9 --------- engine/native/core/math/vector2.cppm | 24 ----------------------- engine/native/core/math/vector3.cppm | 24 ----------------------- engine/native/core/math/vector4.cppm | 24 ----------------------- 4 files changed, 81 deletions(-) diff --git a/engine/native/core/math/types_common.cppm b/engine/native/core/math/types_common.cppm index 089faa2a..fe0f01f2 100644 --- a/engine/native/core/math/types_common.cppm +++ b/engine/native/core/math/types_common.cppm @@ -27,11 +27,8 @@ export namespace draco::math { [[nodiscard]] constexpr const f32& operator[](i32 i) const noexcept; // swizzle - [[nodiscard]] constexpr Vector2 operator[](i32 i0, i32 i1) noexcept; [[nodiscard]] constexpr Vector2 operator[](i32 i0, i32 i1) const noexcept; - [[nodiscard]] constexpr Vector3 operator[](i32 i0, i32 i1, i32 i2) noexcept; [[nodiscard]] constexpr Vector3 operator[](i32 i0, i32 i1, i32 i2) const noexcept; - [[nodiscard]] constexpr Vector4 operator[](i32 i0, i32 i1, i32 i2, i32 i3) noexcept; [[nodiscard]] constexpr Vector4 operator[](i32 i0, i32 i1, i32 i2, i32 i3) const noexcept; // operators @@ -72,11 +69,8 @@ export namespace draco::math { [[nodiscard]] constexpr const f32& operator[](i32 i) const noexcept; // swizzle - [[nodiscard]] constexpr Vector2 operator[](i32 i0, i32 i1) noexcept; [[nodiscard]] constexpr Vector2 operator[](i32 i0, i32 i1) const noexcept; - [[nodiscard]] constexpr Vector3 operator[](i32 i0, i32 i1, i32 i2) noexcept; [[nodiscard]] constexpr Vector3 operator[](i32 i0, i32 i1, i32 i2) const noexcept; - [[nodiscard]] constexpr Vector4 operator[](i32 i0, i32 i1, i32 i2, i32 i3) noexcept; [[nodiscard]] constexpr Vector4 operator[](i32 i0, i32 i1, i32 i2, i32 i3) const noexcept; // operators @@ -120,11 +114,8 @@ export namespace draco::math { [[nodiscard]] constexpr const f32& operator[](i32 i) const noexcept; // swizzle - [[nodiscard]] constexpr Vector2 operator[](i32 i0, i32 i1) noexcept; [[nodiscard]] constexpr Vector2 operator[](i32 i0, i32 i1) const noexcept; - [[nodiscard]] constexpr Vector3 operator[](i32 i0, i32 i1, i32 i2) noexcept; [[nodiscard]] constexpr Vector3 operator[](i32 i0, i32 i1, i32 i2) const noexcept; - [[nodiscard]] constexpr Vector4 operator[](i32 i0, i32 i1, i32 i2, i32 i3) noexcept; [[nodiscard]] constexpr Vector4 operator[](i32 i0, i32 i1, i32 i2, i32 i3) const noexcept; // member operators diff --git a/engine/native/core/math/vector2.cppm b/engine/native/core/math/vector2.cppm index a20b6e3a..83ed3c9a 100644 --- a/engine/native/core/math/vector2.cppm +++ b/engine/native/core/math/vector2.cppm @@ -70,14 +70,6 @@ export namespace draco::math { } // swizzle - [[nodiscard]] constexpr Vector2 Vector2::operator[](const i32 i0, const i32 i1) noexcept { - if consteval { - return { select(i0, x, y), select(i1, x, y) }; - } else { - return { (&x)[i0], (&x)[i1] }; - } - } - [[nodiscard]] constexpr Vector2 Vector2::operator[](const i32 i0, const i32 i1) const noexcept { if consteval { return { select(i0, x, y), select(i1, x, y) }; @@ -86,14 +78,6 @@ export namespace draco::math { } } - [[nodiscard]] constexpr Vector3 Vector2::operator[](const i32 i0, const i32 i1, const i32 i2) noexcept { - if consteval { - return { select(i0, x, y), select(i1, x, y), select(i2, x, y) }; - } else { - return { (&x)[i0], (&x)[i1], (&x)[i2] }; - } - } - [[nodiscard]] constexpr Vector3 Vector2::operator[](const i32 i0, const i32 i1, const i32 i2) const noexcept { if consteval { return { select(i0, x, y), select(i1, x, y), select(i2, x, y) }; @@ -102,14 +86,6 @@ export namespace draco::math { } } - [[nodiscard]] constexpr Vector4 Vector2::operator[](const i32 i0, const i32 i1, const i32 i2, const i32 i3) noexcept { - if consteval { - return { select(i0, x, y), select(i1, x, y), select(i2, x, y), select(i3, x, y) }; - } else { - return { (&x)[i0], (&x)[i1], (&x)[i2], (&x)[i3] }; - } - } - [[nodiscard]] constexpr Vector4 Vector2::operator[](const i32 i0, const i32 i1, const i32 i2, const i32 i3) const noexcept { if consteval { return { select(i0, x, y), select(i1, x, y), select(i2, x, y), select(i3, x, y) }; diff --git a/engine/native/core/math/vector3.cppm b/engine/native/core/math/vector3.cppm index 05240c01..a827d08f 100644 --- a/engine/native/core/math/vector3.cppm +++ b/engine/native/core/math/vector3.cppm @@ -88,14 +88,6 @@ export namespace draco::math { } // swizzle - [[nodiscard]] constexpr Vector2 Vector3::operator[](const i32 i0, const i32 i1) noexcept { - if consteval { - return { select(i0, x, y, z), select(i1, x, y, z) }; - } else { - return { (&x)[i0], (&x)[i1] }; - } - } - [[nodiscard]] constexpr Vector2 Vector3::operator[](const i32 i0, const i32 i1) const noexcept { if consteval { return { select(i0, x, y, z), select(i1, x, y, z) }; @@ -104,14 +96,6 @@ export namespace draco::math { } } - [[nodiscard]] constexpr Vector3 Vector3::operator[](const i32 i0, const i32 i1, const i32 i2) noexcept { - if consteval { - return { select(i0, x, y, z), select(i1, x, y, z), select(i2, x, y, z) }; - } else { - return { (&x)[i0], (&x)[i1], (&x)[i2] }; - } - } - [[nodiscard]] constexpr Vector3 Vector3::operator[](const i32 i0, const i32 i1, const i32 i2) const noexcept { if consteval { return { select(i0, x, y, z), select(i1, x, y, z), select(i2, x, y, z) }; @@ -120,14 +104,6 @@ export namespace draco::math { } } - [[nodiscard]] constexpr Vector4 Vector3::operator[](const i32 i0, const i32 i1, const i32 i2, const i32 i3) noexcept { - if consteval { - return { select(i0, x, y, z), select(i1, x, y, z), select(i2, x, y, z), select(i3, x, y, z) }; - } else { - return { (&x)[i0], (&x)[i1], (&x)[i2], (&x)[i3] }; - } - } - [[nodiscard]] constexpr Vector4 Vector3::operator[](const i32 i0, const i32 i1, const i32 i2, const i32 i3) const noexcept { if consteval { return { select(i0, x, y, z), select(i1, x, y, z), select(i2, x, y, z), select(i3, x, y, z) }; diff --git a/engine/native/core/math/vector4.cppm b/engine/native/core/math/vector4.cppm index d2ddcd40..433ace02 100644 --- a/engine/native/core/math/vector4.cppm +++ b/engine/native/core/math/vector4.cppm @@ -97,14 +97,6 @@ export namespace draco::math { } // swizzle - [[nodiscard]] constexpr Vector2 Vector4::operator[](const i32 i0, const i32 i1) noexcept { - if consteval { - return { select(i0, x, y, z, w), select(i1, x, y, z, w) }; - } else { - return { (&x)[i0], (&x)[i1] }; - } - } - [[nodiscard]] constexpr Vector2 Vector4::operator[](const i32 i0, const i32 i1) const noexcept { if consteval { return { select(i0, x, y, z, w), select(i1, x, y, z, w) }; @@ -113,14 +105,6 @@ export namespace draco::math { } } - [[nodiscard]] constexpr Vector3 Vector4::operator[](const i32 i0, const i32 i1, const i32 i2) noexcept { - if consteval { - return { select(i0, x, y, z, w), select(i1, x, y, z, w), select(i2, x, y, z, w) }; - } else { - return { (&x)[i0], (&x)[i1], (&x)[i2] }; - } - } - [[nodiscard]] constexpr Vector3 Vector4::operator[](const i32 i0, const i32 i1, const i32 i2) const noexcept { if consteval { return { select(i0, x, y, z, w), select(i1, x, y, z, w), select(i2, x, y, z, w) }; @@ -129,14 +113,6 @@ export namespace draco::math { } } - [[nodiscard]] constexpr Vector4 Vector4::operator[](const i32 i0, const i32 i1, const i32 i2, const i32 i3) noexcept { - if consteval { - return { select(i0, x, y, z, w), select(i1, x, y, z, w), select(i2, x, y, z, w), select(i3, x, y, z, w) }; - } else { - return { (&x)[i0], (&x)[i1], (&x)[i2], (&x)[i3] }; - } - } - [[nodiscard]] constexpr Vector4 Vector4::operator[](const i32 i0, const i32 i1, const i32 i2, const i32 i3) const noexcept { if consteval { return { select(i0, x, y, z, w), select(i1, x, y, z, w), select(i2, x, y, z, w), select(i3, x, y, z, w) }; From 21da55f3c9cbb4f9c8adcddf60083a86dd80de64 Mon Sep 17 00:00:00 2001 From: Francisco Miguel Almeida Date: Sat, 13 Jun 2026 11:30:39 +0200 Subject: [PATCH 2/7] Vector types: non-const select --- engine/native/core/math/types_common.cppm | 39 +++++++++++++++++++++-- engine/native/core/math/vector2.cppm | 4 +-- engine/native/core/math/vector3.cppm | 14 ++------ engine/native/core/math/vector4.cppm | 16 ++-------- 4 files changed, 42 insertions(+), 31 deletions(-) diff --git a/engine/native/core/math/types_common.cppm b/engine/native/core/math/types_common.cppm index fe0f01f2..e46b36bb 100644 --- a/engine/native/core/math/types_common.cppm +++ b/engine/native/core/math/types_common.cppm @@ -134,7 +134,8 @@ export namespace draco::math { }; } -template consteval T select(const draco::i32 i, const T v1, const T v2) { +template +consteval const T& select(const draco::i32 i, const T& v1, const T& v2) { switch (i) { case 0: return v1; case 1: return v2; @@ -142,16 +143,48 @@ template consteval T select(const draco::i32 i, const T v1, const T } } -template consteval T select(const draco::i32 i, const T v1, const T v2, const T v3) { +template +consteval T& select(const draco::i32 i, T& v1, T& v2) { + switch (i) { + case 0: return v1; + case 1: return v2; + default: throw "Index out of range"; + } +} + +template +consteval const T& select(const draco::i32 i, const T& v1, const T& v2, const T& v3) { + switch (i) { + case 0: return v1; + case 1: return v2; + case 2: return v3; + default: throw "Index out of range"; + } +} + +template +consteval T& select(const draco::i32 i, T& v1, T& v2, T& v3) { + switch (i) { + case 0: return v1; + case 1: return v2; + case 2: return v3; + default: throw "Index out of range"; + } +} + +template +consteval const T& select(const draco::i32 i, const T& v1, const T& v2, const T& v3, const T& v4) { switch (i) { case 0: return v1; case 1: return v2; case 2: return v3; + case 3: return v4; default: throw "Index out of range"; } } -template consteval T select(const draco::i32 i, const T v1, const T v2, const T v3, const T v4) { +template +consteval T& select(const draco::i32 i, T& v1, T& v2, T& v3, T& v4) { switch (i) { case 0: return v1; case 1: return v2; diff --git a/engine/native/core/math/vector2.cppm b/engine/native/core/math/vector2.cppm index 83ed3c9a..31e594e5 100644 --- a/engine/native/core/math/vector2.cppm +++ b/engine/native/core/math/vector2.cppm @@ -55,7 +55,7 @@ export namespace draco::math { // element access [[nodiscard]] constexpr f32& Vector2::operator[](const i32 i) noexcept { if consteval { - return i ? y : x; + return select(i, x, y); } else { return (&x)[i]; } @@ -63,7 +63,7 @@ export namespace draco::math { [[nodiscard]] constexpr const f32& Vector2::operator[](const i32 i) const noexcept { if consteval { - return i ? y : x; + return select(i, x, y); } else { return (&x)[i]; } diff --git a/engine/native/core/math/vector3.cppm b/engine/native/core/math/vector3.cppm index a827d08f..abe013e2 100644 --- a/engine/native/core/math/vector3.cppm +++ b/engine/native/core/math/vector3.cppm @@ -67,23 +67,13 @@ export namespace draco::math { // element access [[nodiscard]] constexpr f32& Vector3::operator[](const i32 i) noexcept { if consteval { - switch (i) { - case 0: return x; - case 1: return y; - default: - case 2: return z; - } + return select(i, x, y, z); } else { return (&x)[i]; } } [[nodiscard]] constexpr const f32& Vector3::operator[](const i32 i) const noexcept { if consteval { - switch (i) { - case 0: return x; - case 1: return y; - default: - case 2: return z; - } + return select(i, x, y, z); } else { return (&x)[i]; } } diff --git a/engine/native/core/math/vector4.cppm b/engine/native/core/math/vector4.cppm index 433ace02..6e40ced4 100644 --- a/engine/native/core/math/vector4.cppm +++ b/engine/native/core/math/vector4.cppm @@ -74,25 +74,13 @@ export namespace draco::math { // element access [[nodiscard]] constexpr f32& Vector4::operator[](const i32 i) noexcept { if consteval { - switch (i) { - case 0: return x; - case 1: return y; - case 2: return z; - default: - case 3: return w; - } + return select(i, x, y, z, w); } else { return (&x)[i]; } } [[nodiscard]] constexpr const f32& Vector4::operator[](const i32 i) const noexcept { if consteval { - switch (i) { - case 0: return x; - case 1: return y; - case 2: return z; - default: - case 3: return w; - } + return select(i, x, y, z, w); } else { return (&x)[i]; } } From 01b1e820baf4c036fc4ae5b5228fc536fe50154c Mon Sep 17 00:00:00 2001 From: Francisco Miguel Almeida Date: Sat, 13 Jun 2026 11:43:25 +0200 Subject: [PATCH 3/7] clean up math includes and imports --- engine/native/core/math/math.cppm | 3 +-- engine/native/core/math/types_common.cppm | 1 - engine/native/core/math/vector2.cppm | 8 -------- engine/native/core/math/vector3.cppm | 8 -------- engine/native/core/math/vector4.cppm | 8 -------- 5 files changed, 1 insertion(+), 27 deletions(-) diff --git a/engine/native/core/math/math.cppm b/engine/native/core/math/math.cppm index 9aedc64b..bf983a28 100644 --- a/engine/native/core/math/math.cppm +++ b/engine/native/core/math/math.cppm @@ -1,8 +1,7 @@ export module core.math; +export import core.defs; export import core.math.constants; export import core.math.functions; export import core.math.types; -export import core.defs; -export import core.stdtypes; export import core.math.transform; diff --git a/engine/native/core/math/types_common.cppm b/engine/native/core/math/types_common.cppm index e46b36bb..4de2e55e 100644 --- a/engine/native/core/math/types_common.cppm +++ b/engine/native/core/math/types_common.cppm @@ -1,6 +1,5 @@ export module core.math.types:common; import core.defs; -import core.stdtypes; export namespace draco::math { struct Vector2; diff --git a/engine/native/core/math/vector2.cppm b/engine/native/core/math/vector2.cppm index 31e594e5..fd0e1e31 100644 --- a/engine/native/core/math/vector2.cppm +++ b/engine/native/core/math/vector2.cppm @@ -1,15 +1,7 @@ module; #include -#include #include -#include "platform/simd.h" - -#if ARCH_X64 - #include -#elif ARCH_ARM64 - #include -#endif export module core.math.types:vector2; export import :common; diff --git a/engine/native/core/math/vector3.cppm b/engine/native/core/math/vector3.cppm index abe013e2..fe8e8a2f 100644 --- a/engine/native/core/math/vector3.cppm +++ b/engine/native/core/math/vector3.cppm @@ -1,15 +1,7 @@ module; #include -#include #include -#include "platform/simd.h" - -#if ARCH_X64 - #include -#elif ARCH_ARM64 - #include -#endif export module core.math.types:vector3; export import :common; diff --git a/engine/native/core/math/vector4.cppm b/engine/native/core/math/vector4.cppm index 6e40ced4..850daef1 100644 --- a/engine/native/core/math/vector4.cppm +++ b/engine/native/core/math/vector4.cppm @@ -1,15 +1,7 @@ module; #include -#include #include -#include "platform/simd.h" - -#if ARCH_X64 - #include -#elif ARCH_ARM64 - #include -#endif export module core.math.types:vector4; export import :common; From 3ee25d0690ed1e14961b25936470c7ad1a5561a7 Mon Sep 17 00:00:00 2001 From: Francisco Miguel Almeida Date: Sat, 13 Jun 2026 11:56:54 +0200 Subject: [PATCH 4/7] new doctest header, containing the extra macros and STATIC_REQUIRE (from Catch2) --- engine/native/core/math/math.test.cpp | 31 +------------- .../native/core/memory/bumpAllocator.test.cpp | 3 +- .../core/memory/fixedAllocator.test.cpp | 3 +- .../core/memory/trackingAllocator.test.cpp | 3 +- .../thirdparty/doctest/doctest_with_main.h | 42 +++++++++++++++++++ 5 files changed, 46 insertions(+), 36 deletions(-) create mode 100644 engine/native/thirdparty/doctest/doctest_with_main.h diff --git a/engine/native/core/math/math.test.cpp b/engine/native/core/math/math.test.cpp index 2424f921..039d37cc 100644 --- a/engine/native/core/math/math.test.cpp +++ b/engine/native/core/math/math.test.cpp @@ -1,33 +1,4 @@ -#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN -#include -#include - -#define R_CHECK_EQ(L_expr, R_expr) { \ - const auto L_run = (L_expr); \ - const auto R_run = (R_expr); \ - static_assert(std::is_same_v); \ - CHECK_EQ(L_run, R_run); \ -} - -#define RAC_CHECK_EQ(L_expr, R_expr) { \ - static constexpr auto L_comp = (L_expr); \ - static constexpr auto R_comp = (R_expr); \ - static_assert(std::is_same_v); \ - static_assert(L_comp == R_comp); \ - R_CHECK_EQ(L_expr, R_expr); \ -} - -#define BASIC_R_SUBCASE(name, L_expr, R_expr) \ - SUBCASE(name) { R_CHECK_EQ(L_expr, R_expr); } - -#define BASIC_R_SUBCASE_2(name, L_expr1, R_expr1, L_expr2, R_expr2) \ - SUBCASE(name) { R_CHECK_EQ(L_expr1, R_expr1); R_CHECK_EQ(L_expr2, R_expr2); } - -#define BASIC_RAC_SUBCASE(name, L_expr, R_expr) \ - SUBCASE(name) { RAC_CHECK_EQ(L_expr, R_expr); } - -#define BASIC_RAC_SUBCASE_2(name, L_expr1, R_expr1, L_expr2, R_expr2) \ - SUBCASE(name) { RAC_CHECK_EQ(L_expr1, R_expr1); RAC_CHECK_EQ(L_expr2, R_expr2); } +#include import core.math; diff --git a/engine/native/core/memory/bumpAllocator.test.cpp b/engine/native/core/memory/bumpAllocator.test.cpp index fded289d..60c434d9 100644 --- a/engine/native/core/memory/bumpAllocator.test.cpp +++ b/engine/native/core/memory/bumpAllocator.test.cpp @@ -1,5 +1,4 @@ -#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN -#include +#include import core.memory; import core.stdtypes; diff --git a/engine/native/core/memory/fixedAllocator.test.cpp b/engine/native/core/memory/fixedAllocator.test.cpp index 83766123..6a7cc3bf 100644 --- a/engine/native/core/memory/fixedAllocator.test.cpp +++ b/engine/native/core/memory/fixedAllocator.test.cpp @@ -1,5 +1,4 @@ -#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN -#include +#include import core.memory; import core.stdtypes; diff --git a/engine/native/core/memory/trackingAllocator.test.cpp b/engine/native/core/memory/trackingAllocator.test.cpp index 2a1ece42..ef10f7be 100644 --- a/engine/native/core/memory/trackingAllocator.test.cpp +++ b/engine/native/core/memory/trackingAllocator.test.cpp @@ -1,5 +1,4 @@ -#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN -#include +#include import core.memory; import core.memory.slice; diff --git a/engine/native/thirdparty/doctest/doctest_with_main.h b/engine/native/thirdparty/doctest/doctest_with_main.h new file mode 100644 index 00000000..5c27df32 --- /dev/null +++ b/engine/native/thirdparty/doctest/doctest_with_main.h @@ -0,0 +1,42 @@ +#pragma once + +#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +#include +#include + +#define STATIC_REQUIRE(expr) { \ +static_assert(expr); \ +REQUIRE(expr); \ +} + +#define STATIC_REQUIRE_FALSE(expr) { \ +static_assert(!(expr)); \ +REQUIRE_FALSE(expr); \ +} + +#define R_CHECK_EQ(L_expr, R_expr) { \ +const auto L_run = (L_expr); \ +const auto R_run = (R_expr); \ +static_assert(std::is_same_v); \ +CHECK_EQ(L_run, R_run); \ +} + +#define RAC_CHECK_EQ(L_expr, R_expr) { \ +static constexpr auto L_comp = (L_expr); \ +static constexpr auto R_comp = (R_expr); \ +static_assert(std::is_same_v); \ +static_assert(L_comp == R_comp); \ +R_CHECK_EQ(L_expr, R_expr); \ +} + +#define BASIC_R_SUBCASE(name, L_expr, R_expr) \ +SUBCASE(name) { R_CHECK_EQ(L_expr, R_expr); } + +#define BASIC_R_SUBCASE_2(name, L_expr1, R_expr1, L_expr2, R_expr2) \ +SUBCASE(name) { R_CHECK_EQ(L_expr1, R_expr1); R_CHECK_EQ(L_expr2, R_expr2); } + +#define BASIC_RAC_SUBCASE(name, L_expr, R_expr) \ +SUBCASE(name) { RAC_CHECK_EQ(L_expr, R_expr); } + +#define BASIC_RAC_SUBCASE_2(name, L_expr1, R_expr1, L_expr2, R_expr2) \ +SUBCASE(name) { RAC_CHECK_EQ(L_expr1, R_expr1); RAC_CHECK_EQ(L_expr2, R_expr2); } From f0353b6c9caf58126fc69a415ecdb6ae8d002a8a Mon Sep 17 00:00:00 2001 From: Francisco Miguel Almeida Date: Mon, 15 Jun 2026 01:33:47 +0200 Subject: [PATCH 5/7] Rearrange project structure --- .gitmodules | 16 +- CMakeLists.txt | 42 +- .../assets}/draconic_logo_no_text.png | Bin .../assets}/draconic_logo_no_text.svg | 0 .../assets}/draconic_logo_text.png | Bin {docs => Docs}/cxxmodules.md | 0 {docs => Docs}/index.md | 0 Editor/Editor.cs | 1 + Engine/cpp/CMakeLists.txt | 6 + Engine/cpp/DraconicAPI.h | 15 + .../cpp/runtime}/CMakeLists.txt | 2 - .../cpp/runtime}/core/CMakeLists.txt | 0 .../cpp/runtime}/core/core.cppm | 0 .../core/definitions/definitions.cppm | 0 .../runtime}/core/definitions/stdtypes.cppm | 0 .../runtime}/core/definitions/version.cppm | 0 .../cpp/runtime}/core/io/filesystem.cpp | 0 .../cpp/runtime}/core/io/filesystem.cppm | 0 .../cpp/runtime}/core/io/image_loader.cpp | 0 .../cpp/runtime}/core/io/image_loader.cppm | 3 +- .../cpp/runtime}/core/io/io.cppm | 0 .../cpp/runtime}/core/math/constants.cppm | 0 .../cpp/runtime}/core/math/functions.cppm | 0 .../cpp/runtime}/core/math/math.cppm | 0 .../cpp/runtime}/core/math/math.test.cpp | 362 +++++++++--------- Engine/cpp/runtime/core/math/transform.cpp | 38 ++ Engine/cpp/runtime/core/math/transform.cppm | 70 ++++ .../cpp/runtime}/core/math/types.cppm | 0 .../cpp/runtime}/core/math/types_common.cppm | 0 .../cpp/runtime}/core/math/vector2.cppm | 0 .../cpp/runtime}/core/math/vector3.cppm | 0 .../cpp/runtime}/core/math/vector4.cppm | 0 .../cpp/runtime}/core/memory/allocator.cpp | 0 .../cpp/runtime}/core/memory/allocator.cppm | 0 .../runtime}/core/memory/bumpAllocator.cpp | 0 .../runtime}/core/memory/bumpAllocator.cppm | 0 .../core/memory/bumpAllocator.test.cpp | 0 .../runtime}/core/memory/fixedAllocator.cpp | 0 .../runtime}/core/memory/fixedAllocator.cppm | 0 .../core/memory/fixedAllocator.test.cpp | 0 .../cpp/runtime}/core/memory/handle.cppm | 0 .../runtime}/core/memory/handle_registry.cppm | 0 .../runtime}/core/memory/pageAllocator.cpp | 0 .../runtime}/core/memory/pageAllocator.cppm | 0 .../cpp/runtime}/core/memory/root.cppm | 0 .../cpp/runtime}/core/memory/slice.cppm | 0 .../cpp/runtime}/core/memory/slot_array.cppm | 0 .../core/memory/trackingAllocator.cpp | 0 .../core/memory/trackingAllocator.cppm | 0 .../core/memory/trackingAllocator.test.cpp | 0 .../cpp/runtime}/draconic.cppm | 0 .../cpp/runtime}/input/input.cpp | 0 .../cpp/runtime}/input/input.cppm | 0 .../cpp/runtime}/platform/CMakeLists.txt | 0 .../cpp/runtime}/platform/cpu/cpu_info.h | 0 .../runtime}/platform/cpu/cpu_info_neon.cpp | 0 .../runtime}/platform/cpu/cpu_info_x64.cpp | 0 .../cpp/runtime}/platform/impl/CMakeLists.txt | 0 .../runtime}/platform/impl/linux/linux.cpp | 0 .../cpp/runtime}/platform/impl/mac/mac.mm | 0 .../runtime}/platform/impl/platform_impl.h | 0 .../runtime}/platform/impl/win32/win32.cpp | 0 .../cpp/runtime}/platform/platform.cppm | 0 .../cpp/runtime}/platform/simd.h | 0 .../cpp/runtime}/rendering/CMakeLists.txt | 0 .../runtime}/rendering/material/material.cppm | 0 .../cpp/runtime}/rendering/mesh/mesh.cpp | 0 .../cpp/runtime}/rendering/mesh/mesh.cppm | 0 .../rendering/quad_renderer/quad_renderer.cpp | 0 .../quad_renderer/quad_renderer.cppm | 0 .../runtime}/rendering/renderer/renderer.cpp | 5 +- .../runtime}/rendering/renderer/renderer.cppm | 0 .../rendering/rendergraph/rendergraph.cpp | 0 .../rendering/rendergraph/rendergraph.cppm | 0 .../cpp/runtime}/rendering/rendering.cppm | 0 .../cpp/runtime}/rendering/rhi/buffers.cpp | 0 .../cpp/runtime}/rendering/rhi/commands.cpp | 0 .../cpp/runtime}/rendering/rhi/core.cpp | 0 .../cpp/runtime}/rendering/rhi/macros.h | 0 .../cpp/runtime}/rendering/rhi/pipelines.cpp | 0 .../cpp/runtime}/rendering/rhi/rhi.cppm | 0 .../cpp/runtime}/rendering/rhi/texture.cpp | 0 .../rendering/rhi/uniform_registry.cppm | 0 .../cpp/runtime}/rendering/rhi/vertex.cppm | 0 .../cpp/runtime}/rendering/shaders/fs.sc | 0 .../cpp/runtime}/rendering/shaders/fs_quad.sc | 0 .../runtime}/rendering/shaders/varying.def.sc | 0 .../rendering/shaders/varying_quad.def.sc | 0 .../cpp/runtime}/rendering/shaders/vs.sc | 0 .../cpp/runtime}/rendering/shaders/vs_quad.sc | 0 .../cpp/runtime}/scene/CMakeLists.txt | 0 .../scene/camera/camera_controller.cpp | 0 .../scene/camera/camera_controller.cppm | 0 .../runtime}/scene/renderable/renderable.cppm | 0 .../cpp/runtime}/scene/scene.cppm | 0 .../transform_component.cpp | 0 .../transform_component.cppm | 0 .../cpp}/thirdparty/CMakeLists.txt | 0 .../cpp}/thirdparty/cmake/Config.cmake.in | 0 .../cmake/bgfx/3rdparty/dear-imgui.cmake | 0 .../thirdparty/cmake/bgfx/3rdparty/fcpp.cmake | 0 .../cmake/bgfx/3rdparty/glsl-optimizer.cmake | 0 .../cmake/bgfx/3rdparty/glslang.cmake | 0 .../cmake/bgfx/3rdparty/meshoptimizer.cmake | 0 .../cmake/bgfx/3rdparty/spirv-cross.cmake | 0 .../cmake/bgfx/3rdparty/spirv-opt.cmake | 0 .../thirdparty/cmake/bgfx/3rdparty/tint.cmake | 0 .../cmake/bgfx/3rdparty/webgpu.cmake | 0 .../cpp}/thirdparty/cmake/bgfx/CMakeLists.txt | 0 .../cpp}/thirdparty/cmake/bgfx/bgfx.cmake | 0 .../cpp}/thirdparty/cmake/bgfx/examples.cmake | 0 .../cmake/bgfx/generated/bounds.cpp.in | 0 .../cmake/bgfx/generated/shader.cpp.in | 0 .../cmake/bgfx/generated/vertexlayout.cpp.in | 0 .../thirdparty/cmake/bgfx/geometryc.cmake | 0 .../thirdparty/cmake/bgfx/geometryv.cmake | 0 .../cpp}/thirdparty/cmake/bgfx/shaderc.cmake | 0 .../cpp}/thirdparty/cmake/bgfx/shared.cmake | 0 .../cpp}/thirdparty/cmake/bgfx/texturev.cmake | 0 .../cmake/bgfx/util/ConfigureDebugging.cmake | 0 .../cpp}/thirdparty/cmake/bgfxToolUtils.cmake | 0 .../cmake/bimg/3rdparty/astc_encoder.cmake | 0 .../cmake/bimg/3rdparty/edtaa3.cmake | 0 .../thirdparty/cmake/bimg/3rdparty/etc1.cmake | 0 .../thirdparty/cmake/bimg/3rdparty/etc2.cmake | 0 .../thirdparty/cmake/bimg/3rdparty/iqa.cmake | 0 .../cmake/bimg/3rdparty/libsquish.cmake | 0 .../cmake/bimg/3rdparty/loadpng.cmake | 0 .../cmake/bimg/3rdparty/miniz.cmake | 0 .../thirdparty/cmake/bimg/3rdparty/nvtt.cmake | 0 .../cmake/bimg/3rdparty/pvrtc.cmake | 0 .../cmake/bimg/3rdparty/tinyexr.cmake | 0 .../cpp}/thirdparty/cmake/bimg/CMakeLists.txt | 0 .../cpp}/thirdparty/cmake/bimg/bimg.cmake | 0 .../thirdparty/cmake/bimg/bimg_decode.cmake | 0 .../thirdparty/cmake/bimg/bimg_encode.cmake | 0 .../cpp}/thirdparty/cmake/bimg/texturec.cmake | 0 .../cpp}/thirdparty/cmake/bx/CMakeLists.txt | 0 .../cpp}/thirdparty/cmake/bx/bin2c.cmake | 0 .../cpp}/thirdparty/cmake/bx/bx.cmake | 0 .../cpp}/thirdparty/cmake/version.cmake | 0 .../cpp}/thirdparty/doctest/doctest.h | 0 .../thirdparty/doctest/doctest_with_main.h | 0 .../cpp}/thirdparty/stb/CMakeLists.txt | 0 .../cpp}/thirdparty/stb/stb_image.h | 0 README.md | 4 +- Samples/cpp/CMakeLists.txt | 38 ++ .../main.cpp => Samples/cpp/rendering.cpp | 29 +- cmake/Modules.cmake | 2 +- cmake/Shaders.cmake | 14 +- engine/CMakeLists.txt | 2 - engine/native/core/math/transform.cpp | 78 ---- engine/native/core/math/transform.cppm | 32 -- engine/native/thirdparty/bgfx | 1 - engine/native/thirdparty/bimg | 1 - engine/native/thirdparty/bx | 1 - engine/native/thirdparty/sdl | 1 - 157 files changed, 396 insertions(+), 367 deletions(-) rename {assets => Docs/assets}/draconic_logo_no_text.png (100%) rename {assets => Docs/assets}/draconic_logo_no_text.svg (100%) rename {assets => Docs/assets}/draconic_logo_text.png (100%) rename {docs => Docs}/cxxmodules.md (100%) rename {docs => Docs}/index.md (100%) create mode 100644 Editor/Editor.cs create mode 100644 Engine/cpp/CMakeLists.txt create mode 100644 Engine/cpp/DraconicAPI.h rename {engine/native => Engine/cpp/runtime}/CMakeLists.txt (93%) rename {engine/native => Engine/cpp/runtime}/core/CMakeLists.txt (100%) rename {engine/native => Engine/cpp/runtime}/core/core.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/definitions/definitions.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/definitions/stdtypes.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/definitions/version.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/io/filesystem.cpp (100%) rename {engine/native => Engine/cpp/runtime}/core/io/filesystem.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/io/image_loader.cpp (100%) rename {engine/native => Engine/cpp/runtime}/core/io/image_loader.cppm (81%) rename {engine/native => Engine/cpp/runtime}/core/io/io.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/math/constants.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/math/functions.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/math/math.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/math/math.test.cpp (83%) create mode 100644 Engine/cpp/runtime/core/math/transform.cpp create mode 100644 Engine/cpp/runtime/core/math/transform.cppm rename {engine/native => Engine/cpp/runtime}/core/math/types.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/math/types_common.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/math/vector2.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/math/vector3.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/math/vector4.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/allocator.cpp (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/allocator.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/bumpAllocator.cpp (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/bumpAllocator.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/bumpAllocator.test.cpp (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/fixedAllocator.cpp (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/fixedAllocator.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/fixedAllocator.test.cpp (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/handle.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/handle_registry.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/pageAllocator.cpp (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/pageAllocator.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/root.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/slice.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/slot_array.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/trackingAllocator.cpp (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/trackingAllocator.cppm (100%) rename {engine/native => Engine/cpp/runtime}/core/memory/trackingAllocator.test.cpp (100%) rename {engine/native => Engine/cpp/runtime}/draconic.cppm (100%) rename {engine/native => Engine/cpp/runtime}/input/input.cpp (100%) rename {engine/native => Engine/cpp/runtime}/input/input.cppm (100%) rename {engine/native => Engine/cpp/runtime}/platform/CMakeLists.txt (100%) rename {engine/native => Engine/cpp/runtime}/platform/cpu/cpu_info.h (100%) rename {engine/native => Engine/cpp/runtime}/platform/cpu/cpu_info_neon.cpp (100%) rename {engine/native => Engine/cpp/runtime}/platform/cpu/cpu_info_x64.cpp (100%) rename {engine/native => Engine/cpp/runtime}/platform/impl/CMakeLists.txt (100%) rename {engine/native => Engine/cpp/runtime}/platform/impl/linux/linux.cpp (100%) rename {engine/native => Engine/cpp/runtime}/platform/impl/mac/mac.mm (100%) rename {engine/native => Engine/cpp/runtime}/platform/impl/platform_impl.h (100%) rename {engine/native => Engine/cpp/runtime}/platform/impl/win32/win32.cpp (100%) rename {engine/native => Engine/cpp/runtime}/platform/platform.cppm (100%) rename {engine/native => Engine/cpp/runtime}/platform/simd.h (100%) rename {engine/native => Engine/cpp/runtime}/rendering/CMakeLists.txt (100%) rename {engine/native => Engine/cpp/runtime}/rendering/material/material.cppm (100%) rename {engine/native => Engine/cpp/runtime}/rendering/mesh/mesh.cpp (100%) rename {engine/native => Engine/cpp/runtime}/rendering/mesh/mesh.cppm (100%) rename {engine/native => Engine/cpp/runtime}/rendering/quad_renderer/quad_renderer.cpp (100%) rename {engine/native => Engine/cpp/runtime}/rendering/quad_renderer/quad_renderer.cppm (100%) rename {engine/native => Engine/cpp/runtime}/rendering/renderer/renderer.cpp (96%) rename {engine/native => Engine/cpp/runtime}/rendering/renderer/renderer.cppm (100%) rename {engine/native => Engine/cpp/runtime}/rendering/rendergraph/rendergraph.cpp (100%) rename {engine/native => Engine/cpp/runtime}/rendering/rendergraph/rendergraph.cppm (100%) rename {engine/native => Engine/cpp/runtime}/rendering/rendering.cppm (100%) rename {engine/native => Engine/cpp/runtime}/rendering/rhi/buffers.cpp (100%) rename {engine/native => Engine/cpp/runtime}/rendering/rhi/commands.cpp (100%) rename {engine/native => Engine/cpp/runtime}/rendering/rhi/core.cpp (100%) rename {engine/native => Engine/cpp/runtime}/rendering/rhi/macros.h (100%) rename {engine/native => Engine/cpp/runtime}/rendering/rhi/pipelines.cpp (100%) rename {engine/native => Engine/cpp/runtime}/rendering/rhi/rhi.cppm (100%) rename {engine/native => Engine/cpp/runtime}/rendering/rhi/texture.cpp (100%) rename {engine/native => Engine/cpp/runtime}/rendering/rhi/uniform_registry.cppm (100%) rename {engine/native => Engine/cpp/runtime}/rendering/rhi/vertex.cppm (100%) rename {engine/native => Engine/cpp/runtime}/rendering/shaders/fs.sc (100%) rename {engine/native => Engine/cpp/runtime}/rendering/shaders/fs_quad.sc (100%) rename {engine/native => Engine/cpp/runtime}/rendering/shaders/varying.def.sc (100%) rename {engine/native => Engine/cpp/runtime}/rendering/shaders/varying_quad.def.sc (100%) rename {engine/native => Engine/cpp/runtime}/rendering/shaders/vs.sc (100%) rename {engine/native => Engine/cpp/runtime}/rendering/shaders/vs_quad.sc (100%) rename {engine/native => Engine/cpp/runtime}/scene/CMakeLists.txt (100%) rename {engine/native => Engine/cpp/runtime}/scene/camera/camera_controller.cpp (100%) rename {engine/native => Engine/cpp/runtime}/scene/camera/camera_controller.cppm (100%) rename {engine/native => Engine/cpp/runtime}/scene/renderable/renderable.cppm (100%) rename {engine/native => Engine/cpp/runtime}/scene/scene.cppm (100%) rename {engine/native => Engine/cpp/runtime}/scene/transform_component/transform_component.cpp (100%) rename {engine/native => Engine/cpp/runtime}/scene/transform_component/transform_component.cppm (100%) rename {engine/native => Engine/cpp}/thirdparty/CMakeLists.txt (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/Config.cmake.in (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/3rdparty/dear-imgui.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/3rdparty/fcpp.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/3rdparty/glsl-optimizer.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/3rdparty/glslang.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/3rdparty/meshoptimizer.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/3rdparty/spirv-cross.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/3rdparty/spirv-opt.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/3rdparty/tint.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/3rdparty/webgpu.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/CMakeLists.txt (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/bgfx.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/examples.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/generated/bounds.cpp.in (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/generated/shader.cpp.in (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/generated/vertexlayout.cpp.in (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/geometryc.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/geometryv.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/shaderc.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/shared.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/texturev.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfx/util/ConfigureDebugging.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bgfxToolUtils.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/3rdparty/astc_encoder.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/3rdparty/edtaa3.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/3rdparty/etc1.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/3rdparty/etc2.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/3rdparty/iqa.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/3rdparty/libsquish.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/3rdparty/loadpng.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/3rdparty/miniz.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/3rdparty/nvtt.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/3rdparty/pvrtc.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/3rdparty/tinyexr.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/CMakeLists.txt (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/bimg.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/bimg_decode.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/bimg_encode.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bimg/texturec.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bx/CMakeLists.txt (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bx/bin2c.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/bx/bx.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/cmake/version.cmake (100%) rename {engine/native => Engine/cpp}/thirdparty/doctest/doctest.h (100%) rename {engine/native => Engine/cpp}/thirdparty/doctest/doctest_with_main.h (100%) rename {engine/native => Engine/cpp}/thirdparty/stb/CMakeLists.txt (100%) rename {engine/native => Engine/cpp}/thirdparty/stb/stb_image.h (100%) create mode 100644 Samples/cpp/CMakeLists.txt rename engine/native/main/main.cpp => Samples/cpp/rendering.cpp (86%) delete mode 100644 engine/CMakeLists.txt delete mode 100644 engine/native/core/math/transform.cpp delete mode 100644 engine/native/core/math/transform.cppm delete mode 160000 engine/native/thirdparty/bgfx delete mode 160000 engine/native/thirdparty/bimg delete mode 160000 engine/native/thirdparty/bx delete mode 160000 engine/native/thirdparty/sdl diff --git a/.gitmodules b/.gitmodules index 88865010..38b83926 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,12 @@ -[submodule "engine/native/thirdparty/bx"] - path = engine/native/thirdparty/bx +[submodule "Engine/cpp/thirdparty/bx"] + path = Engine/cpp/thirdparty/bx url = https://github.com/bkaradzic/bx -[submodule "engine/native/thirdparty/bimg"] - path = engine/native/thirdparty/bimg +[submodule "Engine/cpp/thirdparty/bimg"] + path = Engine/cpp/thirdparty/bimg url = https://github.com/bkaradzic/bimg -[submodule "engine/native/thirdparty/bgfx"] - path = engine/native/thirdparty/bgfx +[submodule "Engine/cpp/thirdparty/bgfx"] + path = Engine/cpp/thirdparty/bgfx url = https://github.com/bkaradzic/bgfx -[submodule "engine/native/thirdparty/sdl"] - path = engine/native/thirdparty/sdl +[submodule "Engine/cpp/thirdparty/sdl"] + path = Engine/cpp/thirdparty/sdl url = https://github.com/libsdl-org/SDL diff --git a/CMakeLists.txt b/CMakeLists.txt index 99a70261..d99bedff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,42 +25,8 @@ include(Compiler) include(Modules) include(Shaders) -# Subdirectories for engine libs -add_subdirectory(engine) +# Engine runtime (C++) +add_subdirectory(Engine/cpp) -# Main Executable -add_executable(draconic engine/native/main/main.cpp) - -target_link_libraries(draconic - PRIVATE - native - bgfx - bx - bimg -) - -if(UNIX AND NOT APPLE) - target_link_libraries(draconic PRIVATE SDL3::SDL3-static Threads::Threads dl) - target_link_options(draconic PRIVATE -Wl,--whole-archive $ -Wl,--no-whole-archive) -elseif(APPLE) - target_link_libraries(draconic PRIVATE SDL3::SDL3-static) - target_link_options(draconic PRIVATE -Wl,-force_load,$) -else() - target_link_libraries(draconic PRIVATE SDL3::SDL3-static) -endif() - -compile_shaders(draconic) - -set(TEST_IMAGE - "${CMAKE_SOURCE_DIR}/assets/draconic_logo_no_text.png" -) - -add_custom_command( - TARGET draconic POST_BUILD - - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${TEST_IMAGE} - $/test.png - - COMMENT "Copying test texture..." -) +# Samples (C++) +add_subdirectory(Samples/cpp) diff --git a/assets/draconic_logo_no_text.png b/Docs/assets/draconic_logo_no_text.png similarity index 100% rename from assets/draconic_logo_no_text.png rename to Docs/assets/draconic_logo_no_text.png diff --git a/assets/draconic_logo_no_text.svg b/Docs/assets/draconic_logo_no_text.svg similarity index 100% rename from assets/draconic_logo_no_text.svg rename to Docs/assets/draconic_logo_no_text.svg diff --git a/assets/draconic_logo_text.png b/Docs/assets/draconic_logo_text.png similarity index 100% rename from assets/draconic_logo_text.png rename to Docs/assets/draconic_logo_text.png diff --git a/docs/cxxmodules.md b/Docs/cxxmodules.md similarity index 100% rename from docs/cxxmodules.md rename to Docs/cxxmodules.md diff --git a/docs/index.md b/Docs/index.md similarity index 100% rename from docs/index.md rename to Docs/index.md diff --git a/Editor/Editor.cs b/Editor/Editor.cs new file mode 100644 index 00000000..f80babfe --- /dev/null +++ b/Editor/Editor.cs @@ -0,0 +1 @@ +// Placeholder for Editor UI code \ No newline at end of file diff --git a/Engine/cpp/CMakeLists.txt b/Engine/cpp/CMakeLists.txt new file mode 100644 index 00000000..3e594b1a --- /dev/null +++ b/Engine/cpp/CMakeLists.txt @@ -0,0 +1,6 @@ +add_subdirectory(thirdparty SYSTEM) + +add_modules_library(runtime) +target_link_libraries(runtime PUBLIC platform core input scene rendering) + +# TODO: binding library \ No newline at end of file diff --git a/Engine/cpp/DraconicAPI.h b/Engine/cpp/DraconicAPI.h new file mode 100644 index 00000000..ef55fbe4 --- /dev/null +++ b/Engine/cpp/DraconicAPI.h @@ -0,0 +1,15 @@ +#ifndef DRACONICENGINE_API_H +#define DRACONICENGINE_API_H + +/* + * Placeholder for C binding header. + * It will be a C facade to the Draconic C++ runtime. + */ + +extern "C" { + + + +} + +#endif //DRACONICENGINE_API_H \ No newline at end of file diff --git a/engine/native/CMakeLists.txt b/Engine/cpp/runtime/CMakeLists.txt similarity index 93% rename from engine/native/CMakeLists.txt rename to Engine/cpp/runtime/CMakeLists.txt index a8974d19..c9f083ed 100644 --- a/engine/native/CMakeLists.txt +++ b/Engine/cpp/runtime/CMakeLists.txt @@ -1,5 +1,3 @@ -add_subdirectory(thirdparty SYSTEM) - add_modules_library(platform) add_modules_library(core SHARED) add_modules_library(input) diff --git a/engine/native/core/CMakeLists.txt b/Engine/cpp/runtime/core/CMakeLists.txt similarity index 100% rename from engine/native/core/CMakeLists.txt rename to Engine/cpp/runtime/core/CMakeLists.txt diff --git a/engine/native/core/core.cppm b/Engine/cpp/runtime/core/core.cppm similarity index 100% rename from engine/native/core/core.cppm rename to Engine/cpp/runtime/core/core.cppm diff --git a/engine/native/core/definitions/definitions.cppm b/Engine/cpp/runtime/core/definitions/definitions.cppm similarity index 100% rename from engine/native/core/definitions/definitions.cppm rename to Engine/cpp/runtime/core/definitions/definitions.cppm diff --git a/engine/native/core/definitions/stdtypes.cppm b/Engine/cpp/runtime/core/definitions/stdtypes.cppm similarity index 100% rename from engine/native/core/definitions/stdtypes.cppm rename to Engine/cpp/runtime/core/definitions/stdtypes.cppm diff --git a/engine/native/core/definitions/version.cppm b/Engine/cpp/runtime/core/definitions/version.cppm similarity index 100% rename from engine/native/core/definitions/version.cppm rename to Engine/cpp/runtime/core/definitions/version.cppm diff --git a/engine/native/core/io/filesystem.cpp b/Engine/cpp/runtime/core/io/filesystem.cpp similarity index 100% rename from engine/native/core/io/filesystem.cpp rename to Engine/cpp/runtime/core/io/filesystem.cpp diff --git a/engine/native/core/io/filesystem.cppm b/Engine/cpp/runtime/core/io/filesystem.cppm similarity index 100% rename from engine/native/core/io/filesystem.cppm rename to Engine/cpp/runtime/core/io/filesystem.cppm diff --git a/engine/native/core/io/image_loader.cpp b/Engine/cpp/runtime/core/io/image_loader.cpp similarity index 100% rename from engine/native/core/io/image_loader.cpp rename to Engine/cpp/runtime/core/io/image_loader.cpp diff --git a/engine/native/core/io/image_loader.cppm b/Engine/cpp/runtime/core/io/image_loader.cppm similarity index 81% rename from engine/native/core/io/image_loader.cppm rename to Engine/cpp/runtime/core/io/image_loader.cppm index facced31..a1dd61f6 100644 --- a/engine/native/core/io/image_loader.cppm +++ b/Engine/cpp/runtime/core/io/image_loader.cppm @@ -1,7 +1,6 @@ module; #include -#include #include export module core.io.image_loader; @@ -19,6 +18,6 @@ export namespace draco::core::io::image_loader bool is_valid = false; }; - // Load an image file (PNG, JPG, etc) & decode it to raw RGBA8 + // Load an image file (PNG, JPG, etc.) & decode it to raw RGBA8 ImageData load_image(const std::filesystem::path& path); } \ No newline at end of file diff --git a/engine/native/core/io/io.cppm b/Engine/cpp/runtime/core/io/io.cppm similarity index 100% rename from engine/native/core/io/io.cppm rename to Engine/cpp/runtime/core/io/io.cppm diff --git a/engine/native/core/math/constants.cppm b/Engine/cpp/runtime/core/math/constants.cppm similarity index 100% rename from engine/native/core/math/constants.cppm rename to Engine/cpp/runtime/core/math/constants.cppm diff --git a/engine/native/core/math/functions.cppm b/Engine/cpp/runtime/core/math/functions.cppm similarity index 100% rename from engine/native/core/math/functions.cppm rename to Engine/cpp/runtime/core/math/functions.cppm diff --git a/engine/native/core/math/math.cppm b/Engine/cpp/runtime/core/math/math.cppm similarity index 100% rename from engine/native/core/math/math.cppm rename to Engine/cpp/runtime/core/math/math.cppm diff --git a/engine/native/core/math/math.test.cpp b/Engine/cpp/runtime/core/math/math.test.cpp similarity index 83% rename from engine/native/core/math/math.test.cpp rename to Engine/cpp/runtime/core/math/math.test.cpp index 039d37cc..55452830 100644 --- a/engine/native/core/math/math.test.cpp +++ b/Engine/cpp/runtime/core/math/math.test.cpp @@ -6,13 +6,13 @@ using namespace draco; TEST_SUITE("math") { TEST_CASE("pow") { - f32 result = draco::math::pow(2.0f, 0.5f); - constexpr f32 expected = draco::math::SQRT2; + f32 result = math::pow(2.0f, 0.5f); + constexpr f32 expected = math::SQRT2; CHECK_EQ(result, expected); } TEST_CASE("abs") { - using draco::math::abs; + using math::abs; RAC_CHECK_EQ(abs(-1.f), 1.f); RAC_CHECK_EQ(abs(4.56f), 4.56f); @@ -27,9 +27,9 @@ TEST_SUITE("math") { TEST_SUITE("vector2") { TEST_CASE("constructors") { - using draco::math::Vector2; - using draco::math::Vector3; - using draco::math::Vector4; + using math::Vector2; + using math::Vector3; + using math::Vector4; static constexpr Vector3 a{1.0f, 2.0f, 3.0f}; static constexpr Vector4 b{4.0f, 5.0f, 6.0f, 7.0f}; @@ -51,7 +51,7 @@ TEST_SUITE("vector2") { } TEST_CASE("access") { - using draco::math::Vector2; + using math::Vector2; static constexpr Vector2 v(1.0f, 2.0f); @@ -60,9 +60,9 @@ TEST_SUITE("vector2") { } TEST_CASE("swizzle") { - using draco::math::Vector2; - using draco::math::Vector3; - using draco::math::Vector4; + using math::Vector2; + using math::Vector3; + using math::Vector4; static constexpr Vector2 v{1.0f, 2.0f}; @@ -83,7 +83,7 @@ TEST_SUITE("vector2") { } TEST_CASE("swap") { - using draco::math::Vector2; + using math::Vector2; Vector2 a{1.f, 2.f}; Vector2 b{2.f, 1.f}; @@ -95,8 +95,8 @@ TEST_SUITE("vector2") { } TEST_CASE("dot") { - using draco::math::Vector2; - using draco::math::dot; + using math::Vector2; + using math::dot; static constexpr Vector2 a{1.0f, 2.0f}; static constexpr Vector2 b{3.0f, 4.0f}; @@ -118,9 +118,9 @@ TEST_SUITE("vector2") { } TEST_CASE("length") { - using draco::math::Vector2; - using draco::math::length; - using draco::math::length_sq; + using math::Vector2; + using math::length; + using math::length_sq; static constexpr Vector2 v{3.0f, 4.0f}; @@ -136,9 +136,9 @@ TEST_SUITE("vector2") { } TEST_CASE("distance") { - using draco::math::Vector2; - using draco::math::distance; - using draco::math::distance_sq; + using math::Vector2; + using math::distance; + using math::distance_sq; static constexpr Vector2 a{3.0f, 4.0f}; static constexpr Vector2 b{-3.0f, 12.0f}; @@ -155,10 +155,10 @@ TEST_SUITE("vector2") { } TEST_CASE("normalize") { - using draco::math::Vector2; - using draco::math::length; - using draco::math::normalize; - using draco::math::normalize_fast; + using math::Vector2; + using math::length; + using math::normalize; + using math::normalize_fast; static constexpr Vector2 a{3.0f, 4.0f}; static constexpr Vector2 b(1e-99); @@ -173,8 +173,8 @@ TEST_SUITE("vector2") { } TEST_CASE("project") { - using draco::math::Vector2; - using draco::math::project; + using math::Vector2; + using math::project; static constexpr Vector2 a{4.0f, 6.0f}; static constexpr Vector2 b{2.0f, 2.0f}; @@ -186,8 +186,8 @@ TEST_SUITE("vector2") { } TEST_CASE("reflect") { - using draco::math::Vector2; - using draco::math::reflect; + using math::Vector2; + using math::reflect; static constexpr Vector2 a{1.0f, 2.0f}; static constexpr Vector2 b{3.0f, 4.0f}; @@ -199,9 +199,9 @@ TEST_SUITE("vector2") { } TEST_CASE("angle") { - using draco::math::Vector2; - using draco::math::angle; - using draco::math::PI2; + using math::Vector2; + using math::angle; + using math::PI2; static constexpr Vector2 a{2.0f, 1.0f}; static constexpr Vector2 b{-2.0f, 4.0f}; @@ -213,8 +213,8 @@ TEST_SUITE("vector2") { } TEST_CASE("lerp") { - using draco::math::Vector2; - using draco::math::lerp; + using math::Vector2; + using math::lerp; static constexpr Vector2 a{1.0f, 2.0f}; static constexpr Vector2 b{3.0f, 4.0f}; @@ -246,8 +246,8 @@ TEST_SUITE("vector2") { } TEST_CASE("min") { - using draco::math::Vector2; - using draco::math::min; + using math::Vector2; + using math::min; static constexpr Vector2 a{5.0f, 3.0f}; static constexpr Vector2 b{1.0f, 7.0f}; @@ -268,9 +268,9 @@ TEST_SUITE("vector2") { } TEST_CASE("min_length") { - using draco::math::Vector2; - using draco::math::length; - using draco::math::min_length; + using math::Vector2; + using math::length; + using math::min_length; static constexpr Vector2 a{3.0f, 4.0f}; // len: 5 static constexpr Vector2 b{5.0f, 12.0f}; // len: 13 @@ -295,8 +295,8 @@ TEST_SUITE("vector2") { } TEST_CASE("max") { - using draco::math::Vector2; - using draco::math::max; + using math::Vector2; + using math::max; static constexpr Vector2 a{5.0f, 3.0f}; static constexpr Vector2 b{1.0f, 7.0f}; @@ -317,9 +317,9 @@ TEST_SUITE("vector2") { } TEST_CASE("max_length") { - using draco::math::Vector2; - using draco::math::length; - using draco::math::max_length; + using math::Vector2; + using math::length; + using math::max_length; static constexpr Vector2 a{3.0f, 4.0f}; // len: 5 static constexpr Vector2 b{5.0f, 12.0f}; // len: 13 @@ -344,8 +344,8 @@ TEST_SUITE("vector2") { } TEST_CASE("clamp") { - using draco::math::Vector2; - using draco::math::clamp; + using math::Vector2; + using math::clamp; static constexpr Vector2 a{5.0f, 3.0f}; static constexpr Vector2 b{1.0f, 7.0f}; @@ -363,9 +363,9 @@ TEST_SUITE("vector2") { } TEST_CASE("clamp_length") { - using draco::math::Vector2; - using draco::math::length; - using draco::math::clamp_length; + using math::Vector2; + using math::length; + using math::clamp_length; static constexpr Vector2 v{3.0f, 4.0f}; // len: 5 @@ -391,8 +391,8 @@ TEST_SUITE("vector2") { } TEST_CASE("abs") { - using draco::math::Vector2; - using draco::math::abs; + using math::Vector2; + using math::abs; RAC_CHECK_EQ( ( abs(Vector2{1.0f, -2.0f}) ), @@ -401,11 +401,11 @@ TEST_SUITE("vector2") { } TEST_CASE("rounding") { - using draco::math::Vector2; - using draco::math::floor; - using draco::math::ceil; - using draco::math::trunc; - using draco::math::round; + using math::Vector2; + using math::floor; + using math::ceil; + using math::trunc; + using math::round; static constexpr Vector2 a{0.5f, 1.4f}; static constexpr Vector2 b{-1.0f, 1.0f}; @@ -440,8 +440,8 @@ TEST_SUITE("vector2") { } TEST_CASE("sign") { - using draco::math::Vector2; - using draco::math::sign; + using math::Vector2; + using math::sign; RAC_CHECK_EQ( ( sign(Vector2{1.0f, -1.0f}) ), @@ -450,9 +450,9 @@ TEST_SUITE("vector2") { } TEST_CASE("approx_eq") { - using draco::math::Vector2; - using draco::math::approx_eq; - using draco::math::CMP_EPSILON; + using math::Vector2; + using math::approx_eq; + using math::CMP_EPSILON; static constexpr Vector2 v{1.0f, 2.0f}; static constexpr Vector2 offset = Vector2::x_axis(CMP_EPSILON); @@ -476,9 +476,9 @@ TEST_SUITE("vector2") { TEST_SUITE("vector3") { TEST_CASE("constructors") { - using draco::math::Vector2; - using draco::math::Vector3; - using draco::math::Vector4; + using math::Vector2; + using math::Vector3; + using math::Vector4; static constexpr Vector2 a{1.0f, 2.0f}; static constexpr Vector4 b{3.0f, 4.0f, 5.0f, 6.0f}; @@ -505,7 +505,7 @@ TEST_SUITE("vector3") { } TEST_CASE("access") { - using draco::math::Vector3; + using math::Vector3; static constexpr Vector3 v(1.0f, 2.0f, 3.0f); @@ -515,9 +515,9 @@ TEST_SUITE("vector3") { } TEST_CASE("swizzle") { - using draco::math::Vector2; - using draco::math::Vector3; - using draco::math::Vector4; + using math::Vector2; + using math::Vector3; + using math::Vector4; static constexpr Vector3 v{1.0f, 2.0f, 3.0f}; @@ -538,7 +538,7 @@ TEST_SUITE("vector3") { } TEST_CASE("swap") { - using draco::math::Vector3; + using math::Vector3; Vector3 a{1.f, 2.f, 3.f}; Vector3 b{3.f, 2.f, 1.f}; @@ -550,8 +550,8 @@ TEST_SUITE("vector3") { } TEST_CASE("dot") { - using draco::math::Vector3; - using draco::math::dot; + using math::Vector3; + using math::dot; static constexpr Vector3 a{1.0f, 2.0f, 3.0f}; static constexpr Vector3 b{4.0f, 5.0f, 6.0f}; @@ -573,9 +573,9 @@ TEST_SUITE("vector3") { } TEST_CASE("length") { - using draco::math::Vector3; - using draco::math::length; - using draco::math::length_sq; + using math::Vector3; + using math::length; + using math::length_sq; static constexpr Vector3 v{2.0f, 4.0f, 4.0f}; @@ -591,9 +591,9 @@ TEST_SUITE("vector3") { } TEST_CASE("distance") { - using draco::math::Vector3; - using draco::math::distance; - using draco::math::distance_sq; + using math::Vector3; + using math::distance; + using math::distance_sq; static constexpr Vector3 a{2.0f, 4.0f, 4.0f}; static constexpr Vector3 b{-1.0f, -2.0f, -2.0f}; @@ -610,10 +610,10 @@ TEST_SUITE("vector3") { } TEST_CASE("normalize") { - using draco::math::Vector3; - using draco::math::length; - using draco::math::normalize; - using draco::math::normalize_fast; + using math::Vector3; + using math::length; + using math::normalize; + using math::normalize_fast; static constexpr Vector3 a{0.0f, 6.4f, 4.8f}; static constexpr Vector3 b(1e-99); @@ -628,8 +628,8 @@ TEST_SUITE("vector3") { } TEST_CASE("project") { - using draco::math::Vector3; - using draco::math::project; + using math::Vector3; + using math::project; static constexpr Vector3 a{2.0f, 8.0f, 4.0f}; static constexpr Vector3 b{1.0f, 1.0f, 2.0f}; @@ -641,8 +641,8 @@ TEST_SUITE("vector3") { } TEST_CASE("reflect") { - using draco::math::Vector3; - using draco::math::reflect; + using math::Vector3; + using math::reflect; static constexpr Vector3 a{1.0f, 2.0f, 3.0f}; static constexpr Vector3 b{4.0f, 5.0f, 6.0f}; @@ -654,9 +654,9 @@ TEST_SUITE("vector3") { } TEST_CASE("angle") { - using draco::math::Vector3; - using draco::math::angle; - using draco::math::PI; + using math::Vector3; + using math::angle; + using math::PI; static constexpr Vector3 a{2.0f, 4.0f, 4.0f}; static constexpr Vector3 b{-4.0f, -8.0f, -8.0f}; @@ -668,8 +668,8 @@ TEST_SUITE("vector3") { } TEST_CASE("lerp") { - using draco::math::Vector3; - using draco::math::lerp; + using math::Vector3; + using math::lerp; static constexpr Vector3 a{1.0f, 2.0f, 3.0f}; static constexpr Vector3 b{4.0f, 5.0f, 6.0f}; @@ -701,8 +701,8 @@ TEST_SUITE("vector3") { } TEST_CASE("min") { - using draco::math::Vector3; - using draco::math::min; + using math::Vector3; + using math::min; static constexpr Vector3 a{5.0f, 8.0f, 3.0f}; static constexpr Vector3 b{1.0f, 6.0f, 7.0f}; @@ -723,9 +723,9 @@ TEST_SUITE("vector3") { } TEST_CASE("min_length") { - using draco::math::Vector3; - using draco::math::length; - using draco::math::min_length; + using math::Vector3; + using math::length; + using math::min_length; static constexpr Vector3 a{2.0f, 4.0f, 4.0f}; // len: 6 static constexpr Vector3 b{5.0f, 10.0f, 10.0f}; // len: 15 @@ -750,8 +750,8 @@ TEST_SUITE("vector3") { } TEST_CASE("max") { - using draco::math::Vector3; - using draco::math::max; + using math::Vector3; + using math::max; static constexpr Vector3 a{5.0f, 8.0f, 3.0f}; static constexpr Vector3 b{1.0f, 6.0f, 7.0f}; @@ -772,9 +772,9 @@ TEST_SUITE("vector3") { } TEST_CASE("max_length") { - using draco::math::Vector3; - using draco::math::length; - using draco::math::max_length; + using math::Vector3; + using math::length; + using math::max_length; static constexpr Vector3 a{2.0f, 4.0f, 4.0f}; // len: 6 static constexpr Vector3 b{5.0f, 10.0f, 10.0f}; // len: 15 @@ -799,8 +799,8 @@ TEST_SUITE("vector3") { } TEST_CASE("clamp") { - using draco::math::Vector3; - using draco::math::clamp; + using math::Vector3; + using math::clamp; static constexpr Vector3 a{5.0f, 8.0f, 3.0f}; static constexpr Vector3 b{1.0f, 6.0f, 7.0f}; @@ -818,9 +818,9 @@ TEST_SUITE("vector3") { } TEST_CASE("clamp_length") { - using draco::math::Vector3; - using draco::math::length; - using draco::math::clamp_length; + using math::Vector3; + using math::length; + using math::clamp_length; static constexpr Vector3 v{2.0f, 4.0f, 4.0f}; // len: 6 @@ -846,8 +846,8 @@ TEST_SUITE("vector3") { } TEST_CASE("abs") { - using draco::math::Vector3; - using draco::math::abs; + using math::Vector3; + using math::abs; RAC_CHECK_EQ( ( abs(Vector3{1.0f, -2.0f, 0.0f}) ), @@ -856,11 +856,11 @@ TEST_SUITE("vector3") { } TEST_CASE("rounding") { - using draco::math::Vector3; - using draco::math::floor; - using draco::math::ceil; - using draco::math::trunc; - using draco::math::round; + using math::Vector3; + using math::floor; + using math::ceil; + using math::trunc; + using math::round; static constexpr Vector3 a{0.5f, -0.5f, 1.4f}; static constexpr Vector3 b{-1.0f, 0.0f, 1.0f}; @@ -895,8 +895,8 @@ TEST_SUITE("vector3") { } TEST_CASE("sign") { - using draco::math::Vector3; - using draco::math::sign; + using math::Vector3; + using math::sign; RAC_CHECK_EQ( ( sign(Vector3{1.0f, -1.0f, 0.0f}) ), @@ -905,9 +905,9 @@ TEST_SUITE("vector3") { } TEST_CASE("approx_eq") { - using draco::math::Vector3; - using draco::math::approx_eq; - using draco::math::CMP_EPSILON; + using math::Vector3; + using math::approx_eq; + using math::CMP_EPSILON; static constexpr Vector3 v{1.0f, 2.0f, 3.0f}; static constexpr Vector3 offset = Vector3::x_axis(CMP_EPSILON); @@ -929,8 +929,8 @@ TEST_SUITE("vector3") { } TEST_CASE("cross") { - using draco::math::Vector3; - using draco::math::cross; + using math::Vector3; + using math::cross; RAC_CHECK_EQ( ( cross(Vector3::x_axis(), Vector3::y_axis()) ), @@ -941,9 +941,9 @@ TEST_SUITE("vector3") { TEST_SUITE("vector4") { TEST_CASE("constructors") { - using draco::math::Vector2; - using draco::math::Vector3; - using draco::math::Vector4; + using math::Vector2; + using math::Vector3; + using math::Vector4; static constexpr Vector2 a{1.0f, 2.0f}; static constexpr Vector3 b{3.0f, 4.0f, 5.0f}; @@ -995,7 +995,7 @@ TEST_SUITE("vector4") { } TEST_CASE("access") { - using draco::math::Vector4; + using math::Vector4; static constexpr Vector4 v(1.0f, 2.0f, 3.0f, 4.0f); @@ -1006,9 +1006,9 @@ TEST_SUITE("vector4") { } TEST_CASE("swizzle") { - using draco::math::Vector2; - using draco::math::Vector3; - using draco::math::Vector4; + using math::Vector2; + using math::Vector3; + using math::Vector4; static constexpr Vector4 v{1.0f, 2.0f, 3.0f, 4.0f}; @@ -1029,7 +1029,7 @@ TEST_SUITE("vector4") { } TEST_CASE("swap") { - using draco::math::Vector4; + using math::Vector4; Vector4 a{1.f, 2.f, 3.f, 4.f}; Vector4 b{4.f, 3.f, 2.f, 1.f}; @@ -1041,8 +1041,8 @@ TEST_SUITE("vector4") { } TEST_CASE("dot") { - using draco::math::Vector4; - using draco::math::dot; + using math::Vector4; + using math::dot; static constexpr Vector4 a{1.0f, 2.0f, 3.0f, 4.0f}; static constexpr Vector4 b{5.0f, 6.0f, 7.0f, 8.0f}; @@ -1064,9 +1064,9 @@ TEST_SUITE("vector4") { } TEST_CASE("length") { - using draco::math::Vector4; - using draco::math::length; - using draco::math::length_sq; + using math::Vector4; + using math::length; + using math::length_sq; static constexpr Vector4 v{1.0f, 2.0f, 2.0f, 4.0f}; @@ -1082,9 +1082,9 @@ TEST_SUITE("vector4") { } TEST_CASE("distance") { - using draco::math::Vector4; - using draco::math::distance; - using draco::math::distance_sq; + using math::Vector4; + using math::distance; + using math::distance_sq; static constexpr Vector4 a{1.0f, 2.0f, 2.0f, 4.0f}; static constexpr Vector4 b{3.0f, 6.0f, 7.0f, 10.0f}; @@ -1101,10 +1101,10 @@ TEST_SUITE("vector4") { } TEST_CASE("normalize") { - using draco::math::Vector4; - using draco::math::length; - using draco::math::normalize; - using draco::math::normalize_fast; + using math::Vector4; + using math::length; + using math::normalize; + using math::normalize_fast; static constexpr Vector4 a{2.0f, 4.0f, 5.0f, 6.0f}; static constexpr Vector4 b(1e-99); @@ -1119,8 +1119,8 @@ TEST_SUITE("vector4") { } TEST_CASE("project") { - using draco::math::Vector4; - using draco::math::project; + using math::Vector4; + using math::project; static constexpr Vector4 a{8.0f, 2.0f, 6.0f, 8.0f}; static constexpr Vector4 b{12.0f, 14.0f, 8.0f, 6.0f}; @@ -1132,8 +1132,8 @@ TEST_SUITE("vector4") { } TEST_CASE("reflect") { - using draco::math::Vector4; - using draco::math::reflect; + using math::Vector4; + using math::reflect; static constexpr Vector4 a{1.0f, 2.0f, 3.0f, 4.0f}; static constexpr Vector4 b{5.0f, 6.0f, 7.0f, 8.0f}; @@ -1145,9 +1145,9 @@ TEST_SUITE("vector4") { } TEST_CASE("angle") { - using draco::math::Vector4; - using draco::math::angle; - using draco::math::PI2; + using math::Vector4; + using math::angle; + using math::PI2; static constexpr Vector4 a{1.0f, 5.0f, 1.0f, 3.0f}; static constexpr Vector4 b{2.0f, -6.0f, -2.0f, 10.0f}; @@ -1159,8 +1159,8 @@ TEST_SUITE("vector4") { } TEST_CASE("lerp") { - using draco::math::Vector4; - using draco::math::lerp; + using math::Vector4; + using math::lerp; static constexpr Vector4 a{1.0f, 2.0f, 3.0f, 4.0f}; static constexpr Vector4 b{5.0f, 6.0f, 7.0f, 8.0f}; @@ -1192,8 +1192,8 @@ TEST_SUITE("vector4") { } TEST_CASE("min") { - using draco::math::Vector4; - using draco::math::min; + using math::Vector4; + using math::min; static constexpr Vector4 a{5.0f, 8.0f, 3.0f, 4.0f}; static constexpr Vector4 b{1.0f, 6.0f, 7.0f, 2.0f}; @@ -1214,9 +1214,9 @@ TEST_SUITE("vector4") { } TEST_CASE("min_length") { - using draco::math::Vector4; - using draco::math::length; - using draco::math::min_length; + using math::Vector4; + using math::length; + using math::min_length; static constexpr Vector4 a{1.0f, 2.0f, 2.0f, 4.0f}; // len: 5 static constexpr Vector4 b{1.0f, -3.0f, -1.0f, 5.0f}; // len: 6 @@ -1241,8 +1241,8 @@ TEST_SUITE("vector4") { } TEST_CASE("max") { - using draco::math::Vector4; - using draco::math::max; + using math::Vector4; + using math::max; static constexpr Vector4 a{5.0f, 8.0f, 3.0f, 4.0f}; static constexpr Vector4 b{1.0f, 6.0f, 7.0f, 2.0f}; @@ -1263,9 +1263,9 @@ TEST_SUITE("vector4") { } TEST_CASE("max_length") { - using draco::math::Vector4; - using draco::math::length; - using draco::math::max_length; + using math::Vector4; + using math::length; + using math::max_length; static constexpr Vector4 a{1.0f, 2.0f, 2.0f, 4.0f}; // len: 5 static constexpr Vector4 b{1.0f, -3.0f, -1.0f, 5.0f}; // len: 6 @@ -1290,8 +1290,8 @@ TEST_SUITE("vector4") { } TEST_CASE("clamp") { - using draco::math::Vector4; - using draco::math::clamp; + using math::Vector4; + using math::clamp; static constexpr Vector4 a{5.0f, 8.0f, 3.0f, 4.0f}; static constexpr Vector4 b{1.0f, 6.0f, 7.0f, 2.0f}; @@ -1309,9 +1309,9 @@ TEST_SUITE("vector4") { } TEST_CASE("clamp_length") { - using draco::math::Vector4; - using draco::math::length; - using draco::math::clamp_length; + using math::Vector4; + using math::length; + using math::clamp_length; static constexpr Vector4 v{1.0f, -3.0f, -1.0f, 5.0f}; // len: 6 @@ -1337,8 +1337,8 @@ TEST_SUITE("vector4") { } TEST_CASE("abs") { - using draco::math::Vector4; - using draco::math::abs; + using math::Vector4; + using math::abs; RAC_CHECK_EQ( ( abs(Vector4{1.0f, -2.0f, -3.0f, 0.0f}) ), @@ -1347,11 +1347,11 @@ TEST_SUITE("vector4") { } TEST_CASE("rounding") { - using draco::math::Vector4; - using draco::math::floor; - using draco::math::ceil; - using draco::math::trunc; - using draco::math::round; + using math::Vector4; + using math::floor; + using math::ceil; + using math::trunc; + using math::round; static constexpr Vector4 a{0.5f, -0.5f, 1.4f, 1.6f}; static constexpr Vector4 b{-1.0f, 0.0f, 1.0f, 2.0f}; @@ -1386,8 +1386,8 @@ TEST_SUITE("vector4") { } TEST_CASE("sign") { - using draco::math::Vector4; - using draco::math::sign; + using math::Vector4; + using math::sign; RAC_CHECK_EQ( ( sign(Vector4{1.0f, -1.0f, 0.0f, -0.0f}) ), @@ -1396,9 +1396,9 @@ TEST_SUITE("vector4") { } TEST_CASE("approx_eq") { - using draco::math::Vector4; - using draco::math::approx_eq; - using draco::math::CMP_EPSILON; + using math::Vector4; + using math::approx_eq; + using math::CMP_EPSILON; static constexpr Vector4 v{1.0f, 2.0f, 3.0f, 4.0f}; static constexpr Vector4 offset = Vector4::x_axis(CMP_EPSILON); @@ -1418,4 +1418,20 @@ TEST_SUITE("vector4") { ( false ) ); } + + TEST_CASE("Transform") { + using math::Transform; + + static constexpr Transform transform; + STATIC_REQUIRE(transform.position[0] == 0.f); + STATIC_REQUIRE(transform.position[1] == 0.f); + STATIC_REQUIRE(transform.position[2] == 0.f); + STATIC_REQUIRE(transform.rotation[0] == 0.f); + STATIC_REQUIRE(transform.rotation[1] == 0.f); + STATIC_REQUIRE(transform.rotation[2] == 0.f); + STATIC_REQUIRE(transform.scale[0] == 1.f); + STATIC_REQUIRE(transform.scale[1] == 1.f); + STATIC_REQUIRE(transform.scale[2] == 1.f); + + } } \ No newline at end of file diff --git a/Engine/cpp/runtime/core/math/transform.cpp b/Engine/cpp/runtime/core/math/transform.cpp new file mode 100644 index 00000000..b1238927 --- /dev/null +++ b/Engine/cpp/runtime/core/math/transform.cpp @@ -0,0 +1,38 @@ +module; + +#include + +#include + +module core.math.transform; + +import core.stdtypes; + +namespace draco::math +{ + void Transform::to_matrix(f32 out[16]) const + { + f32 translation[16]; + f32 rx[16]; + f32 ry[16]; + f32 rz[16]; + f32 scale[16]; + f32 temp[16]; + + bx::mtxIdentity(out); + + bx::mtxScale(scale, scale[0], scale[1], scale[2]); + + bx::mtxRotateX(rx, rotation[0]); + bx::mtxRotateY(ry, rotation[1]); + bx::mtxRotateZ(rz, rotation[2]); + + bx::mtxTranslate(translation, position[0], position[1], position[2]); + + // scale * rotation * translation + bx::mtxMul(temp, scale, rx); + bx::mtxMul(temp, temp, ry); + bx::mtxMul(temp, temp, rz); + bx::mtxMul(out, temp, translation); + } +} diff --git a/Engine/cpp/runtime/core/math/transform.cppm b/Engine/cpp/runtime/core/math/transform.cppm new file mode 100644 index 00000000..06f85d5d --- /dev/null +++ b/Engine/cpp/runtime/core/math/transform.cppm @@ -0,0 +1,70 @@ +module; + +export module core.math.transform; +import core.math.types; +import core.stdtypes; + +export namespace draco::math +{ + struct Transform + { + f32 position[3] = { 0.0f, 0.0f, 0.0f }; + f32 rotation[3] = { 0.0f, 0.0f, 0.0f }; // Euler (radians) + f32 scale[3] = { 1.0f, 1.0f, 1.0f }; + + constexpr void set_position(f32 x, f32 y, f32 z) noexcept { + position[0] = x; + position[1] = y; + position[2] = z; + } + + constexpr void set_position(const Vector3& v) noexcept { + position[0] = v.x; + position[1] = v.y; + position[2] = v.z; + } + + [[nodiscard]] constexpr Vector3 get_position() const noexcept { + return Vector3{position[0], position[1], position[2]}; + } + + constexpr void set_rotation(f32 x, f32 y, f32 z) noexcept + { + rotation[0] = x; + rotation[1] = y; + rotation[2] = z; + } + + constexpr void set_rotation(const Vector3& v) noexcept + { + rotation[0] = v.x; + rotation[1] = v.y; + rotation[2] = v.z; + } + + [[nodiscard]] constexpr Vector3 get_rotation() const noexcept { + return Vector3{rotation[0], rotation[1], rotation[2]}; + } + + constexpr void set_scale(f32 x, f32 y, f32 z) noexcept + { + scale[0] = x; + scale[1] = y; + scale[2] = z; + } + + constexpr void set_scale(const Vector3& v) noexcept + { + scale[0] = v.x; + scale[1] = v.y; + scale[2] = v.z; + } + + [[nodiscard]] constexpr Vector3 get_scale() const noexcept { + return Vector3{scale[0], scale[1], scale[2]}; + } + + // Compute column-major matrix from transform + void to_matrix(f32 out[16]) const; + }; +} diff --git a/engine/native/core/math/types.cppm b/Engine/cpp/runtime/core/math/types.cppm similarity index 100% rename from engine/native/core/math/types.cppm rename to Engine/cpp/runtime/core/math/types.cppm diff --git a/engine/native/core/math/types_common.cppm b/Engine/cpp/runtime/core/math/types_common.cppm similarity index 100% rename from engine/native/core/math/types_common.cppm rename to Engine/cpp/runtime/core/math/types_common.cppm diff --git a/engine/native/core/math/vector2.cppm b/Engine/cpp/runtime/core/math/vector2.cppm similarity index 100% rename from engine/native/core/math/vector2.cppm rename to Engine/cpp/runtime/core/math/vector2.cppm diff --git a/engine/native/core/math/vector3.cppm b/Engine/cpp/runtime/core/math/vector3.cppm similarity index 100% rename from engine/native/core/math/vector3.cppm rename to Engine/cpp/runtime/core/math/vector3.cppm diff --git a/engine/native/core/math/vector4.cppm b/Engine/cpp/runtime/core/math/vector4.cppm similarity index 100% rename from engine/native/core/math/vector4.cppm rename to Engine/cpp/runtime/core/math/vector4.cppm diff --git a/engine/native/core/memory/allocator.cpp b/Engine/cpp/runtime/core/memory/allocator.cpp similarity index 100% rename from engine/native/core/memory/allocator.cpp rename to Engine/cpp/runtime/core/memory/allocator.cpp diff --git a/engine/native/core/memory/allocator.cppm b/Engine/cpp/runtime/core/memory/allocator.cppm similarity index 100% rename from engine/native/core/memory/allocator.cppm rename to Engine/cpp/runtime/core/memory/allocator.cppm diff --git a/engine/native/core/memory/bumpAllocator.cpp b/Engine/cpp/runtime/core/memory/bumpAllocator.cpp similarity index 100% rename from engine/native/core/memory/bumpAllocator.cpp rename to Engine/cpp/runtime/core/memory/bumpAllocator.cpp diff --git a/engine/native/core/memory/bumpAllocator.cppm b/Engine/cpp/runtime/core/memory/bumpAllocator.cppm similarity index 100% rename from engine/native/core/memory/bumpAllocator.cppm rename to Engine/cpp/runtime/core/memory/bumpAllocator.cppm diff --git a/engine/native/core/memory/bumpAllocator.test.cpp b/Engine/cpp/runtime/core/memory/bumpAllocator.test.cpp similarity index 100% rename from engine/native/core/memory/bumpAllocator.test.cpp rename to Engine/cpp/runtime/core/memory/bumpAllocator.test.cpp diff --git a/engine/native/core/memory/fixedAllocator.cpp b/Engine/cpp/runtime/core/memory/fixedAllocator.cpp similarity index 100% rename from engine/native/core/memory/fixedAllocator.cpp rename to Engine/cpp/runtime/core/memory/fixedAllocator.cpp diff --git a/engine/native/core/memory/fixedAllocator.cppm b/Engine/cpp/runtime/core/memory/fixedAllocator.cppm similarity index 100% rename from engine/native/core/memory/fixedAllocator.cppm rename to Engine/cpp/runtime/core/memory/fixedAllocator.cppm diff --git a/engine/native/core/memory/fixedAllocator.test.cpp b/Engine/cpp/runtime/core/memory/fixedAllocator.test.cpp similarity index 100% rename from engine/native/core/memory/fixedAllocator.test.cpp rename to Engine/cpp/runtime/core/memory/fixedAllocator.test.cpp diff --git a/engine/native/core/memory/handle.cppm b/Engine/cpp/runtime/core/memory/handle.cppm similarity index 100% rename from engine/native/core/memory/handle.cppm rename to Engine/cpp/runtime/core/memory/handle.cppm diff --git a/engine/native/core/memory/handle_registry.cppm b/Engine/cpp/runtime/core/memory/handle_registry.cppm similarity index 100% rename from engine/native/core/memory/handle_registry.cppm rename to Engine/cpp/runtime/core/memory/handle_registry.cppm diff --git a/engine/native/core/memory/pageAllocator.cpp b/Engine/cpp/runtime/core/memory/pageAllocator.cpp similarity index 100% rename from engine/native/core/memory/pageAllocator.cpp rename to Engine/cpp/runtime/core/memory/pageAllocator.cpp diff --git a/engine/native/core/memory/pageAllocator.cppm b/Engine/cpp/runtime/core/memory/pageAllocator.cppm similarity index 100% rename from engine/native/core/memory/pageAllocator.cppm rename to Engine/cpp/runtime/core/memory/pageAllocator.cppm diff --git a/engine/native/core/memory/root.cppm b/Engine/cpp/runtime/core/memory/root.cppm similarity index 100% rename from engine/native/core/memory/root.cppm rename to Engine/cpp/runtime/core/memory/root.cppm diff --git a/engine/native/core/memory/slice.cppm b/Engine/cpp/runtime/core/memory/slice.cppm similarity index 100% rename from engine/native/core/memory/slice.cppm rename to Engine/cpp/runtime/core/memory/slice.cppm diff --git a/engine/native/core/memory/slot_array.cppm b/Engine/cpp/runtime/core/memory/slot_array.cppm similarity index 100% rename from engine/native/core/memory/slot_array.cppm rename to Engine/cpp/runtime/core/memory/slot_array.cppm diff --git a/engine/native/core/memory/trackingAllocator.cpp b/Engine/cpp/runtime/core/memory/trackingAllocator.cpp similarity index 100% rename from engine/native/core/memory/trackingAllocator.cpp rename to Engine/cpp/runtime/core/memory/trackingAllocator.cpp diff --git a/engine/native/core/memory/trackingAllocator.cppm b/Engine/cpp/runtime/core/memory/trackingAllocator.cppm similarity index 100% rename from engine/native/core/memory/trackingAllocator.cppm rename to Engine/cpp/runtime/core/memory/trackingAllocator.cppm diff --git a/engine/native/core/memory/trackingAllocator.test.cpp b/Engine/cpp/runtime/core/memory/trackingAllocator.test.cpp similarity index 100% rename from engine/native/core/memory/trackingAllocator.test.cpp rename to Engine/cpp/runtime/core/memory/trackingAllocator.test.cpp diff --git a/engine/native/draconic.cppm b/Engine/cpp/runtime/draconic.cppm similarity index 100% rename from engine/native/draconic.cppm rename to Engine/cpp/runtime/draconic.cppm diff --git a/engine/native/input/input.cpp b/Engine/cpp/runtime/input/input.cpp similarity index 100% rename from engine/native/input/input.cpp rename to Engine/cpp/runtime/input/input.cpp diff --git a/engine/native/input/input.cppm b/Engine/cpp/runtime/input/input.cppm similarity index 100% rename from engine/native/input/input.cppm rename to Engine/cpp/runtime/input/input.cppm diff --git a/engine/native/platform/CMakeLists.txt b/Engine/cpp/runtime/platform/CMakeLists.txt similarity index 100% rename from engine/native/platform/CMakeLists.txt rename to Engine/cpp/runtime/platform/CMakeLists.txt diff --git a/engine/native/platform/cpu/cpu_info.h b/Engine/cpp/runtime/platform/cpu/cpu_info.h similarity index 100% rename from engine/native/platform/cpu/cpu_info.h rename to Engine/cpp/runtime/platform/cpu/cpu_info.h diff --git a/engine/native/platform/cpu/cpu_info_neon.cpp b/Engine/cpp/runtime/platform/cpu/cpu_info_neon.cpp similarity index 100% rename from engine/native/platform/cpu/cpu_info_neon.cpp rename to Engine/cpp/runtime/platform/cpu/cpu_info_neon.cpp diff --git a/engine/native/platform/cpu/cpu_info_x64.cpp b/Engine/cpp/runtime/platform/cpu/cpu_info_x64.cpp similarity index 100% rename from engine/native/platform/cpu/cpu_info_x64.cpp rename to Engine/cpp/runtime/platform/cpu/cpu_info_x64.cpp diff --git a/engine/native/platform/impl/CMakeLists.txt b/Engine/cpp/runtime/platform/impl/CMakeLists.txt similarity index 100% rename from engine/native/platform/impl/CMakeLists.txt rename to Engine/cpp/runtime/platform/impl/CMakeLists.txt diff --git a/engine/native/platform/impl/linux/linux.cpp b/Engine/cpp/runtime/platform/impl/linux/linux.cpp similarity index 100% rename from engine/native/platform/impl/linux/linux.cpp rename to Engine/cpp/runtime/platform/impl/linux/linux.cpp diff --git a/engine/native/platform/impl/mac/mac.mm b/Engine/cpp/runtime/platform/impl/mac/mac.mm similarity index 100% rename from engine/native/platform/impl/mac/mac.mm rename to Engine/cpp/runtime/platform/impl/mac/mac.mm diff --git a/engine/native/platform/impl/platform_impl.h b/Engine/cpp/runtime/platform/impl/platform_impl.h similarity index 100% rename from engine/native/platform/impl/platform_impl.h rename to Engine/cpp/runtime/platform/impl/platform_impl.h diff --git a/engine/native/platform/impl/win32/win32.cpp b/Engine/cpp/runtime/platform/impl/win32/win32.cpp similarity index 100% rename from engine/native/platform/impl/win32/win32.cpp rename to Engine/cpp/runtime/platform/impl/win32/win32.cpp diff --git a/engine/native/platform/platform.cppm b/Engine/cpp/runtime/platform/platform.cppm similarity index 100% rename from engine/native/platform/platform.cppm rename to Engine/cpp/runtime/platform/platform.cppm diff --git a/engine/native/platform/simd.h b/Engine/cpp/runtime/platform/simd.h similarity index 100% rename from engine/native/platform/simd.h rename to Engine/cpp/runtime/platform/simd.h diff --git a/engine/native/rendering/CMakeLists.txt b/Engine/cpp/runtime/rendering/CMakeLists.txt similarity index 100% rename from engine/native/rendering/CMakeLists.txt rename to Engine/cpp/runtime/rendering/CMakeLists.txt diff --git a/engine/native/rendering/material/material.cppm b/Engine/cpp/runtime/rendering/material/material.cppm similarity index 100% rename from engine/native/rendering/material/material.cppm rename to Engine/cpp/runtime/rendering/material/material.cppm diff --git a/engine/native/rendering/mesh/mesh.cpp b/Engine/cpp/runtime/rendering/mesh/mesh.cpp similarity index 100% rename from engine/native/rendering/mesh/mesh.cpp rename to Engine/cpp/runtime/rendering/mesh/mesh.cpp diff --git a/engine/native/rendering/mesh/mesh.cppm b/Engine/cpp/runtime/rendering/mesh/mesh.cppm similarity index 100% rename from engine/native/rendering/mesh/mesh.cppm rename to Engine/cpp/runtime/rendering/mesh/mesh.cppm diff --git a/engine/native/rendering/quad_renderer/quad_renderer.cpp b/Engine/cpp/runtime/rendering/quad_renderer/quad_renderer.cpp similarity index 100% rename from engine/native/rendering/quad_renderer/quad_renderer.cpp rename to Engine/cpp/runtime/rendering/quad_renderer/quad_renderer.cpp diff --git a/engine/native/rendering/quad_renderer/quad_renderer.cppm b/Engine/cpp/runtime/rendering/quad_renderer/quad_renderer.cppm similarity index 100% rename from engine/native/rendering/quad_renderer/quad_renderer.cppm rename to Engine/cpp/runtime/rendering/quad_renderer/quad_renderer.cppm diff --git a/engine/native/rendering/renderer/renderer.cpp b/Engine/cpp/runtime/rendering/renderer/renderer.cpp similarity index 96% rename from engine/native/rendering/renderer/renderer.cpp rename to Engine/cpp/runtime/rendering/renderer/renderer.cpp index 0859b5ed..e6506a8c 100644 --- a/engine/native/rendering/renderer/renderer.cpp +++ b/Engine/cpp/runtime/rendering/renderer/renderer.cpp @@ -117,10 +117,7 @@ namespace draco::rendering::renderer build_uniforms(material, p.uniforms); - f32 model[16]; - draco::math::compute_matrix(transform, model); - - std::memcpy(p.model, model, sizeof(model)); + transform.to_matrix(p.model); submit_entity(p); } diff --git a/engine/native/rendering/renderer/renderer.cppm b/Engine/cpp/runtime/rendering/renderer/renderer.cppm similarity index 100% rename from engine/native/rendering/renderer/renderer.cppm rename to Engine/cpp/runtime/rendering/renderer/renderer.cppm diff --git a/engine/native/rendering/rendergraph/rendergraph.cpp b/Engine/cpp/runtime/rendering/rendergraph/rendergraph.cpp similarity index 100% rename from engine/native/rendering/rendergraph/rendergraph.cpp rename to Engine/cpp/runtime/rendering/rendergraph/rendergraph.cpp diff --git a/engine/native/rendering/rendergraph/rendergraph.cppm b/Engine/cpp/runtime/rendering/rendergraph/rendergraph.cppm similarity index 100% rename from engine/native/rendering/rendergraph/rendergraph.cppm rename to Engine/cpp/runtime/rendering/rendergraph/rendergraph.cppm diff --git a/engine/native/rendering/rendering.cppm b/Engine/cpp/runtime/rendering/rendering.cppm similarity index 100% rename from engine/native/rendering/rendering.cppm rename to Engine/cpp/runtime/rendering/rendering.cppm diff --git a/engine/native/rendering/rhi/buffers.cpp b/Engine/cpp/runtime/rendering/rhi/buffers.cpp similarity index 100% rename from engine/native/rendering/rhi/buffers.cpp rename to Engine/cpp/runtime/rendering/rhi/buffers.cpp diff --git a/engine/native/rendering/rhi/commands.cpp b/Engine/cpp/runtime/rendering/rhi/commands.cpp similarity index 100% rename from engine/native/rendering/rhi/commands.cpp rename to Engine/cpp/runtime/rendering/rhi/commands.cpp diff --git a/engine/native/rendering/rhi/core.cpp b/Engine/cpp/runtime/rendering/rhi/core.cpp similarity index 100% rename from engine/native/rendering/rhi/core.cpp rename to Engine/cpp/runtime/rendering/rhi/core.cpp diff --git a/engine/native/rendering/rhi/macros.h b/Engine/cpp/runtime/rendering/rhi/macros.h similarity index 100% rename from engine/native/rendering/rhi/macros.h rename to Engine/cpp/runtime/rendering/rhi/macros.h diff --git a/engine/native/rendering/rhi/pipelines.cpp b/Engine/cpp/runtime/rendering/rhi/pipelines.cpp similarity index 100% rename from engine/native/rendering/rhi/pipelines.cpp rename to Engine/cpp/runtime/rendering/rhi/pipelines.cpp diff --git a/engine/native/rendering/rhi/rhi.cppm b/Engine/cpp/runtime/rendering/rhi/rhi.cppm similarity index 100% rename from engine/native/rendering/rhi/rhi.cppm rename to Engine/cpp/runtime/rendering/rhi/rhi.cppm diff --git a/engine/native/rendering/rhi/texture.cpp b/Engine/cpp/runtime/rendering/rhi/texture.cpp similarity index 100% rename from engine/native/rendering/rhi/texture.cpp rename to Engine/cpp/runtime/rendering/rhi/texture.cpp diff --git a/engine/native/rendering/rhi/uniform_registry.cppm b/Engine/cpp/runtime/rendering/rhi/uniform_registry.cppm similarity index 100% rename from engine/native/rendering/rhi/uniform_registry.cppm rename to Engine/cpp/runtime/rendering/rhi/uniform_registry.cppm diff --git a/engine/native/rendering/rhi/vertex.cppm b/Engine/cpp/runtime/rendering/rhi/vertex.cppm similarity index 100% rename from engine/native/rendering/rhi/vertex.cppm rename to Engine/cpp/runtime/rendering/rhi/vertex.cppm diff --git a/engine/native/rendering/shaders/fs.sc b/Engine/cpp/runtime/rendering/shaders/fs.sc similarity index 100% rename from engine/native/rendering/shaders/fs.sc rename to Engine/cpp/runtime/rendering/shaders/fs.sc diff --git a/engine/native/rendering/shaders/fs_quad.sc b/Engine/cpp/runtime/rendering/shaders/fs_quad.sc similarity index 100% rename from engine/native/rendering/shaders/fs_quad.sc rename to Engine/cpp/runtime/rendering/shaders/fs_quad.sc diff --git a/engine/native/rendering/shaders/varying.def.sc b/Engine/cpp/runtime/rendering/shaders/varying.def.sc similarity index 100% rename from engine/native/rendering/shaders/varying.def.sc rename to Engine/cpp/runtime/rendering/shaders/varying.def.sc diff --git a/engine/native/rendering/shaders/varying_quad.def.sc b/Engine/cpp/runtime/rendering/shaders/varying_quad.def.sc similarity index 100% rename from engine/native/rendering/shaders/varying_quad.def.sc rename to Engine/cpp/runtime/rendering/shaders/varying_quad.def.sc diff --git a/engine/native/rendering/shaders/vs.sc b/Engine/cpp/runtime/rendering/shaders/vs.sc similarity index 100% rename from engine/native/rendering/shaders/vs.sc rename to Engine/cpp/runtime/rendering/shaders/vs.sc diff --git a/engine/native/rendering/shaders/vs_quad.sc b/Engine/cpp/runtime/rendering/shaders/vs_quad.sc similarity index 100% rename from engine/native/rendering/shaders/vs_quad.sc rename to Engine/cpp/runtime/rendering/shaders/vs_quad.sc diff --git a/engine/native/scene/CMakeLists.txt b/Engine/cpp/runtime/scene/CMakeLists.txt similarity index 100% rename from engine/native/scene/CMakeLists.txt rename to Engine/cpp/runtime/scene/CMakeLists.txt diff --git a/engine/native/scene/camera/camera_controller.cpp b/Engine/cpp/runtime/scene/camera/camera_controller.cpp similarity index 100% rename from engine/native/scene/camera/camera_controller.cpp rename to Engine/cpp/runtime/scene/camera/camera_controller.cpp diff --git a/engine/native/scene/camera/camera_controller.cppm b/Engine/cpp/runtime/scene/camera/camera_controller.cppm similarity index 100% rename from engine/native/scene/camera/camera_controller.cppm rename to Engine/cpp/runtime/scene/camera/camera_controller.cppm diff --git a/engine/native/scene/renderable/renderable.cppm b/Engine/cpp/runtime/scene/renderable/renderable.cppm similarity index 100% rename from engine/native/scene/renderable/renderable.cppm rename to Engine/cpp/runtime/scene/renderable/renderable.cppm diff --git a/engine/native/scene/scene.cppm b/Engine/cpp/runtime/scene/scene.cppm similarity index 100% rename from engine/native/scene/scene.cppm rename to Engine/cpp/runtime/scene/scene.cppm diff --git a/engine/native/scene/transform_component/transform_component.cpp b/Engine/cpp/runtime/scene/transform_component/transform_component.cpp similarity index 100% rename from engine/native/scene/transform_component/transform_component.cpp rename to Engine/cpp/runtime/scene/transform_component/transform_component.cpp diff --git a/engine/native/scene/transform_component/transform_component.cppm b/Engine/cpp/runtime/scene/transform_component/transform_component.cppm similarity index 100% rename from engine/native/scene/transform_component/transform_component.cppm rename to Engine/cpp/runtime/scene/transform_component/transform_component.cppm diff --git a/engine/native/thirdparty/CMakeLists.txt b/Engine/cpp/thirdparty/CMakeLists.txt similarity index 100% rename from engine/native/thirdparty/CMakeLists.txt rename to Engine/cpp/thirdparty/CMakeLists.txt diff --git a/engine/native/thirdparty/cmake/Config.cmake.in b/Engine/cpp/thirdparty/cmake/Config.cmake.in similarity index 100% rename from engine/native/thirdparty/cmake/Config.cmake.in rename to Engine/cpp/thirdparty/cmake/Config.cmake.in diff --git a/engine/native/thirdparty/cmake/bgfx/3rdparty/dear-imgui.cmake b/Engine/cpp/thirdparty/cmake/bgfx/3rdparty/dear-imgui.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/3rdparty/dear-imgui.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/3rdparty/dear-imgui.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/3rdparty/fcpp.cmake b/Engine/cpp/thirdparty/cmake/bgfx/3rdparty/fcpp.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/3rdparty/fcpp.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/3rdparty/fcpp.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/3rdparty/glsl-optimizer.cmake b/Engine/cpp/thirdparty/cmake/bgfx/3rdparty/glsl-optimizer.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/3rdparty/glsl-optimizer.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/3rdparty/glsl-optimizer.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/3rdparty/glslang.cmake b/Engine/cpp/thirdparty/cmake/bgfx/3rdparty/glslang.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/3rdparty/glslang.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/3rdparty/glslang.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/3rdparty/meshoptimizer.cmake b/Engine/cpp/thirdparty/cmake/bgfx/3rdparty/meshoptimizer.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/3rdparty/meshoptimizer.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/3rdparty/meshoptimizer.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/3rdparty/spirv-cross.cmake b/Engine/cpp/thirdparty/cmake/bgfx/3rdparty/spirv-cross.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/3rdparty/spirv-cross.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/3rdparty/spirv-cross.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/3rdparty/spirv-opt.cmake b/Engine/cpp/thirdparty/cmake/bgfx/3rdparty/spirv-opt.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/3rdparty/spirv-opt.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/3rdparty/spirv-opt.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/3rdparty/tint.cmake b/Engine/cpp/thirdparty/cmake/bgfx/3rdparty/tint.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/3rdparty/tint.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/3rdparty/tint.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/3rdparty/webgpu.cmake b/Engine/cpp/thirdparty/cmake/bgfx/3rdparty/webgpu.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/3rdparty/webgpu.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/3rdparty/webgpu.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/CMakeLists.txt b/Engine/cpp/thirdparty/cmake/bgfx/CMakeLists.txt similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/CMakeLists.txt rename to Engine/cpp/thirdparty/cmake/bgfx/CMakeLists.txt diff --git a/engine/native/thirdparty/cmake/bgfx/bgfx.cmake b/Engine/cpp/thirdparty/cmake/bgfx/bgfx.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/bgfx.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/bgfx.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/examples.cmake b/Engine/cpp/thirdparty/cmake/bgfx/examples.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/examples.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/examples.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/generated/bounds.cpp.in b/Engine/cpp/thirdparty/cmake/bgfx/generated/bounds.cpp.in similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/generated/bounds.cpp.in rename to Engine/cpp/thirdparty/cmake/bgfx/generated/bounds.cpp.in diff --git a/engine/native/thirdparty/cmake/bgfx/generated/shader.cpp.in b/Engine/cpp/thirdparty/cmake/bgfx/generated/shader.cpp.in similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/generated/shader.cpp.in rename to Engine/cpp/thirdparty/cmake/bgfx/generated/shader.cpp.in diff --git a/engine/native/thirdparty/cmake/bgfx/generated/vertexlayout.cpp.in b/Engine/cpp/thirdparty/cmake/bgfx/generated/vertexlayout.cpp.in similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/generated/vertexlayout.cpp.in rename to Engine/cpp/thirdparty/cmake/bgfx/generated/vertexlayout.cpp.in diff --git a/engine/native/thirdparty/cmake/bgfx/geometryc.cmake b/Engine/cpp/thirdparty/cmake/bgfx/geometryc.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/geometryc.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/geometryc.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/geometryv.cmake b/Engine/cpp/thirdparty/cmake/bgfx/geometryv.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/geometryv.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/geometryv.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/shaderc.cmake b/Engine/cpp/thirdparty/cmake/bgfx/shaderc.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/shaderc.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/shaderc.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/shared.cmake b/Engine/cpp/thirdparty/cmake/bgfx/shared.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/shared.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/shared.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/texturev.cmake b/Engine/cpp/thirdparty/cmake/bgfx/texturev.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/texturev.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/texturev.cmake diff --git a/engine/native/thirdparty/cmake/bgfx/util/ConfigureDebugging.cmake b/Engine/cpp/thirdparty/cmake/bgfx/util/ConfigureDebugging.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfx/util/ConfigureDebugging.cmake rename to Engine/cpp/thirdparty/cmake/bgfx/util/ConfigureDebugging.cmake diff --git a/engine/native/thirdparty/cmake/bgfxToolUtils.cmake b/Engine/cpp/thirdparty/cmake/bgfxToolUtils.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bgfxToolUtils.cmake rename to Engine/cpp/thirdparty/cmake/bgfxToolUtils.cmake diff --git a/engine/native/thirdparty/cmake/bimg/3rdparty/astc_encoder.cmake b/Engine/cpp/thirdparty/cmake/bimg/3rdparty/astc_encoder.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/3rdparty/astc_encoder.cmake rename to Engine/cpp/thirdparty/cmake/bimg/3rdparty/astc_encoder.cmake diff --git a/engine/native/thirdparty/cmake/bimg/3rdparty/edtaa3.cmake b/Engine/cpp/thirdparty/cmake/bimg/3rdparty/edtaa3.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/3rdparty/edtaa3.cmake rename to Engine/cpp/thirdparty/cmake/bimg/3rdparty/edtaa3.cmake diff --git a/engine/native/thirdparty/cmake/bimg/3rdparty/etc1.cmake b/Engine/cpp/thirdparty/cmake/bimg/3rdparty/etc1.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/3rdparty/etc1.cmake rename to Engine/cpp/thirdparty/cmake/bimg/3rdparty/etc1.cmake diff --git a/engine/native/thirdparty/cmake/bimg/3rdparty/etc2.cmake b/Engine/cpp/thirdparty/cmake/bimg/3rdparty/etc2.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/3rdparty/etc2.cmake rename to Engine/cpp/thirdparty/cmake/bimg/3rdparty/etc2.cmake diff --git a/engine/native/thirdparty/cmake/bimg/3rdparty/iqa.cmake b/Engine/cpp/thirdparty/cmake/bimg/3rdparty/iqa.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/3rdparty/iqa.cmake rename to Engine/cpp/thirdparty/cmake/bimg/3rdparty/iqa.cmake diff --git a/engine/native/thirdparty/cmake/bimg/3rdparty/libsquish.cmake b/Engine/cpp/thirdparty/cmake/bimg/3rdparty/libsquish.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/3rdparty/libsquish.cmake rename to Engine/cpp/thirdparty/cmake/bimg/3rdparty/libsquish.cmake diff --git a/engine/native/thirdparty/cmake/bimg/3rdparty/loadpng.cmake b/Engine/cpp/thirdparty/cmake/bimg/3rdparty/loadpng.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/3rdparty/loadpng.cmake rename to Engine/cpp/thirdparty/cmake/bimg/3rdparty/loadpng.cmake diff --git a/engine/native/thirdparty/cmake/bimg/3rdparty/miniz.cmake b/Engine/cpp/thirdparty/cmake/bimg/3rdparty/miniz.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/3rdparty/miniz.cmake rename to Engine/cpp/thirdparty/cmake/bimg/3rdparty/miniz.cmake diff --git a/engine/native/thirdparty/cmake/bimg/3rdparty/nvtt.cmake b/Engine/cpp/thirdparty/cmake/bimg/3rdparty/nvtt.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/3rdparty/nvtt.cmake rename to Engine/cpp/thirdparty/cmake/bimg/3rdparty/nvtt.cmake diff --git a/engine/native/thirdparty/cmake/bimg/3rdparty/pvrtc.cmake b/Engine/cpp/thirdparty/cmake/bimg/3rdparty/pvrtc.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/3rdparty/pvrtc.cmake rename to Engine/cpp/thirdparty/cmake/bimg/3rdparty/pvrtc.cmake diff --git a/engine/native/thirdparty/cmake/bimg/3rdparty/tinyexr.cmake b/Engine/cpp/thirdparty/cmake/bimg/3rdparty/tinyexr.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/3rdparty/tinyexr.cmake rename to Engine/cpp/thirdparty/cmake/bimg/3rdparty/tinyexr.cmake diff --git a/engine/native/thirdparty/cmake/bimg/CMakeLists.txt b/Engine/cpp/thirdparty/cmake/bimg/CMakeLists.txt similarity index 100% rename from engine/native/thirdparty/cmake/bimg/CMakeLists.txt rename to Engine/cpp/thirdparty/cmake/bimg/CMakeLists.txt diff --git a/engine/native/thirdparty/cmake/bimg/bimg.cmake b/Engine/cpp/thirdparty/cmake/bimg/bimg.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/bimg.cmake rename to Engine/cpp/thirdparty/cmake/bimg/bimg.cmake diff --git a/engine/native/thirdparty/cmake/bimg/bimg_decode.cmake b/Engine/cpp/thirdparty/cmake/bimg/bimg_decode.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/bimg_decode.cmake rename to Engine/cpp/thirdparty/cmake/bimg/bimg_decode.cmake diff --git a/engine/native/thirdparty/cmake/bimg/bimg_encode.cmake b/Engine/cpp/thirdparty/cmake/bimg/bimg_encode.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/bimg_encode.cmake rename to Engine/cpp/thirdparty/cmake/bimg/bimg_encode.cmake diff --git a/engine/native/thirdparty/cmake/bimg/texturec.cmake b/Engine/cpp/thirdparty/cmake/bimg/texturec.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bimg/texturec.cmake rename to Engine/cpp/thirdparty/cmake/bimg/texturec.cmake diff --git a/engine/native/thirdparty/cmake/bx/CMakeLists.txt b/Engine/cpp/thirdparty/cmake/bx/CMakeLists.txt similarity index 100% rename from engine/native/thirdparty/cmake/bx/CMakeLists.txt rename to Engine/cpp/thirdparty/cmake/bx/CMakeLists.txt diff --git a/engine/native/thirdparty/cmake/bx/bin2c.cmake b/Engine/cpp/thirdparty/cmake/bx/bin2c.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bx/bin2c.cmake rename to Engine/cpp/thirdparty/cmake/bx/bin2c.cmake diff --git a/engine/native/thirdparty/cmake/bx/bx.cmake b/Engine/cpp/thirdparty/cmake/bx/bx.cmake similarity index 100% rename from engine/native/thirdparty/cmake/bx/bx.cmake rename to Engine/cpp/thirdparty/cmake/bx/bx.cmake diff --git a/engine/native/thirdparty/cmake/version.cmake b/Engine/cpp/thirdparty/cmake/version.cmake similarity index 100% rename from engine/native/thirdparty/cmake/version.cmake rename to Engine/cpp/thirdparty/cmake/version.cmake diff --git a/engine/native/thirdparty/doctest/doctest.h b/Engine/cpp/thirdparty/doctest/doctest.h similarity index 100% rename from engine/native/thirdparty/doctest/doctest.h rename to Engine/cpp/thirdparty/doctest/doctest.h diff --git a/engine/native/thirdparty/doctest/doctest_with_main.h b/Engine/cpp/thirdparty/doctest/doctest_with_main.h similarity index 100% rename from engine/native/thirdparty/doctest/doctest_with_main.h rename to Engine/cpp/thirdparty/doctest/doctest_with_main.h diff --git a/engine/native/thirdparty/stb/CMakeLists.txt b/Engine/cpp/thirdparty/stb/CMakeLists.txt similarity index 100% rename from engine/native/thirdparty/stb/CMakeLists.txt rename to Engine/cpp/thirdparty/stb/CMakeLists.txt diff --git a/engine/native/thirdparty/stb/stb_image.h b/Engine/cpp/thirdparty/stb/stb_image.h similarity index 100% rename from engine/native/thirdparty/stb/stb_image.h rename to Engine/cpp/thirdparty/stb/stb_image.h diff --git a/README.md b/README.md index 56182ccc..6cbe427e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

- Draconic Engine Logo + Draconic Engine Logo

@@ -43,4 +43,4 @@ Draconic Engine is a two-tiered project, with an inner core written in C++ and a public interface and editor in C#. Regarding the native layer, it is written in C++, according to the C++23 standard and using modules. -Documentation regarding how C++ modules are used can be read [here](docs/cxxmodules.md). +Documentation regarding how C++ modules are used can be read [here](Docs/cxxmodules.md). diff --git a/Samples/cpp/CMakeLists.txt b/Samples/cpp/CMakeLists.txt new file mode 100644 index 00000000..5ed5dfae --- /dev/null +++ b/Samples/cpp/CMakeLists.txt @@ -0,0 +1,38 @@ +# +# Rendering Sample +# +add_executable(Render rendering.cpp) + +target_link_libraries(Render + PRIVATE + runtime + bgfx + bx + bimg +) + +if(UNIX AND NOT APPLE) + target_link_libraries(Render PRIVATE SDL3::SDL3-static Threads::Threads dl) + target_link_options(Render PRIVATE -Wl,--whole-archive $ -Wl,--no-whole-archive) +elseif(APPLE) + target_link_libraries(Render PRIVATE SDL3::SDL3-static) + target_link_options(Render PRIVATE -Wl,-force_load,$) +else() + target_link_libraries(Render PRIVATE SDL3::SDL3-static) +endif() + +compile_shaders(Render) + +set(TEST_IMAGE + "${CMAKE_SOURCE_DIR}/Docs/assets/draconic_logo_no_text.png" +) + +add_custom_command( + TARGET Render POST_BUILD + + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${TEST_IMAGE} + $/test.png + + COMMENT "Copying test texture..." +) diff --git a/engine/native/main/main.cpp b/Samples/cpp/rendering.cpp similarity index 86% rename from engine/native/main/main.cpp rename to Samples/cpp/rendering.cpp index 726ea8e1..6dd2da9a 100644 --- a/engine/native/main/main.cpp +++ b/Samples/cpp/rendering.cpp @@ -16,7 +16,7 @@ int main(int argc, char* argv[]) } SDL_Window* window = SDL_CreateWindow( - "Draconic Engine", + "Draconic Engine Rendering Sample", 1280, 720, SDL_WINDOW_RESIZABLE ); @@ -112,30 +112,31 @@ int main(int argc, char* argv[]) mat.sampler = s_texColor; mat.uniforms.push_back({.name_hash = draco::rendering::rhi::hash_uniform("u_tint"), .data = tint, .count = 1}); - mat.uniforms.push_back({.name_hash = draco::rendering::rhi::hash_uniform("u_offset"), .data = offset, .count = 1}); draco::scene::Scene scene; - scene.renderables.push_back({cube_mesh, draco::math::make_transform(), mat}); - scene.renderables.push_back({plane_mesh, draco::math::make_transform(), mat}); - scene.renderables.push_back({sphere_mesh, draco::math::make_transform(), mat}); - scene.renderables.push_back({cylinder_mesh, draco::math::make_transform(), mat}); - scene.renderables.push_back({capsule_mesh, draco::math::make_transform(), mat}); + static constexpr draco::math::Transform tr; + + scene.renderables.push_back({cube_mesh, tr, mat}); + scene.renderables.push_back({plane_mesh, tr, mat}); + scene.renderables.push_back({sphere_mesh, tr, mat}); + scene.renderables.push_back({cylinder_mesh, tr, mat}); + scene.renderables.push_back({capsule_mesh, tr, mat}); - draco::math::set_position(scene.renderables[0].transform, -12.0f, 0.0f, 0.0f); - draco::math::set_position(scene.renderables[1].transform, -6.0f, 0.0f, 0.0f); - draco::math::set_position(scene.renderables[2].transform, 0.0f, 0.0f, 0.0f); - draco::math::set_position(scene.renderables[3].transform, 6.0f, 0.0f, 0.0f); - draco::math::set_position(scene.renderables[4].transform, 12.0f, 0.0f, 0.0f); + scene.renderables[0].transform.set_position(-12.0f, 0.0f, 0.0f); + scene.renderables[1].transform.set_position(-6.0f, 0.0f, 0.0f); + scene.renderables[2].transform.set_position(0.0f, 0.0f, 0.0f); + scene.renderables[3].transform.set_position(6.0f, 0.0f, 0.0f); + scene.renderables[4].transform.set_position(12.0f, 0.0f, 0.0f); - draco::math::set_rotation(scene.renderables[1].transform, -bx::kPiHalf, 0.0f, 0.0f); + scene.renderables[1].transform.set_rotation(-bx::kPiHalf, 0.0f, 0.0f); while (running) { static draco::u64 last = SDL_GetTicks(); draco::u64 now = SDL_GetTicks(); - draco::f32 dt = (now - last) / 1000.0f; + draco::f32 dt = static_cast(now - last) / 1000.0f; last = now; SDL_Event e; diff --git a/cmake/Modules.cmake b/cmake/Modules.cmake index 45a14f3c..f29d7615 100644 --- a/cmake/Modules.cmake +++ b/cmake/Modules.cmake @@ -1,6 +1,6 @@ include_guard(GLOBAL) -set(NATIVE_SOURCE_DIR "${PROJECT_SOURCE_DIR}/engine/native") +set(NATIVE_SOURCE_DIR "${PROJECT_SOURCE_DIR}/Engine/cpp") set(NATIVE_THIRD_PARTY_DIR "${NATIVE_SOURCE_DIR}/thirdparty") diff --git a/cmake/Shaders.cmake b/cmake/Shaders.cmake index 2eab7355..5085555b 100644 --- a/cmake/Shaders.cmake +++ b/cmake/Shaders.cmake @@ -1,8 +1,8 @@ include_guard(GLOBAL) -set(SHADER_SRC_DIR "${CMAKE_SOURCE_DIR}/engine/native/rendering/shaders") +set(SHADER_SRC_DIR "${CMAKE_SOURCE_DIR}/Engine/cpp/runtime/rendering/shaders") set(SHADER_BIN_DIR "${CMAKE_BINARY_DIR}") -set(BGFX_INCLUDE "${CMAKE_SOURCE_DIR}/engine/native/thirdparty/bgfx/src") +set(BGFX_INCLUDE "${CMAKE_SOURCE_DIR}/Engine/cpp/thirdparty/bgfx/src") function(compile_shaders TARGET_NAME) file(MAKE_DIRECTORY ${SHADER_BIN_DIR}) @@ -37,7 +37,7 @@ function(compile_shaders TARGET_NAME) set(QUAD_VARYING_DEF "${SHADER_SRC_DIR}/varying_quad.def.sc") add_custom_command( - TARGET draconic POST_BUILD + TARGET ${TARGET_NAME} POST_BUILD COMMENT "Compiling asset pipelines and core engine shaders via native tools..." COMMAND $ @@ -76,9 +76,9 @@ function(compile_shaders TARGET_NAME) --varyingdef ${QUAD_VARYING_DEF} -i ${BGFX_INCLUDE} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VERTEX_OUTPUT} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FRAGMENT_OUTPUT} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QUAD_VERTEX_OUTPUT} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QUAD_FRAGMENT_OUTPUT} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VERTEX_OUTPUT} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FRAGMENT_OUTPUT} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QUAD_VERTEX_OUTPUT} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QUAD_FRAGMENT_OUTPUT} $ ) endfunction() diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt deleted file mode 100644 index b2417e14..00000000 --- a/engine/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_modules_library(native) -target_link_libraries(native PUBLIC platform core input scene rendering) \ No newline at end of file diff --git a/engine/native/core/math/transform.cpp b/engine/native/core/math/transform.cpp deleted file mode 100644 index 2538a51c..00000000 --- a/engine/native/core/math/transform.cpp +++ /dev/null @@ -1,78 +0,0 @@ -module; - -#include - -#include - -module core.math.transform; - -import core.stdtypes; - -namespace draco::math -{ - Transform make_transform() - { - Transform t; - - t.position[0] = 0.0f; - t.position[1] = 0.0f; - t.position[2] = 0.0f; - - t.rotation[0] = 0.0f; - t.rotation[1] = 0.0f; - t.rotation[2] = 0.0f; - - t.scale[0] = 1.0f; - t.scale[1] = 1.0f; - t.scale[2] = 1.0f; - - return t; - } - - void set_position(Transform& t, f32 x, f32 y, f32 z) - { - t.position[0] = x; - t.position[1] = y; - t.position[2] = z; - } - - void set_rotation(Transform& t, f32 x, f32 y, f32 z) - { - t.rotation[0] = x; - t.rotation[1] = y; - t.rotation[2] = z; - } - - void set_scale(Transform& t, f32 x, f32 y, f32 z) - { - t.scale[0] = x; - t.scale[1] = y; - t.scale[2] = z; - } - - void compute_matrix(const Transform& t, f32 out[16]) - { - f32 translation[16]; - f32 rx[16]; - f32 ry[16]; - f32 rz[16]; - f32 scale[16]; - f32 temp[16]; - - bx::mtxIdentity(out); - - bx::mtxScale(scale, t.scale[0], t.scale[1], t.scale[2]); - - bx::mtxRotateX(rx, t.rotation[0]); - bx::mtxRotateY(ry, t.rotation[1]); - bx::mtxRotateZ(rz, t.rotation[2]); - - bx::mtxTranslate(translation, t.position[0], t.position[1], t.position[2]); - - // scale * rotation * translation - bx::mtxMul(temp, scale, rx); - bx::mtxMul(temp, temp, ry); - bx::mtxMul(temp, temp, rz); - bx::mtxMul(out, temp, translation); - } -} diff --git a/engine/native/core/math/transform.cppm b/engine/native/core/math/transform.cppm deleted file mode 100644 index fc1a5893..00000000 --- a/engine/native/core/math/transform.cppm +++ /dev/null @@ -1,32 +0,0 @@ -module; - -#include - -#include - -export module core.math.transform; - -import core.stdtypes; - -export namespace draco::math -{ - struct Transform - { - f32 position[3] = { 0.0f, 0.0f, 0.0f }; - f32 rotation[3] = { 0.0f, 0.0f, 0.0f }; // Euler (radians) - f32 scale[3] = { 1.0f, 1.0f, 1.0f }; - }; - - // TODO: Besides compute_matrix, we should make rest of the funcs constexpr funcs - - // Creates a default identity transform - Transform make_transform(); - - // Recompute matrix from transform (column-major) - void compute_matrix(const Transform& t, f32 out[16]); - - // Helpers - void set_position(Transform& t, f32 x, f32 y, f32 z); - void set_rotation(Transform& t, f32 x, f32 y, f32 z); - void set_scale(Transform& t, f32 x, f32 y, f32 z); -} diff --git a/engine/native/thirdparty/bgfx b/engine/native/thirdparty/bgfx deleted file mode 160000 index 8532b2c4..00000000 --- a/engine/native/thirdparty/bgfx +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8532b2c45d2f4332a9ac9734b85c2ea2253cb8d5 diff --git a/engine/native/thirdparty/bimg b/engine/native/thirdparty/bimg deleted file mode 160000 index 9114b47f..00000000 --- a/engine/native/thirdparty/bimg +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9114b47f532ce59cd0c6c9f8932df2c48888d4c1 diff --git a/engine/native/thirdparty/bx b/engine/native/thirdparty/bx deleted file mode 160000 index cac72f6c..00000000 --- a/engine/native/thirdparty/bx +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cac72f6cfa0893393ea12692ebfacb4495f8c826 diff --git a/engine/native/thirdparty/sdl b/engine/native/thirdparty/sdl deleted file mode 160000 index 1aa72247..00000000 --- a/engine/native/thirdparty/sdl +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1aa72247af95802d897dabd51b29311e87c41ae0 From ba5f87072a909689ddec6cc60f43fab1612abfe4 Mon Sep 17 00:00:00 2001 From: Francisco Miguel Almeida Date: Mon, 15 Jun 2026 01:45:48 +0200 Subject: [PATCH 6/7] fix submodules --- Engine/cpp/thirdparty/bgfx | 1 + Engine/cpp/thirdparty/bimg | 1 + Engine/cpp/thirdparty/bx | 1 + Engine/cpp/thirdparty/sdl | 1 + 4 files changed, 4 insertions(+) create mode 160000 Engine/cpp/thirdparty/bgfx create mode 160000 Engine/cpp/thirdparty/bimg create mode 160000 Engine/cpp/thirdparty/bx create mode 160000 Engine/cpp/thirdparty/sdl diff --git a/Engine/cpp/thirdparty/bgfx b/Engine/cpp/thirdparty/bgfx new file mode 160000 index 00000000..15ef88c4 --- /dev/null +++ b/Engine/cpp/thirdparty/bgfx @@ -0,0 +1 @@ +Subproject commit 15ef88c43a425fdc288d2eab8329b77816b65a69 diff --git a/Engine/cpp/thirdparty/bimg b/Engine/cpp/thirdparty/bimg new file mode 160000 index 00000000..0d3cfc25 --- /dev/null +++ b/Engine/cpp/thirdparty/bimg @@ -0,0 +1 @@ +Subproject commit 0d3cfc25b51097cb9ea2517d041b58dd12cf689c diff --git a/Engine/cpp/thirdparty/bx b/Engine/cpp/thirdparty/bx new file mode 160000 index 00000000..64dcc737 --- /dev/null +++ b/Engine/cpp/thirdparty/bx @@ -0,0 +1 @@ +Subproject commit 64dcc737a016cd41ad9705fb69c905d566813f04 diff --git a/Engine/cpp/thirdparty/sdl b/Engine/cpp/thirdparty/sdl new file mode 160000 index 00000000..51e214a0 --- /dev/null +++ b/Engine/cpp/thirdparty/sdl @@ -0,0 +1 @@ +Subproject commit 51e214a0124d5113e5d5378c9088b10bed96cb34 From 5386b552c36c3d8cd3531156c972b719edb83e86 Mon Sep 17 00:00:00 2001 From: Francisco Miguel Almeida Date: Mon, 15 Jun 2026 09:09:28 +0200 Subject: [PATCH 7/7] restore previous submodule commit hooks --- Engine/cpp/thirdparty/bgfx | 2 +- Engine/cpp/thirdparty/bimg | 2 +- Engine/cpp/thirdparty/bx | 2 +- Engine/cpp/thirdparty/sdl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Engine/cpp/thirdparty/bgfx b/Engine/cpp/thirdparty/bgfx index 15ef88c4..8532b2c4 160000 --- a/Engine/cpp/thirdparty/bgfx +++ b/Engine/cpp/thirdparty/bgfx @@ -1 +1 @@ -Subproject commit 15ef88c43a425fdc288d2eab8329b77816b65a69 +Subproject commit 8532b2c45d2f4332a9ac9734b85c2ea2253cb8d5 diff --git a/Engine/cpp/thirdparty/bimg b/Engine/cpp/thirdparty/bimg index 0d3cfc25..9114b47f 160000 --- a/Engine/cpp/thirdparty/bimg +++ b/Engine/cpp/thirdparty/bimg @@ -1 +1 @@ -Subproject commit 0d3cfc25b51097cb9ea2517d041b58dd12cf689c +Subproject commit 9114b47f532ce59cd0c6c9f8932df2c48888d4c1 diff --git a/Engine/cpp/thirdparty/bx b/Engine/cpp/thirdparty/bx index 64dcc737..cac72f6c 160000 --- a/Engine/cpp/thirdparty/bx +++ b/Engine/cpp/thirdparty/bx @@ -1 +1 @@ -Subproject commit 64dcc737a016cd41ad9705fb69c905d566813f04 +Subproject commit cac72f6cfa0893393ea12692ebfacb4495f8c826 diff --git a/Engine/cpp/thirdparty/sdl b/Engine/cpp/thirdparty/sdl index 51e214a0..1aa72247 160000 --- a/Engine/cpp/thirdparty/sdl +++ b/Engine/cpp/thirdparty/sdl @@ -1 +1 @@ -Subproject commit 51e214a0124d5113e5d5378c9088b10bed96cb34 +Subproject commit 1aa72247af95802d897dabd51b29311e87c41ae0