From a497efe67b8b1292fa6914154a32ef0a0be1ac66 Mon Sep 17 00:00:00 2001 From: Jan Laupetin Date: Wed, 18 Mar 2026 23:04:41 +0100 Subject: [PATCH] feat: compile iw5 techsets --- .../Game/IW5/Techset/TechsetConstantsIW5.h | 17 +++++++++++++++++ src/ObjCompiling/Game/IW5/ObjCompilerIW5.cpp | 9 ++++++++- .../Techset/TechniqueCompiler.cpp.template | 6 +++--- .../Techset/TechniqueCompiler.h.template | 2 +- .../Techset/TechsetCompiler.cpp.template | 2 +- .../Techset/TechsetCompiler.h.template | 2 +- .../Techset/VertexDeclCompiler.cpp.template | 2 +- .../Techset/VertexDeclCompiler.h.template | 2 +- src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp | 7 ++++--- .../Techset/PixelShaderLoader.cpp.template | 2 +- .../Techset/PixelShaderLoader.h.template | 2 +- .../Techset/VertexShaderLoader.cpp.template | 2 +- .../Techset/VertexShaderLoader.h.template | 2 +- 13 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/ObjCommon/Game/IW5/Techset/TechsetConstantsIW5.h b/src/ObjCommon/Game/IW5/Techset/TechsetConstantsIW5.h index ddf69008..a4dfc487 100644 --- a/src/ObjCommon/Game/IW5/Techset/TechsetConstantsIW5.h +++ b/src/ObjCommon/Game/IW5/Techset/TechsetConstantsIW5.h @@ -34,6 +34,22 @@ namespace IW5 "lit omni dfog", "lit omni shadow", "lit omni shadow dfog", + "lit instanced", + "lit instanced dfog", + "lit instanced sun", + "lit instanced sun dfog", + "lit instanced sun shadow", + "lit instanced sun shadow dfog", + "lit instanced spot", + "lit instanced spot dfog", + "lit instanced spot shadow", + "lit instanced spot shadow dfog", + "lit instanced spot shadow cucoloris", + "lit instanced spot shadow cucoloris dfog", + "lit instanced omni", + "lit instanced omni dfog", + "lit instanced omni shadow", + "lit instanced omni shadow dfog", "light spot", "light omni", "light spot shadow", @@ -46,6 +62,7 @@ namespace IW5 "shaded wireframe", "thermal", "debug bumpmap", + "debug bumpmap instanced", }; static_assert(std::extent_v == TECHNIQUE_COUNT); static inline techset::CommonTechniqueTypeNames commonTechniqueTypeNames(techniqueTypeNames, std::extent_v); diff --git a/src/ObjCompiling/Game/IW5/ObjCompilerIW5.cpp b/src/ObjCompiling/Game/IW5/ObjCompilerIW5.cpp index 5f9e9bf9..5a6ba6d3 100644 --- a/src/ObjCompiling/Game/IW5/ObjCompilerIW5.cpp +++ b/src/ObjCompiling/Game/IW5/ObjCompilerIW5.cpp @@ -1,6 +1,9 @@ #include "ObjCompilerIW5.h" #include "Game/IW5/IW5.h" +#include "Game/IW5/Techset/TechniqueCompilerIW5.h" +#include "Game/IW5/Techset/TechsetCompilerIW5.h" +#include "Game/IW5/Techset/VertexDeclCompilerIW5.h" #include "Image/ImageIwdPostProcessor.h" #include @@ -13,7 +16,10 @@ namespace { auto& memory = zone.Memory(); - // No compilers yet + collection.AddAssetCreator(techset::CreateVertexDeclCompilerIW5(memory)); + collection.AddAssetCreator(techset::CreateTechsetCompilerIW5(memory, searchPath)); + + collection.AddSubAssetCreator(techset::CreateTechniqueCompilerIW5(memory, zone, searchPath)); } 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 7728ac01..4d460024 100644 --- a/src/ObjCompiling/Techset/TechniqueCompiler.cpp.template +++ b/src/ObjCompiling/Techset/TechniqueCompiler.cpp.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T5, T6) +#options GAME(IW3, IW4, IW5, T5, T6) #filename "Game/" + GAME + "/Techset/TechniqueCompiler" + GAME + ".cpp" @@ -213,7 +213,7 @@ namespace pass.customSamplerFlags = static_cast(commonPass.m_sampler_flags); } -#ifdef FEATURE_IW4 +#if defined(FEATURE_IW4) || defined(FEATURE_IW5) // Not sure if this is actually how this is calculated. // It produces identical results at least though. constexpr MaterialConstantSource ALLOWED_PIXEL_CONSTANTS_FOR_FLAG_200[]{ @@ -282,7 +282,7 @@ namespace #if defined(FEATURE_IW3) if (lowerTechniqueName == "zprepass") technique.flags |= MTL_TECHFLAG_ZPREPASS; -#elif defined(FEATURE_IW4) +#elif defined(FEATURE_IW4) || defined(FEATURE_IW5) // Not a particularly cool way to do this but... // the game actually does this :shrug: if (lowerTechniqueName == "zprepass") diff --git a/src/ObjCompiling/Techset/TechniqueCompiler.h.template b/src/ObjCompiling/Techset/TechniqueCompiler.h.template index b299555e..3b792279 100644 --- a/src/ObjCompiling/Techset/TechniqueCompiler.h.template +++ b/src/ObjCompiling/Techset/TechniqueCompiler.h.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T5, T6) +#options GAME(IW3, IW4, IW5, 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 74d49327..25b26872 100644 --- a/src/ObjCompiling/Techset/TechsetCompiler.cpp.template +++ b/src/ObjCompiling/Techset/TechsetCompiler.cpp.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T5, T6) +#options GAME(IW3, IW4, IW5, 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 0bc5dc42..e1eb61f6 100644 --- a/src/ObjCompiling/Techset/TechsetCompiler.h.template +++ b/src/ObjCompiling/Techset/TechsetCompiler.h.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T5, T6) +#options GAME(IW3, IW4, IW5, 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 4413cd01..23c9e77f 100644 --- a/src/ObjCompiling/Techset/VertexDeclCompiler.cpp.template +++ b/src/ObjCompiling/Techset/VertexDeclCompiler.cpp.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T5, T6) +#options GAME(IW3, IW4, IW5, T5, T6) #filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".cpp" diff --git a/src/ObjCompiling/Techset/VertexDeclCompiler.h.template b/src/ObjCompiling/Techset/VertexDeclCompiler.h.template index 05341b40..e7272138 100644 --- a/src/ObjCompiling/Techset/VertexDeclCompiler.h.template +++ b/src/ObjCompiling/Techset/VertexDeclCompiler.h.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T5, T6) +#options GAME(IW3, IW4, IW5, T5, T6) #filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".h" diff --git a/src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp b/src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp index 439d1b0c..59a936c8 100644 --- a/src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp +++ b/src/ObjLoading/Game/IW5/ObjLoaderIW5.cpp @@ -6,6 +6,8 @@ #include "Game/IW5/IW5.h" #include "Game/IW5/Image/ImageLoaderEmbeddedIW5.h" #include "Game/IW5/Image/ImageLoaderExternalIW5.h" +#include "Game/IW5/Techset/PixelShaderLoaderIW5.h" +#include "Game/IW5/Techset/VertexShaderLoaderIW5.h" #include "Game/IW5/XModel/LoaderXModelIW5.h" #include "Leaderboard/LoaderLeaderboardIW5.h" #include "Localize/LoaderLocalizeIW5.h" @@ -129,9 +131,8 @@ namespace // collection.AddAssetCreator(std::make_unique(memory)); collection.AddAssetCreator(xmodel::CreateLoaderIW5(memory, searchPath, zone)); collection.AddAssetCreator(material::CreateLoaderIW5(memory, searchPath)); - // collection.AddAssetCreator(std::make_unique(memory)); - // collection.AddAssetCreator(std::make_unique(memory)); - // collection.AddAssetCreator(std::make_unique(memory)); + collection.AddAssetCreator(techset::CreateVertexShaderLoaderIW5(memory, searchPath)); + collection.AddAssetCreator(techset::CreatePixelShaderLoaderIW5(memory, searchPath)); // collection.AddAssetCreator(std::make_unique(memory)); collection.AddAssetCreator(image::CreateLoaderEmbeddedIW5(memory, searchPath)); collection.AddAssetCreator(image::CreateLoaderExternalIW5(memory, searchPath)); diff --git a/src/ObjLoading/Techset/PixelShaderLoader.cpp.template b/src/ObjLoading/Techset/PixelShaderLoader.cpp.template index 7cb348bc..fc86ef17 100644 --- a/src/ObjLoading/Techset/PixelShaderLoader.cpp.template +++ b/src/ObjLoading/Techset/PixelShaderLoader.cpp.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T5, T6) +#options GAME(IW3, IW4, IW5, T5, T6) #filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".cpp" diff --git a/src/ObjLoading/Techset/PixelShaderLoader.h.template b/src/ObjLoading/Techset/PixelShaderLoader.h.template index 8acc4180..90b4c6c2 100644 --- a/src/ObjLoading/Techset/PixelShaderLoader.h.template +++ b/src/ObjLoading/Techset/PixelShaderLoader.h.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T5, T6) +#options GAME(IW3, IW4, IW5, T5, T6) #filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".h" diff --git a/src/ObjLoading/Techset/VertexShaderLoader.cpp.template b/src/ObjLoading/Techset/VertexShaderLoader.cpp.template index 671f478a..e3f1d10d 100644 --- a/src/ObjLoading/Techset/VertexShaderLoader.cpp.template +++ b/src/ObjLoading/Techset/VertexShaderLoader.cpp.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T5, T6) +#options GAME(IW3, IW4, IW5, T5, T6) #filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".cpp" diff --git a/src/ObjLoading/Techset/VertexShaderLoader.h.template b/src/ObjLoading/Techset/VertexShaderLoader.h.template index 0bddf735..fc353afc 100644 --- a/src/ObjLoading/Techset/VertexShaderLoader.h.template +++ b/src/ObjLoading/Techset/VertexShaderLoader.h.template @@ -1,4 +1,4 @@ -#options GAME(IW3, IW4, T5, T6) +#options GAME(IW3, IW4, IW5, T5, T6) #filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".h"