Fix spdlog include.

This commit is contained in:
THoehne
2024-09-19 15:41:33 +02:00
parent 2cd51e29ac
commit 44e16fc8fb
197 changed files with 33037 additions and 185 deletions

View File

@@ -36,7 +36,7 @@
#else
#error The target system must be defined. (See https://github.com/scorpioblood/PhanesEngine for more information)
#error The target system must be defined. (See https://github.com/thoehne/PhanesEngine for more information)
#endif // P_WIN_BUILD

View File

@@ -9,17 +9,15 @@
#include "Core/public/StartingPoint/EntryPoint.h"
// --- OSAL ----------------------------------------
#include "Core/public/HAL/PlatformTypes.h"
#ifdef P_USE_NAMESPACE_ALIAS
// Starting point
namespace PApp = Phanes::Core::Application;
// Starting point
namespace PApp = Phanes::Core::Application;
#endif

View File

@@ -7,49 +7,49 @@
static void IdleMsg()
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, 12);
std::cout << "Welcome to PhanesEngine!" << std::endl << std::endl;
SetConsoleTextAttribute(hConsole, 15);
std::this_thread::sleep_for(std::chrono::seconds(5));
std::cout << "It's silent..." << std::endl << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(3));
std::cout << "To silent." << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(5));
std::cout << "\nI will go now" << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(4));
std::cout << "\nGood by!" << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(3));
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, 12);
std::cout << "\n\nWelcome to PhanesEngine!" << std::endl << std::endl;
SetConsoleTextAttribute(hConsole, 15);
std::this_thread::sleep_for(std::chrono::seconds(5));
std::cout << "It's silent..." << std::endl << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(3));
std::cout << "To silent." << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(5));
std::cout << "\nI will go now" << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(4));
std::cout << "\nGood by!" << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(3));
}
Phanes::Core::Application::PhanesProject::PhanesProject(std::string _ProjectName) : projectName(_ProjectName)
{
}
Phanes::Core::Application::PhanesProject::PhanesProject(std::string _ProjectName)
: projectName(_ProjectName)
{};
Phanes::Core::Application::PhanesProject::~PhanesProject()
{
}
this->projectName = "Unnamed Project";
};
std::string Phanes::Core::Application::PhanesProject::GetName()
{
return this->projectName;
return this->projectName;
}
void Phanes::Core::Application::PhanesProject::Run()
{
std::cin.get();
IdleMsg();
}

View File

@@ -1,7 +1,5 @@
#pragma once
#include "PhanesEnginePCH.h"
// ============================================= //
// Turn os specific types into global types. //
// ============================================= //

View File

@@ -1,7 +1,7 @@
#pragma once
#include "PhanesEnginePCH.h"
#include "PhanesEnginePCH.h"
#include "Core/Core.h"
#ifndef P_DEBUG

View File

@@ -7,6 +7,9 @@ namespace Phanes::Core::Math::Detail
template<RealType T, bool S>
struct construct_vec3 {};
template<RealType T, bool S>
struct move_vec3 {};
template<RealType T, bool S>
struct compute_vec3_add {};
@@ -65,49 +68,43 @@ namespace Phanes::Core::Math::Detail
template<RealType T>
struct construct_vec3<T, false>
{
static constexpr void map(Phanes::Core::Math::TVector3<T, false>& v1, const TVector3<T, false>& v2)
static constexpr void map(Phanes::Core::Math::TVector3<T, false>& r, const TVector3<T, false>& v1)
{
v1.x = v2.x;
v1.y = v2.y;
v1.z = v2.z;
v1.w = (T)0.0;
memcpy(r.data, v1.data, 4 * sizeof(T));
}
static constexpr void map(Phanes::Core::Math::TVector3<T, false>& r, T s)
{
r.x = s;
r.y = s;
r.z = s;
r.w = (T)0.0;
}
static constexpr void map(Phanes::Core::Math::TVector3<T, false>& r, T x, T y, T z)
{
r.x = x;
r.y = y;
r.z = z;
r.w = (T)0.0;
}
static constexpr void map(Phanes::Core::Math::TVector3<T, false>& r, const Phanes::Core::Math::TVector2<T, false>& v1, T s)
{
r.x = v1.x;
r.y = v1.y;
r.z = s;
r.w = (T)0.0;
}
static constexpr void map(Phanes::Core::Math::TVector3<T, false>& v1, T s)
static constexpr void map(Phanes::Core::Math::TVector3<T, false>& r, const T* comp)
{
v1.x = s;
v1.y = s;
v1.z = s;
v1.w = (T)0.0;
}
static constexpr void map(Phanes::Core::Math::TVector3<T, false>& v1, T x, T y, T z)
{
v1.x = x;
v1.y = y;
v1.z = z;
v1.w = (T)0.0;
}
static constexpr void map(Phanes::Core::Math::TVector3<T, false>& v1, const Phanes::Core::Math::TVector2<T, false>& v2, T s)
{
v1.x = v2.x;
v1.y = v2.y;
v1.z = s;
}
static constexpr void map(Phanes::Core::Math::TVector3<T, false>& v1, const T* comp)
{
v1.x = comp[0];
v1.y = comp[1];
v1.z = comp[2];
v1.w = (T)0.0;
memcpy(r.data, comp, 3 * sizeof(T));
r.w = (T)0.0;
}
};
template<RealType T>
struct compute_vec3_add<T, false>
{

View File

@@ -7,6 +7,9 @@ namespace Phanes::Core::Math::Detail
template<RealType T, bool S>
struct construct_vec4 {};
template<RealType T, bool S>
struct move_vec4 {};
template<RealType T, bool S>
struct compute_vec4_add {};
@@ -60,47 +63,43 @@ namespace Phanes::Core::Math::Detail
template<RealType T>
struct construct_vec4<T, false>
{
static constexpr void map(Phanes::Core::Math::TVector4<T, false>& v1, const TVector4<T, false>& v2)
static constexpr void map(Phanes::Core::Math::TVector4<T, false>& r, const TVector4<T, false>& v1)
{
v1.x = v2.x;
v1.y = v2.y;
v1.z = v2.z;
v1.w = v2.w;
memcpy(r.data, v1.data, 4 * sizeof(T));
}
static constexpr void map(Phanes::Core::Math::TVector4<T, false>& r, T s)
{
r.x = s;
r.y = s;
r.z = s;
r.w = s;
}
static constexpr void map(Phanes::Core::Math::TVector4<T, false>& r, T x, T y, T z, T w)
{
r.x = x;
r.y = y;
r.z = z;
r.w = w;
}
static constexpr void map(Phanes::Core::Math::TVector4<T, false>& r, const Phanes::Core::Math::TVector2<T, false>& v2, const Phanes::Core::Math::TVector2<T, false>& v3)
{
r.x = v2.x;
r.y = v2.y;
r.z = v3.x;
r.w = v3.y;
}
static constexpr void map(Phanes::Core::Math::TVector4<T, false>& v1, T s)
static constexpr void map(Phanes::Core::Math::TVector4<T, false>& r, const T* comp)
{
v1.x = s;
v1.y = s;
v1.z = s;
v1.w = s;
}
static constexpr void map(Phanes::Core::Math::TVector4<T, false>& v1, T x, T y, T z, T w)
{
v1.x = x;
v1.y = y;
v1.z = z;
v1.w = w;
}
static constexpr void map(Phanes::Core::Math::TVector4<T, false>& v1, const Phanes::Core::Math::TVector2<T, false>& v2, const Phanes::Core::Math::TVector2<T, false>& v3)
{
v1.x = v2.x;
v1.y = v2.y;
v1.z = v3.x;
v1.w = v3.y;
}
static constexpr void map(Phanes::Core::Math::TVector4<T, false>& v1, const T* comp)
{
memcpy(v1.data, comp, 4 * sizeof(T));
memcpy(r.data, comp, 4 * sizeof(T));
}
};
template<RealType T>
struct compute_vec4_add<T, false>
{

View File

@@ -3,21 +3,25 @@
#pragma once
#include "Point.hpp"
#include "Plane.hpp"
#include "Vector2.hpp"
#include "Vector3.hpp"
#include "Vector4.hpp"
#include "Core/public/Math/Point.hpp"
#include "Core/public/Math/Plane.hpp"
#include "Core/public/Math/Line.hpp"
#include "Core/public/Math/Ray.hpp"
#include "IntPoint.hpp"
#include "IntVector2.hpp"
#include "IntVector3.hpp"
#include "IntVector4.hpp"
#include "Matrix2.hpp"
#include "Matrix3.hpp"
#include "Matrix4.hpp"
#include "Core/public/Math/Vector2.hpp"
#include "Core/public/Math/Vector3.hpp"
#include "Core/public/Math/Vector4.hpp"
#include "MathCommon.hpp"
#include "MathTypeConversion.hpp"
#include "MathUnitConversion.hpp"
#include "Core/public/Math/IntPoint.hpp"
#include "Core/public/Math/IntVector2.hpp"
#include "Core/public/Math/IntVector3.hpp"
#include "Core/public/Math/IntVector4.hpp"
#include "Core/public/Math/Matrix2.hpp"
#include "Core/public/Math/Matrix3.hpp"
#include "Core/public/Math/Matrix4.hpp"
#include "Core/public/Math/MathCommon.hpp"
#include "Core/public/Math/MathTypeConversion.hpp"
#include "Core/public/Math/MathUnitConversion.hpp"

View File

@@ -49,17 +49,14 @@ namespace Phanes::Core::Math {
public:
TMatrix3() = default;
TMatrix3(TMatrix3<T, S>&& m)
: c0(std::move(m.c0)), c1(std::move(m.c1)), c2(std::move(m.c2))
{};
/**
* Copy constructor.
*/
TMatrix3(const TMatrix3<T, S>& m1)
{
this->c0 = TVector3<T, S>(m1.c0);
this->c1 = TVector3<T, S>(m1.c1);
this->c2 = TVector3<T, S>(m1.c2);
}
TMatrix3(const TMatrix3<T, S>& m)
: c0(m.c0), c1(m.c1), c2(m.c2)
{};
/**
* Construct Matrix from 2d array.
@@ -109,6 +106,28 @@ namespace Phanes::Core::Math {
this->c2 = v3;
}
TMatrix3<T, S>& operator= (TMatrix3<T, S>&& m)
{
if (this != &m)
{
this->c0 = std::move(m.c0);
this->c1 = std::move(m.c1);
this->c2 = std::move(m.c2);
}
return *this;
}
TMatrix3<T, S>& operator= (const TMatrix3<T, S>& m)
{
if (this != &m)
{
this->c0 = m.c0;
this->c1 = m.c1;
this->c2 = m.c2;
}
return *this;
}
public:
FORCEINLINE T operator() (int n, int m) const

View File

@@ -38,17 +38,21 @@ namespace Phanes::Core::Math {
/// </summary>
TMatrix4() = default;
/// <summary>
/// Move constructor
/// </summary>
/// <param name="v"></param>
TMatrix4(TMatrix4<T, S>&& m)
: c0(std::move(m.c0)), c1(std::move(m.c1)), c2(std::move(m.c2)), c3(std::move(m.c3))
{};
/// <summary>
/// Copy constructor
/// </summary>
/// <param name="v"></param>
TMatrix4(const TMatrix4<T, S>& m)
{
this->c0 = m.c0;
this->c1 = m.c1;
this->c2 = m.c2;
this->c3 = m.c3;
}
: c0(m.c0), c1(m.c1), c2(m.c2), c3(m.c3)
{};
/// <summary>
/// Construct matrix with values.
@@ -87,6 +91,30 @@ namespace Phanes::Core::Math {
this->c3 = TVector4(field[3]);
}
TMatrix4<T, S>& operator= (TMatrix4<T, S>&& m)
{
if (this != &m)
{
this->c0 = std::move(m.c0);
this->c1 = std::move(m.c1);
this->c2 = std::move(m.c2);
this->c3 = std::move(m.c3);
}
return *this;
}
TMatrix4<T, S>& operator= (const TMatrix4<T, S>& m)
{
if (this != &m)
{
this->c0 = m.c0;
this->c1 = m.c1;
this->c2 = m.c2;
this->c3 = m.c3;
}
return *this;
}
public:
FORCEINLINE T& operator() (int n, int m)

View File

@@ -0,0 +1,112 @@
#pragma once
#include "PhanesEnginePCH.h"
// ============================================= //
// Turn os specific types into global types. //
// ============================================= //
// TODO: include int128
namespace Phanes::Core::Types
{
#ifdef P_WIN_BUILD
// MSCV++ specific types
typedef FLOAT128 float128;
//#elif P_UNIX_BUILD
//
// // GCC specific types
//
// typedef __float128 float128;
#endif
// Specific types size
//
// 8-Bit integer
typedef int8_t int8;
// 16-Bit integer
typedef int16_t int16;
// 32-Bit integer
typedef int32_t int32;
// 64-Bit integer
typedef int64_t int64;
// 8-Bit unsigned integer
typedef uint8_t uint8;
// 16-Bit unsigned integer
typedef uint16_t uint16;
// 32-Bit unsigned integer
typedef uint32_t uint32;
// 64-Bit unsigned integer
typedef uint64_t uint64;
// At least N bit types
//
// At least 8-Bit integer
typedef int_least8_t lint8;
// At least 16-Bit integer
typedef int_least16_t lint16;
// At least 32-Bit integer
typedef int_least32_t lint32;
// At least 64-Bit integer
typedef int_least64_t lint64;
// At least 8-Bit integer
typedef uint_least8_t ulint8;
// At least 16-Bit integer
typedef uint_least16_t ulint16;
// At least 32-Bit integer
typedef uint_least32_t ulint32;
// At least 64-Bit integer
typedef uint_least64_t ulint64;
// Fast N bit types
//
// Fast 8-bit integer
typedef int_fast8_t fint8;
// At least 16-Bit integer
typedef int_fast16_t fint16;
// At least 32-Bit integer
typedef int_fast32_t fint32;
// At least 64-Bit integer
typedef int_fast64_t fint64;
// At least 8-Bit integer
typedef uint_fast8_t ufint8;
// At least 16-Bit integer
typedef uint_fast16_t ufint16;
// At least 32-Bit integer
typedef uint_fast32_t ufint32;
// At least 64-Bit integer
typedef uint_fast64_t ufint64;
}

View File

@@ -5,6 +5,7 @@
### Description
Math lib.
Math is designed, to be completly independent from the rest of Phanes.
### Notes

View File

@@ -132,7 +132,7 @@ namespace Phanes::Core::Math::Detail
{
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& v1, const TVector4<float, true>& v2)
{
v1.comp = _mm_setr_ps(v2.x, v2.y, v2.z, v2.w);
v1.comp = v2.comp;
}
@@ -154,10 +154,18 @@ namespace Phanes::Core::Math::Detail
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& v1, const float* s)
{
v1.comp = _mm_loadu_ps(s);
}
};
template<>
struct move_vec4<float, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& r, Phanes::Core::Math::TVector4<float, true>&& v)
{
r.data = v.data;
v.data = _mm_setzero_ps();
}
};
template<>
struct compute_vec4_add<float, true>
@@ -336,6 +344,16 @@ namespace Phanes::Core::Math::Detail
}
};
template<>
struct move_vec3<float, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector3<float, true>& r, Phanes::Core::Math::TVector3<float, true>&& v)
{
r.data = v.data;
v.data = _mm_setzero_ps();
}
};
template<>
struct compute_vec3_set<float, true>
{

View File

@@ -14,7 +14,7 @@ namespace Phanes::Core::Math::SIMD
template<size_t L, typename T>
struct Storage<L, T, false>
{
typedef T type[L];
typedef T type[4];
};
template<typename T>

View File

@@ -42,12 +42,6 @@ namespace Phanes::Core::Math {
/// </summary>
TVector3() = default;
/// <summary>
/// Copy constructor.
/// </summary>
/// <param name="v"></param>
TVector3(const TVector3<Real, S>& v);
/// <summary>
/// Broadcast s into x, y, z.
/// </summary>
@@ -74,7 +68,6 @@ namespace Phanes::Core::Math {
/// <param name="v">Vector</param>
/// <param name="s">Scalar</param>
TVector3(const TVector2<Real, S>& v, Real s);
};

View File

@@ -11,12 +11,6 @@
namespace Phanes::Core::Math
{
template<RealType T, bool S>
TVector3<T, S>::TVector3(const TVector3<Real, S>& v)
{
Detail::construct_vec3<T, S>::map(*this, v);
}
template<RealType T, bool S>
TVector3<T, S>::TVector3(Real _x, Real _y, Real _z)
{
@@ -38,12 +32,12 @@ namespace Phanes::Core::Math
template<RealType T, bool S>
TVector3<T, S>::TVector3(const Real* comp)
{
static_assert(sizeof(comp) >= sizeof(T) * 3, "Size of comp has to be of at least three (3) components.");
Detail::construct_vec3<T, S>::map(*this, comp);
}
template<RealType T, bool S>
TVector3<T, S>& operator+=(TVector3<T, S>& v1, const TVector3<T, S>& v2)
{

View File

@@ -4,7 +4,6 @@
#include "Core/public/Math/Boilerplate.h"
#include "Core/public/Math/MathCommon.hpp"
#include "Core/public/Math/SIMD/Storage.h"
#include "Core/public/Math/MathFwd.h"
@@ -20,6 +19,7 @@ namespace Phanes::Core::Math
template<RealType T, bool S = false>
struct TVector4
{
public:
using Real = T;
union
@@ -56,13 +56,11 @@ namespace Phanes::Core::Math
};
};
public:
/// Default constructor
TVector4() = default;
/// Copy constructor
TVector4(const TVector4<Real, S>& v);
/// <summary>
/// Construct vector from one scalar.
/// <para>x,y,z,w = s</para>

View File

@@ -10,12 +10,6 @@
namespace Phanes::Core::Math
{
template<RealType T, bool S>
TVector4<T, S>::TVector4(const TVector4<Real, S>& v)
{
Detail::construct_vec4<T, S>::map(*this, v);
}
template<RealType T, bool S>
TVector4<T, S>::TVector4(Real _x, Real _y, Real _z, Real _w)
{
@@ -37,6 +31,7 @@ namespace Phanes::Core::Math
template<RealType T, bool S>
Phanes::Core::Math::TVector4<T, S>::TVector4(const Real* comp)
{
static_assert(sizeof(comp) >= sizeof(T) * 4, "Size of comp has to be of at least four (4) components.");
Detail::construct_vec4<T, S>::map(*this, comp);
}

View File

@@ -1,7 +1,5 @@
#pragma once
#include "PhanesEnginePCH.h"
#include "Core/Core.h"
// Entrypoint class for any Phanes game.