2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-12-27 20:41:49 +00:00

feat: add vertex declaration to t6 techset dumps

This commit is contained in:
Jan Laupetin
2025-11-15 18:57:39 +00:00
parent 9b526adaed
commit 930b116ac0
6 changed files with 309 additions and 60 deletions

View File

@@ -1,7 +1,7 @@
#pragma once
#include "Game/T6/CommonT6.h"
#include "Game/T6/T6.h"
#include "Techset/CommonTechnique.h"
namespace T6
{
@@ -45,57 +45,158 @@ namespace T6
};
static_assert(std::extent_v<decltype(techniqueTypeNames)> == TECHNIQUE_COUNT);
static const char* materialStreamDestinationNames[]{
"position", "normal", "color[0]", "color[1]", "depth", "texcoord[0]", "texcoord[1]",
"texcoord[2]", "texcoord[3]", "texcoord[4]", "texcoord[5]", "texcoord[6]", "texcoord[7]", "texcoord[8]",
"texcoord[9]", "texcoord[10]", "texcoord[11]", "texcoord[12]", "texcoord[13]", "blendWeight",
static techset::CommonStreamRoutingSourceInfo streamRoutingSources[]{
{
.name = "position",
.abbreviation = "p",
.optional = false,
},
{
.name = "color",
.abbreviation = "c",
.optional = false,
},
{
.name = "texcoord[0]",
.abbreviation = "t0",
.optional = false,
},
{
.name = "normal",
.abbreviation = "n",
.optional = false,
},
{
.name = "tangent",
.abbreviation = "t",
.optional = false,
},
{
.name = "texcoord[1]",
.abbreviation = "t1",
.optional = false,
},
{
.name = "texcoord[2]",
.abbreviation = "t2",
.optional = true,
},
{
.name = "texcoord[3]",
.abbreviation = "t3",
.optional = true,
},
{
.name = "normalTransform[0]",
.abbreviation = "n0",
.optional = true,
},
{
.name = "normalTransform[1]",
.abbreviation = "n1",
.optional = true,
},
{
.name = "blendWeight",
.abbreviation = "b",
.optional = true,
},
};
static_assert(std::extent_v<decltype(materialStreamDestinationNames)> == STREAM_DST_COUNT);
static_assert(std::extent_v<decltype(streamRoutingSources)> == STREAM_SRC_COUNT);
static const char* materialStreamDestinationAbbreviation[]{
"p", "n", "c0", "c1", "d", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "t10", "t11", "t12", "t13", "b",
static techset::CommonStreamRoutingDestinationInfo streamRoutingDestinations[]{
{
.name = "position",
.abbreviation = "p",
},
{
.name = "normal",
.abbreviation = "n",
},
{
.name = "color[0]",
.abbreviation = "c0",
},
{
.name = "color[1]",
.abbreviation = "c1",
},
{
.name = "depth",
.abbreviation = "d",
},
{
.name = "texcoord[0]",
.abbreviation = "t0",
},
{
.name = "texcoord[1]",
.abbreviation = "t1",
},
{
.name = "texcoord[2]",
.abbreviation = "t2",
},
{
.name = "texcoord[3]",
.abbreviation = "t3",
},
{
.name = "texcoord[4]",
.abbreviation = "t4",
},
{
.name = "texcoord[5]",
.abbreviation = "t5",
},
{
.name = "texcoord[6]",
.abbreviation = "t6",
},
{
.name = "texcoord[7]",
.abbreviation = "t7",
},
{
.name = "texcoord[8]",
.abbreviation = "t8",
},
{
.name = "texcoord[9]",
.abbreviation = "t9",
},
{
.name = "texcoord[10]",
.abbreviation = "t10",
},
{
.name = "texcoord[11]",
.abbreviation = "t11",
},
{
.name = "texcoord[12]",
.abbreviation = "t12",
},
{
.name = "texcoord[13]",
.abbreviation = "t13",
},
{
.name = "blendWeight",
.abbreviation = "b",
},
};
static_assert(std::extent_v<decltype(materialStreamDestinationAbbreviation)> == STREAM_DST_COUNT);
static const char* materialStreamSourceNames[]{
"position",
"color",
"texcoord[0]",
"normal",
"tangent",
"texcoord[1]",
"texcoord[2]",
"texcoord[3]",
"normalTransform[0]",
"normalTransform[1]",
"blendWeight",
};
static_assert(std::extent_v<decltype(materialStreamSourceNames)> == STREAM_SRC_COUNT);
static const char* materialStreamSourceAbbreviation[]{
"p",
"c",
"t0",
"n",
"t",
"t1",
"t2",
"t3",
"n0",
"n1",
"b",
};
static_assert(std::extent_v<decltype(materialStreamSourceAbbreviation)> == STREAM_SRC_COUNT);
static_assert(std::extent_v<decltype(streamRoutingDestinations)> == STREAM_DST_COUNT);
inline MaterialTypeInfo g_materialTypeInfo[]{
{"", "" },
{"m/", "m_" },
{"mc/", "mc_"},
{"?", "?" },
{"wc/", "wc_"},
{"?", "?" },
{"?", "?" },
{"?", "?" },
}; // TODO: Fill this
{"", "" },
{"m/", "m_" },
{"mc/", "mc_" },
{"mlv/", "mlv_"},
{"wc/", "wc_" },
{"wpc/", "wpc_"},
{"wq/", "wq_" },
{"wqc/", "wqc_"},
};
static_assert(std::extent_v<decltype(g_materialTypeInfo)> == MTL_TYPE_COUNT);
} // namespace T6

View File

@@ -0,0 +1,55 @@
#include "CommonTechnique.h"
namespace techset
{
CommonStreamRoutingInfos::CommonStreamRoutingInfos(const CommonStreamRoutingSourceInfo* sourceInfos,
const size_t sourceCount,
const CommonStreamRoutingDestinationInfo* destinationNames,
const size_t destinationCount)
: m_sources(sourceCount),
m_destinations(destinationCount)
{
std::copy(sourceInfos, &sourceInfos[sourceCount], m_sources.data());
std::copy(destinationNames, &destinationNames[destinationCount], m_destinations.data());
}
const char* CommonStreamRoutingInfos::GetSourceName(const CommonStreamSource source) const
{
if (source >= m_sources.size())
return nullptr;
return m_sources[source].name;
}
const char* CommonStreamRoutingInfos::GetSourceAbbreviation(const CommonStreamSource source) const
{
if (source >= m_sources.size())
return nullptr;
return m_sources[source].abbreviation;
}
bool CommonStreamRoutingInfos::IsSourceOptional(const CommonStreamSource source) const
{
if (source >= m_sources.size())
return false;
return m_sources[source].optional;
}
const char* CommonStreamRoutingInfos::GetDestinationName(const CommonStreamDestination destination) const
{
if (destination >= m_destinations.size())
return nullptr;
return m_destinations[destination].name;
}
const char* CommonStreamRoutingInfos::GetDestinationAbbreviation(const CommonStreamDestination destination) const
{
if (destination >= m_destinations.size())
return nullptr;
return m_destinations[destination].abbreviation;
}
} // namespace techset

View File

@@ -6,6 +6,54 @@
namespace techset
{
struct CommonStreamRoutingSourceInfo
{
const char* name;
const char* abbreviation;
bool optional;
};
struct CommonStreamRoutingDestinationInfo
{
const char* name;
const char* abbreviation;
};
typedef std::uint8_t CommonStreamSource;
typedef std::uint8_t CommonStreamDestination;
class CommonStreamRoutingInfos
{
public:
CommonStreamRoutingInfos(const CommonStreamRoutingSourceInfo* sourceInfos,
size_t sourceCount,
const CommonStreamRoutingDestinationInfo* destinationNames,
size_t destinationCount);
[[nodiscard]] const char* GetSourceName(CommonStreamSource source) const;
[[nodiscard]] const char* GetSourceAbbreviation(CommonStreamSource source) const;
[[nodiscard]] bool IsSourceOptional(CommonStreamSource source) const;
[[nodiscard]] const char* GetDestinationName(CommonStreamDestination destination) const;
[[nodiscard]] const char* GetDestinationAbbreviation(CommonStreamDestination destination) const;
private:
std::vector<CommonStreamRoutingSourceInfo> m_sources;
std::vector<CommonStreamRoutingDestinationInfo> m_destinations;
};
class CommonStreamRouting
{
public:
CommonStreamSource m_source;
CommonStreamDestination m_destination;
};
class CommonVertexDeclaration
{
public:
std::vector<CommonStreamRouting> m_routing;
};
class CommonTechniqueShader
{
public:
@@ -27,6 +75,7 @@ namespace techset
DxVersion m_dx_version;
CommonTechniqueShader m_vertex_shader;
CommonTechniqueShader m_pixel_shader;
CommonVertexDeclaration m_vertex_declaration;
};
class CommonTechnique