Compare commits
No commits in common. "65a42f090482a085798c030a59ad18151bd6b068" and "14f3339eee86e7f8cdb40ed66455fcdfbe6fda2c" have entirely different histories.
65a42f0904
...
14f3339eee
49
.gitignore
vendored
49
.gitignore
vendored
@ -1,54 +1,21 @@
|
|||||||
# vscode
|
|
||||||
.premake/
|
|
||||||
|
|
||||||
# Exclude folders
|
# Exclude folders
|
||||||
bin/
|
bin/
|
||||||
int/
|
bin-int/
|
||||||
external/
|
external/
|
||||||
|
|
||||||
# Frequently edited tests
|
# Frequently edited tests
|
||||||
Tests/TestProject/
|
Tests/TestProject/
|
||||||
|
|
||||||
# Premake Build Files
|
# Exclude files
|
||||||
build/
|
|
||||||
Makefile
|
|
||||||
|
|
||||||
# C++
|
|
||||||
# Prerequisites
|
|
||||||
*.d
|
|
||||||
|
|
||||||
# Compiled Object files
|
|
||||||
*.slo
|
|
||||||
*.lo
|
|
||||||
*.o
|
|
||||||
*.obj
|
|
||||||
|
|
||||||
# Precompiled Headers
|
|
||||||
*.gch
|
|
||||||
*.pch
|
|
||||||
|
|
||||||
# Compiled Dynamic libraries
|
|
||||||
*.so
|
|
||||||
*.dylib
|
|
||||||
*.dll
|
|
||||||
|
|
||||||
# Fortran module files
|
|
||||||
*.mod
|
|
||||||
*.smod
|
|
||||||
|
|
||||||
# Compiled Static libraries
|
|
||||||
*.lai
|
|
||||||
*.la
|
|
||||||
*.a
|
|
||||||
*.lib
|
|
||||||
|
|
||||||
# Executables
|
|
||||||
*.exe
|
|
||||||
*.out
|
|
||||||
*.app
|
|
||||||
|
|
||||||
# Temporary excludes
|
# Temporary excludes
|
||||||
|
|
||||||
|
Core/private/Math/
|
||||||
|
|
||||||
|
Matrix4.h
|
||||||
|
IntVector4.h
|
||||||
|
Vector4.h
|
||||||
|
|
||||||
############################################################################################
|
############################################################################################
|
||||||
|
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
5
.gitmodules
vendored
5
.gitmodules
vendored
@ -1,6 +1,3 @@
|
|||||||
[submodule "Engine/Source/ThirdParty/spdlog"]
|
[submodule "Engine/Source/ThirdParty/spdlog"]
|
||||||
path = Engine/Source/ThirdParty/spdlog
|
path = Engine/Source/ThirdParty/spdlog
|
||||||
url = git@github.com:gabime/spdlog.git
|
url = https://github.com/gabime/spdlog.git
|
||||||
[submodule "Engine/Source/ThirdParty/googletest"]
|
|
||||||
path = Engine/Source/ThirdParty/googletest
|
|
||||||
url = https://github.com/google/googletest.git
|
|
||||||
|
32
.vscode/launch.json
vendored
32
.vscode/launch.json
vendored
@ -1,32 +0,0 @@
|
|||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Debug MathTestFPU (gdb)",
|
|
||||||
"type": "cppdbg",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "${workspaceFolder}/bin/1.0.0/Debug/MathTestFPU/MathTestFPU",
|
|
||||||
"args": [],
|
|
||||||
"stopAtEntry": false,
|
|
||||||
"cwd": "${fileDirname}",
|
|
||||||
"environment": [],
|
|
||||||
"externalConsole": false,
|
|
||||||
"MIMode": "gdb",
|
|
||||||
"setupCommands": [
|
|
||||||
{
|
|
||||||
"description": "Enable pretty-printing for gdb",
|
|
||||||
"text": "-enable-pretty-printing",
|
|
||||||
"ignoreFailures": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": "Set Disassembly Flavor to Intel",
|
|
||||||
"text": "-gdb-set disassembly-flavor intel",
|
|
||||||
"ignoreFailures": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
136
.vscode/settings.json
vendored
136
.vscode/settings.json
vendored
@ -3,8 +3,8 @@
|
|||||||
"C_Cpp.loggingLevel": "Error",
|
"C_Cpp.loggingLevel": "Error",
|
||||||
"C_Cpp.default.cppStandard": "c++20",
|
"C_Cpp.default.cppStandard": "c++20",
|
||||||
"C_Cpp.default.includePath": [
|
"C_Cpp.default.includePath": [
|
||||||
"${workspaceFolder}/Engine/Source/Runtime/",
|
"${workspaceFolder}/Engine/Source/Runtime",
|
||||||
"${workspaceFolder}/Engine/Source/ThirdParty/"
|
"${workspaceFolder}/Engine/Source/ThirdParty"
|
||||||
],
|
],
|
||||||
|
|
||||||
"C_Cpp.default.browse.path": [
|
"C_Cpp.default.browse.path": [
|
||||||
@ -13,140 +13,10 @@
|
|||||||
],
|
],
|
||||||
"C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/browse.vc.db",
|
"C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/browse.vc.db",
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"cstdint": "cpp",
|
"cstdint": "cpp"
|
||||||
"chrono": "cpp",
|
|
||||||
"string": "cpp",
|
|
||||||
"cctype": "cpp",
|
|
||||||
"clocale": "cpp",
|
|
||||||
"cmath": "cpp",
|
|
||||||
"cstdarg": "cpp",
|
|
||||||
"cstddef": "cpp",
|
|
||||||
"cstdio": "cpp",
|
|
||||||
"cstdlib": "cpp",
|
|
||||||
"cstring": "cpp",
|
|
||||||
"ctime": "cpp",
|
|
||||||
"cwchar": "cpp",
|
|
||||||
"cwctype": "cpp",
|
|
||||||
"any": "cpp",
|
|
||||||
"array": "cpp",
|
|
||||||
"atomic": "cpp",
|
|
||||||
"bit": "cpp",
|
|
||||||
"*.tcc": "cpp",
|
|
||||||
"bitset": "cpp",
|
|
||||||
"charconv": "cpp",
|
|
||||||
"cinttypes": "cpp",
|
|
||||||
"codecvt": "cpp",
|
|
||||||
"compare": "cpp",
|
|
||||||
"complex": "cpp",
|
|
||||||
"concepts": "cpp",
|
|
||||||
"condition_variable": "cpp",
|
|
||||||
"deque": "cpp",
|
|
||||||
"forward_list": "cpp",
|
|
||||||
"list": "cpp",
|
|
||||||
"map": "cpp",
|
|
||||||
"set": "cpp",
|
|
||||||
"unordered_map": "cpp",
|
|
||||||
"unordered_set": "cpp",
|
|
||||||
"vector": "cpp",
|
|
||||||
"exception": "cpp",
|
|
||||||
"expected": "cpp",
|
|
||||||
"algorithm": "cpp",
|
|
||||||
"functional": "cpp",
|
|
||||||
"iterator": "cpp",
|
|
||||||
"memory": "cpp",
|
|
||||||
"memory_resource": "cpp",
|
|
||||||
"numeric": "cpp",
|
|
||||||
"optional": "cpp",
|
|
||||||
"random": "cpp",
|
|
||||||
"ratio": "cpp",
|
|
||||||
"regex": "cpp",
|
|
||||||
"source_location": "cpp",
|
|
||||||
"string_view": "cpp",
|
|
||||||
"system_error": "cpp",
|
|
||||||
"tuple": "cpp",
|
|
||||||
"type_traits": "cpp",
|
|
||||||
"utility": "cpp",
|
|
||||||
"hash_map": "cpp",
|
|
||||||
"hash_set": "cpp",
|
|
||||||
"format": "cpp",
|
|
||||||
"fstream": "cpp",
|
|
||||||
"future": "cpp",
|
|
||||||
"initializer_list": "cpp",
|
|
||||||
"iomanip": "cpp",
|
|
||||||
"iosfwd": "cpp",
|
|
||||||
"iostream": "cpp",
|
|
||||||
"istream": "cpp",
|
|
||||||
"limits": "cpp",
|
|
||||||
"mutex": "cpp",
|
|
||||||
"new": "cpp",
|
|
||||||
"numbers": "cpp",
|
|
||||||
"ostream": "cpp",
|
|
||||||
"semaphore": "cpp",
|
|
||||||
"shared_mutex": "cpp",
|
|
||||||
"span": "cpp",
|
|
||||||
"sstream": "cpp",
|
|
||||||
"stdexcept": "cpp",
|
|
||||||
"stdfloat": "cpp",
|
|
||||||
"stop_token": "cpp",
|
|
||||||
"streambuf": "cpp",
|
|
||||||
"text_encoding": "cpp",
|
|
||||||
"thread": "cpp",
|
|
||||||
"cfenv": "cpp",
|
|
||||||
"typeindex": "cpp",
|
|
||||||
"typeinfo": "cpp",
|
|
||||||
"valarray": "cpp",
|
|
||||||
"variant": "cpp"
|
|
||||||
},
|
},
|
||||||
"C_Cpp.default.defines": [
|
"C_Cpp.default.defines": [
|
||||||
"P_LINUX_BUILD",
|
"P_LINUX_BUILD",
|
||||||
"__SSE__",
|
"__SSE__",
|
||||||
],
|
],
|
||||||
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
|
|
||||||
"editor.tokenColorCustomizations": {
|
|
||||||
"[*Light*]": {
|
|
||||||
"textMateRules": [
|
|
||||||
{
|
|
||||||
"scope": "ref.matchtext",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#000"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"[*Dark*]": {
|
|
||||||
"textMateRules": [
|
|
||||||
{
|
|
||||||
"scope": "ref.matchtext",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#fff"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"textMateRules": [
|
|
||||||
{
|
|
||||||
"scope": "googletest.failed",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#f00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "googletest.passed",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#0f0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scope": "googletest.run",
|
|
||||||
"settings": {
|
|
||||||
"foreground": "#0f0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"gtest-adapter.debugConfig": [
|
|
||||||
"Debug MathTestFPU (gdb)"
|
|
||||||
],
|
|
||||||
"gtest-adapter.supportLocation": true,
|
|
||||||
"premake.version": "Premake 5.0-beta5",
|
|
||||||
}
|
}
|
28
.vscode/tasks.json
vendored
28
.vscode/tasks.json
vendored
@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"type": "cppbuild",
|
|
||||||
"label": "C/C++: g++ build active file",
|
|
||||||
"command": "/sbin/g++",
|
|
||||||
"args": [
|
|
||||||
"-fdiagnostics-color=always",
|
|
||||||
"-g",
|
|
||||||
"${file}",
|
|
||||||
"-o",
|
|
||||||
"${fileDirname}/${fileBasenameNoExtension}"
|
|
||||||
],
|
|
||||||
"options": {
|
|
||||||
"cwd": "${fileDirname}"
|
|
||||||
},
|
|
||||||
"problemMatcher": [
|
|
||||||
"$gcc"
|
|
||||||
],
|
|
||||||
"group": {
|
|
||||||
"kind": "build",
|
|
||||||
"isDefault": true
|
|
||||||
},
|
|
||||||
"detail": "Task generated by Debugger."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"version": "2.0.0"
|
|
||||||
}
|
|
21
DevPlayground/CMakeLists.txt
Normal file
21
DevPlayground/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.15...3.30)
|
||||||
|
|
||||||
|
project(DevPlayground)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
|
||||||
|
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../Engine/Source/Runtime ${CMAKE_BINARY_DIR}/Engine)
|
||||||
|
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}../Engine/Source/Runtime)
|
||||||
|
|
||||||
|
add_executable(DevPlayground
|
||||||
|
DevPlayground.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
add_compile_definitions(P_LINUX_BUILD)
|
||||||
|
add_compile_definitions(P_DEBUG)
|
||||||
|
|
||||||
|
target_link_libraries(DevPlayground PRIVATE PhanesCore)
|
@ -1,18 +0,0 @@
|
|||||||
project "DevPlayground"
|
|
||||||
kind "ConsoleApp"
|
|
||||||
|
|
||||||
boilerplate()
|
|
||||||
|
|
||||||
files {
|
|
||||||
phanesRoot .. "/DevPlayground/**.h",
|
|
||||||
phanesRoot .. "/DevPlayground/**.cpp",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Linking PhanesCore
|
|
||||||
links { "PhanesCore" }
|
|
||||||
dependson { "PhanesCore" }
|
|
||||||
|
|
||||||
links{"fmt"}
|
|
||||||
dependson {"fmt"}
|
|
||||||
|
|
||||||
includedirs { PhanesRuntime }
|
|
5
Engine/Source/Runtime/CMakeLists.txt
Normal file
5
Engine/Source/Runtime/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.15...3.30)
|
||||||
|
|
||||||
|
project(PhanesRuntime)
|
||||||
|
|
||||||
|
add_subdirectory(Core)
|
26
Engine/Source/Runtime/Core/CMakeLists.txt
Normal file
26
Engine/Source/Runtime/Core/CMakeLists.txt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.15...3.30)
|
||||||
|
|
||||||
|
project(PhanesCore)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
include(Logging/CMakeLists.txt)
|
||||||
|
include(StartingPoint/CMakeLists.txt)
|
||||||
|
|
||||||
|
add_library(PhanesCore STATIC
|
||||||
|
Core.h
|
||||||
|
${Logging}
|
||||||
|
${StartingPoint}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_precompile_headers(PhanesCore PUBLIC
|
||||||
|
${LoggingPCH}
|
||||||
|
${StartingPointPCH}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_compile_definitions(P_LINUX_BUILD)
|
||||||
|
add_compile_definitions(P_DEBUG)
|
||||||
|
|
||||||
|
|
||||||
|
target_include_directories(PhanesCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
|
@ -38,8 +38,6 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FORCEINLINE inline
|
|
||||||
|
|
||||||
#elif defined(P_ARM_BUILD)
|
#elif defined(P_ARM_BUILD)
|
||||||
|
|
||||||
#error Only Windows is supported at the moment.
|
#error Only Windows is supported at the moment.
|
||||||
|
12
Engine/Source/Runtime/Core/Logging/CMakeLists.txt
Normal file
12
Engine/Source/Runtime/Core/Logging/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.15...3.30)
|
||||||
|
|
||||||
|
project(PhanesLogging)
|
||||||
|
|
||||||
|
set(Logging
|
||||||
|
Logging/Logging.h
|
||||||
|
Logging/private/Logging.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(LoggingPCH
|
||||||
|
Logging/LoggingPCH.h
|
||||||
|
)
|
@ -6,19 +6,13 @@
|
|||||||
|
|
||||||
namespace Phanes::Core::Logging
|
namespace Phanes::Core::Logging
|
||||||
{
|
{
|
||||||
class Logger {
|
static Phanes::Ref<spdlog::logger> _PEngineLogger;
|
||||||
|
static Phanes::Ref<spdlog::logger> _PAppLogger;
|
||||||
|
|
||||||
public:
|
void Init();
|
||||||
|
|
||||||
static void Init();
|
inline std::shared_ptr<spdlog::logger>& PEngineLogger() { return _PEngineLogger; };
|
||||||
|
inline std::shared_ptr<spdlog::logger>& PAppLogger() { return _PAppLogger; };
|
||||||
static std::shared_ptr<spdlog::logger>& PEngineLogger() { return _PEngineLogger; }
|
|
||||||
static std::shared_ptr<spdlog::logger>& PAppLogger() { return _PAppLogger; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
static std::shared_ptr<spdlog::logger> _PEngineLogger;
|
|
||||||
static std::shared_ptr<spdlog::logger> _PAppLogger;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -28,18 +22,18 @@ namespace PLog = Phanes::Core::Logging; // User Macros
|
|||||||
|
|
||||||
// Default logger
|
// Default logger
|
||||||
|
|
||||||
#define PENGINE_LOG_TRACE(...) ::Phanes::Core::Logging::Logger::PEngineLogger()->trace(__VA_ARGS__)
|
#define PENGINE_LOG_TRACE(...) ::Phanes::Core::Logging::PEngineLogger()->trace(__VA_ARGS__)
|
||||||
#define PENGINE_LOG_INFO(...) ::Phanes::Core::Logging::Logger::PEngineLogger()->info(__VA_ARGS__)
|
#define PENGINE_LOG_INFO(...) ::Phanes::Core::Logging::PEngineLogger()->info(__VA_ARGS__)
|
||||||
#define PENGINE_LOG_WARN(...) ::Phanes::Core::Logging::Logger::PEngineLogger()->warn(__VA_ARGS__)
|
#define PENGINE_LOG_WARN(...) ::Phanes::Core::Logging::PEngineLogger()->warn(__VA_ARGS__)
|
||||||
#define PENGINE_LOG_ERROR(...) ::Phanes::Core::Logging::Logger::PEngineLogger()->error(__VA_ARGS__)
|
#define PENGINE_LOG_ERROR(...) ::Phanes::Core::Logging::PEngineLogger()->error(__VA_ARGS__)
|
||||||
#define PENGINE_LOG_FATAL(...) ::Phanes::Core::Logging::Logger::PEngineLogger()->critical(__VA_ARGS__)
|
#define PENGINE_LOG_FATAL(...) ::Phanes::Core::Logging::PEngineLogger()->critical(__VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
#define PAPP_LOG_TRACE(...) ::Phanes::Core::Logging::Logger::PAppLogger()->trace(__VA_ARGS__)
|
#define PAPP_LOG_TRACE(...) ::Phanes::Core::Logging::PAppLogger()->trace(__VA_ARGS__)
|
||||||
#define PAPP_LOG_INFO(...) ::Phanes::Core::Logging::Logger::PAppLogger()->info(__VA_ARGS__)
|
#define PAPP_LOG_INFO(...) ::Phanes::Core::Logging::PAppLogger()->info(__VA_ARGS__)
|
||||||
#define PAPP_LOG_WARN(...) ::Phanes::Core::Logging::Logger::PAppLogger()->warn(__VA_ARGS__)
|
#define PAPP_LOG_WARN(...) ::Phanes::Core::Logging::PAppLogger()->warn(__VA_ARGS__)
|
||||||
#define PAPP_LOG_ERROR(...) ::Phanes::Core::Logging::Logger::PAppLogger()->error(__VA_ARGS__)
|
#define PAPP_LOG_ERROR(...) ::Phanes::Core::Logging::PAppLogger()->error(__VA_ARGS__)
|
||||||
#define PAPP_LOG_FATAL(...) ::Phanes::Core::Logging::Logger::PAppLogger()->critical(__VA_ARGS__)
|
#define PAPP_LOG_FATAL(...) ::Phanes::Core::Logging::PAppLogger()->critical(__VA_ARGS__)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
function includeLogging()
|
|
||||||
files {
|
|
||||||
PhanesRuntime .. "/Core/Logging/**.h",
|
|
||||||
PhanesRuntime .. "/Core/Logging/**.cpp",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- includedirs { PhanesThirdParty .. "/spdlog/include" }
|
|
||||||
|
|
||||||
pchheader (PhanesRuntime .. "/Core/Logging/LoggingPCH.h")
|
|
||||||
pchsource (PhanesRuntime .. "/Core/Logging/private/LoggingPCH.cpp")
|
|
||||||
end
|
|
@ -1,13 +1,6 @@
|
|||||||
#include "Core/Logging/Logging.h"
|
#include "Core/Logging/Logging.h"
|
||||||
|
|
||||||
namespace Phanes::Core::Logging
|
void Phanes::Core::Logging::Init()
|
||||||
{
|
|
||||||
std::shared_ptr<spdlog::logger> Logger::_PEngineLogger;
|
|
||||||
std::shared_ptr<spdlog::logger> Logger::_PAppLogger;
|
|
||||||
} // namespace Phanes::Core::Logging
|
|
||||||
|
|
||||||
|
|
||||||
void Phanes::Core::Logging::Logger::Init()
|
|
||||||
{
|
{
|
||||||
spdlog::set_pattern("%^[%n][%T][%l]:%$ %v");
|
spdlog::set_pattern("%^[%n][%T][%l]:%$ %v");
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#include "Core/Logging/LoggingPCH.h"
|
|
@ -2,9 +2,62 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/MathPCH.h"
|
|
||||||
|
|
||||||
#include "Core/Core.h"
|
|
||||||
|
|
||||||
|
#ifdef P_BUILD_LIB
|
||||||
|
#include "PhanesEnginePCH.h"
|
||||||
|
|
||||||
|
#else
|
||||||
|
#include <type_traits>
|
||||||
|
#include <memory>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef P_WIN_BUILD
|
||||||
|
|
||||||
|
#ifdef P_DEBUG
|
||||||
|
|
||||||
|
#define P_DEBUGBREAK DebugBreak();
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define P_DEBUGBREAK
|
||||||
|
|
||||||
|
#endif // P_DEBUG
|
||||||
|
|
||||||
|
#define FORCEINLINE __forceinline
|
||||||
|
|
||||||
|
#elif defined(P_LINUX_BUILD)
|
||||||
|
|
||||||
|
#ifdef P_DEBUG
|
||||||
|
|
||||||
|
#define P_DEBUGBREAK __builtin_trap();
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define P_DEBUGBREAK
|
||||||
|
|
||||||
|
#endif // P_DEBUG
|
||||||
|
|
||||||
|
#define FORCEINLINE inline __attribute__((always_inline))
|
||||||
|
|
||||||
|
#elif defined(P_ARM_BUILD)
|
||||||
|
|
||||||
|
#error Only Windows is supported at the moment.
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error The target system must be defined. (See https://github.com/scorpioblood/PhanesEngine for more information)
|
||||||
|
|
||||||
|
#endif // P_WIN_BUILD
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Phanes::Core::Math
|
namespace Phanes::Core::Math
|
||||||
@ -21,4 +74,28 @@ namespace Phanes::Core::Math
|
|||||||
// Typenames with Arithmethic constrain have to be number.
|
// Typenames with Arithmethic constrain have to be number.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
concept Arithmethic = std::is_arithmetic_v<T>;
|
concept Arithmethic = std::is_arithmetic_v<T>;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Alias for shared_ptr
|
||||||
|
template<typename T>
|
||||||
|
using Ref = std::shared_ptr<T>;
|
||||||
|
|
||||||
|
// Alias for make_shared
|
||||||
|
template<typename T, typename ...Args>
|
||||||
|
constexpr Ref<T> MakeRef(Args&& ...args)
|
||||||
|
{
|
||||||
|
return std::make_shared<T>(std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alias for unique ptr
|
||||||
|
template<typename T>
|
||||||
|
using Scope = std::unique_ptr<T>;
|
||||||
|
|
||||||
|
// Alias for make_unique
|
||||||
|
template<typename T, typename ...Args>
|
||||||
|
constexpr Scope<T> MakeScope(Args&& ...args)
|
||||||
|
{
|
||||||
|
return std::make_unique<T>(std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
namespace Phanes::Core::Math::Detail
|
namespace Phanes::Core::Math::Detail
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
namespace Phanes::Core::Math::Detail
|
namespace Phanes::Core::Math::Detail
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
namespace Phanes::Core::Math::Detail
|
namespace Phanes::Core::Math::Detail
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
#include "Core/Math/MathCommon.hpp"
|
#include "Core/public/Math/MathCommon.hpp"
|
||||||
|
|
||||||
namespace Phanes::Core::Math::Detail
|
namespace Phanes::Core::Math::Detail
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
#include "Core/Math/MathCommon.hpp"
|
#include "Core/public/Math/MathCommon.hpp"
|
||||||
|
|
||||||
namespace Phanes::Core::Math::Detail
|
namespace Phanes::Core::Math::Detail
|
||||||
{
|
{
|
||||||
@ -46,7 +46,6 @@ namespace Phanes::Core::Math::Detail
|
|||||||
{
|
{
|
||||||
static constexpr bool map(Phanes::Core::Math::TMatrix4<T, false>& r, const Phanes::Core::Math::TMatrix4<T, false>& m)
|
static constexpr bool map(Phanes::Core::Math::TMatrix4<T, false>& r, const Phanes::Core::Math::TMatrix4<T, false>& m)
|
||||||
{
|
{
|
||||||
|
|
||||||
const TVector3<T, false>& a = reinterpret_cast<const TVector3<T, false>&>(m[0]);
|
const TVector3<T, false>& a = reinterpret_cast<const TVector3<T, false>&>(m[0]);
|
||||||
const TVector3<T, false>& b = reinterpret_cast<const TVector3<T, false>&>(m[1]);
|
const TVector3<T, false>& b = reinterpret_cast<const TVector3<T, false>&>(m[1]);
|
||||||
const TVector3<T, false>& c = reinterpret_cast<const TVector3<T, false>&>(m[2]);
|
const TVector3<T, false>& c = reinterpret_cast<const TVector3<T, false>&>(m[2]);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
namespace Phanes::Core::Math::Detail
|
namespace Phanes::Core::Math::Detail
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Phanes::Core::Math::Detail
|
namespace Phanes::Core::Math::Detail
|
||||||
{
|
{
|
||||||
@ -175,8 +177,8 @@ namespace Phanes::Core::Math::Detail
|
|||||||
|
|
||||||
static constexpr bool map(const Phanes::Core::Math::TVector2<T, S>& v1, const Phanes::Core::Math::TVector2<T, S>& v2)
|
static constexpr bool map(const Phanes::Core::Math::TVector2<T, S>& v1, const Phanes::Core::Math::TVector2<T, S>& v2)
|
||||||
{
|
{
|
||||||
return (Phanes::Core::Math::Abs(v1.x - v2.x) <= P_FLT_INAC &&
|
return (Phanes::Core::Math::Abs(v1.x - v2.x) < P_FLT_INAC &&
|
||||||
Phanes::Core::Math::Abs(v1.y - v2.y) <= P_FLT_INAC);
|
Phanes::Core::Math::Abs(v1.y - v2.y) < P_FLT_INAC);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
#include "Core/Math/MathCommon.hpp"
|
|
||||||
|
|
||||||
namespace Phanes::Core::Math::Detail
|
namespace Phanes::Core::Math::Detail
|
||||||
{
|
{
|
||||||
@ -260,7 +259,7 @@ namespace Phanes::Core::Math::Detail
|
|||||||
{
|
{
|
||||||
static constexpr T map(const Phanes::Core::Math::TVector3<T, false>& v1)
|
static constexpr T map(const Phanes::Core::Math::TVector3<T, false>& v1)
|
||||||
{
|
{
|
||||||
return Phanes::Core::Math::Sqrt(v1.x * v1.x + v1.y * v1.y + v1.z * v1.z);
|
return sqrt(v1.x * v1.x + v1.y * v1.y + v1.z * v1.z);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
namespace Phanes::Core::Math::Detail
|
namespace Phanes::Core::Math::Detail
|
||||||
{
|
{
|
||||||
|
@ -1,35 +1,39 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/MathFwd.h"
|
#ifndef P_DEBUG
|
||||||
|
#pragma warning(disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "Core/public/Math/MathFwd.h"
|
||||||
|
|
||||||
|
|
||||||
// --- Vectors ------------------------
|
// --- Vectors ------------------------
|
||||||
|
|
||||||
#include "Core/Math/Vector2.hpp"
|
#include "Core/public/Math/Vector2.hpp"
|
||||||
#include "Core/Math/Vector3.hpp"
|
#include "Core/public/Math/Vector3.hpp"
|
||||||
#include "Core/Math/Vector4.hpp"
|
#include "Core/public/Math/Vector4.hpp"
|
||||||
|
|
||||||
#include "Core/Math/IntVector2.hpp"
|
#include "Core/public/Math/IntVector2.hpp"
|
||||||
#include "Core/Math/IntVector3.hpp"
|
#include "Core/public/Math/IntVector3.hpp"
|
||||||
#include "Core/Math/IntVector4.hpp"
|
#include "Core/public/Math/IntVector4.hpp"
|
||||||
|
|
||||||
#include "Core/Math/Point.hpp"
|
#include "Core/public/Math/Point.hpp"
|
||||||
#include "Core/Math/IntPoint.hpp"
|
#include "Core/public/Math/IntPoint.hpp"
|
||||||
|
|
||||||
|
|
||||||
// --- Matrices ------------------------
|
// --- Matrices ------------------------
|
||||||
|
|
||||||
#include "Core/Math/Matrix2.hpp"
|
#include "Core/public/Math/Matrix2.hpp"
|
||||||
#include "Core/Math/Matrix3.hpp"
|
#include "Core/public/Math/Matrix3.hpp"
|
||||||
#include "Core/Math/Matrix4.hpp"
|
#include "Core/public/Math/Matrix4.hpp"
|
||||||
|
|
||||||
// --- Other Math ----------------------
|
// --- Other Math ----------------------
|
||||||
|
|
||||||
#include "Core/Math/Plane.hpp"
|
#include "Core/public/Math/Plane.hpp"
|
||||||
#include "Core/Math/Line.hpp"
|
#include "Core/public/Math/Line.hpp"
|
||||||
|
|
||||||
|
|
||||||
// --- Misc -----------------
|
// --- Misc -----------------
|
||||||
|
|
||||||
#include "Core/Math/MathTypeConversion.hpp"
|
#include "Core/public/Math/MathTypeConversion.hpp"
|
||||||
#include "Core/Math/MathUnitConversion.hpp"
|
#include "Core/public/Math/MathUnitConversion.hpp"
|
||||||
|
@ -1,14 +1,19 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/MathCommon.hpp"
|
#include "Core/public/Math/MathCommon.hpp"
|
||||||
#include "Core/Math/MathAbstractTypes.h"
|
#include "Core/public/Math/MathAbstractTypes.h"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
|
|
||||||
|
#include "Core/public/Math/IntVector2.hpp"
|
||||||
|
#include "Core/public/Math/IntVector3.hpp"
|
||||||
|
#include "Core/public/Math/IntVector4.hpp"
|
||||||
|
|
||||||
|
#ifndef P_DEBUG
|
||||||
|
#pragma warning(disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "Core/Math/IntVector2.hpp"
|
|
||||||
#include "Core/Math/IntVector3.hpp"
|
|
||||||
#include "Core/Math/IntVector4.hpp"
|
|
||||||
/**
|
/**
|
||||||
* General annonation: The Point is the same as a vector. The type exists, to ensure a
|
* General annonation: The Point is the same as a vector. The type exists, to ensure a
|
||||||
* easy differentiation between the two.
|
* easy differentiation between the two.
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/MathCommon.hpp"
|
#include "Core/public/Math/MathCommon.hpp"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/Storage.h"
|
#include "Core/public/Math/SIMD/Storage.h"
|
||||||
|
|
||||||
|
#ifndef P_DEBUG
|
||||||
|
#pragma warning(disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: Some function are deleted, because, their unusable with int types, except very specific cases.
|
* Note: Some function are deleted, because, their unusable with int types, except very specific cases.
|
||||||
@ -623,4 +627,4 @@ namespace Phanes::Core::Math {
|
|||||||
|
|
||||||
#endif // !INTVECTOR2_H
|
#endif // !INTVECTOR2_H
|
||||||
|
|
||||||
#include "Core/Math/IntVector2.inl"
|
#include "Core/public/Math/IntVector2.inl"
|
@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/Detail/IntVector2Decl.inl"
|
#include "Core/public/Math/Detail/IntVector2Decl.inl"
|
||||||
#include "Core/Math/SIMD/SIMDIntrinsics.h"
|
#include "Core/public/Math/SIMD/SIMDIntrinsics.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/PhanesSIMDTypes.h"
|
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
|
||||||
|
|
||||||
namespace Phanes::Core::Math
|
namespace Phanes::Core::Math
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/MathCommon.hpp"
|
#include "Core/public/Math/MathCommon.hpp"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/Storage.h"
|
#include "Core/public/Math/SIMD/Storage.h"
|
||||||
|
|
||||||
|
#include "Core/public/Math/IntVector4.hpp"
|
||||||
|
|
||||||
|
#ifndef P_DEBUG
|
||||||
|
#pragma warning(disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "Core/Math/IntVector4.hpp"
|
|
||||||
|
|
||||||
#ifndef INTVECTOR3_H
|
#ifndef INTVECTOR3_H
|
||||||
#define INTVECTOR3_H
|
#define INTVECTOR3_H
|
||||||
@ -681,4 +686,4 @@ namespace Phanes::Core::Math {
|
|||||||
|
|
||||||
#endif // !INTVECTOR3_H
|
#endif // !INTVECTOR3_H
|
||||||
|
|
||||||
#include "Core/Math/IntVector3.inl"
|
#include "Core/public/Math/IntVector3.inl"
|
@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/Detail/IntVector3Decl.inl"
|
#include "Core/public/Math/Detail/IntVector3Decl.inl"
|
||||||
#include "Core/Math/SIMD/SIMDIntrinsics.h"
|
#include "Core/public/Math/SIMD/SIMDIntrinsics.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/PhanesSIMDTypes.h"
|
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Phanes::Core::Math
|
namespace Phanes::Core::Math
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/MathCommon.hpp"
|
#include "Core/public/Math/MathCommon.hpp"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/Storage.h"
|
#include "Core/public/Math/SIMD/Storage.h"
|
||||||
|
|
||||||
#include "Core/Math/IntVector2.hpp"
|
#include "Core/public/Math/IntVector2.hpp"
|
||||||
|
|
||||||
|
#ifndef P_DEBUG
|
||||||
|
#pragma warning(disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef INTVECTOR4_H
|
#ifndef INTVECTOR4_H
|
||||||
@ -636,4 +640,4 @@ namespace Phanes::Core::Math {
|
|||||||
#endif // !INTVECTOR3_H
|
#endif // !INTVECTOR3_H
|
||||||
|
|
||||||
|
|
||||||
#include "Core/Math/IntVector4.inl"
|
#include "Core/public/Math/IntVector4.inl"
|
@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/Detail/IntVector4Decl.inl"
|
#include "Core/public/Math/Detail/IntVector4Decl.inl"
|
||||||
#include "Core/Math/SIMD/SIMDIntrinsics.h"
|
#include "Core/public/Math/SIMD/SIMDIntrinsics.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/PhanesSIMDTypes.h"
|
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
|
||||||
|
|
||||||
namespace Phanes::Core::Math
|
namespace Phanes::Core::Math
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
|
|
||||||
#include "Core/Math/Vector3.hpp"
|
#include "Core/public/Math/Vector3.hpp"
|
||||||
|
|
||||||
|
#include <any>
|
||||||
|
|
||||||
|
|
||||||
namespace Phanes::Core::Math
|
namespace Phanes::Core::Math
|
||||||
@ -47,6 +49,8 @@ namespace Phanes::Core::Math
|
|||||||
template<RealType T>
|
template<RealType T>
|
||||||
TLine<T>& NormalizeV(TLine<T>& l1)
|
TLine<T>& NormalizeV(TLine<T>& l1)
|
||||||
{
|
{
|
||||||
|
std::any
|
||||||
|
|
||||||
NormalizeV(l1.direction);
|
NormalizeV(l1.direction);
|
||||||
return l1;
|
return l1;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/MathPCH.h"
|
|
||||||
|
|
||||||
#define P_FLT_INAC_LARGE 0.0001f // large float inaccuracy (1*10^-4);
|
#define P_FLT_INAC_LARGE 0.0001f // large float inaccuracy (1*10^-4);
|
||||||
#define P_FLT_INAC 0.00001f // float inaccuracy (1*10^-5);
|
#define P_FLT_INAC 0.00001f // float inaccuracy (1*10^-5);
|
||||||
#define P_FLT_INAC_SMALL 0.000001f // small float inaccuracy (1*10^-6);
|
#define P_FLT_INAC_SMALL 0.000001f // small float inaccuracy (1*10^-6);
|
||||||
@ -128,16 +126,34 @@ namespace Phanes::Core::Math {
|
|||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T Abs(T s)
|
FORCEINLINE T Abs(T s)
|
||||||
{
|
{
|
||||||
return abs(s);
|
return abs(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<>
|
||||||
inline T Sqrt(T s)
|
FORCEINLINE float Abs<float>(float s)
|
||||||
{
|
{
|
||||||
return sqrt(s);
|
return (float)fabs(s);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
FORCEINLINE long long Abs<long long>(long long s)
|
||||||
|
{
|
||||||
|
return llabs(s);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
FORCEINLINE long Abs<long>(long s)
|
||||||
|
{
|
||||||
|
return labs(s);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
FORCEINLINE double Abs<double>(double s)
|
||||||
|
{
|
||||||
|
return fabsl(s);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
} // phanes
|
} // phanes
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
#ifndef MATH_FWD_H
|
#ifndef MATH_FWD_H
|
||||||
#define MATH_FWD_H
|
#define MATH_FWD_H
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
#include "Core/Math/SIMD/PhanesSIMDTypes.h"
|
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Includes forward declarations, as well as certain useful typedefs.
|
* Includes forward declarations, as well as certain useful typedefs.
|
||||||
|
@ -1,10 +1,27 @@
|
|||||||
// PCH for STL. This is a precompiled header file for the Standard Template Library used in math.
|
// Header file containing all files to be compiled to use core math.
|
||||||
// For a PCH for this submodule see PhanesMathPCH.h
|
// Should be included in PCH file of project to use.
|
||||||
|
|
||||||
#define NOMINMAX
|
#pragma once
|
||||||
|
|
||||||
#include <cmath>
|
#include "Core/public/Math/Point.hpp"
|
||||||
#include <type_traits>
|
#include "Core/public/Math/Plane.hpp"
|
||||||
#include <memory>
|
#include "Core/public/Math/Line.hpp"
|
||||||
#include <string>
|
#include "Core/public/Math/Ray.hpp"
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
|
#include "Core/public/Math/Vector2.hpp"
|
||||||
|
#include "Core/public/Math/Vector3.hpp"
|
||||||
|
#include "Core/public/Math/Vector4.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"
|
@ -6,20 +6,24 @@
|
|||||||
// @ref [FILE]MathUnitConversion //
|
// @ref [FILE]MathUnitConversion //
|
||||||
// ============================================= //
|
// ============================================= //
|
||||||
|
|
||||||
|
#ifdef P_BUILD_LIB
|
||||||
|
#include "PhanesEnginePCH.h"
|
||||||
|
#else
|
||||||
|
#include <string>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
#include "Core/Math/MathPCH.h"
|
|
||||||
|
|
||||||
#include "Core/Math/MathAbstractTypes.h"
|
#include "Core/public/Math/MathAbstractTypes.h"
|
||||||
#include "Core/Math/Vector2.hpp"
|
#include "Core/public/Math/Vector2.hpp"
|
||||||
#include "Core/Math/Vector3.hpp"
|
#include "Core/public/Math/Vector3.hpp"
|
||||||
#include "Core/Math/Vector4.hpp"
|
#include "Core/public/Math/Vector4.hpp"
|
||||||
#include "Core/Math/Matrix2.hpp"
|
#include "Core/public/Math/Matrix2.hpp"
|
||||||
#include "Core/Math/Matrix3.hpp"
|
#include "Core/public/Math/Matrix3.hpp"
|
||||||
#include "Core/Math/Matrix4.hpp"
|
#include "Core/public/Math/Matrix4.hpp"
|
||||||
#include "Core/Math/IntVector2.hpp"
|
#include "Core/public/Math/IntVector2.hpp"
|
||||||
#include "Core/Math/IntVector3.hpp"
|
#include "Core/public/Math/IntVector3.hpp"
|
||||||
#include "Core/Math/IntVector4.hpp"
|
#include "Core/public/Math/IntVector4.hpp"
|
||||||
|
|
||||||
#ifndef MATH_TYPE_CONVERSION_H
|
#ifndef MATH_TYPE_CONVERSION_H
|
||||||
#define MATH_TYPE_CONVERSION_H
|
#define MATH_TYPE_CONVERSION_H
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/MathPCH.h"
|
#ifdef P_BUILD_LIB
|
||||||
|
# include "PhanesEnginePCH.h"
|
||||||
|
#else
|
||||||
|
# define NOMINMAX
|
||||||
|
# include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// ============================================= //
|
// ============================================= //
|
||||||
// Turn os specific types into global types. //
|
// Turn os specific types into global types. //
|
||||||
@ -18,12 +23,6 @@ namespace Phanes::Core::Types
|
|||||||
|
|
||||||
typedef _FLOAT128 float128;
|
typedef _FLOAT128 float128;
|
||||||
|
|
||||||
#elif defined(P_LINUX_BUILD)
|
|
||||||
|
|
||||||
// Linux specific types
|
|
||||||
|
|
||||||
typedef __float128 float128;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
// Contains functions to convert units //
|
// Contains functions to convert units //
|
||||||
// ======================================= //
|
// ======================================= //
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/MathCommon.hpp"
|
#include "Core/public/Math/MathCommon.hpp"
|
||||||
|
|
||||||
namespace Phanes::Core::Math::UnitConversion
|
namespace Phanes::Core::Math::UnitConversion
|
||||||
{
|
{
|
||||||
@ -14,7 +14,7 @@ namespace Phanes::Core::Math::UnitConversion
|
|||||||
/**
|
/**
|
||||||
* Converts degrees to radians.
|
* Converts degrees to radians.
|
||||||
*
|
*
|
||||||
* @param(deg) Angle in degress (<EFBFBD>)
|
* @param(deg) Angle in degress (°)
|
||||||
*
|
*
|
||||||
* @return Angle in radians
|
* @return Angle in radians
|
||||||
*/
|
*/
|
||||||
@ -42,7 +42,7 @@ namespace Phanes::Core::Math::UnitConversion
|
|||||||
/**
|
/**
|
||||||
* Converts degrees to gradian.
|
* Converts degrees to gradian.
|
||||||
*
|
*
|
||||||
* @param(deg) Angle in degress (<EFBFBD>)
|
* @param(deg) Angle in degress (°)
|
||||||
*
|
*
|
||||||
* @return Angle in gradian
|
* @return Angle in gradian
|
||||||
*/
|
*/
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
|
|
||||||
#include "Core/Math/Vector2.hpp"
|
#include "Core/public/Math/Vector2.hpp"
|
||||||
|
|
||||||
#ifndef MATRIX2_H
|
#ifndef MATRIX2_H
|
||||||
#define MATRIX2_H
|
#define MATRIX2_H
|
||||||
@ -355,4 +355,4 @@ namespace Phanes::Core::Math {
|
|||||||
#endif // !MATRIX2_H
|
#endif // !MATRIX2_H
|
||||||
|
|
||||||
|
|
||||||
#include "Core/Math/SIMD/SIMDIntrinsics.h"
|
#include "Core/public/Math/SIMD/SIMDIntrinsics.h"
|
@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/MathAbstractTypes.h"
|
#include "Core/public/Math/MathAbstractTypes.h"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
#include "Core/Math/Vector3.hpp"
|
#include "Core/public/Math/Vector3.hpp"
|
||||||
|
|
||||||
#ifndef MATRIX3_H
|
#ifndef MATRIX3_H
|
||||||
#define MATRIX3_H
|
#define MATRIX3_H
|
||||||
@ -547,4 +547,4 @@ namespace Phanes::Core::Math {
|
|||||||
|
|
||||||
#endif // !MATRIX3_H
|
#endif // !MATRIX3_H
|
||||||
|
|
||||||
#include "Core/Math/Matrix3.inl"
|
#include "Core/public/Math/Matrix3.inl"
|
@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/Detail/Matrix3Decl.inl"
|
#include "Core/public/Math/Detail/Matrix3Decl.inl"
|
||||||
#include "Core/Math/SIMD/SIMDIntrinsics.h"
|
#include "Core/public/Math/SIMD/SIMDIntrinsics.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/PhanesSIMDTypes.h"
|
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
|
||||||
|
|
||||||
namespace Phanes::Core::Math
|
namespace Phanes::Core::Math
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/MathAbstractTypes.h"
|
#include "Core/public/Math/MathAbstractTypes.h"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
#include "Core/Math/Vector4.hpp"
|
#include "Core/public/Math/Vector4.hpp"
|
||||||
|
|
||||||
#ifndef MATRIX4_H
|
#ifndef MATRIX4_H
|
||||||
#define MATRIX4_H
|
#define MATRIX4_H
|
||||||
@ -123,7 +123,7 @@ namespace Phanes::Core::Math {
|
|||||||
}
|
}
|
||||||
FORCEINLINE TVector4<T, S>& operator[] (int m)
|
FORCEINLINE TVector4<T, S>& operator[] (int m)
|
||||||
{
|
{
|
||||||
return (*reinterpret_cast<TVector4<T, S>*>(this->data[m]));
|
return (*reinterpret_cast<TVector4<T, S>*>(this->m[m]));
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCEINLINE const T& operator() (int n, int m) const
|
FORCEINLINE const T& operator() (int n, int m) const
|
||||||
@ -331,4 +331,4 @@ namespace Phanes::Core::Math {
|
|||||||
|
|
||||||
#endif // !MATRIX4_H
|
#endif // !MATRIX4_H
|
||||||
|
|
||||||
#include "Core/Math/Matrix4.inl"
|
#include "Core/public/Math/Matrix4.inl"
|
@ -1,13 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/Detail/Matrix4Decl.inl"
|
#include "Core/public/Math/Detail/Matrix4Decl.inl"
|
||||||
#include "Core/Math/SIMD/SIMDIntrinsics.h"
|
#include "Core/public/Math/SIMD/SIMDIntrinsics.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/PhanesSIMDTypes.h"
|
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Phanes::Core::Math
|
namespace Phanes::Core::Math
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
// Header file containing all files to be compiled to use core math.
|
|
||||||
// Should be included in PCH file of project to use.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Core/Math/Point.hpp"
|
|
||||||
#include "Core/Math/Plane.hpp"
|
|
||||||
#include "Core/Math/Line.hpp"
|
|
||||||
#include "Core/Math/Ray.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
#include "Core/Math/Vector2.hpp"
|
|
||||||
#include "Core/Math/Vector3.hpp"
|
|
||||||
#include "Core/Math/Vector4.hpp"
|
|
||||||
|
|
||||||
#include "Core/Math/IntPoint.hpp"
|
|
||||||
#include "Core/Math/IntVector2.hpp"
|
|
||||||
#include "Core/Math/IntVector3.hpp"
|
|
||||||
#include "Core/Math/IntVector4.hpp"
|
|
||||||
|
|
||||||
#include "Core/Math/Matrix2.hpp"
|
|
||||||
#include "Core/Math/Matrix3.hpp"
|
|
||||||
#include "Core/Math/Matrix4.hpp"
|
|
||||||
|
|
||||||
#include "Core/Math/MathCommon.hpp"
|
|
||||||
#include "Core/Math/MathTypeConversion.hpp"
|
|
||||||
#include "Core/Math/MathUnitConversion.hpp"
|
|
@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
// TODO: Transform
|
// TODO: Transform
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
|
|
||||||
#include "Core/Math/Line.hpp"
|
#include "Core/public/Math/Line.hpp"
|
||||||
#include "Core/Math/Ray.hpp"
|
#include "Core/public/Math/Ray.hpp"
|
||||||
#include "Core/Math/Vector3.hpp"
|
#include "Core/public/Math/Vector3.hpp"
|
||||||
|
|
||||||
namespace Phanes::Core::Math {
|
namespace Phanes::Core::Math {
|
||||||
|
|
||||||
@ -624,7 +624,7 @@ namespace Phanes::Core::Math {
|
|||||||
TPlane<T, false> TranslateV(TPlane<T, false>& pl1, const TVector3<T, false>& v1)
|
TPlane<T, false> TranslateV(TPlane<T, false>& pl1, const TVector3<T, false>& v1)
|
||||||
{
|
{
|
||||||
|
|
||||||
pl1.d = DotP(pl1.normal, GetOrigin(pl1) + v1);
|
pl1.d = DotP(this->normal, GetOrigin(pl1) + v1);
|
||||||
|
|
||||||
return pl1;
|
return pl1;
|
||||||
}
|
}
|
||||||
@ -953,4 +953,4 @@ namespace Phanes::Core::Math {
|
|||||||
} // Phanes::Core::Math
|
} // Phanes::Core::Math
|
||||||
|
|
||||||
// Include operator impl.
|
// Include operator impl.
|
||||||
#include "Core/Math/Plane.inl"
|
#include "Core/public/Math/Plane.inl"
|
@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/Detail/PlaneDecl.inl"
|
#include "Core/public/Math/Detail/PlaneDecl.inl"
|
||||||
#include "Core/Math/SIMD/SIMDIntrinsics.h"
|
#include "Core/public/Math/SIMD/SIMDIntrinsics.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/PhanesSIMDTypes.h"
|
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/MathCommon.hpp"
|
#include "Core/public/Math/MathCommon.hpp"
|
||||||
#include "Core/Math/MathAbstractTypes.h"
|
#include "Core/public/Math/MathAbstractTypes.h"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
|
|
||||||
#include "Core/Math/Vector2.hpp"
|
#include "Core/public/Math/Vector2.hpp"
|
||||||
#include "Core/Math/Vector3.hpp"
|
#include "Core/public/Math/Vector3.hpp"
|
||||||
|
|
||||||
|
#ifndef P_DEBUG
|
||||||
|
#pragma warning(disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Point is the same as a vector. The type exists, to ensure
|
* The Point is the same as a vector. The type exists, to ensure
|
||||||
@ -42,14 +46,6 @@ namespace Phanes::Core::Math {
|
|||||||
this->y = p.y;
|
this->y = p.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Creates Point2 from Vector2
|
|
||||||
/// @param v
|
|
||||||
TPoint2(const TVector2<T, false>& v)
|
|
||||||
{
|
|
||||||
this->x = v.x;
|
|
||||||
this->y = v.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates Point2 from Point4's xy
|
* Creates Point2 from Point4's xy
|
||||||
*
|
*
|
||||||
@ -106,15 +102,6 @@ namespace Phanes::Core::Math {
|
|||||||
this->z = 0;
|
this->z = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Creates Point3 from Vector3
|
|
||||||
/// @param v
|
|
||||||
TPoint3(const TVector3<T, false>& v)
|
|
||||||
{
|
|
||||||
this->x = v.x;
|
|
||||||
this->y = v.y;
|
|
||||||
this->z = v.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates Point3 from Point4's xyz
|
* Creates Point3 from Point4's xyz
|
||||||
*
|
*
|
||||||
@ -184,17 +171,8 @@ namespace Phanes::Core::Math {
|
|||||||
this->z = p.z;
|
this->z = p.z;
|
||||||
this->w = 0;
|
this->w = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TPoint4(const TVector4<T, false>& v)
|
|
||||||
{
|
|
||||||
this->x = v.x;
|
|
||||||
this->y = v.y;
|
|
||||||
this->z = v.z;
|
|
||||||
this->w = v.w;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates distance between two points.
|
* Calculates distance between two points.
|
||||||
*
|
*
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
|
|
||||||
#include "Core/Math/Vector3.hpp"
|
#include "Core/public/Math/Vector3.hpp"
|
||||||
|
|
||||||
namespace Phanes::Core::Math
|
namespace Phanes::Core::Math
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Phanes::Core::Math::SIMD
|
namespace Phanes::Core::Math::SIMD
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
//
|
//
|
||||||
// ARM is not supported.
|
// ARM is not supported.
|
||||||
|
|
||||||
#include "Core/Math/SIMD/Platform.h"
|
#include "Core/public/Math/SIMD/Platform.h"
|
||||||
#include "Core/Math/MathTypes.h"
|
#include "Core/public/Math/MathTypes.h"
|
||||||
|
|
||||||
#if P_INTRINSICS == P_INTRINSICS_AVX2
|
#if P_INTRINSICS == P_INTRINSICS_AVX2
|
||||||
# include <immintrin.h>
|
# include <immintrin.h>
|
||||||
|
@ -2,23 +2,23 @@
|
|||||||
|
|
||||||
#include <nmmintrin.h>
|
#include <nmmintrin.h>
|
||||||
|
|
||||||
#include "Core/Math/SIMD/PhanesSIMDTypes.h"
|
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
#include "Core/Math/MathCommon.hpp"
|
#include "Core/public/Math/MathCommon.hpp"
|
||||||
|
|
||||||
|
|
||||||
#include "Core/Math/Vector2.hpp"
|
#include "Core/public/Math/Vector2.hpp"
|
||||||
#include "Core/Math/Vector3.hpp"
|
#include "Core/public/Math/Vector3.hpp"
|
||||||
#include "Core/Math/Vector4.hpp"
|
#include "Core/public/Math/Vector4.hpp"
|
||||||
|
|
||||||
#include "Core/Math/Plane.hpp"
|
#include "Core/public/Math/Plane.hpp"
|
||||||
|
|
||||||
#include "Core/Math/IntVector2.hpp"
|
#include "Core/public/Math/IntVector2.hpp"
|
||||||
#include "Core/Math/IntVector3.hpp"
|
#include "Core/public/Math/IntVector3.hpp"
|
||||||
#include "Core/Math/IntVector4.hpp"
|
#include "Core/public/Math/IntVector4.hpp"
|
||||||
|
|
||||||
#include "Core/Math/Matrix3.hpp"
|
#include "Core/public/Math/Matrix3.hpp"
|
||||||
#include "Core/Math/Matrix4.hpp"
|
#include "Core/public/Math/Matrix4.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -26,9 +26,6 @@
|
|||||||
// Common //
|
// Common //
|
||||||
// ========== //
|
// ========== //
|
||||||
|
|
||||||
#ifndef PHANES_VECTOR_MATH_SSE_HPP
|
|
||||||
#define PHANES_VECTOR_MATH_SSE_HPP
|
|
||||||
|
|
||||||
namespace Phanes::Core::Math::SIMD
|
namespace Phanes::Core::Math::SIMD
|
||||||
{
|
{
|
||||||
Phanes::Core::Types::Vec4f32Reg vec4_cross_p(const Phanes::Core::Types::Vec4f32Reg v1, const Phanes::Core::Types::Vec4f32Reg v2)
|
Phanes::Core::Types::Vec4f32Reg vec4_cross_p(const Phanes::Core::Types::Vec4f32Reg v1, const Phanes::Core::Types::Vec4f32Reg v2)
|
||||||
@ -51,10 +48,10 @@ namespace Phanes::Core::Math::SIMD
|
|||||||
/// <returns>Sum stored in v[0:31].</returns>
|
/// <returns>Sum stored in v[0:31].</returns>
|
||||||
Phanes::Core::Types::Vec4f32Reg vec4_hadd(const Phanes::Core::Types::Vec4f32Reg v)
|
Phanes::Core::Types::Vec4f32Reg vec4_hadd(const Phanes::Core::Types::Vec4f32Reg v)
|
||||||
{
|
{
|
||||||
__m128 t = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 3, 0, 1));
|
__m128 shufl = _mm_movehdup_ps(v);
|
||||||
t = _mm_add_ps(t, v);
|
__m128 sum = _mm_add_ps(v, shufl);
|
||||||
t = _mm_shuffle_ps(t, t, _MM_SHUFFLE(1, 0, 3, 2));
|
shufl = _mm_movehl_ps(sum, sum);
|
||||||
return _mm_add_ps(t, v);
|
return _mm_add_ss(sum, shufl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -64,11 +61,12 @@ namespace Phanes::Core::Math::SIMD
|
|||||||
/// <returns>Sum of components.</returns>
|
/// <returns>Sum of components.</returns>
|
||||||
float vec4_hadd_cvtf32(const Phanes::Core::Types::Vec4f32Reg v)
|
float vec4_hadd_cvtf32(const Phanes::Core::Types::Vec4f32Reg v)
|
||||||
{
|
{
|
||||||
__m128 t = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 3, 0, 1));
|
__m128 shufl = _mm_movehdup_ps(v);
|
||||||
t = _mm_add_ps(t, v);
|
__m128 sum = _mm_add_ps(v, shufl);
|
||||||
t = _mm_shuffle_ps(t, t, _MM_SHUFFLE(1, 0, 3, 2));
|
shufl = _mm_movehl_ps(sum, sum);
|
||||||
t = _mm_add_ps(t, v);
|
sum = _mm_add_ss(sum, shufl);
|
||||||
return _mm_cvtss_f32(t);
|
|
||||||
|
return _mm_cvtss_f32(sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -588,7 +586,12 @@ namespace Phanes::Core::Math::Detail
|
|||||||
pl.comp.data = _mm_set_ps(x, y, z, d);
|
pl.comp.data = _mm_set_ps(x, y, z, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Create SSE constructor with 3 Points
|
static FORCEINLINE void map(Phanes::Core::Math::TPlane<float, true>& pl, const TVector3<float, true>& v1, const TVector3<float, true>& v2, const TVector3<float, true>& v3)
|
||||||
|
{
|
||||||
|
TVector4<float, false> tmp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1278,7 +1281,7 @@ namespace Phanes::Core::Math::Detail
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct compute_mat4_inv<float, true>
|
struct compute_mat4_inv<float, false>
|
||||||
{
|
{
|
||||||
// From: GLM: https://github.com/g-truc/glm/blob/master/glm/simd/matrix.h (MIT License)
|
// From: GLM: https://github.com/g-truc/glm/blob/master/glm/simd/matrix.h (MIT License)
|
||||||
static FORCEINLINE bool map(Phanes::Core::Math::TMatrix4<float, true>& r, const Phanes::Core::Math::TMatrix4<float, true>& m1)
|
static FORCEINLINE bool map(Phanes::Core::Math::TMatrix4<float, true>& r, const Phanes::Core::Math::TMatrix4<float, true>& m1)
|
||||||
@ -1500,10 +1503,6 @@ namespace Phanes::Core::Math::Detail
|
|||||||
r.c1.data = _mm_mul_ps(Inv1, Rcp0);
|
r.c1.data = _mm_mul_ps(Inv1, Rcp0);
|
||||||
r.c2.data = _mm_mul_ps(Inv2, Rcp0);
|
r.c2.data = _mm_mul_ps(Inv2, Rcp0);
|
||||||
r.c3.data = _mm_mul_ps(Inv3, Rcp0);
|
r.c3.data = _mm_mul_ps(Inv3, Rcp0);
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
@ -23,9 +23,9 @@
|
|||||||
// User defines build platform
|
// User defines build platform
|
||||||
#ifdef P_WIN_BUILD
|
#ifdef P_WIN_BUILD
|
||||||
# define P_PLATFORM P_PLATFORM_WIN
|
# define P_PLATFORM P_PLATFORM_WIN
|
||||||
# error Windows system is not yet supported.
|
|
||||||
#elif P_LINUX_BUILD
|
#elif P_LINUX_BUILD
|
||||||
# define P_PLATFORM P_PLATFORM_LIN
|
# define P_PLATFORM P_PLATFORM_LIN
|
||||||
|
# error Linux / Unix system is not yet supported.
|
||||||
#elif P_MAC_BUILD
|
#elif P_MAC_BUILD
|
||||||
# define P_PLATFORM P_PLATFORM_MAC
|
# define P_PLATFORM P_PLATFORM_MAC
|
||||||
# error Mac target system is not yet supported.
|
# error Mac target system is not yet supported.
|
||||||
@ -142,6 +142,7 @@
|
|||||||
// Clang
|
// Clang
|
||||||
|
|
||||||
#elif (defined(__clang__))
|
#elif (defined(__clang__))
|
||||||
|
# error PhanesEngine only supports MSVC -> Visual Studio
|
||||||
# if defined(__apple_build_version__)
|
# if defined(__apple_build_version__)
|
||||||
#
|
#
|
||||||
# if (__clang_major__ < 6)
|
# if (__clang_major__ < 6)
|
||||||
@ -207,6 +208,7 @@
|
|||||||
|
|
||||||
// G++
|
// G++
|
||||||
#elif defined(__GNUC__) || defined(__MINGW32__)
|
#elif defined(__GNUC__) || defined(__MINGW32__)
|
||||||
|
# error PhanesEngine only supports MSVC -> Visual Studio
|
||||||
# if __GNUC__ >= 14
|
# if __GNUC__ >= 14
|
||||||
# define P_COMPILER P_COMPILER_GCC14
|
# define P_COMPILER P_COMPILER_GCC14
|
||||||
# elif __GNUC__ >= 13
|
# elif __GNUC__ >= 13
|
||||||
@ -311,6 +313,7 @@
|
|||||||
# define P_AVX2__ 0
|
# define P_AVX2__ 0
|
||||||
# define P_AVX__ 0
|
# define P_AVX__ 0
|
||||||
# define P_SSE__ 0
|
# define P_SSE__ 0
|
||||||
|
# define P_SSE__ 0
|
||||||
#else
|
#else
|
||||||
# if (P_AVX__ == 1) && (P_AVX2__ == 0)
|
# if (P_AVX__ == 1) && (P_AVX2__ == 0)
|
||||||
# define P_INTRINSICS P_INTRINSICS_AVX
|
# define P_INTRINSICS P_INTRINSICS_AVX
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
#include "Core/Math/SIMD/Platform.h"
|
#include "Core/public/Math/SIMD/Platform.h"
|
||||||
|
|
||||||
#if P_INTRINSICS == P_INTRINSICS_AVX2
|
#if P_INTRINSICS == P_INTRINSICS_AVX2
|
||||||
# include "Core/Math/SIMD/PhanesVectorMathAVX2.hpp"
|
# include "PhanesVectorMathAVX2.hpp"
|
||||||
#elif P_INTRINSICS == P_INTRINSICS_AVX
|
#elif P_INTRINSICS == P_INTRINSICS_AVX
|
||||||
# include "Core/Math/SIMD/PhanesVectorMathAVX.hpp"
|
# include "PhanesVectorMathAVX.hpp"
|
||||||
#elif P_INTRINSICS == P_INTRINSICS_SSE
|
#elif P_INTRINSICS == P_INTRINSICS_SSE
|
||||||
# include "Core/Math/SIMD/PhanesVectorMathSSE.hpp"
|
# include "PhanesVectorMathSSE.hpp"
|
||||||
#elif P_INTRINSICS == P_INTRINSICS_NEON
|
#elif P_INTRINSICS == P_INTRINSICS_NEON
|
||||||
# include "Core/Math/SIMD/PhanesVectorMathNeon.hpp"
|
# include "PhanesVectorMathNeon.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// Defines on compile time, whether a xmm register or an array should be used.
|
// Defines on compile time, whether a xmm register or an array should be used.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/SIMD/PhanesSIMDTypes.h"
|
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
|
||||||
|
|
||||||
#include "Core/Math/MathTypes.h"
|
#include "Core/public/Math/MathTypes.h"
|
||||||
|
|
||||||
namespace Phanes::Core::Math::SIMD
|
namespace Phanes::Core::Math::SIMD
|
||||||
{
|
{
|
||||||
|
@ -1,21 +1,27 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/MathCommon.hpp"
|
#include "Core/public/Math/MathCommon.hpp"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/Storage.h"
|
#include "Core/public/Math/SIMD/Storage.h"
|
||||||
|
|
||||||
|
#ifndef P_DEBUG
|
||||||
|
#pragma warning(disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma warning(disable: 4661)
|
||||||
|
|
||||||
#ifndef VECTOR2_H
|
#ifndef VECTOR2_H
|
||||||
#define VECTOR2_H
|
#define VECTOR2_H
|
||||||
|
|
||||||
|
|
||||||
#define PZeroVector2(type, aligned) Phanes::Core::Math::TVector2<type, aligned>(0,0)
|
#define PZeroVector2(type, aligned) Phanes::Core::Math::TVector2<##type, ##aligned>(0,0)
|
||||||
#define PVectorSouth2(type, aligned) Phanes::Core::Math::TVector2<type, aligned>(0,-1)
|
#define PVectorSouth2(type, aligned) Phanes::Core::Math::TVector2<##type, ##aligned>(0,-1)
|
||||||
#define PVectorNorth2(type, aligned) Phanes::Core::Math::TVector2<type, aligned>(0,1)
|
#define PVectorNorth2(type, aligned) Phanes::Core::Math::TVector2<##type, ##aligned>(0,1)
|
||||||
#define PVectorEast2(type, aligned) Phanes::Core::Math::TVector2<type, aligned>(1,0)
|
#define PVectorEast2(type, aligned) Phanes::Core::Math::TVector2<##type, ##aligned>(1,0)
|
||||||
#define PVectorWest2(type, aligned) Phanes::Core::Math::TVector2<type, aligned>(-1,0)
|
#define PVectorWest2(type, aligned) Phanes::Core::Math::TVector2<##type, ##aligned>(-1,0)
|
||||||
|
|
||||||
namespace Phanes::Core::Math {
|
namespace Phanes::Core::Math {
|
||||||
|
|
||||||
@ -460,12 +466,6 @@ namespace Phanes::Core::Math {
|
|||||||
return v1;
|
return v1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<RealType T, bool S>
|
|
||||||
T Distance(const TVector2<T, S>& v1, const TVector2<T, S>& v2)
|
|
||||||
{
|
|
||||||
return Magnitude(v2 - v1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds a vector to a square with a radius
|
* Binds a vector to a square with a radius
|
||||||
*
|
*
|
||||||
@ -1016,4 +1016,4 @@ namespace Phanes::Core::Math {
|
|||||||
#endif // !VECTOR2_H
|
#endif // !VECTOR2_H
|
||||||
|
|
||||||
// Include operator impl.
|
// Include operator impl.
|
||||||
#include "Core/Math/Vector2.inl"
|
#include "Core/public/Math/Vector2.inl"
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/Detail/Vector2Decl.inl"
|
#include "Core/public/Math/Detail/Vector2Decl.inl"
|
||||||
#include "Core/Math/SIMD/SIMDIntrinsics.h"
|
#include "Core/public/Math/SIMD/SIMDIntrinsics.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/PhanesSIMDTypes.h"
|
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,24 +3,28 @@
|
|||||||
// TODO: Slerp (using Quaternions)
|
// TODO: Slerp (using Quaternions)
|
||||||
|
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/MathCommon.hpp"
|
#include "Core/public/Math/MathCommon.hpp"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
#include "Core/Math/SIMD/Storage.h"
|
#include "Core/public/Math/SIMD/Storage.h"
|
||||||
|
|
||||||
#include "Core/Math/Vector4.hpp"
|
#include "Core/public/Math/Vector4.hpp"
|
||||||
|
|
||||||
|
#ifndef P_DEBUG
|
||||||
|
#pragma warning(disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef VECTOR3_H
|
#ifndef VECTOR3_H
|
||||||
#define VECTOR3_H
|
#define VECTOR3_H
|
||||||
|
|
||||||
#define PZeroVector3(type, aligned) Phanes::Core::Math::TVector3<type, aligned>(0,0,0)
|
#define PZeroVector3(type, aligned) Phanes::Core::Math::TVector3<##type, ##aligned>(0,0,0)
|
||||||
#define PVectorForward3(type, aligned) Phanes::Core::Math::TVector3<type, aligned>(1,0,0)
|
#define PVectorForward3(type, aligned) Phanes::Core::Math::TVector3<##type, ##aligned>(1,0,0)
|
||||||
#define PVectorBackward3(type, aligned) Phanes::Core::Math::TVector3<type, aligned>(-1,0,0)
|
#define PVectorBackward3(type, aligned) Phanes::Core::Math::TVector3<##type, ##aligned>(-1,0,0)
|
||||||
#define PVectorEast3(type, aligned) Phanes::Core::Math::TVector3<type, aligned>(0,1,0)
|
#define PVectorEast3(type, aligned) Phanes::Core::Math::TVector3<##type, ##aligned>(0,1,0)
|
||||||
#define PVectorWest3(type, aligned) Phanes::Core::Math::TVector3<type, aligned>(0,-1,0)
|
#define PVectorWest3(type, aligned) Phanes::Core::Math::TVector3<##type, ##aligned>(0,-1,0)
|
||||||
#define PVectorUp3(type, aligned) Phanes::Core::Math::TVector3<type, aligned>(0,0,1)
|
#define PVectorUp3(type, aligned) Phanes::Core::Math::TVector3<##type, ##aligned>(0,0,1)
|
||||||
#define PVectorDown3(type, aligned) Phanes::Core::Math::TVector3<type, aligned>(0,0,-1)
|
#define PVectorDown3(type, aligned) Phanes::Core::Math::TVector3<##type, ##aligned>(0,0,-1)
|
||||||
|
|
||||||
namespace Phanes::Core::Math {
|
namespace Phanes::Core::Math {
|
||||||
|
|
||||||
@ -409,46 +413,6 @@ namespace Phanes::Core::Math {
|
|||||||
return v1;
|
return v1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Refracts a vector
|
|
||||||
*
|
|
||||||
* @param(v1) Vector one
|
|
||||||
* @param(normal) Normal of surface
|
|
||||||
* @param(eta) Refraction index
|
|
||||||
*/
|
|
||||||
template<RealType T, bool S>
|
|
||||||
TVector3<T, S>& RefractV(TVector3<T, S>& v1, const TVector3<T, S>& normal, T eta)
|
|
||||||
{
|
|
||||||
T dot = DotP(v1, normal);
|
|
||||||
T k = 1.0f - eta * eta * (1.0f - dot * dot);
|
|
||||||
|
|
||||||
if (k < 0.0f)
|
|
||||||
{
|
|
||||||
v1 = PZeroVector3(T, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
v1 = eta * v1 - (eta * dot + sqrt(k)) * normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
return v1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets distance between two vectors
|
|
||||||
*
|
|
||||||
* @param(v1) Vector one
|
|
||||||
* @param(v2) Vector two
|
|
||||||
*
|
|
||||||
* @return Distance between vectors
|
|
||||||
*/
|
|
||||||
template<RealType T, bool S>
|
|
||||||
T Distance(const TVector3<T, S>& v1, const TVector3<T, S>& v2)
|
|
||||||
{
|
|
||||||
return Magnitude(v2 - v1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets angle between two vectors
|
* Gets angle between two vectors
|
||||||
*
|
*
|
||||||
@ -707,7 +671,7 @@ namespace Phanes::Core::Math {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
template<RealType T, bool S>
|
template<RealType T, bool S>
|
||||||
TVector3<T, S>& ClampToCubeV(TVector3<T, S>& v1, T cubeRadius);
|
TVector3<T, S>& ClampToCubeV(TVector3<T, S> v1, T cubeRadius);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rotates vector around axis
|
* Rotates vector around axis
|
||||||
@ -956,31 +920,6 @@ namespace Phanes::Core::Math {
|
|||||||
return (2 * DotP(v1, normal) * normal) - v1;
|
return (2 * DotP(v1, normal) * normal) - v1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Refracts a vector
|
|
||||||
*
|
|
||||||
* @param (v1) Vector one
|
|
||||||
* @param (normal) Normal of surface
|
|
||||||
* @param (eta) Refraction index
|
|
||||||
*
|
|
||||||
* @return Refracted vector
|
|
||||||
*/
|
|
||||||
template<RealType T, bool S>
|
|
||||||
TVector3<T, S> Refract(const TVector3<T, S>& v1, const TVector3<T, S>& normal, T eta)
|
|
||||||
{
|
|
||||||
T dot = DotP(v1, normal);
|
|
||||||
T k = 1.0f - eta * eta * (1.0f - dot * dot);
|
|
||||||
|
|
||||||
if (k < 0.0f)
|
|
||||||
{
|
|
||||||
return PZeroVector3(T, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return eta * v1 - (eta * dot + sqrt(k)) * normal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performes perspective divide on vector.
|
* Performes perspective divide on vector.
|
||||||
@ -1240,4 +1179,4 @@ namespace Phanes::Core::Math {
|
|||||||
#endif // !VECTOR3_H
|
#endif // !VECTOR3_H
|
||||||
|
|
||||||
|
|
||||||
#include "Core/Math/Vector3.inl"
|
#include "Core/public/Math/Vector3.inl"
|
@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/Detail/Vector3Decl.inl"
|
#include "Core/public/Math/Detail/Vector3Decl.inl"
|
||||||
#include "Core/Math/SIMD/SIMDIntrinsics.h"
|
#include "Core/public/Math/SIMD/SIMDIntrinsics.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/PhanesSIMDTypes.h"
|
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ namespace Phanes::Core::Math
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<RealType T, bool S>
|
template<RealType T, bool S>
|
||||||
TVector3<T, S>& ClampToCubeV(TVector3<T, S>& v1, T cubeRadius)
|
TVector3<T, S>& ClampToCubeV(TVector3<T, S> v1, T cubeRadius)
|
||||||
{
|
{
|
||||||
Detail::compute_vec3_clamp<T, S>::map(v1, v1, cubeRadius);
|
Detail::compute_vec3_clamp<T, S>::map(v1, v1, cubeRadius);
|
||||||
return v1;
|
return v1;
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
#include "Core/Math/MathCommon.hpp"
|
#include "Core/public/Math/MathCommon.hpp"
|
||||||
#include "Core/Math/SIMD/Storage.h"
|
#include "Core/public/Math/SIMD/Storage.h"
|
||||||
#include "Core/Math/MathFwd.h"
|
#include "Core/public/Math/MathFwd.h"
|
||||||
|
|
||||||
|
|
||||||
#include "Core/Math/Vector2.hpp"
|
#include "Core/public/Math/Vector2.hpp"
|
||||||
#include "Core/Math/Vector3.hpp"
|
#include "Core/public/Math/Vector3.hpp"
|
||||||
|
|
||||||
|
#define PZeroVector4(type, aligned) Phanes::Core::Math::TVector4<##type, ##aligned>(0,0,0,0)
|
||||||
|
|
||||||
#define PZeroVector4(type, aligned) Phanes::Core::Math::TVector4<type, aligned>(0,0,0,0)
|
|
||||||
|
|
||||||
namespace Phanes::Core::Math
|
namespace Phanes::Core::Math
|
||||||
{
|
{
|
||||||
@ -743,12 +741,6 @@ namespace Phanes::Core::Math
|
|||||||
return v1;
|
return v1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<RealType T, bool S>
|
|
||||||
T Distance(const TVector4<T, S>& v1, const TVector4<T, S>& v2)
|
|
||||||
{
|
|
||||||
return Magnitude(v1 - v2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Project vector v1 onto v2.
|
/// Project vector v1 onto v2.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -871,4 +863,5 @@ namespace Phanes::Core::Math
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "Core/Math/Vector4.inl"
|
|
||||||
|
#include "Core/public/Math/Vector4.inl"
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/Math/Boilerplate.h"
|
#include "Core/public/Math/Boilerplate.h"
|
||||||
|
|
||||||
#include "Core/Math/Detail/Vector4Decl.inl"
|
#include "Core/public/Math/Detail/Vector4Decl.inl"
|
||||||
#include "Core/Math/SIMD/SIMDIntrinsics.h"
|
#include "Core/public/Math/SIMD/SIMDIntrinsics.h"
|
||||||
|
|
||||||
#include "Core/Math/SIMD/PhanesSIMDTypes.h"
|
|
||||||
|
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
|
||||||
|
|
||||||
namespace Phanes::Core::Math
|
namespace Phanes::Core::Math
|
||||||
{
|
{
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#include "Core/Math/MathPCH.h"
|
|
@ -1 +0,0 @@
|
|||||||
#include "Core/Math/PhanesMathPCH.h"
|
|
13
Engine/Source/Runtime/Core/StartingPoint/CMakeLists.txt
Normal file
13
Engine/Source/Runtime/Core/StartingPoint/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.15...3.30)
|
||||||
|
|
||||||
|
project(StartingPoint)
|
||||||
|
|
||||||
|
set(StartingPoint
|
||||||
|
StartingPoint/EntryPoint.h
|
||||||
|
StartingPoint/StartingPoint.h
|
||||||
|
StartingPoint/private/StartingPoint.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(StartingPointPCH
|
||||||
|
StartingPoint/StartingPointPCH.h
|
||||||
|
)
|
@ -3,6 +3,24 @@
|
|||||||
|
|
||||||
#if defined(P_LINUX_BUILD)
|
#if defined(P_LINUX_BUILD)
|
||||||
|
|
||||||
int main();
|
extern Phanes::Core::Application::PhanesProject* Phanes::Core::Application::CreatePhanesGame();
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
Phanes::Core::Logging::Init();
|
||||||
|
PENGINE_LOG_INFO("Logger initialized!");
|
||||||
|
PENGINE_LOG_INFO("Welcome to PhanesEngine!");
|
||||||
|
|
||||||
|
|
||||||
|
auto phanes_game = Phanes::Core::Application::CreatePhanesGame();
|
||||||
|
|
||||||
|
PENGINE_LOG_INFO("Loading project {0}...", phanes_game->GetName());
|
||||||
|
|
||||||
|
phanes_game->Run();
|
||||||
|
|
||||||
|
delete phanes_game;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -1,9 +0,0 @@
|
|||||||
function includeStartingPoint()
|
|
||||||
files {
|
|
||||||
PhanesRuntime .. "/Core/StartingPoint/**.h",
|
|
||||||
PhanesRuntime .. "/Core/StartingPoint/**.cpp",
|
|
||||||
}
|
|
||||||
|
|
||||||
pchheader (PhanesRuntime .. "/Core/StartingPoint/StartingPointPCH.h")
|
|
||||||
pchsource (PhanesRuntime .. "/Core/StartingPoint/private/StartingPointPCH.cpp")
|
|
||||||
end
|
|
@ -1,22 +0,0 @@
|
|||||||
#include "Core/Include.h"
|
|
||||||
|
|
||||||
#if defined(P_LINUX_BUILD)
|
|
||||||
|
|
||||||
extern Phanes::Core::Application::PhanesProject* Phanes::Core::Application::CreatePhanesGame();
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
Phanes::Core::Logging::Logger::Init();
|
|
||||||
PENGINE_LOG_INFO("Logger initialized!");
|
|
||||||
PENGINE_LOG_INFO("Welcome to PhanesEngine!");
|
|
||||||
|
|
||||||
auto phanes_game = Phanes::Core::Application::CreatePhanesGame();
|
|
||||||
|
|
||||||
phanes_game->Run();
|
|
||||||
|
|
||||||
delete phanes_game;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,38 +1,37 @@
|
|||||||
#include "Core/StartingPoint/StartingPoint.h"
|
#include "Core/StartingPoint/StartingPoint.h"
|
||||||
#include "Core/Logging/Logging.h"
|
|
||||||
|
|
||||||
static void IdleMsg()
|
static void IdleMsg()
|
||||||
{
|
{
|
||||||
std::cout << "\nWelcome to PhanesEngine!\n";
|
std::cout << "\n\nWelcome to PhanesEngine!" << std::endl << std::endl;
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(5));
|
std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||||
|
|
||||||
std::cout << "It's silent...\n";
|
std::cout << "It's silent..." << std::endl << std::endl;
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||||
|
|
||||||
std::cout << "To silent.\n";
|
std::cout << "To silent." << std::endl;
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(5));
|
std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||||
|
|
||||||
std::cout << "I will go now\n";
|
std::cout << "\nI will go now" << std::endl;
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(4));
|
std::this_thread::sleep_for(std::chrono::seconds(4));
|
||||||
|
|
||||||
std::cout << "Good by!\n\n";
|
std::cout << "\nGood by!" << std::endl;
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Phanes::Core::Application::PhanesProject::PhanesProject(std::string _ProjectName)
|
Phanes::Core::Application::PhanesProject::PhanesProject(std::string _ProjectName)
|
||||||
: projectName(_ProjectName)
|
: projectName(_ProjectName)
|
||||||
{
|
{};
|
||||||
PAPP_LOG_INFO("Loading project: {0}", this->GetName());
|
|
||||||
};
|
|
||||||
|
|
||||||
Phanes::Core::Application::PhanesProject::~PhanesProject()
|
Phanes::Core::Application::PhanesProject::~PhanesProject()
|
||||||
{
|
{
|
||||||
PAPP_LOG_INFO("Unloading project: {0}", this->GetName());
|
this->projectName = "Unnamed Project";
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string Phanes::Core::Application::PhanesProject::GetName()
|
std::string Phanes::Core::Application::PhanesProject::GetName()
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#include "Core/StartingPoint/StartingPointPCH.h"
|
|
@ -1,21 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
#include "Core/Math/Include.h"
|
|
||||||
|
|
||||||
namespace PMath = Phanes::Core::Math;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
PMath::Matrix4 m0 = PMath::Matrix4(1.0f, 5.0f, 3.0f, 4.0f,
|
|
||||||
2.0f, 6.0f, 4.0f, 1.0f,
|
|
||||||
2.0f, -3.0f, 5.0f, 3.0f,
|
|
||||||
8.0f, -4.0f, 6.0f, -2.0f);
|
|
||||||
|
|
||||||
|
|
||||||
PMath::Matrix4 m2;
|
|
||||||
|
|
||||||
std::cout << std::to_string(PMath::InverseV<float, false>(m0)) << std::endl;
|
|
||||||
|
|
||||||
std::cout << PMath::ToString(m0) << std::endl;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
#include "pch.h"
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
//
|
|
||||||
// pch.h
|
|
||||||
//
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "googletest/googletest/include/gtest/gtest.h"
|
|
@ -1,39 +0,0 @@
|
|||||||
project "gtest"
|
|
||||||
language "C++"
|
|
||||||
kind "StaticLib"
|
|
||||||
third_party_boilerplate()
|
|
||||||
|
|
||||||
includedirs {
|
|
||||||
|
|
||||||
PhanesThirdParty .. "/googletest/googletest/include",
|
|
||||||
PhanesThirdParty .. "/googletest/googletest/include/gtest",
|
|
||||||
PhanesThirdParty .. "/googletest/googletest"
|
|
||||||
|
|
||||||
}
|
|
||||||
files {
|
|
||||||
PhanesThirdParty .. "/googletest/googletest/src/**.cc",
|
|
||||||
PhanesThirdParty .. "/googletest/googletest/include/gtest/**.h"
|
|
||||||
}
|
|
||||||
|
|
||||||
project "MathTestFPU"
|
|
||||||
kind "ConsoleApp"
|
|
||||||
boilerplate()
|
|
||||||
|
|
||||||
files {
|
|
||||||
PhanesRuntime .. "/Core/Tests/Math/MathTestFPU/test.cpp"
|
|
||||||
}
|
|
||||||
|
|
||||||
buildoptions {"-Wno-unused-variable", "-w", "-fpermissive"}
|
|
||||||
|
|
||||||
pchheader (PhanesRuntime .. "/Core/Tests/Math/MathTestFPU/pch.h")
|
|
||||||
pchsource (PhanesRuntime .. "/Core/Tests/Math/MathTestFPU/pch.cpp")
|
|
||||||
|
|
||||||
links { "gtest" }
|
|
||||||
dependson { "gtest" }
|
|
||||||
|
|
||||||
includedirs {
|
|
||||||
PhanesRuntime .. "/Core/Tests/Math/MathTestFPU",
|
|
||||||
PhanesThirdParty .. "/googletest/googletest/include",
|
|
||||||
PhanesThirdParty,
|
|
||||||
PhanesRuntime
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
include (PhanesRuntime .. "/Core/StartingPoint/premake5.lua")
|
|
||||||
include (PhanesRuntime .. "/Core/Logging/premake5.lua")
|
|
||||||
|
|
||||||
|
|
||||||
project "PhanesCore"
|
|
||||||
kind "StaticLib"
|
|
||||||
|
|
||||||
boilerplate()
|
|
||||||
|
|
||||||
files {
|
|
||||||
PhanesRuntime .. "/Core/Core.h"
|
|
||||||
}
|
|
||||||
|
|
||||||
includedirs { PhanesRuntime }
|
|
||||||
|
|
||||||
includeStartingPoint()
|
|
||||||
includeLogging()
|
|
@ -2,5 +2,6 @@
|
|||||||
|
|
||||||
// --- Core -------------------
|
// --- Core -------------------
|
||||||
|
|
||||||
|
#include "PhanesEnginePCH.h"
|
||||||
#include "Core/Include.h"
|
#include "Core/Include.h"
|
||||||
|
|
||||||
|
1
Engine/Source/ThirdParty/googletest
vendored
1
Engine/Source/ThirdParty/googletest
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit a6ce08abf746c0aaa577520d6d1f6ea2abeeb61d
|
|
2
Engine/Source/ThirdParty/spdlog
vendored
2
Engine/Source/ThirdParty/spdlog
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 3335c380a08c5e0f5117a66622df6afdb3d74959
|
Subproject commit bdd1dff3788ebfe520f48f9ad216c60da6dd8f00
|
7
MathTestFPU/pch.cpp
Normal file
7
MathTestFPU/pch.cpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
//
|
||||||
|
// pch.cpp
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "pch.h"
|
7
MathTestFPU/pch.h
Normal file
7
MathTestFPU/pch.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
//
|
||||||
|
// pch.h
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "gtest/gtest.h"
|
@ -1,12 +1,9 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
#include "Core/Math/Include.h"
|
#include "Core/public/Math/Include.h"
|
||||||
|
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-fpermissive"
|
|
||||||
|
|
||||||
namespace PMath = Phanes::Core::Math;
|
namespace PMath = Phanes::Core::Math;
|
||||||
using namespace Phanes::Core::Math::UnitLiterals;
|
using namespace Phanes::Core::Math::UnitLiterals;
|
||||||
|
|
||||||
@ -740,8 +737,7 @@ namespace VectorTests
|
|||||||
EXPECT_TRUE(PMath::CompInverseV(v0) == PMath::Vector3(1.0f / 2.4f, 1.0f / 3.1f, 1.0f / 5.6f));
|
EXPECT_TRUE(PMath::CompInverseV(v0) == PMath::Vector3(1.0f / 2.4f, 1.0f / 3.1f, 1.0f / 5.6f));
|
||||||
|
|
||||||
v0 = PMath::Vector3(2.4f, 3.1f, 5.6f);
|
v0 = PMath::Vector3(2.4f, 3.1f, 5.6f);
|
||||||
PMath::Vector3 test = PMath::ClampToCubeV(v0, 3.2f);
|
EXPECT_TRUE(PMath::ClampToCubeV(v0, 3.2f) == PMath::Vector3(2.4f, 3.1f, 3.2f));
|
||||||
EXPECT_TRUE(test == PMath::Vector3(2.4f, 3.1f, 3.2f));
|
|
||||||
|
|
||||||
v0 = PMath::Vector3(2.4f, 3.1f, 5.6f);
|
v0 = PMath::Vector3(2.4f, 3.1f, 5.6f);
|
||||||
EXPECT_TRUE(PMath::RotateAroundAxisV(v0, PMath::Vector3(0.0f, 0.0f, 1.0f), (float)30.0_deg) == PMath::Vector3(3.628461f, 1.484679f, 5.600000f)) << PMath::ToString(PMath::RotateAroundAxisV(v0, PMath::Vector3(0.0f, 0.0f, 1.0f), (float)30.0_deg));
|
EXPECT_TRUE(PMath::RotateAroundAxisV(v0, PMath::Vector3(0.0f, 0.0f, 1.0f), (float)30.0_deg) == PMath::Vector3(3.628461f, 1.484679f, 5.600000f)) << PMath::ToString(PMath::RotateAroundAxisV(v0, PMath::Vector3(0.0f, 0.0f, 1.0f), (float)30.0_deg));
|
||||||
@ -934,16 +930,16 @@ namespace MatrixTests
|
|||||||
PMath::Matrix2 m0 = PMath::Matrix2(1.0f, 5.0f, 3.0f, 2.0f);
|
PMath::Matrix2 m0 = PMath::Matrix2(1.0f, 5.0f, 3.0f, 2.0f);
|
||||||
|
|
||||||
m0 += 2.0f;
|
m0 += 2.0f;
|
||||||
EXPECT_TRUE(m0 == PMath::Matrix2(3.0f, 7.0f, 5.0f, 4.0f)) << PMath::ToString(m0);
|
EXPECT_TRUE(m0 == PMath::Matrix2(3.0f, 7.0f, 5.0f, 4.0f));
|
||||||
|
|
||||||
m0 -= 2.0f;
|
m0 -= 2.0f;
|
||||||
EXPECT_TRUE(m0 == PMath::Matrix2(1.0f, 5.0f, 3.0f, 2.0f)) << PMath::ToString(m0);
|
EXPECT_TRUE(m0 == PMath::Matrix2(1.0f, 5.0f, 3.0f, 2.0f));
|
||||||
|
|
||||||
m0 *= 2.0f;
|
m0 *= 2.0f;
|
||||||
EXPECT_TRUE(m0 == PMath::Matrix2(2.0f, 10.0f, 6.0f, 4.0f)) << PMath::ToString(m0);
|
EXPECT_TRUE(m0 == PMath::Matrix2(2.0f, 10.0f, 6.0f, 4.0f));
|
||||||
|
|
||||||
m0 /= 2.0f;
|
m0 /= 2.0f;
|
||||||
EXPECT_TRUE(m0 == PMath::Matrix2(1.0f, 5.0f, 3.0f, 2.0f)) << PMath::ToString(m0);
|
EXPECT_TRUE(m0 == PMath::Matrix2(1.0f, 5.0f, 3.0f, 2.0f));
|
||||||
|
|
||||||
|
|
||||||
m0 = m0 + 2.0f;
|
m0 = m0 + 2.0f;
|
||||||
@ -999,7 +995,7 @@ namespace MatrixTests
|
|||||||
|
|
||||||
EXPECT_FLOAT_EQ(PMath::Determinant(m0), -13.0f);
|
EXPECT_FLOAT_EQ(PMath::Determinant(m0), -13.0f);
|
||||||
|
|
||||||
EXPECT_TRUE(PMath::InverseV(m0) == PMath::Matrix2(-2.0f / 13.0f, 5.0f / 13.0f, 3.0f / 13.0f, -1.0f / 13.0f)) << PMath::ToString(m0);
|
EXPECT_TRUE(PMath::InverseV(m0) == PMath::Matrix2(-2.0f / 13.0f, 5.0f / 13.0f, 3.0f / 13.0f, -1.0f / 13.0f));
|
||||||
|
|
||||||
m0 = PMath::Matrix2(1.0f, 5.0f, 3.0f, 2.0f);
|
m0 = PMath::Matrix2(1.0f, 5.0f, 3.0f, 2.0f);
|
||||||
EXPECT_TRUE(PMath::TransposeV(m0) == PMath::Matrix2(1.0f, 3.0f, 5.0f, 2.0f));
|
EXPECT_TRUE(PMath::TransposeV(m0) == PMath::Matrix2(1.0f, 3.0f, 5.0f, 2.0f));
|
||||||
@ -1267,14 +1263,7 @@ namespace Plane
|
|||||||
TEST(Plane, OperatorTests)
|
TEST(Plane, OperatorTests)
|
||||||
{
|
{
|
||||||
PMath::Plane pl1(3.0f / 5.4772255750f, -2.0f / 5.4772255750f, -3.0f / 5.4772255750f, 4.0f);
|
PMath::Plane pl1(3.0f / 5.4772255750f, -2.0f / 5.4772255750f, -3.0f / 5.4772255750f, 4.0f);
|
||||||
PMath::Plane pl2 = PMath::Plane(-0.526316f, -0.442105f, -0.726316f, 6.0f);
|
PMath::Plane pl2(-0.526316f, -0.442105f, -0.726316f, 6.0f);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
|
||||||
{
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
|
||||||
return RUN_ALL_TESTS();
|
|
||||||
}
|
}
|
131
premake5.lua
131
premake5.lua
@ -1,131 +0,0 @@
|
|||||||
-- Phanes build configuration
|
|
||||||
VERSION = "1.0.0"
|
|
||||||
|
|
||||||
-- Override with specific platform if necessary
|
|
||||||
PLATFORM = os.target()
|
|
||||||
|
|
||||||
-- architecture.
|
|
||||||
ARCH = "x86_64"
|
|
||||||
|
|
||||||
-- SSE options:
|
|
||||||
-- SSE4: SSE
|
|
||||||
-- AVX: AVX
|
|
||||||
-- AVX2: AVX2
|
|
||||||
-- No SSE: FPU
|
|
||||||
-- None: Automatically detect SSE during build
|
|
||||||
SSE = "None"
|
|
||||||
|
|
||||||
|
|
||||||
phanesRoot = path.getabsolute(".")
|
|
||||||
phanesBin = path.join(phanesRoot, "bin")
|
|
||||||
phanesInt = path.join(phanesRoot, ".int")
|
|
||||||
phanesBuildFiles = path.join(phanesRoot, "build")
|
|
||||||
|
|
||||||
PhanesEngine = path.join(phanesRoot, "Engine")
|
|
||||||
PhanesRuntime = path.join(PhanesEngine, "Source/Runtime")
|
|
||||||
PhanesThirdParty = path.join(PhanesEngine, "Source/ThirdParty")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
workspace "PhanesEngine"
|
|
||||||
cppdialect "C++20"
|
|
||||||
architecture (ARCH)
|
|
||||||
toolset "gcc"
|
|
||||||
flags { "MultiProcessorCompile" }
|
|
||||||
clangtidy "On"
|
|
||||||
debugger "gdb"
|
|
||||||
startproject "MathTestFPU"
|
|
||||||
configurations { "Debug", "Release" }
|
|
||||||
|
|
||||||
|
|
||||||
function linux_sse()
|
|
||||||
if SSE == "SSE" then
|
|
||||||
defines {"P_SSE__"}
|
|
||||||
buildoptions {"-msse4", "-msse2", "-msse3"}
|
|
||||||
elseif SSE == "AVX" then
|
|
||||||
defines { "P_AVX__" }
|
|
||||||
buildoptions {"-mavx", "-msse4", "-msse2", "-msse3"}
|
|
||||||
elseif SSE == "AVX2" then
|
|
||||||
defines { "P_AVX2__" }
|
|
||||||
buildoptions {"-mavx2", "-mavx", "-msse4", "-msse2", "-msse3"}
|
|
||||||
elseif SSE == "FPU" then
|
|
||||||
defines { "P_FORCE_FPU" }
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
function boilerplate()
|
|
||||||
language "C++"
|
|
||||||
|
|
||||||
location (phanesBuildFiles .. "/%{prj.name}")
|
|
||||||
targetdir (phanesBin .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
|
|
||||||
objdir (phanesInt .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
|
|
||||||
|
|
||||||
if PLATFORM == "linux" then
|
|
||||||
defines { "P_LINUX_BUILD" }
|
|
||||||
buildoptions {"-Wall", "-Wextra", "-Werror"}
|
|
||||||
linux_sse()
|
|
||||||
buildoptions { "-Wno-unused-parameter" , "-fms-extensions" }
|
|
||||||
end
|
|
||||||
|
|
||||||
filter "configurations:Debug"
|
|
||||||
defines { "DEBUG", "TRACE", "P_DEBUG"}
|
|
||||||
symbols "On"
|
|
||||||
buildmessage("Building %{prj.name} in debug mode")
|
|
||||||
|
|
||||||
filter "configurations:Release"
|
|
||||||
defines { "NDEBUG", "P_RELEASE" }
|
|
||||||
linktimeoptimization "On"
|
|
||||||
optimize "On"
|
|
||||||
intrinsics "On"
|
|
||||||
buildmessage("Building %{prj.name} in release mode")
|
|
||||||
|
|
||||||
filter{}
|
|
||||||
end
|
|
||||||
|
|
||||||
function third_party_boilerplate()
|
|
||||||
language "C++"
|
|
||||||
|
|
||||||
location (phanesBuildFiles .. "/%{prj.name}")
|
|
||||||
targetdir (phanesBin .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
|
|
||||||
objdir (phanesInt .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
|
|
||||||
|
|
||||||
if PLATFORM == "linux" then
|
|
||||||
buildoptions {"-Wall", "-Wextra", "-Werror"}
|
|
||||||
linux_sse()
|
|
||||||
end
|
|
||||||
|
|
||||||
filter "configurations:Debug"
|
|
||||||
defines { "DEBUG", "TRACE", "P_DEBUG"}
|
|
||||||
symbols "On"
|
|
||||||
buildmessage("Building %{prj.name} in debug mode")
|
|
||||||
|
|
||||||
filter "configurations:Release"
|
|
||||||
defines { "NDEBUG", "P_RELEASE" }
|
|
||||||
linktimeoptimization "On"
|
|
||||||
optimize "On"
|
|
||||||
intrinsics "On"
|
|
||||||
buildmessage("Building %{prj.name} in release mode")
|
|
||||||
|
|
||||||
filter{}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- actions
|
|
||||||
|
|
||||||
function action_clean()
|
|
||||||
os.rmdir(phanesBin)
|
|
||||||
os.rmdir(phanesInt)
|
|
||||||
os.rmdir(phanesBuildFiles)
|
|
||||||
os.remove(phanesRoot .. "/Makefile")
|
|
||||||
end
|
|
||||||
|
|
||||||
newaction {
|
|
||||||
trigger = "clean",
|
|
||||||
description = "Clean the build",
|
|
||||||
execute = action_clean,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- includeProjects here
|
|
||||||
include (phanesRoot .. "/Engine/Source/Runtime/Core/premake5.lua")
|
|
||||||
include (phanesRoot .. "/DevPlayground/premake5.lua")
|
|
||||||
include (PhanesRuntime .. "/Core/Tests/Math/MathTestFPU/premake5.lua")
|
|
Loading…
x
Reference in New Issue
Block a user