Merge branch 'main' into SP3-18-Events

This commit is contained in:
Xiao Qi 2022-09-15 09:10:49 +08:00
commit d62201367a
22 changed files with 430 additions and 111 deletions

Binary file not shown.

View File

@ -15,8 +15,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msdfgen", "Dependencies\msd
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reactphysics3d", "Dependencies\reactphysics3d\reactphysics3d.vcxproj", "{2ECAB41A-1A98-A820-032C-1947EF988485}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spdlog", "Dependencies\spdlog\spdlog.vcxproj", "{8EAD431C-7A4F-6EF2-630A-82464F4BF542}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yaml-cpp", "Dependencies\yamlcpp\yaml-cpp.vcxproj", "{88F1A057-74BE-FB62-9DD7-E90A890331F1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SHADE_Engine", "SHADE_Engine\SHADE_Engine.vcxproj", "{3F92E998-2BF5-783D-D47A-B1F3C0BC44C0}"
@ -26,7 +24,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SHADE_Engine", "SHADE_Engin
{38BD587B-248B-4C81-0D1F-BDA7F98B28E6} = {38BD587B-248B-4C81-0D1F-BDA7F98B28E6}
{2ECAB41A-1A98-A820-032C-1947EF988485} = {2ECAB41A-1A98-A820-032C-1947EF988485}
{C0FF640D-2C14-8DBE-F595-301E616989EF} = {C0FF640D-2C14-8DBE-F595-301E616989EF}
{8EAD431C-7A4F-6EF2-630A-82464F4BF542} = {8EAD431C-7A4F-6EF2-630A-82464F4BF542}
EndProjectSection
EndProject
Global
@ -59,10 +56,6 @@ Global
{2ECAB41A-1A98-A820-032C-1947EF988485}.Debug|x64.Build.0 = Debug|x64
{2ECAB41A-1A98-A820-032C-1947EF988485}.Release|x64.ActiveCfg = Release|x64
{2ECAB41A-1A98-A820-032C-1947EF988485}.Release|x64.Build.0 = Release|x64
{8EAD431C-7A4F-6EF2-630A-82464F4BF542}.Debug|x64.ActiveCfg = Debug|x64
{8EAD431C-7A4F-6EF2-630A-82464F4BF542}.Debug|x64.Build.0 = Debug|x64
{8EAD431C-7A4F-6EF2-630A-82464F4BF542}.Release|x64.ActiveCfg = Release|x64
{8EAD431C-7A4F-6EF2-630A-82464F4BF542}.Release|x64.Build.0 = Release|x64
{88F1A057-74BE-FB62-9DD7-E90A890331F1}.Debug|x64.ActiveCfg = Debug|x64
{88F1A057-74BE-FB62-9DD7-E90A890331F1}.Debug|x64.Build.0 = Debug|x64
{88F1A057-74BE-FB62-9DD7-E90A890331F1}.Release|x64.ActiveCfg = Release|x64
@ -81,7 +74,6 @@ Global
{38BD587B-248B-4C81-0D1F-BDA7F98B28E6} = {53E47842-3FC8-3998-A828-34EB942B241A}
{8900D8DD-F5DF-5679-FEF7-E14F6A56BDDA} = {53E47842-3FC8-3998-A828-34EB942B241A}
{2ECAB41A-1A98-A820-032C-1947EF988485} = {53E47842-3FC8-3998-A828-34EB942B241A}
{8EAD431C-7A4F-6EF2-630A-82464F4BF542} = {53E47842-3FC8-3998-A828-34EB942B241A}
{88F1A057-74BE-FB62-9DD7-E90A890331F1} = {53E47842-3FC8-3998-A828-34EB942B241A}
EndGlobalSection
EndGlobal

View File

@ -42,15 +42,15 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>bin\Debug_x86_64\SHADE_Application\</OutDir>
<IntDir>bin-int\Debug_x86_64\SHADE_Application\</IntDir>
<OutDir>..\bin\Debug\</OutDir>
<IntDir>..\bin_int\Debug\SHADE_Application\</IntDir>
<TargetName>SHADE_Application</TargetName>
<TargetExt>.exe</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>bin\Release_x86_64\SHADE_Application\</OutDir>
<IntDir>bin-int\Release_x86_64\SHADE_Application\</IntDir>
<OutDir>..\bin\Release\</OutDir>
<IntDir>..\bin_int\Release\SHADE_Application\</IntDir>
<TargetName>SHADE_Application</TargetName>
<TargetExt>.exe</TargetExt>
</PropertyGroup>
@ -60,13 +60,13 @@
<PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;..\SHADE_Engine\src;src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;..\SHADE_Engine\src;src;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -80,15 +80,15 @@
<PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;..\SHADE_Engine\src;src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;..\SHADE_Engine\src;src;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@ -1,19 +1,20 @@
project "SHADE_Application"
kind "WindowedApp"
language "C++"
cppdialect "C++latest"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
cppdialect "C++20"
targetdir (outputdir)
objdir (interdir)
systemversion "latest"
pchheader "SBpch.h"
pchsource "%{prj.location}/src/SBpch.cpp"
staticruntime "on"
staticruntime "off"
entrypoint "wWinMainCRTStartup"
system ("windows")
files
{
"%{prj.location}/src/**.h",
"%{prj.location}/src/**.hpp",
"%{prj.location}/src/**.c",
"%{prj.location}/src/**.cpp",
"%{prj.location}/src/**.glsl",
@ -23,7 +24,8 @@ project "SHADE_Application"
{
"%{IncludeDir.spdlog}/include",
"../SHADE_Engine/src",
"src"
"src",
"%{IncludeDir.dotnet}/include",
}
flags
@ -33,11 +35,7 @@ project "SHADE_Application"
links
{
"SHADE_Engine"
}
postbuildcommands
{
"SHADE_Engine",
}
warnings 'Extra'
@ -48,4 +46,4 @@ project "SHADE_Application"
filter "configurations:Release"
optimize "On"
defines{"_RELEASE"}
defines{"_RELEASE"}

View File

@ -6,6 +6,9 @@
#include "Scenes/SBEditorScene.h"
#endif // SHEDITOR
#include "Tools/SHLogger.h"
#include "Tools/SHFileUtilties.h"
#include <chrono>
#include <ratio>
#include <ctime>
@ -21,7 +24,9 @@ namespace Sandbox
_In_ INT nCmdShow
)
{
// Set working directory
SHADE::SHFileUtilities::SetWorkDirToExecDir();
window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
#ifdef SHEDITOR

View File

@ -26,15 +26,15 @@ INT WINAPI wWinMain
)
{
const SHADE::SHLogger::Config LOGGER_CONFIG{ .directoryPath = "./logs/" };
SHADE::SHLogger::Initialise(LOGGER_CONFIG);
auto logger = SHADE::SHLogger::Initialise(LOGGER_CONFIG);
try
{
#ifndef SHEDITOR
//ShowWindow(::GetConsoleWindow(), SW_HIDE);
#endif
#endif
SHLOG_INFO("sup")
SHLOG_REGISTER(logger)
SHADE::SHEngine::Run<Sandbox::SBApplication>(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

View File

@ -19,13 +19,13 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
@ -41,65 +41,71 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>bin\Debug_x86_64\SHADE_Engine\</OutDir>
<IntDir>bin-int\Debug_x86_64\SHADE_Engine\</IntDir>
<LinkIncremental>true</LinkIncremental>
<OutDir>..\bin\Debug\</OutDir>
<IntDir>..\bin_int\Debug\SHADE_Engine\</IntDir>
<TargetName>SHADE_Engine</TargetName>
<TargetExt>.lib</TargetExt>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin\Release_x86_64\SHADE_Engine\</OutDir>
<IntDir>bin-int\Release_x86_64\SHADE_Engine\</IntDir>
<LinkIncremental>false</LinkIncremental>
<OutDir>..\bin\Release\</OutDir>
<IntDir>..\bin_int\Release\SHADE_Engine\</IntDir>
<TargetName>SHADE_Engine</TargetName>
<TargetExt>.lib</TargetExt>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>SHpch.h</PrecompiledHeaderFile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>_LIB;_GLFW_INCLUDE_NONE;MSDFGEN_USE_CPP11;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_LIB;_GLFW_INCLUDE_NONE;MSDFGEN_USE_CPP11;NOMINMAX;SH_API_EXPORT;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>src;..\Dependencies\assimp\include;..\Dependencies\imgui;..\Dependencies\imguizmo;..\Dependencies\imnodes;..\Dependencies\msdf;..\Dependencies\msdf\msdfgen;..\Dependencies\spdlog\include;..\Dependencies\tracy;..\Dependencies\VMA\include;..\Dependencies\yamlcpp\include;..\Dependencies\ktx\include;..\Dependencies\RTTR\include;..\Dependencies\reactphysics3d\include;$(VULKAN_SDK)\include;$(VULKAN_SDK)\Source\SPIRV-Reflect;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>vulkan-1.lib;shaderc_shared.lib;shlwapi.lib;assimp-vc142-mtd.lib;librttr_core_d.lib;spdlogd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>libs;$(VULKAN_SDK)\Lib;..\Dependencies\assimp\lib\Debug;..\Dependencies\assimp\lib\Release;..\Dependencies\RTTR\lib;..\Dependencies\spdlog\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ImportLibrary>..\bin\Debug\SHADE_Engine.lib</ImportLibrary>
</Link>
<Lib>
<AdditionalDependencies>vulkan-1.lib;shaderc_shared.lib;assimp-vc142-mtd.lib;ktxd.lib;librttr_core_d.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>libs;$(VULKAN_SDK)\Lib;..\Dependencies\assimp\lib\Debug;..\Dependencies\assimp\lib\Release;..\Dependencies\RTTR\lib;..\Dependencies\ktx\lib\Debug;..\Dependencies\ktx\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
<PostBuildEvent>
<Command>xcopy /s /r /y /q "$(SolutionDir)/Dependencies/spdlog/bin" "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>SHpch.h</PrecompiledHeaderFile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>_LIB;_GLFW_INCLUDE_NONE;MSDFGEN_USE_CPP11;NOMINMAX;_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_LIB;_GLFW_INCLUDE_NONE;MSDFGEN_USE_CPP11;NOMINMAX;SH_API_EXPORT;_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>src;..\Dependencies\assimp\include;..\Dependencies\imgui;..\Dependencies\imguizmo;..\Dependencies\imnodes;..\Dependencies\msdf;..\Dependencies\msdf\msdfgen;..\Dependencies\spdlog\include;..\Dependencies\tracy;..\Dependencies\VMA\include;..\Dependencies\yamlcpp\include;..\Dependencies\ktx\include;..\Dependencies\RTTR\include;..\Dependencies\reactphysics3d\include;$(VULKAN_SDK)\include;$(VULKAN_SDK)\Source\SPIRV-Reflect;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>vulkan-1.lib;shaderc_shared.lib;shlwapi.lib;assimp-vc142-mt.lib;librttr_core.lib;spdlog.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>libs;$(VULKAN_SDK)\Lib;..\Dependencies\assimp\lib\Debug;..\Dependencies\assimp\lib\Release;..\Dependencies\RTTR\lib;..\Dependencies\spdlog\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ImportLibrary>..\bin\Release\SHADE_Engine.lib</ImportLibrary>
</Link>
<Lib>
<AdditionalDependencies>vulkan-1.lib;shaderc_shared.lib;assimp-vc142-mt.lib;ktx.lib;librttr_core.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>libs;$(VULKAN_SDK)\Lib;..\Dependencies\assimp\lib\Debug;..\Dependencies\assimp\lib\Release;..\Dependencies\RTTR\lib;..\Dependencies\ktx\lib\Debug;..\Dependencies\ktx\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
<PostBuildEvent>
<Command>xcopy /s /r /y /q "$(SolutionDir)/Dependencies/spdlog/bin" "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="src\Common\SHCommonTypes.h" />
@ -188,12 +194,15 @@
<ClInclude Include="src\Resource\Handle.h" />
<ClInclude Include="src\Resource\ResourceLibrary.h" />
<ClInclude Include="src\Resource\SparseSet.h" />
<ClInclude Include="src\SHCommonTypes.h" />
<ClInclude Include="src\SH_API.h" />
<ClInclude Include="src\SHpch.h" />
<ClInclude Include="src\Scene\SHScene.h" />
<ClInclude Include="src\Scene\SHSceneGraph.h" />
<ClInclude Include="src\Scene\SHSceneManager.h" />
<ClInclude Include="src\Tools\SHException.h" />
<ClInclude Include="src\Tools\SHExceptionHandler.h" />
<ClInclude Include="src\Tools\SHFileUtilties.h" />
<ClInclude Include="src\Tools\SHLogger.h" />
<ClInclude Include="src\Tools\SHUtilities.h" />
</ItemGroup>
@ -267,6 +276,7 @@
<ClCompile Include="src\Scene\SHSceneManager.cpp" />
<ClCompile Include="src\Tools\SHException.cpp" />
<ClCompile Include="src\Tools\SHExceptionHandler.cpp" />
<ClCompile Include="src\Tools\SHFileUtilties.cpp" />
<ClCompile Include="src\Tools\SHLogger.cpp" />
</ItemGroup>
<ItemGroup>
@ -285,9 +295,6 @@
<ProjectReference Include="..\Dependencies\imgui\ImGui.vcxproj">
<Project>{C0FF640D-2C14-8DBE-F595-301E616989EF}</Project>
</ProjectReference>
<ProjectReference Include="..\Dependencies\spdlog\spdlog.vcxproj">
<Project>{8EAD431C-7A4F-6EF2-630A-82464F4BF542}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -378,6 +378,8 @@
<ClInclude Include="src\Resource\SparseSet.h">
<Filter>Resource</Filter>
</ClInclude>
<ClInclude Include="src\SHCommonTypes.h" />
<ClInclude Include="src\SH_API.h" />
<ClInclude Include="src\SHpch.h" />
<ClInclude Include="src\Scene\SHScene.h">
<Filter>Scene</Filter>
@ -394,6 +396,9 @@
<ClInclude Include="src\Tools\SHExceptionHandler.h">
<Filter>Tools</Filter>
</ClInclude>
<ClInclude Include="src\Tools\SHFileUtilties.h">
<Filter>Tools</Filter>
</ClInclude>
<ClInclude Include="src\Tools\SHLogger.h">
<Filter>Tools</Filter>
</ClInclude>
@ -602,6 +607,9 @@
<ClCompile Include="src\Tools\SHExceptionHandler.cpp">
<Filter>Tools</Filter>
</ClCompile>
<ClCompile Include="src\Tools\SHFileUtilties.cpp">
<Filter>Tools</Filter>
</ClCompile>
<ClCompile Include="src\Tools\SHLogger.cpp">
<Filter>Tools</Filter>
</ClCompile>

View File

@ -1,13 +1,13 @@
project "SHADE_Engine"
kind "StaticLib"
kind "SharedLib"
language "C++"
cppdialect "C++latest"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
cppdialect "C++20"
targetdir (outputdir)
objdir (interdir)
systemversion "latest"
pchheader "SHpch.h"
pchsource "%{prj.location}/src/SHpch.cpp"
staticruntime "on"
staticruntime "off"
files
{
@ -35,7 +35,7 @@ project "SHADE_Engine"
"%{IncludeDir.RTTR}/include",
"%{IncludeDir.reactphysics3d}/include",
"%{IncludeDir.VULKAN}/include",
"%{IncludeDir.VULKAN}/Source/SPIRV-Reflect"
"%{IncludeDir.VULKAN}/Source/SPIRV-Reflect"
}
libdirs
@ -45,8 +45,7 @@ project "SHADE_Engine"
"%{IncludeDir.assimp}/lib/Debug",
"%{IncludeDir.assimp}/lib/Release",
"%{IncludeDir.RTTR}/lib",
"%{IncludeDir.ktx}/lib/Debug",
"%{IncludeDir.ktx}/lib/Release",
"%{IncludeDir.spdlog}/lib"
}
links
@ -56,9 +55,9 @@ project "SHADE_Engine"
"msdf-atlas-gen",
"reactphysics3d",
"imgui",
"spdlog",
"vulkan-1.lib",
"shaderc_shared.lib"
"shaderc_shared.lib",
"shlwapi"
}
defines
@ -66,7 +65,8 @@ project "SHADE_Engine"
"_LIB",
"_GLFW_INCLUDE_NONE",
"MSDFGEN_USE_CPP11",
"NOMINMAX"
"NOMINMAX",
"SH_API_EXPORT"
}
flags
@ -81,7 +81,11 @@ project "SHADE_Engine"
"msdf-atlas-gen",
"reactphysics3d",
"imgui",
"spdlog",
}
postbuildcommands
{
"xcopy /s /r /y /q \"%{IncludeDir.spdlog}/bin\" \"$(OutDir)\""
}
warnings 'Extra'
@ -89,11 +93,11 @@ project "SHADE_Engine"
filter "configurations:Debug"
symbols "On"
defines {"_DEBUG"}
links{"assimp-vc142-mtd.lib", "ktxd.lib", "librttr_core_d.lib"}
links{"assimp-vc142-mtd.lib", "librttr_core_d.lib", "spdlogd.lib"}
--links{"fmodstudioL_vc.lib", "fmodL_vc.lib"}
filter "configurations:Release"
optimize "On"
defines{"_RELEASE"}
links{"assimp-vc142-mt.lib", "ktx.lib", "librttr_core.lib"}
links{"assimp-vc142-mt.lib", "librttr_core.lib", "spdlog.lib"}
--links{"fmodstudio_vc.lib", "fmod_vc.lib"}

View File

@ -14,13 +14,14 @@
#include "SHpch.h"
#include "../SHECSMacros.h"
#include "SH_API.h"
namespace SHADE
{
class SHComponentManager;
class SHComponent
class SH_API SHComponent
{
friend SHComponentManager;

View File

@ -15,6 +15,7 @@
#include "../Components/SHComponent.h"
#include "../System/SHComponentManager.h"
//#include "../../Scene/SHSceneNode.h"
#include "SH_API.h"
@ -23,7 +24,7 @@ namespace SHADE
class SHComponentManager;
class SHEntityManager;
class SHEntity
class SH_API SHEntity
{
public:

View File

@ -19,13 +19,14 @@
#include "../Components/SHComponent.h"
#include "../Components/SHComponentGroup.h"
//#include "Scene/SHSceneNode.h"
#include "SH_API.h"
#include <cassert>
namespace SHADE
{
class SHComponentManager
class SH_API SHComponentManager
{
private:

View File

@ -22,11 +22,12 @@
#include "../Components/SHComponent.h"
#include "../General/SHHandleGenerator.h"
#include "../SHECSMacros.h"
#include "SH_API.h"
namespace SHADE
{
class SHEntityManager
class SH_API SHEntityManager
{
private:
static std::vector<std::unique_ptr<SHEntity>> entityVec;

View File

@ -5,6 +5,7 @@
#include <functional>
#include <unordered_map>
#include "SHWindowMap.h"
#include "SH_API.h"
namespace SHADE
{
@ -67,7 +68,7 @@ namespace SHADE
std::string icoPath = "";
};
class SHWindow
class SH_API SHWindow
{
public:
using SHVec2 = std::pair<uint32_t, uint32_t>;

View File

@ -0,0 +1,28 @@
/************************************************************************************//*!
\file SHCommonTypes.h
\author Tng Kah Wei, kahwei.tng, 390009620
\par email: kahwei.tng\@digipen.edu
\date Sep 8, 2022
\brief Contains the definitions of type alias for commonly used units for
clarity and convenience.
Copyright (C) 2022 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents without the prior written consent
of DigiPen Institute of Technology is prohibited.
*//*************************************************************************************/
#pragma once
namespace SHADE
{
/*---------------------------------------------------------------------------------*/
/* Type Definitions */
/*---------------------------------------------------------------------------------*/
/***********************************************************************************/
/*!
\brief
Type used to mark a value that is supposed to represent a size in bytes.
*/
/***********************************************************************************/
using Byte = size_t;
}

36
SHADE_Engine/src/SH_API.h Normal file
View File

@ -0,0 +1,36 @@
/************************************************************************************//*!
\file SH_API.h
\author Tng Kah Wei, kahwei.tng, 390009620
\par email: kahwei.tng\@digipen.edu
\date Sep 13, 2022
\brief Contains dllexport and dllimport macros for the SHADE Engine.
Copyright (C) 2022 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents without the prior written consent
of DigiPen Institute of Technology is prohibited.
*//*************************************************************************************/
#pragma once
// Select the correct export system based on the compiler
#if defined SH_LIB
# define SH_API
#else
# if defined _WIN32 || defined __CYGWIN__ || defined _MSC_VER
# define SH_EXPORT __declspec(dllexport)
# define SH_IMPORT __declspec(dllimport)
# elif defined __GNUC__ && __GNUC__ >= 4
# define SH_EXPORT __attribute__((visibility("default")))
# define SH_IMPORT __attribute__((visibility("default")))
# else /* Unsupported compiler */
# define SH_EXPORT
# define SH_IMPORT
# endif
// Define the correct
# ifndef SH_API
# if defined SH_API_EXPORT
# define SH_API SH_EXPORT
# else
# define SH_API SH_IMPORT
# endif
# endif
#endif

View File

@ -12,13 +12,15 @@
#include <exception>
#include "SH_API.h"
namespace SHADE
{
/*-----------------------------------------------------------------------------------*/
/* Type Definitions */
/*-----------------------------------------------------------------------------------*/
class SHExceptionHandler
class SH_API SHExceptionHandler
{
public:
/*---------------------------------------------------------------------------------*/

View File

@ -0,0 +1,30 @@
/************************************************************************************//*!
\file SHFileUtilities.cpp
\author Tng Kah Wei, kahwei.tng, 390009620
\par email: kahwei.tng\@digipen.edu
\date Sep 15, 2022
\brief Contains the definition of functions of the SHFileUtilities static class.
Copyright (C) 2022 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents without the prior written consent
of DigiPen Institute of Technology is prohibited.
*//*************************************************************************************/
// Precompiled Header
#include "SHpch.h"
// Primary Header
#include "SHFileUtilties.h"
// Standard Libraries
#include <filesystem>
// External Dependencies
#include <shlwapi.h> // GetModuleFileName, PathRemoveFileSpec
namespace SHADE
{
void SHFileUtilities::SetWorkDirToExecDir()
{
TCHAR currentExecFilePath[MAX_PATH] = { '\0' };
GetModuleFileName(nullptr, currentExecFilePath, MAX_PATH);
PathRemoveFileSpec(currentExecFilePath);
std::filesystem::current_path(currentExecFilePath);
}
}

View File

@ -0,0 +1,38 @@
/************************************************************************************//*!
\file SHFileUtilities.h
\author Tng Kah Wei, kahwei.tng, 390009620
\par email: kahwei.tng\@digipen.edu
\date Sep 15, 2022
\brief Contains the SHFileUtilities static class.
Copyright (C) 2022 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents without the prior written consent
of DigiPen Institute of Technology is prohibited.
*//*************************************************************************************/
// Project Headers
#include "SH_API.h"
namespace SHADE
{
/*!************************************************************************************
\class SHFileUtilities
\brief
Static class that contains functions for working with files and directories.
**************************************************************************************/
class SH_API SHFileUtilities
{
public:
/*!**********************************************************************************
\brief
Sets the application's current working directory to the application executable's
directory.
************************************************************************************/
static void SetWorkDirToExecDir();
};
}

View File

@ -30,8 +30,9 @@ namespace SHADE
/*-----------------------------------------------------------------------------------*/
/* Static Data Member Definitions */
/*-----------------------------------------------------------------------------------*/
unsigned char SHLogger::configFlags = DEFAULT_CONFIG_FLAG;
SHLogger::DateFormat SHLogger::dateFormat = SHLogger::DateFormat::DD_MM_YY;
unsigned char SHLogger::configFlags = DEFAULT_CONFIG_FLAG;
SHLogger::DateFormat SHLogger::dateFormat = SHLogger::DateFormat::DD_MM_YY;
SHLogger::Logger SHLogger::logger = nullptr;
std::string SHLogger::trivialPattern;
std::string SHLogger::verbosePattern;
@ -142,7 +143,7 @@ namespace SHADE
/* Public Function Member Definitions */
/*-----------------------------------------------------------------------------------*/
void SHLogger::Initialise(const Config& config)
SHLogger::Logger SHLogger::Initialise(const Config& config)
{
SetConfig(config);
@ -176,10 +177,10 @@ namespace SHADE
FILE_SINK->set_pattern(trivialPattern + "%v");
// Create and register logger with spdlog
const auto LOGGER = std::make_shared<spdlog::logger>(SHLOGGER_NAME, sinks.begin(), sinks.end());
LOGGER->set_level(spdlog::level::trace);
LOGGER->flush_on(spdlog::level::trace);
register_logger(LOGGER);
logger = std::make_shared<spdlog::logger>(SHLOGGER_NAME, sinks.begin(), sinks.end());
logger->set_level(spdlog::level::trace);
logger->flush_on(spdlog::level::trace);
spdlog::register_logger(logger);
// Flush every 3 seconds
spdlog::flush_every(std::chrono::seconds(config.flushTime));
@ -190,6 +191,8 @@ namespace SHADE
{
std::cout << "Log initialisation failed: " << e.what() << std::endl;
}
return logger;
}
void SHLogger::Shutdown() noexcept
@ -211,6 +214,143 @@ namespace SHADE
sinks[1]->set_pattern(verbosePattern + "%v"); // File Sink
}
void SHLogger::LogInfo(const std::string& msg) noexcept
{
SHLOG_INFO(msg)
}
void SHLogger::LogVerboseInfo(const std::string& msg, const std::source_location& src) noexcept
{
const bool SHOW_SRC_FILE = configFlags & (1U << 3);
const bool SHOW_SRC_LINE = configFlags & (1U << 4);
std::stringstream ss;
ss << "[";
if (SHOW_SRC_FILE)
{
ss << std::filesystem::path(src.file_name()).filename().string() << ", ";
if (SHOW_SRC_LINE)
{
ss << src.line() << ", ";
}
}
ss << src.function_name() << "] " << msg;
SHLOG_INFO(ss.str())
}
void SHLogger::LogWarning(const std::string& msg) noexcept
{
SHLOG_WARNING(msg)
}
void SHLogger::LogVerboseWarning(const std::string& msg, const std::source_location& src) noexcept
{
const bool SHOW_SRC_FILE = configFlags & (1U << 3);
const bool SHOW_SRC_LINE = configFlags & (1U << 4);
std::stringstream ss;
ss << "[";
if (SHOW_SRC_FILE)
{
ss << std::filesystem::path(src.file_name()).filename().string() << ", ";
if (SHOW_SRC_LINE)
{
ss << src.line() << ", ";
}
}
ss << src.function_name() << "] " << msg;
SHLOG_WARNING(ss.str())
}
void SHLogger::LogError(const std::string& msg) noexcept
{
SHLOG_ERROR(msg)
}
void SHLogger::LogVerboseError(const std::string& msg, const std::source_location& src) noexcept
{
const bool SHOW_SRC_FILE = configFlags & (1U << 3);
const bool SHOW_SRC_LINE = configFlags & (1U << 4);
std::stringstream ss;
ss << "[";
if (SHOW_SRC_FILE)
{
ss << std::filesystem::path(src.file_name()).filename().string() << ", ";
if (SHOW_SRC_LINE)
{
ss << src.line() << ", ";
}
}
ss << src.function_name() << "] " << msg;
SHLOG_ERROR(ss.str())
}
void SHLogger::LogCritical(const std::string& msg) noexcept
{
SHLOG_CRITICAL(msg)
}
void SHLogger::LogVerboseCritical(const std::string& msg, const std::source_location& src) noexcept
{
const bool SHOW_SRC_FILE = configFlags & (1U << 3);
const bool SHOW_SRC_LINE = configFlags & (1U << 4);
std::stringstream ss;
ss << "[";
if (SHOW_SRC_FILE)
{
ss << std::filesystem::path(src.file_name()).filename().string() << ", ";
if (SHOW_SRC_LINE)
{
ss << src.line() << ", ";
}
}
ss << src.function_name() << "] " << msg;
SHLOG_CRITICAL(ss.str())
}
void SHLogger::LogFloor() noexcept
{
SHLOG_FLOOR()
}
#ifdef _DEBUG
void SHLogger::LogTrace(const std::string& msg) noexcept
{
SHLOG_TRACE(msg)
}
void SHLogger::LogVerboseTrace(const std::string& msg, const std::source_location& src) noexcept
{
const bool SHOW_SRC_FILE = configFlags & (1U << 3);
const bool SHOW_SRC_LINE = configFlags & (1U << 4);
std::stringstream ss;
ss << "[";
if (SHOW_SRC_FILE)
{
ss << std::filesystem::path(src.file_name()).filename().string() << ", ";
if (SHOW_SRC_LINE)
{
ss << src.line() << ", ";
}
}
ss << src.function_name() << "] " << msg;
SHLOG_TRACE(ss.str())
}
#endif
/*-----------------------------------------------------------------------------------*/
/* Private Function Member Definitions */
/*-----------------------------------------------------------------------------------*/

View File

@ -12,9 +12,11 @@
#include <string_view>
#include <filesystem>
#include <source_location>
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
#include <spdlog/spdlog.h>
#include "SH_API.h"
/*-------------------------------------------------------------------------------------*/
/* Macros */
@ -27,13 +29,15 @@ namespace SHADE
/* Type Definitions */
/*-----------------------------------------------------------------------------------*/
class SHLogger
class SH_API SHLogger
{
public:
/*---------------------------------------------------------------------------------*/
/* Type Definitions */
/*---------------------------------------------------------------------------------*/
using Logger = std::shared_ptr<spdlog::logger>;
enum class ClockFormat { _12HR, _24HR };
enum class DateFormat
@ -70,33 +74,33 @@ namespace SHADE
/* Getter Functions */
/*---------------------------------------------------------------------------------*/
[[nodiscard]] static const std::string& GetTrivialPattern () noexcept { return trivialPattern; }
[[nodiscard]] static const std::string& GetVerbosePattern () noexcept { return verbosePattern; }
[[nodiscard]] static const std::string& GetTrivialPattern () noexcept { return trivialPattern; }
[[nodiscard]] static const std::string& GetVerbosePattern () noexcept { return verbosePattern; }
/*---------------------------------------------------------------------------------*/
/* Setter Functions */
/*---------------------------------------------------------------------------------*/
static void SetTrivialPattern (const std::string& pattern) noexcept { trivialPattern = pattern; }
static void SetVerbosePattern (const std::string& pattern) noexcept { verbosePattern = pattern; }
static void SetTrivialPattern (const std::string& pattern) noexcept { trivialPattern = pattern; }
static void SetVerbosePattern (const std::string& pattern) noexcept { verbosePattern = pattern; }
static void SetConfig (const Config& config) noexcept;
static void SetConfig (const Config& config) noexcept;
static void SetShowTime (bool showTime) noexcept;
static void SetShowDate (bool showDate) noexcept;
static void SetShowFunctionFileName (bool showFunctionFileName) noexcept;
static void SetShowFunctionLineNumber (bool showFunctionLineNumber) noexcept;
static void SetShowTime (bool showTime) noexcept;
static void SetShowDate (bool showDate) noexcept;
static void SetShowFunctionFileName (bool showFunctionFileName) noexcept;
static void SetShowFunctionLineNumber (bool showFunctionLineNumber) noexcept;
static void SetClockFormat (ClockFormat newClockFormat) noexcept;
static void SetDateFormat (DateFormat newDateFormat) noexcept;
static void SetClockFormat (ClockFormat newClockFormat) noexcept;
static void SetDateFormat (DateFormat newDateFormat) noexcept;
static void SetFileName (const std::string& logFileName) noexcept;
static void SetDirectoryPath (const std::filesystem::path& logDirectoryPath) noexcept;
static void SetFileName (const std::string& logFileName) noexcept;
static void SetDirectoryPath (const std::filesystem::path& logDirectoryPath) noexcept;
static void SetFlushTime (int seconds) noexcept;
static void SetFlushTime (size_t seconds) noexcept { spdlog::flush_every(std::chrono::seconds(seconds)); }
static void SetFlushTime (int seconds) noexcept;
static void SetFlushTime (size_t seconds) noexcept { spdlog::flush_every(std::chrono::seconds(seconds)); }
/*---------------------------------------------------------------------------------*/
/* Function Members */
@ -106,17 +110,34 @@ namespace SHADE
* @brief Creates a console and a file to log to.
* @param[in] config The configuration parameters for the logger.
*/
static void Initialise (const Config& config = Config{});
static Logger Initialise (const Config& config = Config{});
static void Shutdown () noexcept;
/**
* @brief The next message logged by the logger will be set to follow the trivial pattern.
*/
static void UseTrivialPattern () noexcept;
static void UseTrivialPattern () noexcept;
/**
* @brief The next message logged by the logger will be set to follow the verbose pattern.
*/
static void UseVerbosePattern () noexcept;
static void UseVerbosePattern () noexcept;
/// Logging Functions to interface with C++/CLI.
static void LogInfo (const std::string& msg) noexcept;
static void LogVerboseInfo (const std::string& msg, const std::source_location& src= std::source_location::current()) noexcept;
static void LogWarning (const std::string& msg) noexcept;
static void LogVerboseWarning (const std::string& msg, const std::source_location& src = std::source_location::current()) noexcept;
static void LogError (const std::string& msg) noexcept;
static void LogVerboseError (const std::string& msg, const std::source_location& src = std::source_location::current()) noexcept;
static void LogCritical (const std::string& msg) noexcept;
static void LogVerboseCritical (const std::string& msg, const std::source_location& src = std::source_location::current()) noexcept;
static void LogFloor () noexcept;
#ifdef _DEBUG
static void LogTrace (const std::string& msg) noexcept;
static void LogVerboseTrace (const std::string& msg, const std::source_location& src = std::source_location::current()) noexcept;
#endif
private:
/*---------------------------------------------------------------------------------*/
@ -126,7 +147,9 @@ namespace SHADE
static constexpr short DEFAULT_CONSOLE_LEN = 1024;
static unsigned char configFlags; // Initialised 0 0 FuncLine# FuncFileName Date TimeFormat Time
static DateFormat dateFormat;
static DateFormat dateFormat;
static Logger logger;
static std::string trivialPattern;
static std::string verbosePattern;
@ -171,4 +194,7 @@ namespace SHADE
#define SHLOGV_CRITICAL(format, ...) SHADE::SHLogger::UseVerbosePattern(); SPDLOG_LOGGER_CRITICAL(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
// Misc Logging Macros
#define SHLOG_FLOOR() SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_INFO(spdlog::get(SHLOGGER_NAME), "--------------------------------");
#define SHLOG_FLOOR() SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_INFO(spdlog::get(SHLOGGER_NAME), "--------------------------------");
// For use outside the library to register the logger
#define SHLOG_REGISTER(logger) spdlog::register_logger(logger); spdlog::set_level(spdlog::level::level_enum::trace);

View File

@ -12,18 +12,18 @@ workspace "SHADE"
flags
{
"MultiProcessorCompile"
"MultiProcessorCompile"
}
outputdir = "%{cfg.buildcfg}_%{cfg.architecture}"
include "SHADE_Application"
outputdir = "%{wks.location}/bin/%{cfg.buildcfg}"
interdir = "%{wks.location}/bin_int"
include "SHADE_Engine"
include "SHADE_Application"
group "Dependencies"
include "Dependencies/msdf"
include "Dependencies/imgui"
include "Dependencies/spdlog"
--include "Dependencies/tracy"
include "Dependencies/yamlcpp"
include "Dependencies/reactphysics3d"