mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 23:08:05 -05:00
chore: implement obj loading skeleton with localize asset
This commit is contained in:
@ -1,36 +0,0 @@
|
||||
#include "AssetLoaderLocalizeEntry.h"
|
||||
|
||||
#include "Localize/LocalizeCommonAssetLoader.h"
|
||||
|
||||
using namespace IW5;
|
||||
|
||||
XAssetInfoGeneric* AssetLoaderLocalizeEntry::LoadFromGlobalAssetPools(const std::string& assetName) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void* AssetLoaderLocalizeEntry::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool AssetLoaderLocalizeEntry::CanLoadFromRaw() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetLoaderLocalizeEntry::LoadFromRaw(
|
||||
const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
||||
{
|
||||
const LocalizeCommonAssetLoader commonLoader(
|
||||
[memory, manager](const CommonLocalizeEntry& entry)
|
||||
{
|
||||
auto* localizeEntry = memory->Create<LocalizeEntry>();
|
||||
localizeEntry->name = memory->Dup(entry.m_key.c_str());
|
||||
localizeEntry->value = memory->Dup(entry.m_value.c_str());
|
||||
|
||||
manager->AddAsset<AssetLocalize>(entry.m_key, localizeEntry);
|
||||
});
|
||||
|
||||
return commonLoader.LoadLocalizeAsset(assetName, searchPath, manager, zone);
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "AssetLoading/BasicAssetLoader.h"
|
||||
#include "AssetLoading/IAssetLoadingManager.h"
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "SearchPath/ISearchPath.h"
|
||||
|
||||
namespace IW5
|
||||
{
|
||||
class AssetLoaderLocalizeEntry final : public BasicAssetLoader<AssetLocalize>
|
||||
{
|
||||
public:
|
||||
_NODISCARD XAssetInfoGeneric* LoadFromGlobalAssetPools(const std::string& assetName) const override;
|
||||
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
|
||||
_NODISCARD bool CanLoadFromRaw() const override;
|
||||
bool
|
||||
LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override;
|
||||
};
|
||||
} // namespace IW5
|
23
src/ObjLoading/Game/IW5/Localize/AssetLoaderLocalizeIW5.cpp
Normal file
23
src/ObjLoading/Game/IW5/Localize/AssetLoaderLocalizeIW5.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "AssetLoaderLocalizeIW5.h"
|
||||
|
||||
using namespace IW5;
|
||||
|
||||
AssetLoaderLocalize::AssetLoaderLocalize(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
|
||||
: CommonLocalizeLoader(searchPath, zone),
|
||||
m_memory(memory)
|
||||
{
|
||||
}
|
||||
|
||||
AssetCreationResult AssetLoaderLocalize::CreateAsset(const std::string& assetName, AssetCreationContext& context)
|
||||
{
|
||||
return CreateLocalizeAsset(assetName, context);
|
||||
}
|
||||
|
||||
AssetCreationResult AssetLoaderLocalize::CreateAssetFromCommonAsset(const CommonLocalizeEntry& localizeEntry, AssetCreationContext& context)
|
||||
{
|
||||
auto* asset = m_memory.Alloc<LocalizeEntry>();
|
||||
asset->name = m_memory.Dup(localizeEntry.m_key.c_str());
|
||||
asset->value = m_memory.Dup(localizeEntry.m_value.c_str());
|
||||
|
||||
return AssetCreationResult::Success(context.AddAsset<AssetLocalize>(localizeEntry.m_key, asset));
|
||||
}
|
25
src/ObjLoading/Game/IW5/Localize/AssetLoaderLocalizeIW5.h
Normal file
25
src/ObjLoading/Game/IW5/Localize/AssetLoaderLocalizeIW5.h
Normal file
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "Asset/AssetCreationContext.h"
|
||||
#include "Asset/IAssetCreator.h"
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Localize/CommonLocalizeLoader.h"
|
||||
#include "SearchPath/ISearchPath.h"
|
||||
#include "Utils/MemoryManager.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
namespace IW5
|
||||
{
|
||||
class AssetLoaderLocalize final : public AssetCreator<AssetLocalize>, public CommonLocalizeLoader
|
||||
{
|
||||
public:
|
||||
AssetLoaderLocalize(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
|
||||
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override;
|
||||
|
||||
protected:
|
||||
AssetCreationResult CreateAssetFromCommonAsset(const CommonLocalizeEntry& localizeEntry, AssetCreationContext& context) override;
|
||||
|
||||
private:
|
||||
MemoryManager& m_memory;
|
||||
};
|
||||
} // namespace IW5
|
@ -1,128 +1,158 @@
|
||||
#include "ObjLoaderIW5.h"
|
||||
|
||||
#include "AssetLoaders/AssetLoaderAddonMapEnts.h"
|
||||
#include "AssetLoaders/AssetLoaderClipMap.h"
|
||||
#include "AssetLoaders/AssetLoaderComWorld.h"
|
||||
#include "AssetLoaders/AssetLoaderFont.h"
|
||||
#include "AssetLoaders/AssetLoaderFx.h"
|
||||
#include "AssetLoaders/AssetLoaderFxImpactTable.h"
|
||||
#include "AssetLoaders/AssetLoaderFxWorld.h"
|
||||
#include "AssetLoaders/AssetLoaderGfxImage.h"
|
||||
#include "AssetLoaders/AssetLoaderGfxLightDef.h"
|
||||
#include "AssetLoaders/AssetLoaderGfxWorld.h"
|
||||
#include "AssetLoaders/AssetLoaderGlassWorld.h"
|
||||
#include "AssetLoaders/AssetLoaderLeaderboard.h"
|
||||
#include "AssetLoaders/AssetLoaderLoadedSound.h"
|
||||
#include "AssetLoaders/AssetLoaderLocalizeEntry.h"
|
||||
#include "AssetLoaders/AssetLoaderMapEnts.h"
|
||||
#include "AssetLoaders/AssetLoaderMaterial.h"
|
||||
#include "AssetLoaders/AssetLoaderMenuDef.h"
|
||||
#include "AssetLoaders/AssetLoaderMenuList.h"
|
||||
#include "AssetLoaders/AssetLoaderPathData.h"
|
||||
#include "AssetLoaders/AssetLoaderPhysCollmap.h"
|
||||
#include "AssetLoaders/AssetLoaderPhysPreset.h"
|
||||
#include "AssetLoaders/AssetLoaderPixelShader.h"
|
||||
#include "AssetLoaders/AssetLoaderRawFile.h"
|
||||
#include "AssetLoaders/AssetLoaderScriptFile.h"
|
||||
#include "AssetLoaders/AssetLoaderSoundAliasList.h"
|
||||
#include "AssetLoaders/AssetLoaderSoundCurve.h"
|
||||
#include "AssetLoaders/AssetLoaderStringTable.h"
|
||||
#include "AssetLoaders/AssetLoaderStructuredDataDef.h"
|
||||
#include "AssetLoaders/AssetLoaderSurfaceFxTable.h"
|
||||
#include "AssetLoaders/AssetLoaderTechniqueSet.h"
|
||||
#include "AssetLoaders/AssetLoaderTracerDef.h"
|
||||
#include "AssetLoaders/AssetLoaderVehicleDef.h"
|
||||
#include "AssetLoaders/AssetLoaderVehicleTrack.h"
|
||||
#include "AssetLoaders/AssetLoaderVertexDecl.h"
|
||||
#include "AssetLoaders/AssetLoaderVertexShader.h"
|
||||
#include "AssetLoaders/AssetLoaderWeapon.h"
|
||||
#include "AssetLoaders/AssetLoaderWeaponAttachment.h"
|
||||
#include "AssetLoaders/AssetLoaderXAnim.h"
|
||||
#include "AssetLoaders/AssetLoaderXModel.h"
|
||||
#include "AssetLoaders/AssetLoaderXModelSurfs.h"
|
||||
#include "AssetLoading/AssetLoadingManager.h"
|
||||
#include "Asset/GlobalAssetPoolsLoader.h"
|
||||
#include "Game/IW5/GameIW5.h"
|
||||
#include "Image/IwiLoader.h"
|
||||
#include "ObjContainer/IPak/IPak.h"
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Localize/AssetLoaderLocalizeIW5.h"
|
||||
#include "ObjLoading.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace IW5;
|
||||
|
||||
ObjLoader::ObjLoader()
|
||||
{
|
||||
#define REGISTER_ASSET_LOADER(t) \
|
||||
{ \
|
||||
auto l = std::make_unique<t>(); \
|
||||
m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l); \
|
||||
}
|
||||
|
||||
REGISTER_ASSET_LOADER(AssetLoaderPhysPreset)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderPhysCollmap)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderXAnim)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderXModelSurfs)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderXModel)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderMaterial)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderPixelShader)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderVertexShader)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderVertexDecl)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderTechniqueSet)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderGfxImage)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderSoundAliasList)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderSoundCurve)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderLoadedSound)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderClipMap)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderComWorld)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderGlassWorld)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderPathData)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderVehicleTrack)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderMapEnts)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderFxWorld)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderGfxWorld)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderGfxLightDef)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderFont)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderMenuList)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderMenuDef)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderLocalizeEntry)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderWeaponAttachment)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderWeapon)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderFx)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderFxImpactTable)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderSurfaceFxTable)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderRawFile)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderScriptFile)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderStringTable)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderLeaderboard)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderStructuredDataDef)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderTracerDef)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderVehicleDef)
|
||||
REGISTER_ASSET_LOADER(AssetLoaderAddonMapEnts)
|
||||
|
||||
#undef REGISTER_ASSET_LOADER
|
||||
}
|
||||
|
||||
bool ObjLoader::IsMpZone(const Zone& zone)
|
||||
{
|
||||
return zone.m_name.compare(0, 3, "mp_") == 0 || zone.m_name.compare(zone.m_name.length() - 3, 3, "_mp") == 0;
|
||||
}
|
||||
|
||||
bool ObjLoader::IsZmZone(const Zone& zone)
|
||||
{
|
||||
return zone.m_name.compare(0, 3, "zm_") == 0 || zone.m_name.compare(zone.m_name.length() - 3, 3, "_zm") == 0;
|
||||
}
|
||||
|
||||
void ObjLoader::LoadReferencedContainersForZone(ISearchPath& searchPath, Zone& zone) const {}
|
||||
|
||||
void ObjLoader::UnloadContainersOfZone(Zone& zone) const {}
|
||||
|
||||
void ObjLoader::ConfigureCreatorCollection(AssetCreatorCollection& collection) const {}
|
||||
|
||||
bool ObjLoader::LoadAssetForZone(AssetLoadingContext& context, const asset_type_t assetType, const std::string& assetName) const
|
||||
namespace
|
||||
{
|
||||
AssetLoadingManager assetLoadingManager(m_asset_loaders_by_type, context);
|
||||
return assetLoadingManager.LoadAssetFromLoader(assetType, assetName);
|
||||
}
|
||||
void ConfigureDefaultCreators(AssetCreatorCollection& collection, Zone& zone)
|
||||
{
|
||||
auto& memory = *zone.GetMemory();
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorPhysPreset>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorPhysCollMap>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorXAnim>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorXModelSurfs>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorXModel>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorMaterial>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorPixelShader>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorVertexShader>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorVertexDecl>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorTechniqueSet>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorImage>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorSound>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorSoundCurve>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorLoadedSound>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorClipMap>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorComWorld>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorGlassWorld>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorPathData>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorVehicleTrack>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorMapEnts>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorFxWorld>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorGfxWorld>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorLightDef>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorFont>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorMenuList>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorMenu>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorLocalize>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorAttachment>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorWeapon>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorFx>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorImpactFx>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorSurfaceFx>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorRawFile>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorScript>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorStringTable>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorLeaderboard>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorStructuredDataDef>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorTracer>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorVehicle>(memory));
|
||||
// collection.AddDefaultAssetCreator(std::make_unique<DefaultCreatorAddonMapEnts>(memory));
|
||||
}
|
||||
|
||||
void ObjLoader::FinalizeAssetsForZone(AssetLoadingContext& context) const
|
||||
void ConfigureGlobalAssetPoolsLoaders(AssetCreatorCollection& collection, Zone& zone)
|
||||
{
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetPhysPreset>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetPhysCollMap>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetXAnim>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetXModelSurfs>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetXModel>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetMaterial>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetPixelShader>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetVertexShader>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetVertexDecl>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetTechniqueSet>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetImage>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSound>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundCurve>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetLoadedSound>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMap>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetComWorld>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetGlassWorld>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetPathData>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetVehicleTrack>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetMapEnts>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetFxWorld>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetGfxWorld>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetLightDef>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetFont>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetMenuList>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetMenu>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetLocalize>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetAttachment>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetWeapon>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetFx>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetImpactFx>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSurfaceFx>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetRawFile>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetScript>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetStringTable>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetLeaderboard>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetStructuredDataDef>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetTracer>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetVehicle>>(zone));
|
||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetAddonMapEnts>>(zone));
|
||||
}
|
||||
|
||||
void ConfigureDefaultCreators(AssetCreatorCollection& collection, Zone& zone, ISearchPath& searchPath)
|
||||
{
|
||||
auto& memory = *zone.GetMemory();
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderPhysPreset>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderPhysCollMap>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderXAnim>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderXModelSurfs>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderXModel>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderMaterial>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderPixelShader>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderVertexShader>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderVertexDecl>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderTechniqueSet>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderImage>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderSound>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderSoundCurve>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderLoadedSound>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderClipMap>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderComWorld>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderGlassWorld>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderPathData>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderVehicleTrack>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderMapEnts>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderFxWorld>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderGfxWorld>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderLightDef>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderFont>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderMenuList>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderMenu>(memory));
|
||||
collection.AddAssetCreator(std::make_unique<AssetLoaderLocalize>(memory, searchPath, zone));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderAttachment>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderWeapon>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderFx>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderImpactFx>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderSurfaceFx>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderRawFile>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderScript>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderStringTable>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderLeaderboard>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderStructuredDataDef>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderTracer>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderVehicle>(memory));
|
||||
// collection.AddAssetCreator(std::make_unique<AssetLoaderAddonMapEnts>(memory));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void ObjLoader::ConfigureCreatorCollection(AssetCreatorCollection& collection, Zone& zone, ISearchPath& searchPath) const
|
||||
{
|
||||
for (const auto& [type, loader] : m_asset_loaders_by_type)
|
||||
loader->FinalizeAssetsForZone(context);
|
||||
ConfigureDefaultCreators(collection, zone, searchPath);
|
||||
ConfigureGlobalAssetPoolsLoaders(collection, zone);
|
||||
}
|
||||
|
@ -4,28 +4,14 @@
|
||||
#include "IObjLoader.h"
|
||||
#include "SearchPath/ISearchPath.h"
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace IW5
|
||||
{
|
||||
class ObjLoader final : public IObjLoader
|
||||
{
|
||||
public:
|
||||
ObjLoader();
|
||||
|
||||
void LoadReferencedContainersForZone(ISearchPath& searchPath, Zone& zone) const override;
|
||||
void UnloadContainersOfZone(Zone& zone) const override;
|
||||
|
||||
void ConfigureCreatorCollection(AssetCreatorCollection& collection) const override;
|
||||
|
||||
bool LoadAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const override;
|
||||
void FinalizeAssetsForZone(AssetLoadingContext& context) const override;
|
||||
|
||||
private:
|
||||
static bool IsMpZone(const Zone& zone);
|
||||
static bool IsZmZone(const Zone& zone);
|
||||
|
||||
std::unordered_map<asset_type_t, std::unique_ptr<IAssetLoader>> m_asset_loaders_by_type;
|
||||
void ConfigureCreatorCollection(AssetCreatorCollection& collection, Zone& zone, ISearchPath& searchPath) const override;
|
||||
};
|
||||
} // namespace IW5
|
||||
|
Reference in New Issue
Block a user