mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
Skeleton for IW4 MaterialTechnique dumping
This commit is contained in:
parent
25244bc3b0
commit
8e76f05d05
@ -837,6 +837,42 @@ namespace IW4
|
|||||||
uint16_t loadForRenderer;
|
uint16_t loadForRenderer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum MaterialStreamStreamSource_e
|
||||||
|
{
|
||||||
|
STREAM_SRC_POSITION = 0x0,
|
||||||
|
STREAM_SRC_COLOR = 0x1,
|
||||||
|
STREAM_SRC_TEXCOORD_0 = 0x2,
|
||||||
|
STREAM_SRC_NORMAL = 0x3,
|
||||||
|
STREAM_SRC_TANGENT = 0x4,
|
||||||
|
STREAM_SRC_OPTIONAL_BEGIN = 0x5,
|
||||||
|
STREAM_SRC_PRE_OPTIONAL_BEGIN = 0x4,
|
||||||
|
STREAM_SRC_TEXCOORD_1 = 0x5,
|
||||||
|
STREAM_SRC_TEXCOORD_2 = 0x6,
|
||||||
|
STREAM_SRC_NORMAL_TRANSFORM_0 = 0x7,
|
||||||
|
STREAM_SRC_NORMAL_TRANSFORM_1 = 0x8,
|
||||||
|
|
||||||
|
STREAM_SRC_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum MaterialStreamDestination_e
|
||||||
|
{
|
||||||
|
STREAM_DST_POSITION = 0x0,
|
||||||
|
STREAM_DST_NORMAL = 0x1,
|
||||||
|
STREAM_DST_COLOR_0 = 0x2,
|
||||||
|
STREAM_DST_COLOR_1 = 0x3,
|
||||||
|
STREAM_DST_DEPTH = 0x4,
|
||||||
|
STREAM_DST_TEXCOORD_0 = 0x5,
|
||||||
|
STREAM_DST_TEXCOORD_1 = 0x6,
|
||||||
|
STREAM_DST_TEXCOORD_2 = 0x7,
|
||||||
|
STREAM_DST_TEXCOORD_3 = 0x8,
|
||||||
|
STREAM_DST_TEXCOORD_4 = 0x9,
|
||||||
|
STREAM_DST_TEXCOORD_5 = 0xA,
|
||||||
|
STREAM_DST_TEXCOORD_6 = 0xB,
|
||||||
|
STREAM_DST_TEXCOORD_7 = 0xC,
|
||||||
|
|
||||||
|
STREAM_DST_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
struct MaterialStreamRouting
|
struct MaterialStreamRouting
|
||||||
{
|
{
|
||||||
char source;
|
char source;
|
||||||
|
@ -28,6 +28,72 @@ namespace IW4
|
|||||||
|
|
||||||
class TechniqueFileWriter : public AbstractTextDumper
|
class TechniqueFileWriter : public AbstractTextDumper
|
||||||
{
|
{
|
||||||
|
void DumpStateMap() const
|
||||||
|
{
|
||||||
|
Indent();
|
||||||
|
// TODO: Actual statemap: Maybe find all materials using this techset and try to make out rules for the flags based on the statebitstable
|
||||||
|
m_stream << "stateMap \"\"; // TODO\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void DumpVertexShader(const MaterialPass& pass)
|
||||||
|
{
|
||||||
|
if (pass.vertexShader == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_stream << "\n";
|
||||||
|
Indent();
|
||||||
|
// TODO: Actually find out which version this shader uses
|
||||||
|
m_stream << "vertexShader 1.0 \"" << pass.vertexShader->name << "\"\n";
|
||||||
|
Indent();
|
||||||
|
m_stream << "{\n";
|
||||||
|
IncIndent();
|
||||||
|
|
||||||
|
// TODO: Dump vertex shader args
|
||||||
|
|
||||||
|
DecIndent();
|
||||||
|
Indent();
|
||||||
|
m_stream << "}\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void DumpPixelShader(const MaterialPass& pass)
|
||||||
|
{
|
||||||
|
if (pass.pixelShader == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_stream << "\n";
|
||||||
|
Indent();
|
||||||
|
// TODO: Actually find out which version this shader uses
|
||||||
|
m_stream << "pixelShader 1.0 \"" << pass.pixelShader->name << "\"\n";
|
||||||
|
Indent();
|
||||||
|
m_stream << "{\n";
|
||||||
|
IncIndent();
|
||||||
|
|
||||||
|
// TODO: Dump pixel shader args
|
||||||
|
|
||||||
|
DecIndent();
|
||||||
|
Indent();
|
||||||
|
m_stream << "}\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void DumpVertexDecl(const MaterialPass& pass)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void DumpPass(const MaterialPass& pass)
|
||||||
|
{
|
||||||
|
m_stream << "{\n";
|
||||||
|
IncIndent();
|
||||||
|
|
||||||
|
DumpStateMap();
|
||||||
|
DumpVertexShader(pass);
|
||||||
|
DumpPixelShader(pass);
|
||||||
|
DumpVertexDecl(pass);
|
||||||
|
|
||||||
|
DecIndent();
|
||||||
|
m_stream << "}\n";
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TechniqueFileWriter(std::ostream& stream)
|
explicit TechniqueFileWriter(std::ostream& stream)
|
||||||
: AbstractTextDumper(stream)
|
: AbstractTextDumper(stream)
|
||||||
@ -36,7 +102,8 @@ namespace IW4
|
|||||||
|
|
||||||
void DumpTechnique(const MaterialTechnique* technique)
|
void DumpTechnique(const MaterialTechnique* technique)
|
||||||
{
|
{
|
||||||
m_stream << "technique lol";
|
for (auto i = 0u; i < technique->passCount; i++)
|
||||||
|
DumpPass(technique->passArray[i]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user