mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
Dump IW4 techset files
This commit is contained in:
parent
66b62611f3
commit
25244bc3b0
62
src/ObjCommon/Game/IW4/TechsetConstantsIW4.h
Normal file
62
src/ObjCommon/Game/IW4/TechsetConstantsIW4.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "Game/IW4/IW4.h"
|
||||||
|
|
||||||
|
namespace IW4
|
||||||
|
{
|
||||||
|
inline const char* techniqueTypeNames[]
|
||||||
|
{
|
||||||
|
"depth prepass",
|
||||||
|
"build floatz",
|
||||||
|
"build shadowmap depth",
|
||||||
|
"build shadowmap color",
|
||||||
|
"unlit",
|
||||||
|
"emissive",
|
||||||
|
"emissive dfog",
|
||||||
|
"emissive shadow",
|
||||||
|
"emissive shadow dfog",
|
||||||
|
"lit",
|
||||||
|
"lit dfog",
|
||||||
|
"lit sun",
|
||||||
|
"lit sun dfog",
|
||||||
|
"lit sun shadow",
|
||||||
|
"lit sun shadow dfog",
|
||||||
|
"lit spot",
|
||||||
|
"lit spot dfog",
|
||||||
|
"lit spot shadow",
|
||||||
|
"lit spot shadow dfog",
|
||||||
|
"lit omni",
|
||||||
|
"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 omni",
|
||||||
|
"lit instanced omni dfog",
|
||||||
|
"lit instanced omni shadow",
|
||||||
|
"lit instanced omni shadow dfog",
|
||||||
|
"light spot",
|
||||||
|
"light omni",
|
||||||
|
"light spot shadow",
|
||||||
|
"fakelight normal",
|
||||||
|
"fakelight view",
|
||||||
|
"sunlight preview",
|
||||||
|
"case texture",
|
||||||
|
"solid wireframe",
|
||||||
|
"shaded wireframe",
|
||||||
|
"debug bumpmap",
|
||||||
|
"debug bumpmap instanced",
|
||||||
|
};
|
||||||
|
|
||||||
|
static_assert(std::extent_v<decltype(techniqueTypeNames)> == TECHNIQUE_COUNT);
|
||||||
|
}
|
@ -1,8 +1,11 @@
|
|||||||
#include "AssetDumperTechniqueSet.h"
|
#include "AssetDumperTechniqueSet.h"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#include "Dumping/AbstractTextDumper.h"
|
#include "Dumping/AbstractTextDumper.h"
|
||||||
|
#include "Game/IW4/TechsetConstantsIW4.h"
|
||||||
|
|
||||||
using namespace IW4;
|
using namespace IW4;
|
||||||
|
|
||||||
@ -39,15 +42,61 @@ namespace IW4
|
|||||||
|
|
||||||
class TechsetFileWriter : public AbstractTextDumper
|
class TechsetFileWriter : public AbstractTextDumper
|
||||||
{
|
{
|
||||||
|
bool m_last_write_was_value;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TechsetFileWriter(std::ostream& stream)
|
explicit TechsetFileWriter(std::ostream& stream)
|
||||||
: AbstractTextDumper(stream)
|
: AbstractTextDumper(stream),
|
||||||
|
m_last_write_was_value(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WriteTechniqueType(const size_t techniqueIndex)
|
||||||
|
{
|
||||||
|
assert(techniqueIndex < std::extent_v<decltype(techniqueTypeNames)>);
|
||||||
|
|
||||||
|
if(m_last_write_was_value)
|
||||||
|
{
|
||||||
|
m_stream << "\n";
|
||||||
|
m_last_write_was_value = false;
|
||||||
|
}
|
||||||
|
m_stream << '"' << techniqueTypeNames[techniqueIndex] << "\":\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void WriteTechniqueValue(const char* value)
|
||||||
|
{
|
||||||
|
m_last_write_was_value = true;
|
||||||
|
|
||||||
|
IncIndent();
|
||||||
|
Indent();
|
||||||
|
m_stream << value << ";\n";
|
||||||
|
DecIndent();
|
||||||
|
}
|
||||||
|
|
||||||
void DumpTechset(const MaterialTechniqueSet* techset)
|
void DumpTechset(const MaterialTechniqueSet* techset)
|
||||||
{
|
{
|
||||||
m_stream << "techset lol";
|
std::vector<bool> dumpedTechniques(std::extent_v<decltype(MaterialTechniqueSet::techniques)>);
|
||||||
|
|
||||||
|
for(auto techniqueIndex = 0u; techniqueIndex < std::extent_v<decltype(MaterialTechniqueSet::techniques)>; techniqueIndex++)
|
||||||
|
{
|
||||||
|
const auto* technique = techset->techniques[techniqueIndex];
|
||||||
|
if(technique == nullptr || dumpedTechniques[techniqueIndex])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
dumpedTechniques[techniqueIndex] = true;
|
||||||
|
WriteTechniqueType(techniqueIndex);
|
||||||
|
|
||||||
|
for(auto nextTechniqueIndex = techniqueIndex + 1; nextTechniqueIndex < std::extent_v<decltype(MaterialTechniqueSet::techniques)>; nextTechniqueIndex++)
|
||||||
|
{
|
||||||
|
if(techset->techniques[nextTechniqueIndex] != technique)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
dumpedTechniques[nextTechniqueIndex] = true;
|
||||||
|
WriteTechniqueType(nextTechniqueIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteTechniqueValue(technique->name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user