2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-03-25 14:03:03 +00:00

feat: compile iw5 techsets

This commit is contained in:
Jan Laupetin
2026-03-18 23:04:41 +01:00
parent 72f285178b
commit a497efe67b
13 changed files with 41 additions and 16 deletions

View File

@@ -34,6 +34,22 @@ namespace IW5
"lit omni dfog", "lit omni dfog",
"lit omni shadow", "lit omni shadow",
"lit omni shadow dfog", "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 spot",
"light omni", "light omni",
"light spot shadow", "light spot shadow",
@@ -46,6 +62,7 @@ namespace IW5
"shaded wireframe", "shaded wireframe",
"thermal", "thermal",
"debug bumpmap", "debug bumpmap",
"debug bumpmap instanced",
}; };
static_assert(std::extent_v<decltype(techniqueTypeNames)> == TECHNIQUE_COUNT); static_assert(std::extent_v<decltype(techniqueTypeNames)> == TECHNIQUE_COUNT);
static inline techset::CommonTechniqueTypeNames commonTechniqueTypeNames(techniqueTypeNames, std::extent_v<decltype(techniqueTypeNames)>); static inline techset::CommonTechniqueTypeNames commonTechniqueTypeNames(techniqueTypeNames, std::extent_v<decltype(techniqueTypeNames)>);

View File

@@ -1,6 +1,9 @@
#include "ObjCompilerIW5.h" #include "ObjCompilerIW5.h"
#include "Game/IW5/IW5.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 "Image/ImageIwdPostProcessor.h"
#include <memory> #include <memory>
@@ -13,7 +16,10 @@ namespace
{ {
auto& memory = zone.Memory(); 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, void ConfigurePostProcessors(AssetCreatorCollection& collection,
@@ -39,5 +45,6 @@ void ObjCompiler::ConfigureCreatorCollection(AssetCreatorCollection& collection,
IOutputPath& outDir, IOutputPath& outDir,
IOutputPath& cacheDir) const IOutputPath& cacheDir) const
{ {
ConfigureCompilers(collection, zone, searchPath);
ConfigurePostProcessors(collection, zone, zoneDefinition, searchPath, zoneStates, outDir); ConfigurePostProcessors(collection, zone, zoneDefinition, searchPath, zoneStates, outDir);
} }

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T5, T6) #options GAME(IW3, IW4, IW5, T5, T6)
#filename "Game/" + GAME + "/Techset/TechniqueCompiler" + GAME + ".cpp" #filename "Game/" + GAME + "/Techset/TechniqueCompiler" + GAME + ".cpp"
@@ -213,7 +213,7 @@ namespace
pass.customSamplerFlags = static_cast<decltype(MaterialPass::customSamplerFlags)>(commonPass.m_sampler_flags); pass.customSamplerFlags = static_cast<decltype(MaterialPass::customSamplerFlags)>(commonPass.m_sampler_flags);
} }
#ifdef FEATURE_IW4 #if defined(FEATURE_IW4) || defined(FEATURE_IW5)
// Not sure if this is actually how this is calculated. // Not sure if this is actually how this is calculated.
// It produces identical results at least though. // It produces identical results at least though.
constexpr MaterialConstantSource ALLOWED_PIXEL_CONSTANTS_FOR_FLAG_200[]{ constexpr MaterialConstantSource ALLOWED_PIXEL_CONSTANTS_FOR_FLAG_200[]{
@@ -282,7 +282,7 @@ namespace
#if defined(FEATURE_IW3) #if defined(FEATURE_IW3)
if (lowerTechniqueName == "zprepass") if (lowerTechniqueName == "zprepass")
technique.flags |= MTL_TECHFLAG_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... // Not a particularly cool way to do this but...
// the game actually does this :shrug: // the game actually does this :shrug:
if (lowerTechniqueName == "zprepass") if (lowerTechniqueName == "zprepass")

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T5, T6) #options GAME(IW3, IW4, IW5, T5, T6)
#filename "Game/" + GAME + "/Techset/TechniqueCompiler" + GAME + ".h" #filename "Game/" + GAME + "/Techset/TechniqueCompiler" + GAME + ".h"

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T5, T6) #options GAME(IW3, IW4, IW5, T5, T6)
#filename "Game/" + GAME + "/Techset/TechsetCompiler" + GAME + ".cpp" #filename "Game/" + GAME + "/Techset/TechsetCompiler" + GAME + ".cpp"

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T5, T6) #options GAME(IW3, IW4, IW5, T5, T6)
#filename "Game/" + GAME + "/Techset/TechsetCompiler" + GAME + ".h" #filename "Game/" + GAME + "/Techset/TechsetCompiler" + GAME + ".h"

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T5, T6) #options GAME(IW3, IW4, IW5, T5, T6)
#filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".cpp" #filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".cpp"

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T5, T6) #options GAME(IW3, IW4, IW5, T5, T6)
#filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".h" #filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".h"

View File

@@ -6,6 +6,8 @@
#include "Game/IW5/IW5.h" #include "Game/IW5/IW5.h"
#include "Game/IW5/Image/ImageLoaderEmbeddedIW5.h" #include "Game/IW5/Image/ImageLoaderEmbeddedIW5.h"
#include "Game/IW5/Image/ImageLoaderExternalIW5.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 "Game/IW5/XModel/LoaderXModelIW5.h"
#include "Leaderboard/LoaderLeaderboardIW5.h" #include "Leaderboard/LoaderLeaderboardIW5.h"
#include "Localize/LoaderLocalizeIW5.h" #include "Localize/LoaderLocalizeIW5.h"
@@ -129,9 +131,8 @@ namespace
// collection.AddAssetCreator(std::make_unique<AssetLoaderXModelSurfs>(memory)); // collection.AddAssetCreator(std::make_unique<AssetLoaderXModelSurfs>(memory));
collection.AddAssetCreator(xmodel::CreateLoaderIW5(memory, searchPath, zone)); collection.AddAssetCreator(xmodel::CreateLoaderIW5(memory, searchPath, zone));
collection.AddAssetCreator(material::CreateLoaderIW5(memory, searchPath)); collection.AddAssetCreator(material::CreateLoaderIW5(memory, searchPath));
// collection.AddAssetCreator(std::make_unique<AssetLoaderPixelShader>(memory)); collection.AddAssetCreator(techset::CreateVertexShaderLoaderIW5(memory, searchPath));
// collection.AddAssetCreator(std::make_unique<AssetLoaderVertexShader>(memory)); collection.AddAssetCreator(techset::CreatePixelShaderLoaderIW5(memory, searchPath));
// collection.AddAssetCreator(std::make_unique<AssetLoaderVertexDecl>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderTechniqueSet>(memory)); // collection.AddAssetCreator(std::make_unique<AssetLoaderTechniqueSet>(memory));
collection.AddAssetCreator(image::CreateLoaderEmbeddedIW5(memory, searchPath)); collection.AddAssetCreator(image::CreateLoaderEmbeddedIW5(memory, searchPath));
collection.AddAssetCreator(image::CreateLoaderExternalIW5(memory, searchPath)); collection.AddAssetCreator(image::CreateLoaderExternalIW5(memory, searchPath));

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T5, T6) #options GAME(IW3, IW4, IW5, T5, T6)
#filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".cpp" #filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".cpp"

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T5, T6) #options GAME(IW3, IW4, IW5, T5, T6)
#filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".h" #filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".h"

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T5, T6) #options GAME(IW3, IW4, IW5, T5, T6)
#filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".cpp" #filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".cpp"

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T5, T6) #options GAME(IW3, IW4, IW5, T5, T6)
#filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".h" #filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".h"