2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-24 21:52:06 +00:00

refactor: do not nest asset namespaces in game namespaces

* Duplicated namespace names are kind of annoying
This commit is contained in:
Jan Laupetin
2025-08-06 00:50:35 +02:00
parent 33c09dfe61
commit 46fb919a52
336 changed files with 1430 additions and 1480 deletions

View File

@@ -48,7 +48,7 @@ namespace
m_registration(registration),
m_state_map_cache(context.GetZoneAssetCreationState<::techset::TechniqueStateMapCache>()),
m_base_state_bits{},
m_techset_creator(IW4::techset::CreateLoader(memory, searchPath))
m_techset_creator(techset::CreateLoaderIW4(memory, searchPath))
{
}
@@ -1325,7 +1325,7 @@ namespace
std::vector<MaterialTextureDef> m_textures;
std::vector<MaterialConstantDef> m_constants;
std::unique_ptr<::IW4::techset::ICreator> m_techset_creator;
std::unique_ptr<techset::ICreatorIW4> m_techset_creator;
};
class MaterialLoader final : public AssetCreator<AssetMaterial>
@@ -1375,10 +1375,10 @@ namespace
};
} // namespace
namespace IW4::material
namespace material
{
std::unique_ptr<AssetCreator<AssetMaterial>> CreateCompiler(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt)
std::unique_ptr<AssetCreator<AssetMaterial>> CreateCompilerIW4(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt)
{
return std::make_unique<MaterialLoader>(memory, searchPath, gdt);
}
} // namespace IW4::material
} // namespace material

View File

@@ -6,7 +6,7 @@
#include "SearchPath/ISearchPath.h"
#include "Utils/MemoryManager.h"
namespace IW4::material
namespace material
{
std::unique_ptr<AssetCreator<AssetMaterial>> CreateCompiler(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt);
} // namespace IW4::material
std::unique_ptr<AssetCreator<IW4::AssetMaterial>> CreateCompilerIW4(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt);
} // namespace material

View File

@@ -17,10 +17,10 @@ namespace
auto& memory = zone.Memory();
#ifdef EXPERIMENTAL_MATERIAL_COMPILATION
collection.AddAssetCreator(material::CreateCompiler(memory, searchPath, gdt));
collection.AddAssetCreator(IW4::techset::CreateLoader(memory, searchPath));
collection.AddAssetCreator(material::CreateCompilerIW4(memory, searchPath, gdt));
collection.AddAssetCreator(techset::CreateLoaderIW4(memory, searchPath));
#endif
collection.AddAssetCreator(vertex_decl::CreateLoader(memory));
collection.AddAssetCreator(vertex_decl::CreateLoaderIW4(memory));
}
void ConfigurePostProcessors(AssetCreatorCollection& collection,

View File

@@ -203,7 +203,7 @@ namespace
ISearchPath& searchPath,
MemoryManager& memory,
AssetCreationContext& context,
IW4::techset::ICreator* techsetCreator)
techset::ICreatorIW4* techsetCreator)
: m_technique_name(techniqueName),
m_search_path(searchPath),
m_memory(memory),
@@ -1026,13 +1026,13 @@ namespace
TechniqueZoneLoadingState& m_zone_state;
TechniqueStateMapCache& m_state_map_cache;
ShaderInfoFromFileSystemCacheState& m_shader_info_cache;
IW4::techset::ICreator* m_techset_creator;
techset::ICreatorIW4* m_techset_creator;
};
class TechniqueLoader
{
public:
TechniqueLoader(ISearchPath& searchPath, MemoryManager& memory, AssetCreationContext& context, IW4::techset::ICreator* techsetCreator)
TechniqueLoader(ISearchPath& searchPath, MemoryManager& memory, AssetCreationContext& context, techset::ICreatorIW4* techsetCreator)
: m_search_path(searchPath),
m_memory(memory),
m_context(context),
@@ -1260,10 +1260,10 @@ namespace
MemoryManager& m_memory;
AssetCreationContext& m_context;
TechniqueZoneLoadingState& m_zone_state;
IW4::techset::ICreator* m_techset_creator;
techset::ICreatorIW4* m_techset_creator;
};
class TechsetLoader final : public IW4::techset::ICreator
class TechsetLoader final : public techset::ICreatorIW4
{
public:
TechsetLoader(MemoryManager& memory, ISearchPath& searchPath)
@@ -1369,10 +1369,10 @@ namespace
};
} // namespace
namespace IW4::techset
namespace techset
{
std::unique_ptr<ICreator> CreateLoader(MemoryManager& memory, ISearchPath& searchPath)
std::unique_ptr<ICreatorIW4> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath)
{
return std::make_unique<TechsetLoader>(memory, searchPath);
}
} // namespace IW4::techset
} // namespace techset

View File

@@ -10,17 +10,17 @@
#include <memory>
#include <string>
namespace IW4::techset
namespace techset
{
class ICreator : public AssetCreator<AssetTechniqueSet>
class ICreatorIW4 : public AssetCreator<IW4::AssetTechniqueSet>
{
public:
ICreator() = default;
virtual ~ICreator() = default;
ICreatorIW4() = default;
virtual ~ICreatorIW4() = default;
virtual ::techset::TechsetDefinition* LoadTechsetDefinition(const std::string& assetName, AssetCreationContext& context, bool& failure) = 0;
virtual TechsetDefinition* LoadTechsetDefinition(const std::string& assetName, AssetCreationContext& context, bool& failure) = 0;
virtual const state_map::StateMapDefinition* LoadStateMapDefinition(const std::string& stateMapName, AssetCreationContext& context) = 0;
};
std::unique_ptr<ICreator> CreateLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace IW4::techset
std::unique_ptr<ICreatorIW4> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath);
} // namespace techset

View File

@@ -92,10 +92,10 @@ namespace
};
} // namespace
namespace IW4::vertex_decl
namespace vertex_decl
{
std::unique_ptr<AssetCreator<AssetVertexDecl>> CreateLoader(MemoryManager& memory)
std::unique_ptr<AssetCreator<AssetVertexDecl>> CreateLoaderIW4(MemoryManager& memory)
{
return std::make_unique<LoaderVertexDecl>(memory);
}
} // namespace IW4::vertex_decl
} // namespace vertex_decl

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace IW4::vertex_decl
namespace vertex_decl
{
std::unique_ptr<AssetCreator<AssetVertexDecl>> CreateLoader(MemoryManager& memory);
} // namespace IW4::vertex_decl
std::unique_ptr<AssetCreator<IW4::AssetVertexDecl>> CreateLoaderIW4(MemoryManager& memory);
} // namespace vertex_decl

View File

@@ -71,11 +71,11 @@ namespace
};
} // namespace
namespace T6::key_value_pairs
namespace key_value_pairs
{
std::unique_ptr<IAssetCreator>
CreateCompiler(MemoryManager& memory, const Zone& zone, const ZoneDefinition& zoneDefinition, ZoneAssetCreationStateContainer& zoneStates)
CreateCompilerT6(MemoryManager& memory, const Zone& zone, const ZoneDefinition& zoneDefinition, ZoneAssetCreationStateContainer& zoneStates)
{
return std::make_unique<KeyValuePairsCompiler>(memory, zone, zoneDefinition, zoneStates);
}
} // namespace T6::key_value_pairs
} // namespace key_value_pairs

View File

@@ -9,8 +9,8 @@
#include <memory>
namespace T6::key_value_pairs
namespace key_value_pairs
{
std::unique_ptr<IAssetCreator>
CreateCompiler(MemoryManager& memory, const Zone& zone, const ZoneDefinition& zoneDefinition, ZoneAssetCreationStateContainer& zoneStates);
} // namespace T6::key_value_pairs
CreateCompilerT6(MemoryManager& memory, const Zone& zone, const ZoneDefinition& zoneDefinition, ZoneAssetCreationStateContainer& zoneStates);
} // namespace key_value_pairs

View File

@@ -19,7 +19,7 @@ namespace
{
auto& memory = zone.Memory();
collection.AddAssetCreator(T6::key_value_pairs::CreateCompiler(memory, zone, zoneDefinition.m_zone_definition, zoneStates));
collection.AddAssetCreator(key_value_pairs::CreateCompilerT6(memory, zone, zoneDefinition.m_zone_definition, zoneStates));
}
void ConfigurePostProcessors(AssetCreatorCollection& collection,