chore: get rid of now unused AssetLoading classes

This commit is contained in:
Jan 2024-12-31 16:34:39 +01:00
parent e11e8a361e
commit 9852f52a15
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
27 changed files with 8 additions and 233 deletions

View File

@ -1,6 +1,5 @@
#include "ZoneCreator.h"
#include "AssetLoading/AssetLoadingContext.h"
#include "Gdt/GdtLookup.h"
#include "IObjCompiler.h"
#include "IObjLoader.h"

View File

@ -1,7 +1,6 @@
#pragma once
#include "Asset/AssetCreatorCollection.h"
#include "AssetLoading/AssetLoadingContext.h"
#include "SearchPath/ISearchPath.h"
#include "Zone/Definition/ZoneDefinition.h"
#include "Zone/Zone.h"

View File

@ -1,6 +1,6 @@
#pragma once
#include "AssetLoading/IZoneAssetLoaderState.h"
#include "Asset/IZoneAssetLoaderState.h"
#include "AssetRegistration.h"
#include "Game/IAsset.h"
#include "Pool/XAssetInfo.h"

View File

@ -1,7 +0,0 @@
#include "AssetLoadingContext.h"
AssetLoadingContext::AssetLoadingContext(Zone& zone, ISearchPath& rawSearchPath, std::vector<Gdt*> gdtFiles)
: m_zone(zone),
m_raw_search_path(rawSearchPath)
{
}

View File

@ -1,41 +0,0 @@
#pragma once
#include "Gdt/IGdtQueryable.h"
#include "IZoneAssetLoaderState.h"
#include "Obj/Gdt/Gdt.h"
#include "SearchPath/ISearchPath.h"
#include "Zone/Zone.h"
#include <type_traits>
#include <typeindex>
#include <unordered_map>
class AssetLoadingContext final : public IGdtQueryable
{
public:
AssetLoadingContext(Zone& zone, ISearchPath& rawSearchPath, std::vector<Gdt*> gdtFiles);
GdtEntry* GetGdtEntryByGdfAndName(const std::string& gdfName, const std::string& entryName) override;
template<typename T> T* GetZoneAssetLoaderState()
{
static_assert(std::is_base_of_v<IZoneAssetLoaderState, T>, "T must inherit IZoneAssetLoaderState");
// T must also have a public default constructor
const auto foundEntry = m_zone_asset_loader_states.find(typeid(T));
if (foundEntry != m_zone_asset_loader_states.end())
return dynamic_cast<T*>(foundEntry->second.get());
auto newState = std::make_unique<T>();
newState->SetZone(&m_zone);
auto* newStatePtr = newState.get();
m_zone_asset_loader_states.emplace(std::make_pair<std::type_index, std::unique_ptr<IZoneAssetLoaderState>>(typeid(T), std::move(newState)));
return newStatePtr;
}
public:
Zone& m_zone;
ISearchPath& m_raw_search_path;
std::unordered_map<std::string, asset_type_t> m_ignored_asset_map;
std::unordered_map<std::type_index, std::unique_ptr<IZoneAssetLoaderState>> m_zone_asset_loader_states;
};

View File

@ -1,23 +0,0 @@
#pragma once
#include "IAssetLoader.h"
#include "Pool/GlobalAssetPool.h"
template<typename T> class BasicAssetLoaderWithoutType : public IAssetLoader
{
public:
_NODISCARD XAssetInfoGeneric* LoadFromGlobalAssetPools(const std::string& assetName) const override
{
return GlobalAssetPool<T>::GetAssetByName(assetName);
}
};
template<typename AssetType> class BasicAssetLoader : public BasicAssetLoaderWithoutType<typename AssetType::Type>
{
public:
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
_NODISCARD asset_type_t GetHandlingAssetType() const override
{
return AssetType::EnumEntry;
}
};

View File

@ -1,54 +0,0 @@
#pragma once
#include "Gdt/IGdtQueryable.h"
#include "IAssetLoadingManager.h"
#include "SearchPath/ISearchPath.h"
#include "Utils/ClassUtils.h"
#include "Zone/ZoneTypes.h"
#include <string>
class IAssetLoader
{
public:
IAssetLoader() = default;
virtual ~IAssetLoader() = default;
IAssetLoader(const IAssetLoader& other) = default;
IAssetLoader(IAssetLoader&& other) noexcept = default;
IAssetLoader& operator=(const IAssetLoader& other) = default;
IAssetLoader& operator=(IAssetLoader&& other) noexcept = default;
_NODISCARD virtual asset_type_t GetHandlingAssetType() const = 0;
_NODISCARD virtual XAssetInfoGeneric* LoadFromGlobalAssetPools(const std::string& assetName) const = 0;
_NODISCARD virtual void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
{
// TODO: Make this pure virtual
return nullptr;
}
_NODISCARD virtual bool CanLoadFromGdt() const
{
return false;
}
_NODISCARD virtual bool CanLoadFromRaw() const
{
return false;
}
virtual bool LoadFromGdt(const std::string& assetName, IGdtQueryable* gdtQueryable, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
{
return false;
}
virtual bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
{
return false;
}
virtual void FinalizeAssetsForZone(AssetLoadingContext& context) const
{
// Do nothing by default
}
};

View File

@ -1,89 +0,0 @@
#pragma once
#include "AssetLoadingContext.h"
#include "Game/IAsset.h"
#include "Pool/XAssetInfo.h"
#include "Utils/ClassUtils.h"
#include "Zone/ZoneTypes.h"
#include <string>
class IAssetLoadingManager
{
public:
IAssetLoadingManager() = default;
virtual ~IAssetLoadingManager() = default;
IAssetLoadingManager(const IAssetLoadingManager& other) = default;
IAssetLoadingManager(IAssetLoadingManager&& other) noexcept = default;
IAssetLoadingManager& operator=(const IAssetLoadingManager& other) = default;
IAssetLoadingManager& operator=(IAssetLoadingManager&& other) noexcept = default;
_NODISCARD virtual AssetLoadingContext* GetAssetLoadingContext() const = 0;
template<typename AssetType> XAssetInfo<typename AssetType::Type>* AddAsset(const std::string& assetName, typename AssetType::Type* asset)
{
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
return static_cast<XAssetInfo<typename AssetType::Type>*>(AddAsset(std::make_unique<XAssetInfoGeneric>(
AssetType::EnumEntry, assetName, asset, std::vector<XAssetInfoGeneric*>(), std::vector<scr_string_t>(), std::vector<IndirectAssetReference>())));
}
template<typename AssetType>
XAssetInfo<typename AssetType::Type>* AddAsset(const std::string& assetName, typename AssetType::Type* asset, std::vector<XAssetInfoGeneric*> dependencies)
{
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
return static_cast<XAssetInfo<typename AssetType::Type>*>(AddAsset(std::make_unique<XAssetInfoGeneric>(
AssetType::EnumEntry, assetName, asset, std::move(dependencies), std::vector<scr_string_t>(), std::vector<IndirectAssetReference>())));
}
template<typename AssetType>
XAssetInfo<typename AssetType::Type>* AddAsset(const std::string& assetName,
typename AssetType::Type* asset,
std::vector<XAssetInfoGeneric*> dependencies,
std::vector<scr_string_t> usedScriptStrings)
{
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
return static_cast<XAssetInfo<typename AssetType::Type>*>(AddAsset(std::make_unique<XAssetInfoGeneric>(
AssetType::EnumEntry, assetName, asset, std::move(dependencies), std::move(usedScriptStrings), std::vector<IndirectAssetReference>())));
}
template<typename AssetType>
XAssetInfo<typename AssetType::Type>* AddAsset(const std::string& assetName,
typename AssetType::Type* asset,
std::vector<XAssetInfoGeneric*> dependencies,
std::vector<scr_string_t> usedScriptStrings,
std::vector<IndirectAssetReference> indirectAssetReferences)
{
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
return static_cast<XAssetInfo<typename AssetType::Type>*>(AddAsset(std::make_unique<XAssetInfoGeneric>(
AssetType::EnumEntry, assetName, asset, std::move(dependencies), std::move(usedScriptStrings), std::move(indirectAssetReferences))));
}
template<typename AssetType> XAssetInfo<typename AssetType::Type>* AddAsset(std::unique_ptr<XAssetInfo<typename AssetType::Type>> xAssetInfo)
{
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
return static_cast<XAssetInfo<typename AssetType::Type>*>(AddAsset(std::unique_ptr<XAssetInfoGeneric>(xAssetInfo.release())));
}
template<typename AssetType> XAssetInfo<typename AssetType::Type>* LoadDependency(const std::string& assetName)
{
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
return static_cast<XAssetInfo<typename AssetType::Type>*>(LoadDependency(AssetType::EnumEntry, assetName));
}
template<typename AssetType> IndirectAssetReference LoadIndirectAssetReference(const std::string& assetName)
{
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
return LoadIndirectAssetReference(AssetType::EnumEntry, assetName);
}
protected:
virtual XAssetInfoGeneric* AddAsset(std::unique_ptr<XAssetInfoGeneric> xAssetInfo) = 0;
virtual XAssetInfoGeneric* LoadDependency(asset_type_t assetType, const std::string& assetName) = 0;
virtual IndirectAssetReference LoadIndirectAssetReference(asset_type_t assetType, const std::string& assetName) = 0;
};

View File

@ -1,6 +1,5 @@
#pragma once
#include "AssetLoading/IAssetLoadingManager.h"
#include "Game/IW4/IW4.h"
#include "InfoString/InfoStringToStructConverterBase.h"

View File

@ -1,12 +1,12 @@
#include "LoaderMaterialIW4.h"
#include "AssetLoading/AbstractGdtEntryReader.h"
#include "Game/IW4/CommonIW4.h"
#include "Game/IW4/IW4.h"
#include "Game/IW4/MaterialConstantsIW4.h"
#include "Game/IW4/ObjConstantsIW4.h"
#include "Game/IW4/Techset/LoaderTechsetIW4.h"
#include "Game/IW4/TechsetConstantsIW4.h"
#include "Gdt/AbstractGdtEntryReader.h"
#include "ObjLoading.h"
#include "Pool/GlobalAssetPool.h"
#include "StateMap/StateMapFromTechniqueExtractor.h"

View File

@ -1,6 +1,6 @@
#pragma once
#include "AssetLoading/IZoneAssetLoaderState.h"
#include "Asset/IZoneAssetLoaderState.h"
#include "Game/IW4/IW4.h"
#include <map>

View File

@ -1,6 +1,5 @@
#pragma once
#include "AssetLoading/IAssetLoader.h"
#include "IObjLoader.h"
#include "SearchPath/ISearchPath.h"
#include "Zone/Zone.h"

View File

@ -1,6 +1,5 @@
#pragma once
#include "AssetLoading/IAssetLoadingManager.h"
#include "Game/IW5/IW5.h"
#include "InfoString/InfoStringToStructConverterBase.h"

View File

@ -1,6 +1,6 @@
#pragma once
#include "AssetLoading/IZoneAssetLoaderState.h"
#include "Asset/IZoneAssetLoaderState.h"
#include "Game/IW5/IW5.h"
#include <map>

View File

@ -1,6 +1,5 @@
#pragma once
#include "AssetLoading/IAssetLoader.h"
#include "IObjLoader.h"
#include "SearchPath/ISearchPath.h"

View File

@ -1,6 +1,5 @@
#pragma once
#include "AssetLoading/IAssetLoader.h"
#include "IObjLoader.h"
#include "SearchPath/ISearchPath.h"

View File

@ -1,6 +1,5 @@
#pragma once
#include "AssetLoading/IAssetLoadingManager.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoStringToStructConverterBase.h"

View File

@ -1,6 +1,5 @@
#pragma once
#include "AssetLoading/IAssetLoader.h"
#include "Game/T6/T6.h"
#include "IObjLoader.h"
#include "ObjContainer/SoundBank/SoundBank.h"

View File

@ -1,7 +1,6 @@
#pragma once
#include "Asset/AssetCreatorCollection.h"
#include "AssetLoading/AssetLoadingContext.h"
#include "Gdt/IGdtQueryable.h"
#include "SearchPath/ISearchPath.h"
#include "Zone/Zone.h"

View File

@ -1,7 +1,6 @@
#pragma once
#include "Asset/IAssetCreator.h"
#include "AssetLoading/IAssetLoadingManager.h"
#include "Localize/CommonLocalizeEntry.h"
#include "Localize/Parsing/ILocalizeFileDuplicationChecker.h"
#include "SearchPath/ISearchPath.h"

View File

@ -1,6 +1,6 @@
#pragma once
#include "AssetLoading/IZoneAssetLoaderState.h"
#include "Asset/IZoneAssetLoaderState.h"
#include "Domain/CommonFunctionDef.h"
#include "Domain/CommonMenuDef.h"

View File

@ -1,6 +1,6 @@
#pragma once
#include "AssetLoading/IZoneAssetLoaderState.h"
#include "Asset/IZoneAssetLoaderState.h"
#include "StateMap/StateMapDefinition.h"
#include "Utils/ClassUtils.h"

View File

@ -1,6 +1,6 @@
#pragma once
#include "AssetLoading/IZoneAssetLoaderState.h"
#include "Asset/IZoneAssetLoaderState.h"
#include "TechsetDefinition.h"
#include "Utils/ClassUtils.h"

View File

@ -1,6 +1,6 @@
#pragma once
#include "AssetLoading/IZoneAssetLoaderState.h"
#include "Asset/IZoneAssetLoaderState.h"
#include "Parsing/GenericGraph2D.h"
#include "SearchPath/ISearchPath.h"