WIP Rewrite flow from compiling to loading to recognising assets
This commit is contained in:
parent
2a31ea6798
commit
e2778da955
|
@ -7,7 +7,7 @@ echo "SHADE DEPENDENCIES (Default - All in 10 Seconds)"
|
|||
echo "A - All"
|
||||
echo "B - VMA"
|
||||
echo "C - msdf"
|
||||
echo "D - assimp"
|
||||
echo "D - ModelCompiler"
|
||||
echo "E - spdlog"
|
||||
echo "F - reactphysics3d"
|
||||
echo "G - imgui"
|
||||
|
@ -29,7 +29,7 @@ set _e=%ERRORLEVEL%
|
|||
if %_e%==1 goto VMA
|
||||
if %_e%==2 goto VMA
|
||||
if %_e%==3 goto MSDF
|
||||
if %_e%==4 goto assimp
|
||||
if %_e%==4 goto ModelCompiler
|
||||
if %_e%==5 goto spdlog
|
||||
if %_e%==6 goto reactphysics3d
|
||||
if %_e%==7 goto imgui
|
||||
|
@ -53,12 +53,13 @@ if %_e%==2 (goto :done) else (goto :MSDF)
|
|||
echo -----------------------MSDF----------------------------
|
||||
rmdir "Dependencies/msdf" /S /Q
|
||||
git clone --recurse-submodules https://github.com/SHADE-DP/msdf-atlas-gen.git "Dependencies/msdf"
|
||||
if %_e%==3 (goto :done) else (goto :assimp)
|
||||
if %_e%==3 (goto :done) else (goto :ModelCompiler)
|
||||
|
||||
:assimp
|
||||
echo -----------------------assimp----------------------------
|
||||
rmdir "Dependencies/assimp" /S /Q
|
||||
git clone https://github.com/SHADE-DP/assimp.git "Dependencies/assimp"
|
||||
:ModelCompiler
|
||||
echo -----------------------ModelCompiler----------------------------
|
||||
rmdir "Dependencies/ModelCompiler" /S /Q
|
||||
git clone https://github.com/SHADE-DP/ModelCompiler.git "Dependencies/ModelCompiler"
|
||||
Dependencies/ModelCompiler/Dependencies.bat
|
||||
if %_e%==4 (goto :done) else (goto :spdlog)
|
||||
|
||||
@REM :ktx
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
IncludeDir = {}
|
||||
IncludeDir["assimp"] = "%{wks.location}\\Dependencies\\assimp"
|
||||
IncludeDir["ModelCompiler"] = "%{wks.location}\\Dependencies\\ModelCompiler"
|
||||
IncludeDir["imgui"] = "%{wks.location}\\Dependencies\\imgui"
|
||||
IncludeDir["imguizmo"] = "%{wks.location}\\Dependencies\\imguizmo"
|
||||
IncludeDir["imnodes"] = "%{wks.location}\\Dependencies\\imnodes"
|
||||
|
|
|
@ -26,7 +26,6 @@ project "SHADE_Engine"
|
|||
|
||||
externalincludedirs
|
||||
{
|
||||
"%{IncludeDir.assimp}\\include",
|
||||
"%{IncludeDir.imgui}",
|
||||
"%{IncludeDir.imguizmo}",
|
||||
"%{IncludeDir.imnodes}",
|
||||
|
@ -52,8 +51,6 @@ project "SHADE_Engine"
|
|||
{
|
||||
"%{prj.location}/libs",
|
||||
"%{IncludeDir.VULKAN}/Lib",
|
||||
"%{IncludeDir.assimp}/lib/Debug",
|
||||
"%{IncludeDir.assimp}/lib/Release",
|
||||
"%{IncludeDir.RTTR}/lib",
|
||||
"%{IncludeDir.SDL}/lib",
|
||||
"%{IncludeDir.spdlog}/lib",
|
||||
|
@ -119,7 +116,7 @@ project "SHADE_Engine"
|
|||
filter "configurations:Debug"
|
||||
postbuildcommands
|
||||
{
|
||||
"xcopy /r /y /q \"%{IncludeDir.assimp}\\bin\\Debug\\assimp-vc142-mtd.dll\" \"$(OutDir)\"",
|
||||
--"xcopy /r /y /q \"%{IncludeDir.assimp}\\bin\\Debug\\assimp-vc142-mtd.dll\" \"$(OutDir)\"",
|
||||
"xcopy /r /y /q \"%{IncludeDir.fmod}\\lib\\fmodL.dll\" \"$(OutDir)\"",
|
||||
"xcopy /r /y /q \"%{IncludeDir.fmod}\\lib\\fmodstudioL.dll\" \"$(OutDir)\""
|
||||
}
|
||||
|
@ -127,7 +124,7 @@ project "SHADE_Engine"
|
|||
filter "configurations:Release"
|
||||
postbuildcommands
|
||||
{
|
||||
"xcopy /r /y /q \"%{IncludeDir.assimp}\\bin\\Release\\assimp-vc142-mt.dll\" \"$(OutDir)\"",
|
||||
--"xcopy /r /y /q \"%{IncludeDir.assimp}\\bin\\Release\\assimp-vc142-mt.dll\" \"$(OutDir)\"",
|
||||
"xcopy /r /y /q \"%{IncludeDir.fmod}\\lib\\fmod.dll\" \"$(OutDir)\"",
|
||||
"xcopy /r /y /q \"%{IncludeDir.fmod}\\lib\\fmodstudio.dll\" \"$(OutDir)\""
|
||||
}
|
||||
|
@ -135,32 +132,35 @@ project "SHADE_Engine"
|
|||
filter "configurations:Publish"
|
||||
postbuildcommands
|
||||
{
|
||||
"xcopy /r /y /q \"%{IncludeDir.assimp}\\bin\\Release\\assimp-vc142-mt.dll\" \"$(OutDir)\"",
|
||||
--"xcopy /r /y /q \"%{IncludeDir.assimp}\\bin\\Release\\assimp-vc142-mt.dll\" \"$(OutDir)\"",
|
||||
"xcopy /r /y /q \"%{IncludeDir.fmod}\\lib\\fmod.dll\" \"$(OutDir)\"",
|
||||
"xcopy /r /y /q \"%{IncludeDir.fmod}\\lib\\fmodstudio.dll\" \"$(OutDir)\""
|
||||
}
|
||||
|
||||
filter "configurations:Publish"
|
||||
postbuildcommands {"xcopy /r /y /q \"%{IncludeDir.assimp}\\bin\\Release\\assimp-vc142-mt.dll\" \"$(OutDir)\""}
|
||||
postbuildcommands
|
||||
{
|
||||
--"xcopy /r /y /q \"%{IncludeDir.assimp}\\bin\\Release\\assimp-vc142-mt.dll\" \"$(OutDir)\""
|
||||
}
|
||||
|
||||
warnings 'Extra'
|
||||
|
||||
filter "configurations:Debug"
|
||||
symbols "On"
|
||||
defines {"_DEBUG", "SHEDITOR"}
|
||||
links{"assimp-vc142-mtd.lib", "librttr_core_d.lib", "spdlogd.lib"}
|
||||
links{"librttr_core_d.lib", "spdlogd.lib"}
|
||||
links{"fmodstudioL_vc.lib", "fmodL_vc.lib"}
|
||||
|
||||
filter "configurations:Release"
|
||||
optimize "On"
|
||||
defines{"_RELEASE", "SHEDITOR"}
|
||||
links{"assimp-vc142-mt.lib", "librttr_core.lib", "spdlog.lib"}
|
||||
links{"librttr_core.lib", "spdlog.lib"}
|
||||
links{"fmodstudio_vc.lib", "fmod_vc.lib"}
|
||||
|
||||
filter "configurations:Publish"
|
||||
optimize "On"
|
||||
defines{"_RELEASE", "_PUBLISH"}
|
||||
links{"assimp-vc142-mt.lib", "librttr_core.lib", "spdlog.lib"}
|
||||
links{"librttr_core.lib", "spdlog.lib"}
|
||||
excludes
|
||||
{
|
||||
-- "%{prj.location}/src/Editor/**.cpp",
|
||||
|
|
|
@ -63,6 +63,9 @@ constexpr std::string_view ASSET_ROOT {"../../Assets"};
|
|||
constexpr std::string_view BUILT_IN_ASSET_ROOT{ "../../Built_In" };
|
||||
#endif
|
||||
|
||||
// COMPILER PATHS
|
||||
constexpr std::string_view MODEL_COMPILER_EXE{ "ModelCompiler.exe" };
|
||||
|
||||
// INTERNAL ASSET PATHS
|
||||
constexpr std::string_view SCENE_FOLDER{ "/Scenes/" };
|
||||
constexpr std::string_view PREFAB_FOLDER{ "/Prefabs/" };
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <random>
|
||||
#include <chrono>
|
||||
#include <ranges>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "SHAssetManager.h"
|
||||
#include "SHAssetMetaHandler.h"
|
||||
|
||||
|
@ -19,7 +21,7 @@
|
|||
#include "Libraries/Loaders/SHShaderSourceLoader.h"
|
||||
#include "Libraries/Loaders/SHTextBasedLoader.h"
|
||||
|
||||
#include "Libraries/Compilers/SHMeshCompiler.h"
|
||||
//#include "Libraries/Compilers/SHMeshCompiler.h"
|
||||
#include "Libraries/Compilers/SHTextureCompiler.h"
|
||||
#include "Libraries/Compilers/SHShaderSourceCompiler.h"
|
||||
|
||||
|
@ -413,22 +415,15 @@ namespace SHADE
|
|||
}
|
||||
else if (ext == GLTF_EXTENSION.data() || ext == FBX_EXTENSION.data())
|
||||
{
|
||||
std::vector<SHMeshAsset*> meshes;
|
||||
std::vector<SHAnimationAsset*> anims;
|
||||
SHMeshCompiler::LoadFromFile(path, meshes, anims);
|
||||
std::string command = MODEL_COMPILER_EXE.data();
|
||||
command += " " + path.string();
|
||||
std::system(command.c_str());
|
||||
|
||||
for (auto const& mesh : meshes)
|
||||
{
|
||||
SHAsset meshAsset{
|
||||
.name = mesh->header.name
|
||||
};
|
||||
meshAsset.path = SHMeshCompiler::CompileMeshBinary(*mesh, path).value();
|
||||
meshAsset.id = GenerateAssetID(AssetType::MESH);
|
||||
meshAsset.type = AssetType::MESH;
|
||||
assetCollection.insert({ meshAsset.id, meshAsset });
|
||||
SHAssetMetaHandler::WriteMetaData(meshAsset);
|
||||
}
|
||||
continue;
|
||||
std::string newPath = path.string().substr(0, path.string().find_last_of('.'));
|
||||
newPath += MESH_EXTENSION;
|
||||
newAsset.path = newPath;
|
||||
newAsset.id = GenerateAssetID(AssetType::MESH);
|
||||
newAsset.type = AssetType::MESH;
|
||||
}
|
||||
|
||||
assetCollection.insert({ newAsset.id, newAsset });
|
||||
|
@ -492,6 +487,11 @@ namespace SHADE
|
|||
return data;
|
||||
}
|
||||
|
||||
void SHAssetManager::LoadDataFromScratch(AssetPath path) noexcept
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SHAssetManager::BuildAssetCollection() noexcept
|
||||
{
|
||||
SHFileSystem::BuildDirectory(ASSET_ROOT.data(), folderRoot, assetCollection);
|
||||
|
|
|
@ -96,6 +96,7 @@ namespace SHADE
|
|||
static void InitLoaders() noexcept;
|
||||
static void LoadAllData() noexcept;
|
||||
static SHAssetData* LoadData(SHAsset const& asset) noexcept;
|
||||
static void LoadDataFromScratch(AssetPath path) noexcept;
|
||||
inline static void BuildAssetCollection() noexcept;
|
||||
|
||||
static bool IsRecognised(char const*) noexcept;
|
||||
|
|
|
@ -30,4 +30,5 @@ workspace "SHADE"
|
|||
--include "Dependencies/tracy"
|
||||
include "Dependencies/yamlcpp"
|
||||
include "Dependencies/reactphysics3d"
|
||||
include "Dependencies/ModelCompiler"
|
||||
group ""
|
||||
|
|
Loading…
Reference in New Issue