diff --git a/src/ObjCompiling/Game/T5/ObjCompilerT5.cpp b/src/ObjCompiling/Game/T5/ObjCompilerT5.cpp index 0442c1e8..12a63556 100644 --- a/src/ObjCompiling/Game/T5/ObjCompilerT5.cpp +++ b/src/ObjCompiling/Game/T5/ObjCompilerT5.cpp @@ -1,6 +1,9 @@ #include "ObjCompilerT5.h" #include "Game/T5/T5.h" +#include "Game/T5/Techset/TechniqueCompilerT5.h" +#include "Game/T5/Techset/TechsetCompilerT5.h" +#include "Game/T5/Techset/VertexDeclCompilerT5.h" #include "Image/ImageIwdPostProcessor.h" #include @@ -13,7 +16,10 @@ namespace { auto& memory = zone.Memory(); - // No compilers yet + collection.AddAssetCreator(techset::CreateTechsetCompilerT5(memory, searchPath)); + + collection.AddSubAssetCreator(techset::CreateTechniqueCompilerT5(memory, zone, searchPath)); + collection.AddSubAssetCreator(techset::CreateVertexDeclCompilerT5(memory)); } void ConfigurePostProcessors(AssetCreatorCollection& collection, @@ -39,5 +45,6 @@ void ObjCompiler::ConfigureCreatorCollection(AssetCreatorCollection& collection, IOutputPath& outDir, IOutputPath& cacheDir) const { + ConfigureCompilers(collection, zone, searchPath); ConfigurePostProcessors(collection, zone, zoneDefinition, searchPath, zoneStates, outDir); } diff --git a/src/ObjCompiling/Techset/TechniqueCompiler.cpp.template b/src/ObjCompiling/Techset/TechniqueCompiler.cpp.template index 14d6facc..7728ac01 100644 --- a/src/ObjCompiling/Techset/TechniqueCompiler.cpp.template +++ b/src/ObjCompiling/Techset/TechniqueCompiler.cpp.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T6) +#options GAME(IW3, IW4, T5, T6) #filename "Game/" + GAME + "/Techset/TechniqueCompiler" + GAME + ".cpp" @@ -297,6 +297,14 @@ namespace if (ShouldApplyFlag200(technique)) technique.flags |= TECHNIQUE_FLAG_200; +#elif defined(FEATURE_T5) + // Not a particularly cool way to do this but... + // the game actually does this :shrug: + if (lowerTechniqueName == "zprepass" || lowerTechniqueName.starts_with("pimp_technique_zprepass_") + || lowerTechniqueName.starts_with("pimp_technique_layer_zprepass_")) + { + technique.flags |= MTL_TECHFLAG_ZPREPASS; + } #elif defined(FEATURE_T6) // Not a particularly cool way to do this but... // the game actually does this :shrug: @@ -332,7 +340,7 @@ namespace return technique; } -#if defined(FEATURE_T6) +#if defined(FEATURE_T5) || defined(FEATURE_T6) void ApplyTechFlagsFromMaterial(const Material& material, const Zone& zone) { if (!material.techniqueSet || !material.techniqueSet->name || !material.stateBitsTable) @@ -458,13 +466,15 @@ namespace void FinalizeZone(AssetCreationContext& context) override { -#if defined(FEATURE_T6) +#if defined(FEATURE_T5) || defined(FEATURE_T6) const auto materials = m_zone.m_pools.PoolAssets(); for (auto* materialAsset : materials) { ApplyTechFlagsFromMaterial(*materialAsset->Asset(), m_zone); } +#endif +#if defined(FEATURE_T6) const auto techniques = context.PoolSubAssets(); for (auto* techniqueSubAsset : techniques) { diff --git a/src/ObjCompiling/Techset/TechniqueCompiler.h.template b/src/ObjCompiling/Techset/TechniqueCompiler.h.template index 300d599e..b299555e 100644 --- a/src/ObjCompiling/Techset/TechniqueCompiler.h.template +++ b/src/ObjCompiling/Techset/TechniqueCompiler.h.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T6) +#options GAME(IW3, IW4, T5, T6) #filename "Game/" + GAME + "/Techset/TechniqueCompiler" + GAME + ".h" diff --git a/src/ObjCompiling/Techset/TechsetCompiler.cpp.template b/src/ObjCompiling/Techset/TechsetCompiler.cpp.template index 980926d0..74d49327 100644 --- a/src/ObjCompiling/Techset/TechsetCompiler.cpp.template +++ b/src/ObjCompiling/Techset/TechsetCompiler.cpp.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T6) +#options GAME(IW3, IW4, T5, T6) #filename "Game/" + GAME + "/Techset/TechsetCompiler" + GAME + ".cpp" diff --git a/src/ObjCompiling/Techset/TechsetCompiler.h.template b/src/ObjCompiling/Techset/TechsetCompiler.h.template index ce6ff411..0bc5dc42 100644 --- a/src/ObjCompiling/Techset/TechsetCompiler.h.template +++ b/src/ObjCompiling/Techset/TechsetCompiler.h.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T6) +#options GAME(IW3, IW4, T5, T6) #filename "Game/" + GAME + "/Techset/TechsetCompiler" + GAME + ".h" diff --git a/src/ObjCompiling/Techset/VertexDeclCompiler.cpp.template b/src/ObjCompiling/Techset/VertexDeclCompiler.cpp.template index ad6dcc04..4413cd01 100644 --- a/src/ObjCompiling/Techset/VertexDeclCompiler.cpp.template +++ b/src/ObjCompiling/Techset/VertexDeclCompiler.cpp.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T6) +#options GAME(IW3, IW4, T5, T6) #filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".cpp" @@ -15,6 +15,7 @@ #define FEATURE_IW5 #elif GAME == "T5" #define FEATURE_T5 +#define IS_SUB_ASSET #elif GAME == "T6" #define FEATURE_T6 #define IS_SUB_ASSET diff --git a/src/ObjCompiling/Techset/VertexDeclCompiler.h.template b/src/ObjCompiling/Techset/VertexDeclCompiler.h.template index 32f66784..05341b40 100644 --- a/src/ObjCompiling/Techset/VertexDeclCompiler.h.template +++ b/src/ObjCompiling/Techset/VertexDeclCompiler.h.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T6) +#options GAME(IW3, IW4, T5, T6) #filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".h" @@ -11,6 +11,7 @@ #define FEATURE_IW5 #elif GAME == "T5" #define FEATURE_T5 +#define IS_SUB_ASSET #elif GAME == "T6" #define FEATURE_T6 #define IS_SUB_ASSET diff --git a/src/ObjLoading/Game/T5/ObjLoaderT5.cpp b/src/ObjLoading/Game/T5/ObjLoaderT5.cpp index 01d22d5f..b50a9a53 100644 --- a/src/ObjLoading/Game/T5/ObjLoaderT5.cpp +++ b/src/ObjLoading/Game/T5/ObjLoaderT5.cpp @@ -6,6 +6,8 @@ #include "Game/T5/Image/ImageLoaderEmbeddedT5.h" #include "Game/T5/Image/ImageLoaderExternalT5.h" #include "Game/T5/T5.h" +#include "Game/T5/Techset/PixelShaderLoaderT5.h" +#include "Game/T5/Techset/VertexShaderLoaderT5.h" #include "Game/T5/XModel/LoaderXModelT5.h" #include "Localize/LoaderLocalizeT5.h" #include "Material/LoaderMaterialT5.h" @@ -136,6 +138,9 @@ namespace // collection.AddAssetCreator(std::make_unique(memory)); // collection.AddAssetCreator(std::make_unique(memory)); // collection.AddAssetCreator(std::make_unique(memory)); + + collection.AddSubAssetCreator(techset::CreateVertexShaderLoaderT5(memory, searchPath)); + collection.AddSubAssetCreator(techset::CreatePixelShaderLoaderT5(memory, searchPath)); } } // namespace diff --git a/src/ObjLoading/Techset/PixelShaderLoader.cpp.template b/src/ObjLoading/Techset/PixelShaderLoader.cpp.template index d02e87bb..7cb348bc 100644 --- a/src/ObjLoading/Techset/PixelShaderLoader.cpp.template +++ b/src/ObjLoading/Techset/PixelShaderLoader.cpp.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T6) +#options GAME(IW3, IW4, T5, T6) #filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".cpp" @@ -18,6 +18,7 @@ #elif GAME == "T5" #define FEATURE_T5 #define IS_DX9 +#define IS_SUB_ASSET #elif GAME == "T6" #define FEATURE_T6 #define IS_DX11 diff --git a/src/ObjLoading/Techset/PixelShaderLoader.h.template b/src/ObjLoading/Techset/PixelShaderLoader.h.template index bc2a1731..8acc4180 100644 --- a/src/ObjLoading/Techset/PixelShaderLoader.h.template +++ b/src/ObjLoading/Techset/PixelShaderLoader.h.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T6) +#options GAME(IW3, IW4, T5, T6) #filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".h" @@ -11,6 +11,7 @@ #define FEATURE_IW5 #elif GAME == "T5" #define FEATURE_T5 +#define IS_SUB_ASSET #elif GAME == "T6" #define FEATURE_T6 #define IS_SUB_ASSET diff --git a/src/ObjLoading/Techset/VertexShaderLoader.cpp.template b/src/ObjLoading/Techset/VertexShaderLoader.cpp.template index 3e02b330..671f478a 100644 --- a/src/ObjLoading/Techset/VertexShaderLoader.cpp.template +++ b/src/ObjLoading/Techset/VertexShaderLoader.cpp.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T6) +#options GAME(IW3, IW4, T5, T6) #filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".cpp" @@ -18,6 +18,7 @@ #elif GAME == "T5" #define FEATURE_T5 #define IS_DX9 +#define IS_SUB_ASSET #elif GAME == "T6" #define FEATURE_T6 #define IS_DX11 diff --git a/src/ObjLoading/Techset/VertexShaderLoader.h.template b/src/ObjLoading/Techset/VertexShaderLoader.h.template index 83957393..0bddf735 100644 --- a/src/ObjLoading/Techset/VertexShaderLoader.h.template +++ b/src/ObjLoading/Techset/VertexShaderLoader.h.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T6) +#options GAME(IW3, IW4, T5, T6) #filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".h" @@ -11,6 +11,7 @@ #define FEATURE_IW5 #elif GAME == "T5" #define FEATURE_T5 +#define IS_SUB_ASSET #elif GAME == "T6" #define FEATURE_T6 #define IS_SUB_ASSET