2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-03-15 17:33:03 +00:00

feat: add techset compiling for IW3

This commit is contained in:
Jan Laupetin
2026-03-14 20:46:58 +01:00
parent 5993c88897
commit daa891a922
14 changed files with 45 additions and 20 deletions

View File

@@ -1240,7 +1240,7 @@ namespace IW3
struct MaterialVertexDeclaration
{
char streamCount;
unsigned char streamCount;
bool hasOptionalSource;
bool isLoaded;
MaterialVertexStreamRouting routing;

View File

@@ -738,11 +738,13 @@ namespace IW3
.value = TEXTURE_SRC_CODE_RESOLVED_POST_SUN,
.accessor = "resolvedPostSun",
.updateFrequency = techset::CommonCodeSourceUpdateFrequency::RARELY,
.techFlags = MTL_TECHFLAG_NEEDS_RESOLVED_POST_SUN,
},
{
.value = TEXTURE_SRC_CODE_RESOLVED_SCENE,
.accessor = "resolvedScene",
.updateFrequency = techset::CommonCodeSourceUpdateFrequency::RARELY,
.techFlags = MTL_TECHFLAG_NEEDS_RESOLVED_SCENE,
},
{
.value = TEXTURE_SRC_CODE_POST_EFFECT_0,

View File

@@ -1,6 +1,9 @@
#include "ObjCompilerIW3.h"
#include "Game/IW3/IW3.h"
#include "Game/IW3/Techset/TechniqueCompilerIW3.h"
#include "Game/IW3/Techset/TechsetCompilerIW3.h"
#include "Game/IW3/Techset/VertexDeclCompilerIW3.h"
#include "Image/ImageIwdPostProcessor.h"
#include <memory>
@@ -13,7 +16,10 @@ namespace
{
auto& memory = zone.Memory();
// No compilers yet
collection.AddAssetCreator(techset::CreateTechsetCompilerIW3(memory, searchPath));
collection.AddSubAssetCreator(techset::CreateTechniqueCompilerIW3(memory, zone, searchPath));
collection.AddSubAssetCreator(techset::CreateVertexDeclCompilerIW3(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);
}

View File

@@ -1,4 +1,4 @@
#options GAME(IW4, T6)
#options GAME(IW3, IW4, T6)
#filename "Game/" + GAME + "/Techset/TechniqueCompiler" + GAME + ".cpp"
@@ -9,6 +9,7 @@
#if GAME == "IW3"
#define FEATURE_IW3
#define IS_DX9
#define SHADERS_ARE_SUBASSETS
#elif GAME == "IW4"
#define FEATURE_IW4
#define IS_DX9
@@ -278,7 +279,10 @@ namespace
std::string lowerTechniqueName(commonTechnique.m_name);
utils::MakeStringLowerCase(lowerTechniqueName);
#if defined(FEATURE_IW4)
#if defined(FEATURE_IW3)
if (lowerTechniqueName == "zprepass")
technique.flags |= MTL_TECHFLAG_ZPREPASS;
#elif defined(FEATURE_IW4)
// Not a particularly cool way to do this but...
// the game actually does this :shrug:
if (lowerTechniqueName == "zprepass")
@@ -290,7 +294,7 @@ namespace
if (technique.flags & MTL_TECHFLAG_USES_FLOATZ && lowerTechniqueName.starts_with("distortion_"))
technique.flags = (technique.flags & ~MTL_TECHFLAG_USES_FLOATZ) | MTL_TECHFLAG_USES_DISTORTION_FLOATZ;
if (ShouldApplyFlag200(technique))
technique.flags |= TECHNIQUE_FLAG_200;
#elif defined(FEATURE_T6)
@@ -454,9 +458,7 @@ namespace
void FinalizeZone(AssetCreationContext& context) override
{
#if defined(FEATURE_IW4)
// TODO
#elif defined(FEATURE_T6)
#if defined(FEATURE_T6)
const auto materials = m_zone.m_pools.PoolAssets<AssetMaterial>();
for (auto* materialAsset : materials)
{

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
#options GAME(IW4, T6)
#options GAME(IW3, IW4, T6)
#filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".cpp"
@@ -8,6 +8,7 @@
#if GAME == "IW3"
#define FEATURE_IW3
#define IS_SUB_ASSET
#elif GAME == "IW4"
#define FEATURE_IW4
#elif GAME == "IW5"

View File

@@ -1,9 +1,10 @@
#options GAME(IW4, T6)
#options GAME(IW3, IW4, T6)
#filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".h"
#if GAME == "IW3"
#define FEATURE_IW3
#define IS_SUB_ASSET
#elif GAME == "IW4"
#define FEATURE_IW4
#elif GAME == "IW5"
@@ -12,6 +13,7 @@
#define FEATURE_T5
#elif GAME == "T6"
#define FEATURE_T6
#define IS_SUB_ASSET
#endif
// This file was templated.
@@ -27,7 +29,7 @@
#set CREATE_COMPILER_METHOD "CreateVertexDeclCompiler" + GAME
#if defined(FEATURE_T6)
#if defined(IS_SUB_ASSET)
#define INTERFACE_NAME ISubAssetCreator
#else
#define INTERFACE_NAME IAssetCreator

View File

@@ -6,6 +6,8 @@
#include "Game/IW3/IW3.h"
#include "Game/IW3/Image/ImageLoaderEmbeddedIW3.h"
#include "Game/IW3/Image/ImageLoaderExternalIW3.h"
#include "Game/IW3/Techset/PixelShaderLoaderIW3.h"
#include "Game/IW3/Techset/VertexShaderLoaderIW3.h"
#include "Game/IW3/XModel/LoaderXModelIW3.h"
#include "Localize/AssetLoaderLocalizeIW3.h"
#include "Material/LoaderMaterialIW3.h"
@@ -118,6 +120,9 @@ namespace
// collection.AddAssetCreator(std::make_unique<AssetLoaderImpactFx>(memory));
collection.AddAssetCreator(raw_file::CreateLoaderIW3(memory, searchPath));
collection.AddAssetCreator(string_table::CreateLoaderIW3(memory, searchPath));
collection.AddSubAssetCreator(techset::CreateVertexShaderLoaderIW3(memory, searchPath));
collection.AddSubAssetCreator(techset::CreatePixelShaderLoaderIW3(memory, searchPath));
}
} // namespace

View File

@@ -1,4 +1,4 @@
#options GAME(IW4, T6)
#options GAME(IW3, IW4, T6)
#filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".cpp"
@@ -8,6 +8,7 @@
#if GAME == "IW3"
#define FEATURE_IW3
#define IS_DX9
#define IS_SUB_ASSET
#elif GAME == "IW4"
#define FEATURE_IW4
#define IS_DX9

View File

@@ -1,9 +1,10 @@
#options GAME(IW4, T6)
#options GAME(IW3, IW4, T6)
#filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".h"
#if GAME == "IW3"
#define FEATURE_IW3
#define IS_SUB_ASSET
#elif GAME == "IW4"
#define FEATURE_IW4
#elif GAME == "IW5"
@@ -12,6 +13,7 @@
#define FEATURE_T5
#elif GAME == "T6"
#define FEATURE_T6
#define IS_SUB_ASSET
#endif
// This file was templated.
@@ -28,7 +30,7 @@
#set CREATE_LOADER_METHOD "CreatePixelShaderLoader" + GAME
#if defined(FEATURE_T6)
#if defined(IS_SUB_ASSET)
#define INTERFACE_NAME ISubAssetCreator
#else
#define INTERFACE_NAME IAssetCreator

View File

@@ -1,4 +1,4 @@
#options GAME(IW4, T6)
#options GAME(IW3, IW4, T6)
#filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".cpp"
@@ -8,6 +8,7 @@
#if GAME == "IW3"
#define FEATURE_IW3
#define IS_DX9
#define IS_SUB_ASSET
#elif GAME == "IW4"
#define FEATURE_IW4
#define IS_DX9

View File

@@ -1,9 +1,10 @@
#options GAME(IW4, T6)
#options GAME(IW3, IW4, T6)
#filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".h"
#if GAME == "IW3"
#define FEATURE_IW3
#define IS_SUB_ASSET
#elif GAME == "IW4"
#define FEATURE_IW4
#elif GAME == "IW5"
@@ -12,6 +13,7 @@
#define FEATURE_T5
#elif GAME == "T6"
#define FEATURE_T6
#define IS_SUB_ASSET
#endif
// This file was templated.
@@ -28,7 +30,7 @@
#set CREATE_LOADER_METHOD "CreateVertexShaderLoader" + GAME
#if defined(FEATURE_T6)
#if defined(IS_SUB_ASSET)
#define INTERFACE_NAME ISubAssetCreator
#else
#define INTERFACE_NAME IAssetCreator