mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-02-14 03:13:03 +00:00
chore: use CommonTechset instead of TechsetDefinition
This commit is contained in:
@@ -7,11 +7,11 @@
|
||||
#include "Shader/D3D9ShaderAnalyser.h"
|
||||
#include "Shader/ShaderCommon.h"
|
||||
#include "StateMap/StateMapReader.h"
|
||||
#include "Techset/CommonTechsetCache.h"
|
||||
#include "Techset/CommonTechsetLoader.h"
|
||||
#include "Techset/TechniqueFileReader.h"
|
||||
#include "Techset/TechniqueStateMapCache.h"
|
||||
#include "Techset/TechsetCommon.h"
|
||||
#include "Techset/TechsetDefinitionCache.h"
|
||||
#include "Techset/TechsetFileReader.h"
|
||||
#include "Utils/Alignment.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
@@ -1284,7 +1284,7 @@ namespace
|
||||
}
|
||||
|
||||
private:
|
||||
AssetCreationResult CreateTechsetFromDefinition(const std::string& assetName, const TechsetDefinition& definition, AssetCreationContext& context)
|
||||
AssetCreationResult CreateTechsetFromDefinition(const std::string& assetName, const CommonTechset& definition, AssetCreationContext& context)
|
||||
{
|
||||
auto* techset = m_memory.Alloc<MaterialTechniqueSet>();
|
||||
techset->name = m_memory.Dup(assetName.c_str());
|
||||
@@ -1294,8 +1294,8 @@ namespace
|
||||
const TechniqueLoader techniqueLoader(m_search_path, m_memory, context, this);
|
||||
for (auto i = 0u; i < std::extent_v<decltype(MaterialTechniqueSet::techniques)>; i++)
|
||||
{
|
||||
std::string techniqueName;
|
||||
if (definition.GetTechniqueByIndex(i, techniqueName))
|
||||
const auto& techniqueName = definition.m_technique_names[i];
|
||||
if (!techniqueName.empty())
|
||||
{
|
||||
auto* technique = techniqueLoader.LoadMaterialTechnique(techniqueName);
|
||||
|
||||
@@ -1312,10 +1312,10 @@ namespace
|
||||
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
|
||||
}
|
||||
|
||||
TechsetDefinition* LoadTechsetDefinition(const std::string& assetName, AssetCreationContext& context, bool& failure) override
|
||||
CommonTechset* LoadTechsetDefinition(const std::string& assetName, AssetCreationContext& context, bool& failure) override
|
||||
{
|
||||
failure = false;
|
||||
auto& definitionCache = context.GetZoneAssetCreationState<TechsetDefinitionCache>();
|
||||
auto& definitionCache = context.GetZoneAssetCreationState<CommonTechsetCache>();
|
||||
auto* cachedTechsetDefinition = definitionCache.GetCachedTechsetDefinition(assetName);
|
||||
if (cachedTechsetDefinition)
|
||||
return cachedTechsetDefinition;
|
||||
@@ -1325,17 +1325,13 @@ namespace
|
||||
if (!file.IsOpen())
|
||||
return nullptr;
|
||||
|
||||
const TechsetFileReader reader(*file.m_stream, techsetFileName, techniqueTypeNames, std::extent_v<decltype(techniqueTypeNames)>);
|
||||
auto techsetDefinition = reader.ReadTechsetDefinition();
|
||||
auto techsetDefinition = LoadCommonTechset(assetName, commonTechniqueTypeNames, m_search_path, failure);
|
||||
if (!techsetDefinition)
|
||||
{
|
||||
failure = true;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto* techsetDefinitionPtr = techsetDefinition.get();
|
||||
|
||||
definitionCache.AddTechsetDefinitionToCache(assetName, std::move(techsetDefinition));
|
||||
definitionCache.AddCommonTechsetToCache(assetName, std::move(techsetDefinition));
|
||||
|
||||
return techsetDefinitionPtr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user