mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-30 08:37:53 -05:00
chore: move material compilation behind compiler flag
This commit is contained in:
@ -84,6 +84,9 @@ workspace "OpenAssetTools"
|
||||
filter "options:debug-techset"
|
||||
defines { "TECHSET_DEBUG" }
|
||||
filter {}
|
||||
filter "options:experimental-material-compilation"
|
||||
defines { "EXPERIMENTAL_MATERIAL_COMPILATION" }
|
||||
filter {}
|
||||
|
||||
-- ========================
|
||||
-- ThirdParty
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "CompilingMaterialLoad.h"
|
||||
#include "CompilerMaterialIW4.h"
|
||||
|
||||
#include "Game/IW4/CommonIW4.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
@ -1376,7 +1376,7 @@ namespace
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetMaterial>> CreateCompilingMaterialLoader(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt)
|
||||
std::unique_ptr<AssetCreator<AssetMaterial>> CreateMaterialCompiler(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt)
|
||||
{
|
||||
return std::make_unique<MaterialLoader>(memory, searchPath, gdt);
|
||||
}
|
@ -8,5 +8,5 @@
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetMaterial>> CreateCompilingMaterialLoader(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt);
|
||||
std::unique_ptr<AssetCreator<AssetMaterial>> CreateMaterialCompiler(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt);
|
||||
} // namespace IW4
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "Image/ImageIwdPostProcessor.h"
|
||||
#include "Material/CompilerMaterialIW4.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -9,11 +10,13 @@ using namespace IW4;
|
||||
|
||||
namespace
|
||||
{
|
||||
void ConfigureCompilers(AssetCreatorCollection& collection, Zone& zone, ISearchPath& searchPath)
|
||||
void ConfigureCompilers(AssetCreatorCollection& collection, Zone& zone, ISearchPath& searchPath, IGdtQueryable& gdt)
|
||||
{
|
||||
auto& memory = zone.Memory();
|
||||
|
||||
// No compilers yet
|
||||
#ifdef EXPERIMENTAL_MATERIAL_COMPILATION
|
||||
collection.AddAssetCreator(CreateCompilingMaterialLoader(memory, searchPath, gdt));
|
||||
#endif
|
||||
}
|
||||
|
||||
void ConfigurePostProcessors(AssetCreatorCollection& collection,
|
||||
@ -39,5 +42,6 @@ void ObjCompiler::ConfigureCreatorCollection(AssetCreatorCollection& collection,
|
||||
IOutputPath& outDir,
|
||||
IOutputPath& cacheDir) const
|
||||
{
|
||||
ConfigureCompilers(collection, zone, searchPath, gdt);
|
||||
ConfigurePostProcessors(collection, zone, zoneDefinition, searchPath, zoneStates, outDir);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "Leaderboard/LoaderLeaderboardIW4.h"
|
||||
#include "LightDef/LoaderLightDefIW4.h"
|
||||
#include "Localize/LoaderLocalizeIW4.h"
|
||||
#include "Material/CompilingMaterialLoad.h"
|
||||
#include "Material/LoaderMaterialIW4.h"
|
||||
#include "Menu/LoaderMenuListIW4.h"
|
||||
#include "ObjLoading.h"
|
||||
@ -128,7 +127,6 @@ namespace
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderXModelSurfs>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderXModel>(memory));
|
||||
collection.AddAssetCreator(CreateMaterialLoader(memory, searchPath));
|
||||
collection.AddAssetCreator(CreateCompilingMaterialLoader(memory, searchPath, gdt));
|
||||
collection.AddAssetCreator(CreatePixelShaderLoader(memory, searchPath));
|
||||
collection.AddAssetCreator(CreateVertexShaderLoader(memory, searchPath));
|
||||
collection.AddAssetCreator(CreateVertexDeclLoader(memory));
|
||||
|
@ -5,8 +5,6 @@
|
||||
#include "Game/IW4/Material/MaterialConstantZoneState.h"
|
||||
#include "Material/MaterialCommon.h"
|
||||
|
||||
// #define EXPERIMENTAL_DECOMPILE_MATERIAL 1
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
void AssetDumperMaterial::DumpPool(AssetDumpingContext& context, AssetPool<Material>* pool)
|
||||
@ -24,7 +22,7 @@ bool AssetDumperMaterial::ShouldDump(XAssetInfo<Material>* asset)
|
||||
|
||||
void AssetDumperMaterial::DumpAsset(AssetDumpingContext& context, XAssetInfo<Material>* asset)
|
||||
{
|
||||
#ifdef EXPERIMENTAL_DECOMPILE_MATERIAL
|
||||
#ifdef EXPERIMENTAL_MATERIAL_COMPILATION
|
||||
if (context.m_gdt)
|
||||
{
|
||||
DecompileMaterialToGdt(*context.m_gdt, *asset->Asset(), context);
|
||||
|
@ -6,3 +6,7 @@ newoption {
|
||||
trigger = "debug-techset",
|
||||
description = "Activate additional debugging logic for Techset assets"
|
||||
}
|
||||
newoption {
|
||||
trigger = "experimental-material-compilation",
|
||||
description = "Activate experimental material compilation support"
|
||||
}
|
||||
|
Reference in New Issue
Block a user