mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-09-06 00:37:26 +00:00
feat: add templated iw4 material loading
This commit is contained in:
1383
src/ObjLoading/Game/IW4/Material/CompilingMaterialLoad.cpp
Normal file
1383
src/ObjLoading/Game/IW4/Material/CompilingMaterialLoad.cpp
Normal file
File diff suppressed because it is too large
Load Diff
12
src/ObjLoading/Game/IW4/Material/CompilingMaterialLoad.h
Normal file
12
src/ObjLoading/Game/IW4/Material/CompilingMaterialLoad.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "Asset/IAssetCreator.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "Gdt/IGdtQueryable.h"
|
||||
#include "SearchPath/ISearchPath.h"
|
||||
#include "Utils/MemoryManager.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetMaterial>> CreateCompilingMaterialLoader(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt);
|
||||
} // namespace IW4
|
File diff suppressed because it is too large
Load Diff
@@ -8,5 +8,5 @@
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
std::unique_ptr<AssetCreator<AssetMaterial>> CreateMaterialLoader(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt);
|
||||
std::unique_ptr<AssetCreator<AssetMaterial>> CreateMaterialLoader(MemoryManager& memory, ISearchPath& searchPath);
|
||||
} // namespace IW4
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include "Leaderboard/LoaderLeaderboardIW4.h"
|
||||
#include "LightDef/LoaderLightDefIW4.h"
|
||||
#include "Localize/LoaderLocalizeIW4.h"
|
||||
#include "Material/CompilingMaterialLoad.h"
|
||||
#include "Material/LoaderMaterialIW4.h"
|
||||
#include "Menu/LoaderMenuListIW4.h"
|
||||
#include "ObjLoading.h"
|
||||
@@ -126,7 +127,8 @@ namespace
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderXAnim>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderXModelSurfs>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderXModel>(memory));
|
||||
collection.AddAssetCreator(CreateMaterialLoader(memory, searchPath, gdt));
|
||||
collection.AddAssetCreator(CreateMaterialLoader(memory, searchPath));
|
||||
collection.AddAssetCreator(CreateCompilingMaterialLoader(memory, searchPath, gdt));
|
||||
collection.AddAssetCreator(CreatePixelShaderLoader(memory, searchPath));
|
||||
collection.AddAssetCreator(CreateVertexShaderLoader(memory, searchPath));
|
||||
collection.AddAssetCreator(CreateVertexDeclLoader(memory));
|
||||
|
@@ -1,8 +1,12 @@
|
||||
#options GAME (IW5, T6)
|
||||
#options GAME (IW4, IW5, T6)
|
||||
|
||||
#filename "Game/" + GAME + "/Material/JsonMaterialLoader" + GAME + ".cpp"
|
||||
|
||||
#if GAME == "IW5"
|
||||
#if GAME == "IW4"
|
||||
#define FEATURE_IW4
|
||||
#define HAS_WATER
|
||||
#define GAME_LOWER "iw4"
|
||||
#elif GAME == "IW5"
|
||||
#define FEATURE_IW5
|
||||
#define HAS_WATER
|
||||
#define GAME_LOWER "iw5"
|
||||
@@ -90,7 +94,7 @@ namespace
|
||||
std::cerr << std::format("Cannot load material \"{}\": {}\n", material.info.name, message);
|
||||
}
|
||||
|
||||
#ifdef FEATURE_IW5
|
||||
#if defined(FEATURE_IW4) || defined(FEATURE_IW5)
|
||||
static bool CreateGameFlagsFromJson(const JsonMaterial& jMaterial, unsigned char& gameFlags)
|
||||
#elif defined(FEATURE_T6)
|
||||
static bool CreateGameFlagsFromJson(const JsonMaterial& jMaterial, unsigned& gameFlags)
|
||||
@@ -300,7 +304,7 @@ namespace
|
||||
structured.alphaTestDisabled = 0;
|
||||
structured.alphaTest = GFXS_ALPHA_TEST_GT_0;
|
||||
}
|
||||
#ifdef FEATURE_IW5
|
||||
#if defined(FEATURE_IW4) || defined(FEATURE_IW5)
|
||||
else if (jStateBitsTableEntry.alphaTest == JsonAlphaTest::LT128)
|
||||
{
|
||||
structured.alphaTestDisabled = 0;
|
||||
@@ -335,7 +339,7 @@ namespace
|
||||
structured.blendOpAlpha = jStateBitsTableEntry.blendOpAlpha;
|
||||
structured.colorWriteRgb = jStateBitsTableEntry.colorWriteRgb;
|
||||
structured.colorWriteAlpha = jStateBitsTableEntry.colorWriteAlpha;
|
||||
#ifdef FEATURE_IW5
|
||||
#if defined(FEATURE_IW4) || defined(FEATURE_IW5)
|
||||
structured.gammaWrite = jStateBitsTableEntry.gammaWrite;
|
||||
#endif
|
||||
structured.polymodeLine = jStateBitsTableEntry.polymodeLine;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#options GAME (IW5, T6)
|
||||
#options GAME (IW4, IW5, T6)
|
||||
|
||||
#filename "Game/" + GAME + "/Material/JsonMaterialLoader" + GAME + ".h"
|
||||
|
||||
|
Reference in New Issue
Block a user