Merge branch 'main' into SP3-1-Rendering
This commit is contained in:
commit
3dcb6f26c2
|
@ -77,7 +77,8 @@ project "SHADE_Application"
|
||||||
"26439",
|
"26439",
|
||||||
"26451",
|
"26451",
|
||||||
"26437",
|
"26437",
|
||||||
"4275"
|
"4275",
|
||||||
|
"4635"
|
||||||
}
|
}
|
||||||
|
|
||||||
linkoptions { "-IGNORE:4006" }
|
linkoptions { "-IGNORE:4006" }
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
//#include "Scenes/SBEditorScene.h"
|
//#include "Scenes/SBEditorScene.h"
|
||||||
#endif // SHEDITOR
|
#endif // SHEDITOR
|
||||||
|
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Tools/SHFileUtilties.h"
|
#include "Tools/Utilities/SHFileUtilties.h"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <ratio>
|
#include <ratio>
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
#include "Scenes/SBMainScene.h"
|
#include "Scenes/SBMainScene.h"
|
||||||
#include "Serialization/Configurations/SHConfigurationManager.h"
|
#include "Serialization/Configurations/SHConfigurationManager.h"
|
||||||
|
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Tools/SHDebugDraw.h"
|
#include "Tools/SHDebugDraw.h"
|
||||||
|
|
||||||
using namespace SHADE;
|
using namespace SHADE;
|
||||||
|
@ -60,6 +60,8 @@ namespace Sandbox
|
||||||
_In_ INT nCmdShow
|
_In_ INT nCmdShow
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
SHLOG_INFO_D("Initialising SHADE engine")
|
||||||
|
|
||||||
// Set working directory
|
// Set working directory
|
||||||
SHFileUtilities::SetWorkDirToExecDir();
|
SHFileUtilities::SetWorkDirToExecDir();
|
||||||
WindowData wndData{};
|
WindowData wndData{};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "SBpch.h"
|
#include "SBpch.h"
|
||||||
#include <Engine/SHEngine.h>
|
#include <Engine/SHEngine.h>
|
||||||
#include <Tools/SHLogger.h>
|
#include <Tools/Logger/SHLogger.h>
|
||||||
#include <Tools/SHExceptionHandler.h>
|
#include <Tools/SHExceptionHandler.h>
|
||||||
#include "Application/SBApplication.h"
|
#include "Application/SBApplication.h"
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,12 @@ project "SHADE_CSharp"
|
||||||
|
|
||||||
warnings 'Extra'
|
warnings 'Extra'
|
||||||
|
|
||||||
|
postbuildcommands
|
||||||
|
{
|
||||||
|
"xcopy /r /y /q \"%{outputdir}\\net5.0\\SHADE_CSharp.xml\" \"%{outputdir}\"",
|
||||||
|
"xcopy /r /y /q \"%{outputdir}\\net5.0\\SHADE_CSharp.pdb\" \"%{outputdir}\""
|
||||||
|
}
|
||||||
|
|
||||||
filter "configurations:Debug"
|
filter "configurations:Debug"
|
||||||
symbols "On"
|
symbols "On"
|
||||||
defines {"_DEBUG"}
|
defines {"_DEBUG"}
|
||||||
|
@ -41,12 +47,18 @@ project "SHADE_CSharp"
|
||||||
|
|
||||||
require "vstudio"
|
require "vstudio"
|
||||||
|
|
||||||
function platformsElement(cfg)
|
function platformsElementCS(cfg)
|
||||||
_p(2,'<Platforms>x64</Platforms>')
|
_p(2,'<Platforms>x64</Platforms>')
|
||||||
end
|
end
|
||||||
|
function docsElementCS(cfg)
|
||||||
|
_p(2,'<GenerateDocumentationFile>true</GenerateDocumentationFile>')
|
||||||
|
end
|
||||||
|
function docsLocationElementCS(cfg)
|
||||||
|
_p(2,'<DocumentationFile>$(OutDir)</DocumentationFile>')
|
||||||
|
end
|
||||||
|
|
||||||
premake.override(premake.vstudio.cs2005.elements, "projectProperties", function (oldfn, cfg)
|
premake.override(premake.vstudio.cs2005.elements, "projectProperties", function (oldfn, cfg)
|
||||||
return table.join(oldfn(cfg), {
|
return table.join(oldfn(cfg), {
|
||||||
platformsElement,
|
platformsElementCS, docsElementCS, docsLocationElementCS,
|
||||||
})
|
})
|
||||||
end)
|
end)
|
|
@ -78,7 +78,8 @@ project "SHADE_Engine"
|
||||||
"26439",
|
"26439",
|
||||||
"26451",
|
"26451",
|
||||||
"26437",
|
"26437",
|
||||||
"4275"
|
"4275",
|
||||||
|
"4635"
|
||||||
}
|
}
|
||||||
|
|
||||||
linkoptions { "-IGNORE:4006" }
|
linkoptions { "-IGNORE:4006" }
|
||||||
|
|
|
@ -161,21 +161,39 @@ namespace SHADE
|
||||||
newPath += PREFAB_FOLDER;
|
newPath += PREFAB_FOLDER;
|
||||||
newPath += name;
|
newPath += name;
|
||||||
newPath += PREFAB_EXTENSION;
|
newPath += PREFAB_EXTENSION;
|
||||||
data = new SHPrefabAsset();
|
{
|
||||||
|
auto prefab = new SHPrefabAsset();
|
||||||
|
prefab->name = name;
|
||||||
|
|
||||||
|
data = prefab;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AssetType::SCENE:
|
case AssetType::SCENE:
|
||||||
newPath += SCENE_FOLDER;
|
newPath += SCENE_FOLDER;
|
||||||
newPath += name;
|
newPath += name;
|
||||||
newPath += SCENE_EXTENSION;
|
newPath += SCENE_EXTENSION;
|
||||||
data = new SHSceneAsset();
|
|
||||||
|
{
|
||||||
|
auto scene = new SHSceneAsset();
|
||||||
|
scene->name = name;
|
||||||
|
|
||||||
|
data = scene;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AssetType::MATERIAL:
|
case AssetType::MATERIAL:
|
||||||
newPath += MATERIAL_FOLDER;
|
newPath += MATERIAL_FOLDER;
|
||||||
newPath += name;
|
newPath += name;
|
||||||
newPath += MATERIAL_EXTENSION;
|
newPath += MATERIAL_EXTENSION;
|
||||||
data = new SHMaterialAsset();
|
|
||||||
|
{
|
||||||
|
auto material = new SHMaterialAsset();
|
||||||
|
material->name = name;
|
||||||
|
|
||||||
|
data = material;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -192,7 +210,7 @@ namespace SHADE
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
||||||
assetCollection.insert({
|
auto result = assetCollection.emplace(
|
||||||
id,
|
id,
|
||||||
SHAsset(
|
SHAsset(
|
||||||
name,
|
name,
|
||||||
|
@ -201,10 +219,13 @@ namespace SHADE
|
||||||
newPath,
|
newPath,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
});
|
);
|
||||||
|
|
||||||
assetData.emplace(id, data);
|
assetData.emplace(id, data);
|
||||||
|
|
||||||
|
SHAssetMetaHandler::WriteMetaData(asset);
|
||||||
|
SaveAsset(id);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,6 +388,21 @@ namespace SHADE
|
||||||
modelPath += MODEL_EXTENSION;
|
modelPath += MODEL_EXTENSION;
|
||||||
newPath = modelPath;
|
newPath = modelPath;
|
||||||
}
|
}
|
||||||
|
else if (ext == DDS_EXTENSION.data())
|
||||||
|
{
|
||||||
|
auto pathGen = SHTextureCompiler::CompileTextureAsset(path);
|
||||||
|
if (!pathGen.has_value())
|
||||||
|
{
|
||||||
|
SHLOG_ERROR("Texture Compilation Failed for: {}", path.string());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
newPath = pathGen.value();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SHLOG_WARNING("File Type compilation not yet Implemented: {}", path.string());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (genMeta)
|
if (genMeta)
|
||||||
{
|
{
|
||||||
|
@ -382,7 +418,7 @@ namespace SHADE
|
||||||
void SHAssetManager::RefreshDirectory() noexcept
|
void SHAssetManager::RefreshDirectory() noexcept
|
||||||
{
|
{
|
||||||
SHFileSystem::DestroyDirectory(folderRoot);
|
SHFileSystem::DestroyDirectory(folderRoot);
|
||||||
assetCollection.clear();
|
//assetCollection.clear();
|
||||||
BuildAssetCollection();
|
BuildAssetCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +549,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
SHAsset newAsset{
|
SHAsset newAsset{
|
||||||
path.stem().string(),
|
path.stem().string(),
|
||||||
GenerateAssetID(AssetType::SHADER_BUILT_IN),
|
GenerateAssetID(AssetType::TEXTURE),
|
||||||
AssetType::SHADER_BUILT_IN,
|
AssetType::SHADER_BUILT_IN,
|
||||||
path,
|
path,
|
||||||
false
|
false
|
||||||
|
@ -620,6 +656,12 @@ namespace SHADE
|
||||||
for (auto i{ 0 }; i < asset.subAssets.size(); ++i)
|
for (auto i{ 0 }; i < asset.subAssets.size(); ++i)
|
||||||
{
|
{
|
||||||
auto const id = asset.subAssets[i]->id;
|
auto const id = asset.subAssets[i]->id;
|
||||||
|
|
||||||
|
if (assetCollection.contains(id))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
assetCollection[id] = *asset.subAssets[i];
|
assetCollection[id] = *asset.subAssets[i];
|
||||||
delete asset.subAssets[i];
|
delete asset.subAssets[i];
|
||||||
asset.subAssets[i] = &assetCollection[id];
|
asset.subAssets[i] = &assetCollection[id];
|
||||||
|
|
|
@ -138,6 +138,7 @@ namespace SHADE
|
||||||
metaFile.close();
|
metaFile.close();
|
||||||
|
|
||||||
meta.path = path.parent_path().string() + "/" + path.stem().string();
|
meta.path = path.parent_path().string() + "/" + path.stem().string();
|
||||||
|
meta.path.make_preferred();
|
||||||
|
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "ECS_Base/Managers/SHComponentManager.h"
|
#include "ECS_Base/Managers/SHComponentManager.h"
|
||||||
#include "ECS_Base/SHECSMacros.h"
|
#include "ECS_Base/SHECSMacros.h"
|
||||||
#include "ECS_Base/Managers/SHEntityManager.h"
|
#include "ECS_Base/Managers/SHEntityManager.h"
|
||||||
#include "Tools/SHLog.h"
|
#include "Tools/Logger/SHLog.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "../Managers/SHSystemManager.h"
|
#include "../Managers/SHSystemManager.h"
|
||||||
#include "SHTestComponents.h"
|
#include "SHTestComponents.h"
|
||||||
#include "SHTestSystems.h"
|
#include "SHTestSystems.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
#include "Serialization/SHSerialization.h"
|
#include "Serialization/SHSerialization.h"
|
||||||
#include "Tools/SHClipboardUtilities.h"
|
#include "Tools/Utilities/SHClipboardUtilities.h"
|
||||||
|
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "SHEditorWindow.h"
|
#include "SHEditorWindow.h"
|
||||||
#include "Tools/SHLog.h"
|
#include "Tools/Logger/SHLog.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
//#==============================================================#
|
//#==============================================================#
|
||||||
//|| SHADE Includes ||
|
//|| SHADE Includes ||
|
||||||
//#==============================================================#
|
//#==============================================================#
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Tools/SHException.h"
|
#include "Tools/SHException.h"
|
||||||
|
|
||||||
#include "ECS_Base/Managers/SHSystemManager.h"
|
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "ECS_Base/System/SHSystemRoutine.h"
|
#include "ECS_Base/System/SHSystemRoutine.h"
|
||||||
#include "Resource/SHHandle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "EditorWindow/SHEditorWindow.h"
|
#include "EditorWindow/SHEditorWindow.h"
|
||||||
#include "Tools/SHLog.h"
|
#include "Tools/Logger/SHLog.h"
|
||||||
#include "Gizmos/SHTransformGizmo.h"
|
#include "Gizmos/SHTransformGizmo.h"
|
||||||
#include "Events/SHEventDefines.h"
|
#include "Events/SHEventDefines.h"
|
||||||
#include "Events/SHEvent.h"
|
#include "Events/SHEvent.h"
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
|
|
||||||
//TODO Legacy code. Delete soon
|
//TODO Legacy code. Delete soon
|
||||||
|
|
||||||
|
#include <SHpch.h>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <SHpch.h>
|
|
||||||
#include "SHFramerateController.h"
|
#include "SHFramerateController.h"
|
||||||
#include "../Tools/SHLogger.h"
|
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,8 +151,11 @@ namespace SHADE
|
||||||
|
|
||||||
bool found{ false };
|
bool found{ false };
|
||||||
for (auto const& asset : assets)
|
for (auto const& asset : assets)
|
||||||
|
{
|
||||||
|
if (!assetCollection.contains(asset.id))
|
||||||
{
|
{
|
||||||
assetCollection.emplace(asset.id, asset);
|
assetCollection.emplace(asset.id, asset);
|
||||||
|
}
|
||||||
if (file.name == asset.name)
|
if (file.name == asset.name)
|
||||||
{
|
{
|
||||||
AssetPath path{ file.path };
|
AssetPath path{ file.path };
|
||||||
|
@ -170,22 +173,6 @@ namespace SHADE
|
||||||
toGenerate.push_back(&file);
|
toGenerate.push_back(&file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//for (auto const& asset : assets)
|
|
||||||
//{
|
|
||||||
// assetCollection.emplace(asset.id, asset);
|
|
||||||
// for(auto& file : folder->files)
|
|
||||||
// {
|
|
||||||
// if (file.name == asset.name)
|
|
||||||
// {
|
|
||||||
// AssetPath path{ file.path };
|
|
||||||
// if (SHAssetMetaHandler::GetTypeFromExtension(path.extension().string()) == asset.type)
|
|
||||||
// {
|
|
||||||
// file.assetMeta = &assetCollection[asset.id];
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
for (auto i {0}; i < folder->files.size(); ++i)
|
for (auto i {0}; i < folder->files.size(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "SHVkCommandPool.h"
|
#include "SHVkCommandPool.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "SHVkCommandPool.h"
|
#include "SHVkCommandPool.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Graphics/Renderpass/SHVkRenderpass.h"
|
#include "Graphics/Renderpass/SHVkRenderpass.h"
|
||||||
#include "Graphics/Framebuffer/SHVkFramebuffer.h"
|
#include "Graphics/Framebuffer/SHVkFramebuffer.h"
|
||||||
#include "Graphics/Pipeline/SHVkPipeline.h"
|
#include "Graphics/Pipeline/SHVkPipeline.h"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Graphics/Instance/SHVkInstance.h"
|
#include "Graphics/Instance/SHVkInstance.h"
|
||||||
#include "Resource/SHResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "SHPch.h"
|
#include "SHPch.h"
|
||||||
#include "SHValidationLayersQuery.h"
|
#include "SHValidationLayersQuery.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
#include "SHVkDebugMessenger.h"
|
#include "SHVkDebugMessenger.h"
|
||||||
#include "SHVulkanDebugUtil.h"
|
#include "SHVulkanDebugUtil.h"
|
||||||
#include "Graphics/Instance/SHVkInstance.h"
|
#include "Graphics/Instance/SHVkInstance.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
//#include "Tools/SHLogger.h"
|
//#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "SHPch.h"
|
#include "SHPch.h"
|
||||||
#include "SHVulkanDebugUtil.h"
|
#include "SHVulkanDebugUtil.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "SHVkDescriptorPool.h"
|
#include "SHVkDescriptorPool.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Graphics/Descriptors/SHVkDescriptorSetLayout.h"
|
#include "Graphics/Descriptors/SHVkDescriptorSetLayout.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Graphics/Images/SHVkImage.h"
|
#include "Graphics/Images/SHVkImage.h"
|
||||||
#include "Graphics/Images/SHVkImageView.h"
|
#include "Graphics/Images/SHVkImageView.h"
|
||||||
#include "Graphics/Images/SHVkSampler.h"
|
#include "Graphics/Images/SHVkSampler.h"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "SHVkLogicalDevice.h"
|
#include "SHVkLogicalDevice.h"
|
||||||
#include "SHVkPhysicalDevice.h"
|
#include "SHVkPhysicalDevice.h"
|
||||||
#include "Graphics/Instance/SHVkInstance.h"
|
#include "Graphics/Instance/SHVkInstance.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Graphics/Windowing/Surface/SHVkSurface.h"
|
#include "Graphics/Windowing/Surface/SHVkSurface.h"
|
||||||
#include "Graphics/Swapchain/SHVkSwapchain.h"
|
#include "Graphics/Swapchain/SHVkSwapchain.h"
|
||||||
#include "Graphics/Commands/SHVkCommandPool.h"
|
#include "Graphics/Commands/SHVkCommandPool.h"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "SHVkPhysicalDeviceLibrary.h"
|
#include "SHVkPhysicalDeviceLibrary.h"
|
||||||
#include "Graphics/Instance/SHVkInstance.h"
|
#include "Graphics/Instance/SHVkInstance.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "Graphics/Images/SHVkImageView.h"
|
#include "Graphics/Images/SHVkImageView.h"
|
||||||
#include "Graphics/Images/SHVkImage.h"
|
#include "Graphics/Images/SHVkImage.h"
|
||||||
#include "Graphics/Renderpass/SHVkRenderpass.h"
|
#include "Graphics/Renderpass/SHVkRenderpass.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "SHVkImage.h"
|
#include "SHVkImage.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Graphics/Debugging/SHVulkanDebugUtil.h"
|
#include "Graphics/Debugging/SHVulkanDebugUtil.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "SHVkImageView.h"
|
#include "SHVkImageView.h"
|
||||||
#include "Graphics/Instance/SHVkInstance.h"
|
#include "Graphics/Instance/SHVkInstance.h"
|
||||||
#include "Graphics/Buffers/SHVkBuffer.h"
|
#include "Graphics/Buffers/SHVkBuffer.h"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "SHVkImageView.h"
|
#include "SHVkImageView.h"
|
||||||
#include "SHVkImage.h"
|
#include "SHVkImage.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "Graphics/Debugging/SHValidationLayersQuery.h"
|
#include "Graphics/Debugging/SHValidationLayersQuery.h"
|
||||||
#include "Graphics/Debugging/SHVkDebugMessenger.h"
|
#include "Graphics/Debugging/SHVkDebugMessenger.h"
|
||||||
#include "Graphics/Devices/SHVkPhysicalDeviceLibrary.h"
|
#include "Graphics/Devices/SHVkPhysicalDeviceLibrary.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Graphics/Devices/SHVkPhysicalDeviceLibrary.h"
|
#include "Graphics/Devices/SHVkPhysicalDeviceLibrary.h"
|
||||||
//#include <vulkan/vulkan_win32.h>
|
//#include <vulkan/vulkan_win32.h>
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
||||||
#include "Graphics/Pipeline/SHVkPipeline.h"
|
#include "Graphics/Pipeline/SHVkPipeline.h"
|
||||||
#include "ECS_Base/Managers/SHComponentManager.h"
|
#include "ECS_Base/Managers/SHComponentManager.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "Graphics/Pipeline/SHVkPipelineLayout.h"
|
#include "Graphics/Pipeline/SHVkPipelineLayout.h"
|
||||||
#include "Graphics/Descriptors/SHVkDescriptorSetLayout.h"
|
#include "Graphics/Descriptors/SHVkDescriptorSetLayout.h"
|
||||||
#include "Graphics/MiddleEnd/Lights/SHLightData.h"
|
#include "Graphics/MiddleEnd/Lights/SHLightData.h"
|
||||||
#include "Tools/SHUtilities.h"
|
#include "Tools/Utilities/SHUtilities.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "SHGraphicsConstants.h"
|
#include "SHGraphicsConstants.h"
|
||||||
#include "SHMaterial.h"
|
#include "SHMaterial.h"
|
||||||
#include "Graphics/Pipeline/SHVkPipeline.h"
|
#include "Graphics/Pipeline/SHVkPipeline.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
|
|
||||||
#include "Graphics/Commands/SHVkCommandBuffer.h"
|
#include "Graphics/Commands/SHVkCommandBuffer.h"
|
||||||
#include "Graphics/Instance/SHVkInstance.h"
|
#include "Graphics/Instance/SHVkInstance.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "SHRenderer.h"
|
#include "SHRenderer.h"
|
||||||
#include "Resource/SHResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
#include "Graphics/RenderGraph/SHRenderGraph.h"
|
#include "Graphics/RenderGraph/SHRenderGraph.h"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "SHpch.h"
|
#include "SHpch.h"
|
||||||
#include "SHLightingSubSystem.h"
|
#include "SHLightingSubSystem.h"
|
||||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.h"
|
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.h"
|
||||||
#include "Tools/SHUtilities.h"
|
#include "Tools/Utilities/SHUtilities.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Graphics/Buffers/SHVkBuffer.h"
|
#include "Graphics/Buffers/SHVkBuffer.h"
|
||||||
#include "Graphics/Descriptors/SHVkDescriptorSetGroup.h"
|
#include "Graphics/Descriptors/SHVkDescriptorSetGroup.h"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "SHPch.h"
|
#include "SHPch.h"
|
||||||
#include "SHRenderContext.h"
|
#include "SHRenderContext.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Graphics/Swapchain/SHVkSwapchain.h"
|
#include "Graphics/Swapchain/SHVkSwapchain.h"
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Graphics/Buffers/SHVkBuffer.h"
|
#include "Graphics/Buffers/SHVkBuffer.h"
|
||||||
#include "Graphics/Commands/SHVkCommandBuffer.h"
|
#include "Graphics/Commands/SHVkCommandBuffer.h"
|
||||||
#include "Graphics/SHVkUtil.h"
|
#include "Graphics/SHVkUtil.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Graphics/MiddleEnd/Interface/SHGraphicsConstants.h"
|
#include "Graphics/MiddleEnd/Interface/SHGraphicsConstants.h"
|
||||||
#include "Graphics/Descriptors/SHVkDescriptorSetGroup.h"
|
#include "Graphics/Descriptors/SHVkDescriptorSetGroup.h"
|
||||||
#include "Graphics/Images/SHVkImage.h"
|
#include "Graphics/Images/SHVkImage.h"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "SHVkPipelineLayout.h"
|
#include "SHVkPipelineLayout.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Graphics/Shaders/SHVkShaderModule.h"
|
#include "Graphics/Shaders/SHVkShaderModule.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Graphics/Instance/SHVkInstance.h"
|
#include "Graphics/Instance/SHVkInstance.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "SHPch.h"
|
#include "SHPch.h"
|
||||||
#include "SHVkQueue.h"
|
#include "SHVkQueue.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Graphics/Synchronization/SHVkSemaphore.h"
|
#include "Graphics/Synchronization/SHVkSemaphore.h"
|
||||||
#include "Graphics/Synchronization/SHVkFence.h"
|
#include "Graphics/Synchronization/SHVkFence.h"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "Graphics/Images/SHVkImageView.h"
|
#include "Graphics/Images/SHVkImageView.h"
|
||||||
#include "Graphics/Framebuffer/SHVkFramebuffer.h"
|
#include "Graphics/Framebuffer/SHVkFramebuffer.h"
|
||||||
#include "Graphics/Buffers/SHVkBuffer.h"
|
#include "Graphics/Buffers/SHVkBuffer.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "SHAttachmentDescInitParams.h"
|
#include "SHAttachmentDescInitParams.h"
|
||||||
#include "SHRenderGraphStorage.h"
|
#include "SHRenderGraphStorage.h"
|
||||||
#include "Graphics/RenderGraph/SHRenderGraphNodeCompute.h"
|
#include "Graphics/RenderGraph/SHRenderGraphNodeCompute.h"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "SHPch.h"
|
#include "SHPch.h"
|
||||||
#include "SHShaderBlockInterface.h"
|
#include "SHShaderBlockInterface.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "SHPch.h"
|
#include "SHPch.h"
|
||||||
#include "SHShaderReflected.h"
|
#include "SHShaderReflected.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Graphics/Instance/SHVkInstance.h"
|
#include "Graphics/Instance/SHVkInstance.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "SHVkShaderModule.h"
|
#include "SHVkShaderModule.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Graphics/Debugging/SHVulkanDebugUtil.h"
|
#include "Graphics/Debugging/SHVulkanDebugUtil.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "Graphics/Devices/SHVkPhysicalDevice.h"
|
#include "Graphics/Devices/SHVkPhysicalDevice.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Graphics/Windowing/Surface/SHVkSurface.h"
|
#include "Graphics/Windowing/Surface/SHVkSurface.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Graphics/Images/SHVkImage.h"
|
#include "Graphics/Images/SHVkImage.h"
|
||||||
#include "Graphics/Instance/SHVkInstance.h"
|
#include "Graphics/Instance/SHVkInstance.h"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Graphics/Instance/SHVkInstance.h"
|
#include "Graphics/Instance/SHVkInstance.h"
|
||||||
#include "Graphics/Debugging/SHVulkanDebugUtil.h"
|
#include "Graphics/Debugging/SHVulkanDebugUtil.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "Vector/SHVec3.h"
|
#include "Vector/SHVec3.h"
|
||||||
#include "SHMatrix.h"
|
#include "SHMatrix.h"
|
||||||
#include "SHMathHelpers.h"
|
#include "SHMathHelpers.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
using namespace DirectX;
|
using namespace DirectX;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "SHVec2.h"
|
#include "SHVec2.h"
|
||||||
// Project Headers
|
// Project Headers
|
||||||
#include "Math/SHMatrix.h"
|
#include "Math/SHMatrix.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
using namespace DirectX;
|
using namespace DirectX;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
// Project Headers
|
// Project Headers
|
||||||
#include "Math/SHMatrix.h"
|
#include "Math/SHMatrix.h"
|
||||||
#include "Math/SHQuaternion.h"
|
#include "Math/SHQuaternion.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
using namespace DirectX;
|
using namespace DirectX;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
// Project Headers
|
// Project Headers
|
||||||
#include "Math/SHMatrix.h"
|
#include "Math/SHMatrix.h"
|
||||||
#include "Math/SHColour.h"
|
#include "Math/SHColour.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
using namespace DirectX;
|
using namespace DirectX;
|
||||||
|
|
||||||
|
|
|
@ -177,9 +177,21 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
dirty = true;
|
dirty = true;
|
||||||
|
|
||||||
const auto* colliderComponent = SHComponentManager::GetComponent<SHColliderComponent>(entityID);
|
const auto* COLLIDER = SHComponentManager::GetComponent<SHColliderComponent>(entityID);
|
||||||
|
auto* box = reinterpret_cast<SHBox*>(shape);
|
||||||
|
|
||||||
|
SHVec3 correctedHalfExtents = halfExtents;
|
||||||
|
|
||||||
|
// Get current relative halfExtents for error checking. 0 is ignored
|
||||||
|
const SHVec3& CURRENT_RELATIVE_EXTENTS = box->GetRelativeExtents();
|
||||||
|
for (size_t i = 0; i < SHVec3::SIZE; ++i)
|
||||||
|
{
|
||||||
|
if (SHMath::CompareFloat(halfExtents[i], 0.0f))
|
||||||
|
correctedHalfExtents[i] = CURRENT_RELATIVE_EXTENTS[i];
|
||||||
|
}
|
||||||
|
|
||||||
// Set the half extents relative to world scale
|
// Set the half extents relative to world scale
|
||||||
const SHVec3 WORLD_EXTENTS = halfExtents * colliderComponent->GetScale() * 0.5f;
|
const SHVec3 WORLD_EXTENTS = correctedHalfExtents * COLLIDER->GetScale() * 0.5f;
|
||||||
|
|
||||||
if (type != Type::BOX)
|
if (type != Type::BOX)
|
||||||
{
|
{
|
||||||
|
@ -189,18 +201,24 @@ namespace SHADE
|
||||||
shape = new SHBox{ positionOffset, WORLD_EXTENTS };
|
shape = new SHBox{ positionOffset, WORLD_EXTENTS };
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* box = reinterpret_cast<SHBox*>(shape);
|
|
||||||
box->SetWorldExtents(WORLD_EXTENTS);
|
box->SetWorldExtents(WORLD_EXTENTS);
|
||||||
box->SetRelativeExtents(halfExtents);
|
box->SetRelativeExtents(correctedHalfExtents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHCollisionShape::SetBoundingSphere(float radius)
|
void SHCollisionShape::SetBoundingSphere(float radius)
|
||||||
{
|
{
|
||||||
dirty = true;
|
dirty = true;
|
||||||
|
|
||||||
const auto* colliderComponent = SHComponentManager::GetComponent<SHColliderComponent>(entityID);
|
auto* sphere = reinterpret_cast<SHSphere*>(shape);
|
||||||
|
const auto* COLLIDER = SHComponentManager::GetComponent<SHColliderComponent>(entityID);
|
||||||
|
|
||||||
|
// Get current relative halfExtents for error checking. 0 is ignored
|
||||||
|
const float CURRENT_RELATIVE_RADIUS = sphere->GetRelativeRadius();
|
||||||
|
if (SHMath::CompareFloat(radius, 0.0f))
|
||||||
|
radius = CURRENT_RELATIVE_RADIUS;
|
||||||
|
|
||||||
// Set the radius relative to world scale
|
// Set the radius relative to world scale
|
||||||
const SHVec3 WORLD_SCALE = colliderComponent->GetScale();
|
const SHVec3 WORLD_SCALE = COLLIDER->GetScale();
|
||||||
const float MAX_SCALE = SHMath::Max({ WORLD_SCALE.x, WORLD_SCALE.y, WORLD_SCALE.z });
|
const float MAX_SCALE = SHMath::Max({ WORLD_SCALE.x, WORLD_SCALE.y, WORLD_SCALE.z });
|
||||||
const float WORLD_RADIUS = radius * MAX_SCALE * 0.5f;
|
const float WORLD_RADIUS = radius * MAX_SCALE * 0.5f;
|
||||||
|
|
||||||
|
@ -212,8 +230,8 @@ namespace SHADE
|
||||||
shape = new SHSphere{ positionOffset, WORLD_RADIUS };
|
shape = new SHSphere{ positionOffset, WORLD_RADIUS };
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* sphere = reinterpret_cast<SHSphere*>(shape);
|
|
||||||
sphere->SetWorldRadius(WORLD_RADIUS);
|
sphere->SetWorldRadius(WORLD_RADIUS);
|
||||||
|
sphere->SetRelativeRadius(radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHCollisionShape::SetIsTrigger(bool trigger) noexcept
|
void SHCollisionShape::SetIsTrigger(bool trigger) noexcept
|
||||||
|
|
|
@ -302,6 +302,9 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
static constexpr int FLAG_POS = 9;
|
static constexpr int FLAG_POS = 9;
|
||||||
|
|
||||||
|
if (newMass < 0.0f)
|
||||||
|
return;
|
||||||
|
|
||||||
if (type != Type::DYNAMIC)
|
if (type != Type::DYNAMIC)
|
||||||
{
|
{
|
||||||
SHLOG_WARNING("Cannot set mass of a non-dynamic object {}", GetEID())
|
SHLOG_WARNING("Cannot set mass of a non-dynamic object {}", GetEID())
|
||||||
|
@ -385,42 +388,62 @@ namespace SHADE
|
||||||
|
|
||||||
void SHRigidBodyComponent::AddForce(const SHVec3& force) const noexcept
|
void SHRigidBodyComponent::AddForce(const SHVec3& force) const noexcept
|
||||||
{
|
{
|
||||||
system->AddForce(GetEID(), force);
|
if (auto* physicsObject = system->GetPhysicsObject(GetEID()); physicsObject)
|
||||||
|
physicsObject->GetRigidBody()->applyWorldForceAtCenterOfMass(force);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHRigidBodyComponent::AddForceAtLocalPos(const SHVec3& force, const SHVec3& localPos) const noexcept
|
void SHRigidBodyComponent::AddForceAtLocalPos(const SHVec3& force, const SHVec3& localPos) const noexcept
|
||||||
{
|
{
|
||||||
system->AddForceAtLocalPos(GetEID(), force, localPos);
|
if (auto* physicsObject = system->GetPhysicsObject(GetEID()); physicsObject)
|
||||||
|
physicsObject->GetRigidBody()->applyWorldForceAtLocalPosition(force, localPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHRigidBodyComponent::AddForceAtWorldPos(const SHVec3& force, const SHVec3& worldPos) const noexcept
|
void SHRigidBodyComponent::AddForceAtWorldPos(const SHVec3& force, const SHVec3& worldPos) const noexcept
|
||||||
{
|
{
|
||||||
system->AddForceAtWorldPos(GetEID(), force, worldPos);
|
if (auto* physicsObject = system->GetPhysicsObject(GetEID()); physicsObject)
|
||||||
|
physicsObject->GetRigidBody()->applyWorldForceAtWorldPosition(force, worldPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHRigidBodyComponent::AddRelativeForce(const SHVec3& relativeForce) const noexcept
|
void SHRigidBodyComponent::AddRelativeForce(const SHVec3& relativeForce) const noexcept
|
||||||
{
|
{
|
||||||
system->AddRelativeForce(GetEID(), relativeForce);
|
if (auto* physicsObject = system->GetPhysicsObject(GetEID()); physicsObject)
|
||||||
|
physicsObject->GetRigidBody()->applyLocalForceAtCenterOfMass(relativeForce);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHRigidBodyComponent::AddRelativeForceAtLocalPos(const SHVec3& relativeForce, const SHVec3& localPos) const noexcept
|
void SHRigidBodyComponent::AddRelativeForceAtLocalPos(const SHVec3& relativeForce, const SHVec3& localPos) const noexcept
|
||||||
{
|
{
|
||||||
system->AddRelativeForceAtLocalPos(GetEID(), relativeForce, localPos);
|
if (auto* physicsObject = system->GetPhysicsObject(GetEID()); physicsObject)
|
||||||
|
physicsObject->GetRigidBody()->applyLocalForceAtLocalPosition(relativeForce, localPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHRigidBodyComponent::AddRelativeForceAtWorldPos(const SHVec3& relativeForce, const SHVec3& worldPos) const noexcept
|
void SHRigidBodyComponent::AddRelativeForceAtWorldPos(const SHVec3& relativeForce, const SHVec3& worldPos) const noexcept
|
||||||
{
|
{
|
||||||
system->AddRelativeForceAtWorldPos(GetEID(), relativeForce, worldPos);
|
if (auto* physicsObject = system->GetPhysicsObject(GetEID()); physicsObject)
|
||||||
|
physicsObject->GetRigidBody()->applyLocalForceAtWorldPosition(relativeForce, worldPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHRigidBodyComponent::AddTorque(const SHVec3& torque) const noexcept
|
void SHRigidBodyComponent::AddTorque(const SHVec3& torque) const noexcept
|
||||||
{
|
{
|
||||||
system->AddTorque(GetEID(), torque);
|
if (auto* physicsObject = system->GetPhysicsObject(GetEID()); physicsObject)
|
||||||
|
physicsObject->GetRigidBody()->applyWorldTorque(torque);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHRigidBodyComponent::AddRelativeTorque(const SHVec3& relativeTorque) const noexcept
|
void SHRigidBodyComponent::AddRelativeTorque(const SHVec3& relativeTorque) const noexcept
|
||||||
{
|
{
|
||||||
system->AddRelativeTorque(GetEID(), relativeTorque);
|
if (auto* physicsObject = system->GetPhysicsObject(GetEID()); physicsObject)
|
||||||
|
physicsObject->GetRigidBody()->applyLocalTorque(relativeTorque);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHRigidBodyComponent::ClearForces() const noexcept
|
||||||
|
{
|
||||||
|
if (auto* physicsObject = system->GetPhysicsObject(GetEID()); physicsObject)
|
||||||
|
physicsObject->GetRigidBody()->resetForce();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHRigidBodyComponent::ClearTorque() const noexcept
|
||||||
|
{
|
||||||
|
if (auto* physicsObject = system->GetPhysicsObject(GetEID()); physicsObject)
|
||||||
|
physicsObject->GetRigidBody()->resetTorque();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace SHADE
|
} // namespace SHADE
|
||||||
|
|
|
@ -125,14 +125,15 @@ namespace SHADE
|
||||||
void AddForce (const SHVec3& force) const noexcept;
|
void AddForce (const SHVec3& force) const noexcept;
|
||||||
void AddForceAtLocalPos (const SHVec3& force, const SHVec3& localPos) const noexcept;
|
void AddForceAtLocalPos (const SHVec3& force, const SHVec3& localPos) const noexcept;
|
||||||
void AddForceAtWorldPos (const SHVec3& force, const SHVec3& worldPos) const noexcept;
|
void AddForceAtWorldPos (const SHVec3& force, const SHVec3& worldPos) const noexcept;
|
||||||
|
|
||||||
void AddRelativeForce (const SHVec3& relativeForce) const noexcept;
|
void AddRelativeForce (const SHVec3& relativeForce) const noexcept;
|
||||||
void AddRelativeForceAtLocalPos (const SHVec3& relativeForce, const SHVec3& localPos) const noexcept;
|
void AddRelativeForceAtLocalPos (const SHVec3& relativeForce, const SHVec3& localPos) const noexcept;
|
||||||
void AddRelativeForceAtWorldPos (const SHVec3& relativeForce, const SHVec3& worldPos) const noexcept;
|
void AddRelativeForceAtWorldPos (const SHVec3& relativeForce, const SHVec3& worldPos) const noexcept;
|
||||||
|
|
||||||
void AddTorque (const SHVec3& torque) const noexcept;
|
void AddTorque (const SHVec3& torque) const noexcept;
|
||||||
void AddRelativeTorque (const SHVec3& relativeTorque) const noexcept;
|
void AddRelativeTorque (const SHVec3& relativeTorque) const noexcept;
|
||||||
|
|
||||||
|
void ClearForces () const noexcept;
|
||||||
|
void ClearTorque () const noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Data Members */
|
/* Data Members */
|
||||||
|
|
|
@ -277,23 +277,24 @@ namespace SHADE
|
||||||
if (!rp3dBody->isActive())
|
if (!rp3dBody->isActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int index = 0;
|
const int NUM_SHAPES = static_cast<int>(component.collisionShapes.size());
|
||||||
for (auto& collisionShape : component.collisionShapes)
|
for (int i = 0; i < NUM_SHAPES; ++i)
|
||||||
{
|
{
|
||||||
|
auto& collisionShape = component.collisionShapes[i];
|
||||||
|
|
||||||
if (!collisionShape.dirty)
|
if (!collisionShape.dirty)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (collisionShape.GetType())
|
switch (collisionShape.GetType())
|
||||||
{
|
{
|
||||||
case SHCollisionShape::Type::BOX: syncBoxShape(index, collisionShape); break;
|
case SHCollisionShape::Type::BOX: syncBoxShape(i, collisionShape); break;
|
||||||
case SHCollisionShape::Type::SPHERE: syncSphereShape(index, collisionShape); break;
|
case SHCollisionShape::Type::SPHERE: syncSphereShape(i, collisionShape); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(Diren): Update Material
|
syncMaterial(i, collisionShape);
|
||||||
|
|
||||||
collisionShape.dirty = false;
|
collisionShape.dirty = false;
|
||||||
++index;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,6 +302,14 @@ namespace SHADE
|
||||||
/* Private Function Member Definitions */
|
/* Private Function Member Definitions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void SHPhysicsObject::syncMaterial(int colliderIndex, SHCollisionShape& collisionShape) const noexcept
|
||||||
|
{
|
||||||
|
auto& rp3dMaterial = rp3dBody->getCollider(colliderIndex)->getMaterial();
|
||||||
|
rp3dMaterial.setFrictionCoefficient(collisionShape.GetFriction());
|
||||||
|
rp3dMaterial.setBounciness(collisionShape.GetBounciness());
|
||||||
|
rp3dMaterial.setMassDensity(collisionShape.GetDensity());
|
||||||
|
}
|
||||||
|
|
||||||
void SHPhysicsObject::addBoxShape(SHCollisionShape& boxShape) const noexcept
|
void SHPhysicsObject::addBoxShape(SHCollisionShape& boxShape) const noexcept
|
||||||
{
|
{
|
||||||
const rp3d::Transform OFFSETS
|
const rp3d::Transform OFFSETS
|
||||||
|
|
|
@ -96,6 +96,8 @@ namespace SHADE
|
||||||
/* Function Members */
|
/* Function Members */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void syncMaterial (int colliderIndex, SHCollisionShape& collisionShape) const noexcept;
|
||||||
|
|
||||||
// Box Shapes
|
// Box Shapes
|
||||||
|
|
||||||
void addBoxShape (SHCollisionShape& boxShape) const noexcept;
|
void addBoxShape (SHCollisionShape& boxShape) const noexcept;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
// Project Headers
|
// Project Headers
|
||||||
#include "ECS_Base/Managers/SHEntityManager.h"
|
#include "ECS_Base/Managers/SHEntityManager.h"
|
||||||
#include "Tools/SHUtilities.h"
|
#include "Tools/Utilities/SHUtilities.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "ECS_Base/System/SHSystemRoutine.h"
|
#include "ECS_Base/System/SHSystemRoutine.h"
|
||||||
#include "Math/SHColour.h"
|
#include "Math/SHColour.h"
|
||||||
#include "SHPhysicsSystem.h"
|
#include "SHPhysicsSystem.h"
|
||||||
#include "Tools/SHUtilities.h"
|
#include "Tools/Utilities/SHUtilities.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace SHADE
|
||||||
return collisionListener.GetTriggerInfoContainer();
|
return collisionListener.GetTriggerInfoContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
const SHPhysicsObject* const SHPhysicsSystem::GetPhysicsObject(EntityID eid) noexcept
|
const SHPhysicsObject* SHPhysicsSystem::GetPhysicsObject(EntityID eid) noexcept
|
||||||
{
|
{
|
||||||
return objectManager.GetPhysicsObject(eid);
|
return objectManager.GetPhysicsObject(eid);
|
||||||
}
|
}
|
||||||
|
@ -223,55 +223,6 @@ namespace SHADE
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHPhysicsSystem::AddForce(EntityID eid, const SHVec3& force) noexcept
|
|
||||||
{
|
|
||||||
const auto* PHYSICS_OBJECT = objectManager.GetPhysicsObject(eid);
|
|
||||||
PHYSICS_OBJECT->GetRigidBody()->applyWorldForceAtCenterOfMass(force);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SHPhysicsSystem::AddForceAtLocalPos(EntityID eid, const SHVec3& force, const SHVec3& localPos) noexcept
|
|
||||||
{
|
|
||||||
const auto* PHYSICS_OBJECT = objectManager.GetPhysicsObject(eid);
|
|
||||||
PHYSICS_OBJECT->GetRigidBody()->applyWorldForceAtLocalPosition(force, localPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SHPhysicsSystem::AddForceAtWorldPos(EntityID eid, const SHVec3& force, const SHVec3& worldPos) noexcept
|
|
||||||
{
|
|
||||||
const auto* PHYSICS_OBJECT = objectManager.GetPhysicsObject(eid);
|
|
||||||
PHYSICS_OBJECT->GetRigidBody()->applyWorldForceAtWorldPosition(force, worldPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SHPhysicsSystem::AddRelativeForce(EntityID eid, const SHVec3& relativeForce) noexcept
|
|
||||||
{
|
|
||||||
const auto* PHYSICS_OBJECT = objectManager.GetPhysicsObject(eid);
|
|
||||||
PHYSICS_OBJECT->GetRigidBody()->applyLocalForceAtCenterOfMass(relativeForce);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SHPhysicsSystem::AddRelativeForceAtLocalPos(EntityID eid, const SHVec3& relativeForce, const SHVec3& localPos) noexcept
|
|
||||||
{
|
|
||||||
const auto* PHYSICS_OBJECT = objectManager.GetPhysicsObject(eid);
|
|
||||||
PHYSICS_OBJECT->GetRigidBody()->applyLocalForceAtLocalPosition(relativeForce, localPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SHPhysicsSystem::AddRelativeForceAtWorldPos(EntityID eid, const SHVec3& relativeForce, const SHVec3& worldPos) noexcept
|
|
||||||
{
|
|
||||||
const auto* PHYSICS_OBJECT = objectManager.GetPhysicsObject(eid);
|
|
||||||
PHYSICS_OBJECT->GetRigidBody()->applyLocalForceAtWorldPosition(relativeForce, worldPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SHPhysicsSystem::AddTorque(EntityID eid, const SHVec3& torque) noexcept
|
|
||||||
{
|
|
||||||
const auto* PHYSICS_OBJECT = objectManager.GetPhysicsObject(eid);
|
|
||||||
PHYSICS_OBJECT->GetRigidBody()->applyWorldTorque(torque);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SHPhysicsSystem::AddRelativeTorque(EntityID eid, const SHVec3& relativeTorque) noexcept
|
|
||||||
{
|
|
||||||
const auto* PHYSICS_OBJECT = objectManager.GetPhysicsObject(eid);
|
|
||||||
PHYSICS_OBJECT->GetRigidBody()->applyLocalTorque(relativeTorque);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Private Function Member Definitions */
|
/* Private Function Member Definitions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace SHADE
|
||||||
[[nodiscard]] const std::vector<SHCollisionInfo>& GetAllCollisionInfo () const noexcept;
|
[[nodiscard]] const std::vector<SHCollisionInfo>& GetAllCollisionInfo () const noexcept;
|
||||||
[[nodiscard]] const std::vector<SHCollisionInfo>& GetAllTriggerInfo () const noexcept;
|
[[nodiscard]] const std::vector<SHCollisionInfo>& GetAllTriggerInfo () const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] const SHPhysicsObject* const GetPhysicsObject (EntityID eid) noexcept;
|
[[nodiscard]] const SHPhysicsObject* GetPhysicsObject (EntityID eid) noexcept;
|
||||||
[[nodiscard]] const SHPhysicsObjectManager::PhysicsObjectEntityMap& GetPhysicsObjects () const noexcept;
|
[[nodiscard]] const SHPhysicsObjectManager::PhysicsObjectEntityMap& GetPhysicsObjects () const noexcept;
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Setter Functions */
|
/* Setter Functions */
|
||||||
|
@ -79,25 +79,13 @@ namespace SHADE
|
||||||
|
|
||||||
void ForceUpdate ();
|
void ForceUpdate ();
|
||||||
|
|
||||||
// Specific Handling for Collision Shapes as they are not under the Component System
|
// Specific Handling for Collision Shapes as they are not under the Component System.
|
||||||
|
// This is done as events need to be sent out.
|
||||||
|
// TODO(Diren): Consider using a static method through the ColliderComponent.
|
||||||
|
|
||||||
void AddCollisionShape (EntityID eid, int shapeIndex);
|
void AddCollisionShape (EntityID eid, int shapeIndex);
|
||||||
void RemoveCollisionShape (EntityID eid, int shapeIndex);
|
void RemoveCollisionShape (EntityID eid, int shapeIndex);
|
||||||
|
|
||||||
// Forces are applied from components here. These functions should only be invoked during play (through scripts)
|
|
||||||
// Thus there is no need to check for an editor.
|
|
||||||
|
|
||||||
void AddForce (EntityID eid, const SHVec3& force) noexcept;
|
|
||||||
void AddForceAtLocalPos (EntityID eid, const SHVec3& force, const SHVec3& localPos) noexcept;
|
|
||||||
void AddForceAtWorldPos (EntityID eid, const SHVec3& force, const SHVec3& worldPos) noexcept;
|
|
||||||
|
|
||||||
void AddRelativeForce (EntityID eid, const SHVec3& relativeForce) noexcept;
|
|
||||||
void AddRelativeForceAtLocalPos (EntityID eid, const SHVec3& relativeForce, const SHVec3& localPos) noexcept;
|
|
||||||
void AddRelativeForceAtWorldPos (EntityID eid, const SHVec3& relativeForce, const SHVec3& worldPos) noexcept;
|
|
||||||
|
|
||||||
void AddTorque (EntityID eid, const SHVec3& torque) noexcept;
|
|
||||||
void AddRelativeTorque (EntityID eid, const SHVec3& relativeTorque) noexcept;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* System Routines */
|
/* System Routines */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -13,11 +13,14 @@
|
||||||
// Primary Header
|
// Primary Header
|
||||||
#include "SHPhysicsSystem.h"
|
#include "SHPhysicsSystem.h"
|
||||||
// Project Headers
|
// Project Headers
|
||||||
|
#include "ECS_Base/Managers/SHEntityManager.h"
|
||||||
#include "ECS_Base/Managers/SHSystemManager.h"
|
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||||
#include "Editor/SHEditor.h"
|
#include "Editor/SHEditor.h"
|
||||||
#include "Scene/SHSceneManager.h"
|
#include "Scene/SHSceneManager.h"
|
||||||
#include "Scripting/SHScriptEngine.h"
|
#include "Scripting/SHScriptEngine.h"
|
||||||
|
|
||||||
|
#include "Input/SHInputManager.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
@ -139,14 +142,6 @@ namespace SHADE
|
||||||
|
|
||||||
physicsSystem->worldState.world->update(static_cast<rp3d::decimal>(FIXED_DT));
|
physicsSystem->worldState.world->update(static_cast<rp3d::decimal>(FIXED_DT));
|
||||||
|
|
||||||
// Clear all forces of every body in the scene after each update
|
|
||||||
for (auto& physicsObject : physicsSystem->objectManager.physicsObjects | std::views::values)
|
|
||||||
{
|
|
||||||
auto* rp3dRigidBody = physicsObject.GetRigidBody();
|
|
||||||
rp3dRigidBody->resetForce();
|
|
||||||
rp3dRigidBody->resetTorque();
|
|
||||||
}
|
|
||||||
|
|
||||||
accumulatedTime -= FIXED_DT;
|
accumulatedTime -= FIXED_DT;
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Assets/Asset Types/SHAssetIncludes.h"
|
#include "Assets/Asset Types/SHAssetIncludes.h"
|
||||||
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h"
|
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h"
|
||||||
#include "ECS_Base/Managers/SHSystemManager.h"
|
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||||
#include "Tools/SHLog.h"
|
#include "Tools/Logger/SHLog.h"
|
||||||
#include "Graphics/Shaders/SHVkShaderModule.h"
|
#include "Graphics/Shaders/SHVkShaderModule.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Graphics/MiddleEnd/Materials/SHMaterialSpec.h"
|
#include "Graphics/MiddleEnd/Materials/SHMaterialSpec.h"
|
||||||
|
|
|
@ -37,5 +37,5 @@
|
||||||
#include <span>
|
#include <span>
|
||||||
|
|
||||||
#include "Common/SHCommonTypes.h"
|
#include "Common/SHCommonTypes.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Tools/SHException.h"
|
#include "Tools/SHException.h"
|
||||||
|
|
|
@ -20,7 +20,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include <array>
|
#include <array>
|
||||||
// External Dependencies
|
// External Dependencies
|
||||||
#include <shlwapi.h> // PathRemoveFileSpecA
|
#include <shlwapi.h> // PathRemoveFileSpecA
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,8 +19,8 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include <memory> // std::shared_ptr
|
#include <memory> // std::shared_ptr
|
||||||
#include <thread> // std::this_thread::sleep_for
|
#include <thread> // std::this_thread::sleep_for
|
||||||
// Project Headers
|
// Project Headers
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/Logger/SHLogger.h"
|
||||||
#include "Tools/SHStringUtils.h"
|
#include "Tools/Utilities/SHStringUtilities.h"
|
||||||
#include "ECS_Base/Events/SHEntityDestroyedEvent.h"
|
#include "ECS_Base/Events/SHEntityDestroyedEvent.h"
|
||||||
#include "Events/SHEvent.h"
|
#include "Events/SHEvent.h"
|
||||||
#include "Events/SHEventReceiver.h"
|
#include "Events/SHEventReceiver.h"
|
||||||
|
@ -272,6 +272,7 @@ namespace SHADE
|
||||||
<ItemGroup>\n\
|
<ItemGroup>\n\
|
||||||
<None Remove=\".gitignore\" />\n\
|
<None Remove=\".gitignore\" />\n\
|
||||||
<None Remove=\".gitmodules\" />\n\
|
<None Remove=\".gitmodules\" />\n\
|
||||||
|
<None Remove=\"*.shmeta\" />\n\
|
||||||
</ItemGroup>\n\
|
</ItemGroup>\n\
|
||||||
<ItemGroup>\n\
|
<ItemGroup>\n\
|
||||||
<Reference Include=\"SHADE_Managed\">\n";
|
<Reference Include=\"SHADE_Managed\">\n";
|
||||||
|
@ -615,7 +616,7 @@ namespace SHADE
|
||||||
auto err = GetLastError();
|
auto err = GetLastError();
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "[ScriptEngine] Failed to launch process. Error code: " << std::hex << err
|
oss << "[ScriptEngine] Failed to launch process. Error code: " << std::hex << err
|
||||||
<< " (" << SHStringUtils::GetWin32ErrorMessage(err) << ")";
|
<< " (" << SHStringUtilities::GetWin32ErrorMessage(err) << ")";
|
||||||
throw std::runtime_error(oss.str());
|
throw std::runtime_error(oss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,7 +630,7 @@ namespace SHADE
|
||||||
auto err = GetLastError();
|
auto err = GetLastError();
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "[ScriptEngine] Failed to query process. Error code: " << std::hex << err
|
oss << "[ScriptEngine] Failed to query process. Error code: " << std::hex << err
|
||||||
<< " (" << SHStringUtils::GetWin32ErrorMessage(err) << ")";
|
<< " (" << SHStringUtilities::GetWin32ErrorMessage(err) << ")";
|
||||||
throw std::runtime_error(oss.str());
|
throw std::runtime_error(oss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,7 +647,7 @@ namespace SHADE
|
||||||
std::wstring SHScriptEngine::generateBuildCommand(bool debug)
|
std::wstring SHScriptEngine::generateBuildCommand(bool debug)
|
||||||
{
|
{
|
||||||
std::wostringstream oss;
|
std::wostringstream oss;
|
||||||
oss << "dotnet build \"" << SHStringUtils::StrToWstr(CSPROJ_PATH) << "\" -c ";
|
oss << "dotnet build \"" << SHStringUtilities::StrToWstr(CSPROJ_PATH) << "\" -c ";
|
||||||
oss << debug ? "Debug" : "Release";
|
oss << debug ? "Debug" : "Release";
|
||||||
oss << " -o \"./tmp/\" -fl -flp:LogFile=build.log;Verbosity=quiet -r \"win-x64\"";
|
oss << " -o \"./tmp/\" -fl -flp:LogFile=build.log;Verbosity=quiet -r \"win-x64\"";
|
||||||
return oss.str();
|
return oss.str();
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include "ECS_Base/Managers/SHComponentManager.h"
|
#include "ECS_Base/Managers/SHComponentManager.h"
|
||||||
#include "Graphics/MiddleEnd/Materials/SHMaterialSpec.h"
|
#include "Graphics/MiddleEnd/Materials/SHMaterialSpec.h"
|
||||||
#include "Tools/SHLog.h"
|
#include "Tools/Logger/SHLog.h"
|
||||||
|
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -177,8 +177,34 @@ namespace SHADE
|
||||||
/*-------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define SHLOG_TRACE(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_TRACE(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
|
|
||||||
#define SHLOGV_TRACE(format, ...) SHADE::SHLogger::UseVerbosePattern(); SPDLOG_LOGGER_TRACE(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
|
#define SHLOG_INFO_D(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_INFO(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
|
||||||
|
#define SHLOGV_INFO_D(format, ...) SHADE::SHLogger::UseVerbosePattern(); SPDLOG_LOGGER_INFO(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
|
||||||
|
|
||||||
|
#define SHLOG_WARNING_D(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_WARN(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
|
||||||
|
#define SHLOGV_WARNING_D(format, ...) SHADE::SHLogger::UseVerbosePattern(); SPDLOG_LOGGER_WARN(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
|
||||||
|
|
||||||
|
#define SHLOG_ERROR_D(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_ERROR(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
|
||||||
|
#define SHLOGV_ERROR_D(format, ...) SHADE::SHLogger::UseVerbosePattern(); SPDLOG_LOGGER_ERROR(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
|
||||||
|
|
||||||
|
#define SHLOG_CRITICAL_D(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_CRITICAL(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
|
||||||
|
#define SHLOGV_CRITICAL_D(format, ...) SHADE::SHLogger::UseVerbosePattern(); SPDLOG_LOGGER_CRITICAL(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define SHLOG_INFO_D(format, ...)
|
||||||
|
#define SHLOGV_INFO_D(format, ...)
|
||||||
|
|
||||||
|
#define SHLOG_WARNING_D(format, ...)
|
||||||
|
#define SHLOGV_WARNING_D(format, ...)
|
||||||
|
|
||||||
|
#define SHLOG_ERROR_D(format, ...)
|
||||||
|
#define SHLOGV_ERROR_D(format, ...)
|
||||||
|
|
||||||
|
#define SHLOG_CRITICAL_D(format, ...)
|
||||||
|
#define SHLOGV_CRITICAL_D(format, ...)
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SHLOG_INFO(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_INFO(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
|
#define SHLOG_INFO(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_INFO(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__);
|
|
@ -18,7 +18,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
// Project Headers
|
// Project Headers
|
||||||
#include "SHLogger.h"
|
#include "Logger/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,10 +12,8 @@
|
||||||
|
|
||||||
// Primary Header
|
// Primary Header
|
||||||
#include "SHExceptionHandler.h"
|
#include "SHExceptionHandler.h"
|
||||||
|
|
||||||
// Project Headers
|
// Project Headers
|
||||||
#include "SHException.h"
|
#include "SHException.h"
|
||||||
#include "SHLogger.h"
|
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/************************************************************************************//*!
|
/************************************************************************************//*!
|
||||||
\file StringUtilities.cpp
|
\file SHStringUtilities.cpp
|
||||||
\author Tng Kah Wei, kahwei.tng, 390009620
|
\author Tng Kah Wei, kahwei.tng, 390009620
|
||||||
\par email: kahwei.tng\@digipen.edu
|
\par email: kahwei.tng\@digipen.edu
|
||||||
\date Nov 29, 2021
|
\date Nov 29, 2021
|
||||||
|
@ -12,22 +12,22 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// Precompiled Header
|
// Precompiled Header
|
||||||
#include <SHpch.h>
|
#include <SHpch.h>
|
||||||
// Primary Header
|
// Primary Header
|
||||||
#include "SHStringUtils.h"
|
#include "SHStringUtilities.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Utility Functions */
|
/* Utility Functions */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
std::vector<std::string> SHStringUtils::Split(const std::string& str, const char& delim)
|
std::vector<std::string> SHStringUtilities::Split(const std::string& str, const char& delim)
|
||||||
{
|
{
|
||||||
return Split<char>(str, delim);
|
return Split<char>(str, delim);
|
||||||
}
|
}
|
||||||
std::vector<std::wstring> SHStringUtils::Split(const std::wstring& str, const wchar_t& delim)
|
std::vector<std::wstring> SHStringUtilities::Split(const std::wstring& str, const wchar_t& delim)
|
||||||
{
|
{
|
||||||
return Split<wchar_t>(str, delim);
|
return Split<wchar_t>(str, delim);
|
||||||
}
|
}
|
||||||
std::string SHStringUtils::WstrToStr(const std::wstring& wstr)
|
std::string SHStringUtilities::WstrToStr(const std::wstring& wstr)
|
||||||
{
|
{
|
||||||
static std::vector<char> buffer;
|
static std::vector<char> buffer;
|
||||||
const int STR_SIZE = WideCharToMultiByte(CP_UTF8, 0, wstr.data(), static_cast<int>(wstr.size()), nullptr, 0, nullptr, nullptr) + 1 /* Null Terminator */;
|
const int STR_SIZE = WideCharToMultiByte(CP_UTF8, 0, wstr.data(), static_cast<int>(wstr.size()), nullptr, 0, nullptr, nullptr) + 1 /* Null Terminator */;
|
||||||
|
@ -35,7 +35,7 @@ namespace SHADE
|
||||||
WideCharToMultiByte(CP_UTF8, 0, wstr.data(), static_cast<int>(wstr.size()), buffer.data(), MAX_PATH, nullptr, nullptr);
|
WideCharToMultiByte(CP_UTF8, 0, wstr.data(), static_cast<int>(wstr.size()), buffer.data(), MAX_PATH, nullptr, nullptr);
|
||||||
return std::string(buffer.data());
|
return std::string(buffer.data());
|
||||||
}
|
}
|
||||||
std::wstring SHStringUtils::StrToWstr(const std::string& str)
|
std::wstring SHStringUtilities::StrToWstr(const std::string& str)
|
||||||
{
|
{
|
||||||
static std::vector<wchar_t> buffer;
|
static std::vector<wchar_t> buffer;
|
||||||
const int WSTR_SIZE = MultiByteToWideChar(CP_UTF8, 0, str.data(), static_cast<int>(str.size()), nullptr, 0) + 1 /* Null Terminator */;
|
const int WSTR_SIZE = MultiByteToWideChar(CP_UTF8, 0, str.data(), static_cast<int>(str.size()), nullptr, 0) + 1 /* Null Terminator */;
|
||||||
|
@ -44,7 +44,7 @@ namespace SHADE
|
||||||
return std::wstring(buffer.data());
|
return std::wstring(buffer.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SHStringUtils::GetWin32ErrorMessage(unsigned long errorCode)
|
std::string SHStringUtilities::GetWin32ErrorMessage(unsigned long errorCode)
|
||||||
{
|
{
|
||||||
return std::system_category().message(errorCode);
|
return std::system_category().message(errorCode);
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/************************************************************************************//*!
|
/************************************************************************************//*!
|
||||||
\file StringUtilities.h
|
\file SHStringUtilities.h
|
||||||
\author Tng Kah Wei, kahwei.tng, 390009620
|
\author Tng Kah Wei, kahwei.tng, 390009620
|
||||||
\par email: kahwei.tng\@digipen.edu
|
\par email: kahwei.tng\@digipen.edu
|
||||||
\date Nov 29, 2021
|
\date Nov 29, 2021
|
||||||
|
@ -19,7 +19,7 @@ namespace SHADE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains useful functions for operating on strings.
|
/// Contains useful functions for operating on strings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class SHStringUtils
|
class SHStringUtilities
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
@ -74,8 +74,8 @@ namespace SHADE
|
||||||
/*-------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------*/
|
||||||
/* Constructors/Destructors */
|
/* Constructors/Destructors */
|
||||||
/*-------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------*/
|
||||||
SHStringUtils() = delete;
|
SHStringUtilities() = delete;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "SHStringUtils.hpp"
|
#include "SHStringUtilities.hpp"
|
|
@ -1,5 +1,5 @@
|
||||||
/************************************************************************************//*!
|
/************************************************************************************//*!
|
||||||
\file StringUtilities.hpp
|
\file SHStringUtilities.hpp
|
||||||
\author Tng Kah Wei, kahwei.tng, 390009620
|
\author Tng Kah Wei, kahwei.tng, 390009620
|
||||||
\par email: kahwei.tng\@digipen.edu
|
\par email: kahwei.tng\@digipen.edu
|
||||||
\date Nov 29, 2021
|
\date Nov 29, 2021
|
||||||
|
@ -12,7 +12,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
*//*************************************************************************************/
|
*//*************************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
// Primary Header
|
// Primary Header
|
||||||
#include "SHStringUtils.h"
|
#include "SHStringUtilities.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ namespace SHADE
|
||||||
/* Template Function Definitions */
|
/* Template Function Definitions */
|
||||||
/*-------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline std::vector<std::basic_string<T>> SHStringUtils::Split(const std::basic_string<T>& str, const T& delim)
|
inline std::vector<std::basic_string<T>> SHStringUtilities::Split(const std::basic_string<T>& str, const T& delim)
|
||||||
{
|
{
|
||||||
std::vector<std::basic_string<T>> results;
|
std::vector<std::basic_string<T>> results;
|
||||||
std::basic_string<T> remaining = str;
|
std::basic_string<T> remaining = str;
|
|
@ -75,7 +75,8 @@ project "SHADE_Managed"
|
||||||
|
|
||||||
disablewarnings
|
disablewarnings
|
||||||
{
|
{
|
||||||
"4275"
|
"4275",
|
||||||
|
"4635"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,3 +103,15 @@ project "SHADE_Managed"
|
||||||
optimize "On"
|
optimize "On"
|
||||||
defines{"_RELEASE"}
|
defines{"_RELEASE"}
|
||||||
links{"librttr_core.lib"}
|
links{"librttr_core.lib"}
|
||||||
|
|
||||||
|
require "vstudio"
|
||||||
|
|
||||||
|
function docsElementCPP(cfg)
|
||||||
|
_p(3,'<GenerateXMLDocumentationFiles>true</GenerateXMLDocumentationFiles>')
|
||||||
|
end
|
||||||
|
|
||||||
|
premake.override(premake.vstudio.vc2010.elements, "clCompile", function (oldfn, cfg)
|
||||||
|
return table.join(oldfn(cfg), {
|
||||||
|
docsElementCPP,
|
||||||
|
})
|
||||||
|
end)
|
|
@ -194,6 +194,12 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
return Convert::ToCLI(GetNativeComponent()->GetForce());
|
return Convert::ToCLI(GetNativeComponent()->GetForce());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RigidBody::ClearForces()
|
||||||
|
{
|
||||||
|
GetNativeComponent()->ClearForces();
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Torque Functions */
|
/* Torque Functions */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
@ -212,4 +218,9 @@ namespace SHADE
|
||||||
return Convert::ToCLI(GetNativeComponent()->GetTorque());
|
return Convert::ToCLI(GetNativeComponent()->GetTorque());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RigidBody::ClearTorque()
|
||||||
|
{
|
||||||
|
GetNativeComponent()->ClearTorque();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -146,6 +146,7 @@ namespace SHADE
|
||||||
void AddRelativeForceAtWorldPos(Vector3 relativeForce, Vector3 worldPos);
|
void AddRelativeForceAtWorldPos(Vector3 relativeForce, Vector3 worldPos);
|
||||||
|
|
||||||
Vector3 GetForce();
|
Vector3 GetForce();
|
||||||
|
void ClearForces();
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Torque Functions */
|
/* Torque Functions */
|
||||||
|
@ -154,6 +155,7 @@ namespace SHADE
|
||||||
void AddRelativeTorque(Vector3 relativeForce);
|
void AddRelativeTorque(Vector3 relativeForce);
|
||||||
|
|
||||||
Vector3 GetTorque();
|
Vector3 GetTorque();
|
||||||
|
void ClearTorque();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
|
@ -26,7 +26,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Physics/Interface/SHRigidBodyComponent.h"
|
#include "Physics/Interface/SHRigidBodyComponent.h"
|
||||||
#include "Scene/SHSceneManager.h"
|
#include "Scene/SHSceneManager.h"
|
||||||
#include "Scene/SHSceneGraph.h"
|
#include "Scene/SHSceneGraph.h"
|
||||||
#include "Tools/SHLog.h"
|
#include "Tools/Logger/SHLog.h"
|
||||||
#include "Graphics\MiddleEnd\Interface\SHRenderable.h"
|
#include "Graphics\MiddleEnd\Interface\SHRenderable.h"
|
||||||
// Project Headers
|
// Project Headers
|
||||||
#include "Utility/Convert.hxx"
|
#include "Utility/Convert.hxx"
|
||||||
|
|
|
@ -20,7 +20,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
// External Dependencies
|
// External Dependencies
|
||||||
#include "ECS_Base/Managers/SHEntityManager.h"
|
#include "ECS_Base/Managers/SHEntityManager.h"
|
||||||
#include "Tools/SHLog.h"
|
#include "Tools/Logger/SHLog.h"
|
||||||
// Project Headers
|
// Project Headers
|
||||||
#include "Utility/Debug.hxx"
|
#include "Utility/Debug.hxx"
|
||||||
#include "Utility/Convert.hxx"
|
#include "Utility/Convert.hxx"
|
||||||
|
|
|
@ -19,7 +19,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// Standard Libraries
|
// Standard Libraries
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
// External Libraries
|
// External Libraries
|
||||||
#include "Tools/SHLog.h"
|
#include "Tools/Logger/SHLog.h"
|
||||||
// Project Headers
|
// Project Headers
|
||||||
#include "Convert.hxx"
|
#include "Convert.hxx"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue