2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-01-24 08:53:04 +00:00
This commit is contained in:
Jan Laupetin
2026-01-23 21:55:27 +00:00
parent d4a95d046e
commit bc6d06640e
41 changed files with 336 additions and 224 deletions

View File

@@ -2,8 +2,8 @@
#include "Game/IW4/CommonIW4.h"
#include "Game/IW4/IW4.h"
#include "StateMap/StateMapLayout.h"
#include "Techset/CommonTechset.h"
#include "Techset/StateMap/StateMapLayout.h"
#include <type_traits>
#include <unordered_map>

View File

@@ -190,6 +190,11 @@ namespace T6
};
static_assert(std::extent_v<decltype(streamRoutingDestinations)> == STREAM_DST_COUNT);
static inline techset::CommonStreamRoutingInfos commonRoutingInfos(streamRoutingSources,
std::extent_v<decltype(streamRoutingSources)>,
streamRoutingDestinations,
std::extent_v<decltype(streamRoutingDestinations)>);
static inline techset::CommonCodeConstSourceInfo commonCodeConstSources[]{
{
.value = CONST_SRC_CODE_LIGHT_POSITION,
@@ -1790,6 +1795,10 @@ namespace T6
.updateFrequency = techset::CommonCodeSourceUpdateFrequency::RARELY,
},
};
static inline techset::CommonCodeSourceInfos commonCodeSourceInfos(commonCodeConstSources,
std::extent_v<decltype(commonCodeConstSources)>,
commonCodeSamplerSources,
std::extent_v<decltype(commonCodeSamplerSources)>);
static inline MaterialTypeInfo g_materialTypeInfo[]{
{"", "" },

View File

@@ -64,6 +64,11 @@ namespace techset
{
std::copy(sourceInfos, &sourceInfos[sourceCount], m_sources.data());
std::copy(destinationNames, &destinationNames[destinationCount], m_destinations.data());
for (size_t i = 0; i < sourceCount; i++)
m_source_lookup[sourceInfos[i].name] = static_cast<CommonStreamSource>(i);
for (size_t i = 0; i < destinationCount; i++)
m_destination_lookup[destinationNames[i].name] = static_cast<CommonStreamDestination>(i);
}
const char* CommonStreamRoutingInfos::GetSourceName(const CommonStreamSource source) const
@@ -105,4 +110,44 @@ namespace techset
return m_destinations[destination].abbreviation;
}
std::optional<CommonStreamSource> CommonStreamRoutingInfos::GetSourceByName(const std::string& name) const
{
const auto foundSource = m_source_lookup.find(name);
if (foundSource != m_source_lookup.end())
return foundSource->second;
return std::nullopt;
}
std::optional<CommonStreamDestination> CommonStreamRoutingInfos::GetDestinationByName(const std::string& name) const
{
const auto foundDestination = m_destination_lookup.find(name);
if (foundDestination != m_destination_lookup.end())
return foundDestination->second;
return std::nullopt;
}
CommonStreamRouting::CommonStreamRouting(const CommonStreamSource source, const CommonStreamDestination destination)
: m_source(source),
m_destination(destination)
{
}
CommonTechniqueShader::CommonTechniqueShader(std::string name)
: m_name(std::move(name))
{
}
CommonTechnique::CommonTechnique()
: m_flags(0)
{
}
CommonTechnique::CommonTechnique(std::string name)
: m_name(std::move(name)),
m_flags(0)
{
}
} // namespace techset

View File

@@ -4,6 +4,7 @@
#include <cstdint>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>
namespace techset
@@ -79,10 +80,14 @@ namespace techset
[[nodiscard]] bool IsSourceOptional(CommonStreamSource source) const;
[[nodiscard]] const char* GetDestinationName(CommonStreamDestination destination) const;
[[nodiscard]] const char* GetDestinationAbbreviation(CommonStreamDestination destination) const;
[[nodiscard]] std::optional<CommonStreamSource> GetSourceByName(const std::string& name) const;
[[nodiscard]] std::optional<CommonStreamDestination> GetDestinationByName(const std::string& name) const;
private:
std::vector<CommonStreamRoutingSourceInfo> m_sources;
std::vector<CommonStreamRoutingDestinationInfo> m_destinations;
std::unordered_map<std::string, CommonStreamSource> m_source_lookup;
std::unordered_map<std::string, CommonStreamDestination> m_destination_lookup;
};
union CommonShaderArgValue
@@ -132,6 +137,8 @@ namespace techset
class CommonShaderArg
{
public:
CommonShaderArg() = default;
CommonShaderArgType m_type;
CommonShaderArgDestination m_destination;
CommonShaderArgValue m_value;
@@ -140,6 +147,9 @@ namespace techset
class CommonStreamRouting
{
public:
CommonStreamRouting() = default;
CommonStreamRouting(CommonStreamSource source, CommonStreamDestination destination);
CommonStreamSource m_source;
CommonStreamDestination m_destination;
};
@@ -147,15 +157,26 @@ namespace techset
class CommonVertexDeclaration
{
public:
CommonVertexDeclaration() = default;
std::vector<CommonStreamRouting> m_routing;
};
class CommonTechniqueShaderBin
{
public:
const void* m_shader_bin;
size_t m_shader_bin_size;
};
class CommonTechniqueShader
{
public:
CommonTechniqueShader() = default;
explicit CommonTechniqueShader(std::string name);
std::string m_name;
const void* m_shader_bin;
size_t m_shader_bin_size;
std::optional<CommonTechniqueShaderBin> m_bin;
std::vector<CommonShaderArg> m_args;
};
@@ -168,7 +189,10 @@ namespace techset
class CommonPass
{
public:
CommonPass() = default;
uint32_t m_sampler_flags;
std::string m_state_map;
DxVersion m_dx_version;
CommonTechniqueShader m_vertex_shader;
CommonTechniqueShader m_pixel_shader;
@@ -178,6 +202,9 @@ namespace techset
class CommonTechnique
{
public:
CommonTechnique();
explicit CommonTechnique(std::string name);
std::string m_name;
uint64_t m_flags;
std::vector<CommonPass> m_passes;