2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-03-16 01:43:04 +00:00

feat: t5 techset compiling

This commit is contained in:
Jan Laupetin
2026-03-14 23:23:30 +01:00
parent 04870e8fbf
commit e8b9ece6bd
12 changed files with 41 additions and 13 deletions

View File

@@ -1,6 +1,9 @@
#include "ObjCompilerT5.h" #include "ObjCompilerT5.h"
#include "Game/T5/T5.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 "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::CreateTechsetCompilerT5(memory, searchPath));
collection.AddSubAssetCreator(techset::CreateTechniqueCompilerT5(memory, zone, searchPath));
collection.AddSubAssetCreator(techset::CreateVertexDeclCompilerT5(memory));
} }
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, T6) #options GAME(IW3, IW4, T5, T6)
#filename "Game/" + GAME + "/Techset/TechniqueCompiler" + GAME + ".cpp" #filename "Game/" + GAME + "/Techset/TechniqueCompiler" + GAME + ".cpp"
@@ -297,6 +297,14 @@ namespace
if (ShouldApplyFlag200(technique)) if (ShouldApplyFlag200(technique))
technique.flags |= TECHNIQUE_FLAG_200; 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) #elif defined(FEATURE_T6)
// 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:
@@ -332,7 +340,7 @@ namespace
return technique; return technique;
} }
#if defined(FEATURE_T6) #if defined(FEATURE_T5) || defined(FEATURE_T6)
void ApplyTechFlagsFromMaterial(const Material& material, const Zone& zone) void ApplyTechFlagsFromMaterial(const Material& material, const Zone& zone)
{ {
if (!material.techniqueSet || !material.techniqueSet->name || !material.stateBitsTable) if (!material.techniqueSet || !material.techniqueSet->name || !material.stateBitsTable)
@@ -458,13 +466,15 @@ namespace
void FinalizeZone(AssetCreationContext& context) override void FinalizeZone(AssetCreationContext& context) override
{ {
#if defined(FEATURE_T6) #if defined(FEATURE_T5) || defined(FEATURE_T6)
const auto materials = m_zone.m_pools.PoolAssets<AssetMaterial>(); const auto materials = m_zone.m_pools.PoolAssets<AssetMaterial>();
for (auto* materialAsset : materials) for (auto* materialAsset : materials)
{ {
ApplyTechFlagsFromMaterial(*materialAsset->Asset(), m_zone); ApplyTechFlagsFromMaterial(*materialAsset->Asset(), m_zone);
} }
#endif
#if defined(FEATURE_T6)
const auto techniques = context.PoolSubAssets<SubAssetTechnique>(); const auto techniques = context.PoolSubAssets<SubAssetTechnique>();
for (auto* techniqueSubAsset : techniques) for (auto* techniqueSubAsset : techniques)
{ {

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T6) #options GAME(IW3, IW4, 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, T6) #options GAME(IW3, IW4, 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, T6) #options GAME(IW3, IW4, 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, T6) #options GAME(IW3, IW4, T5, T6)
#filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".cpp" #filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".cpp"
@@ -15,6 +15,7 @@
#define FEATURE_IW5 #define FEATURE_IW5
#elif GAME == "T5" #elif GAME == "T5"
#define FEATURE_T5 #define FEATURE_T5
#define IS_SUB_ASSET
#elif GAME == "T6" #elif GAME == "T6"
#define FEATURE_T6 #define FEATURE_T6
#define IS_SUB_ASSET #define IS_SUB_ASSET

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T6) #options GAME(IW3, IW4, T5, T6)
#filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".h" #filename "Game/" + GAME + "/Techset/VertexDeclCompiler" + GAME + ".h"
@@ -11,6 +11,7 @@
#define FEATURE_IW5 #define FEATURE_IW5
#elif GAME == "T5" #elif GAME == "T5"
#define FEATURE_T5 #define FEATURE_T5
#define IS_SUB_ASSET
#elif GAME == "T6" #elif GAME == "T6"
#define FEATURE_T6 #define FEATURE_T6
#define IS_SUB_ASSET #define IS_SUB_ASSET

View File

@@ -6,6 +6,8 @@
#include "Game/T5/Image/ImageLoaderEmbeddedT5.h" #include "Game/T5/Image/ImageLoaderEmbeddedT5.h"
#include "Game/T5/Image/ImageLoaderExternalT5.h" #include "Game/T5/Image/ImageLoaderExternalT5.h"
#include "Game/T5/T5.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 "Game/T5/XModel/LoaderXModelT5.h"
#include "Localize/LoaderLocalizeT5.h" #include "Localize/LoaderLocalizeT5.h"
#include "Material/LoaderMaterialT5.h" #include "Material/LoaderMaterialT5.h"
@@ -136,6 +138,9 @@ namespace
// collection.AddAssetCreator(std::make_unique<AssetLoaderDDL>(memory)); // collection.AddAssetCreator(std::make_unique<AssetLoaderDDL>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderGlasses>(memory)); // collection.AddAssetCreator(std::make_unique<AssetLoaderGlasses>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderEmblemSet>(memory)); // collection.AddAssetCreator(std::make_unique<AssetLoaderEmblemSet>(memory));
collection.AddSubAssetCreator(techset::CreateVertexShaderLoaderT5(memory, searchPath));
collection.AddSubAssetCreator(techset::CreatePixelShaderLoaderT5(memory, searchPath));
} }
} // namespace } // namespace

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T6) #options GAME(IW3, IW4, T5, T6)
#filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".cpp" #filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".cpp"
@@ -18,6 +18,7 @@
#elif GAME == "T5" #elif GAME == "T5"
#define FEATURE_T5 #define FEATURE_T5
#define IS_DX9 #define IS_DX9
#define IS_SUB_ASSET
#elif GAME == "T6" #elif GAME == "T6"
#define FEATURE_T6 #define FEATURE_T6
#define IS_DX11 #define IS_DX11

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T6) #options GAME(IW3, IW4, T5, T6)
#filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".h" #filename "Game/" + GAME + "/Techset/PixelShaderLoader" + GAME + ".h"
@@ -11,6 +11,7 @@
#define FEATURE_IW5 #define FEATURE_IW5
#elif GAME == "T5" #elif GAME == "T5"
#define FEATURE_T5 #define FEATURE_T5
#define IS_SUB_ASSET
#elif GAME == "T6" #elif GAME == "T6"
#define FEATURE_T6 #define FEATURE_T6
#define IS_SUB_ASSET #define IS_SUB_ASSET

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T6) #options GAME(IW3, IW4, T5, T6)
#filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".cpp" #filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".cpp"
@@ -18,6 +18,7 @@
#elif GAME == "T5" #elif GAME == "T5"
#define FEATURE_T5 #define FEATURE_T5
#define IS_DX9 #define IS_DX9
#define IS_SUB_ASSET
#elif GAME == "T6" #elif GAME == "T6"
#define FEATURE_T6 #define FEATURE_T6
#define IS_DX11 #define IS_DX11

View File

@@ -1,4 +1,4 @@
#options GAME(IW3, IW4, T6) #options GAME(IW3, IW4, T5, T6)
#filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".h" #filename "Game/" + GAME + "/Techset/VertexShaderLoader" + GAME + ".h"
@@ -11,6 +11,7 @@
#define FEATURE_IW5 #define FEATURE_IW5
#elif GAME == "T5" #elif GAME == "T5"
#define FEATURE_T5 #define FEATURE_T5
#define IS_SUB_ASSET
#elif GAME == "T6" #elif GAME == "T6"
#define FEATURE_T6 #define FEATURE_T6
#define IS_SUB_ASSET #define IS_SUB_ASSET