mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-02-10 17:43:03 +00:00
refactor: streamline obj compiling asset loading
This commit is contained in:
@@ -5,48 +5,51 @@
|
||||
#include "Image/IPak/IPakCreator.h"
|
||||
#include "SearchPath/IOutputPath.h"
|
||||
|
||||
class AbstractImageIPakPostProcessor : public IAssetPostProcessor
|
||||
namespace image
|
||||
{
|
||||
public:
|
||||
AbstractImageIPakPostProcessor(const ZoneDefinitionContext& zoneDefinition,
|
||||
ISearchPath& searchPath,
|
||||
ZoneAssetCreationStateContainer& zoneStates,
|
||||
IOutputPath& outDir);
|
||||
|
||||
static bool AppliesToZoneDefinition(const ZoneDefinitionContext& zoneDefinition);
|
||||
|
||||
void PostProcessAsset(XAssetInfoGeneric& assetInfo, AssetCreationContext& context) override;
|
||||
void FinalizeZone(AssetCreationContext& context) override;
|
||||
|
||||
private:
|
||||
void FindNextObjContainer();
|
||||
|
||||
const ZoneDefinitionContext& m_zone_definition;
|
||||
ISearchPath& m_search_path;
|
||||
IPakCreator& m_ipak_creator;
|
||||
IOutputPath& m_out_dir;
|
||||
|
||||
unsigned m_obj_container_index;
|
||||
IPakToCreate* m_current_ipak;
|
||||
unsigned m_current_ipak_start_index;
|
||||
unsigned m_current_ipak_end_index;
|
||||
};
|
||||
|
||||
template<typename AssetType> class ImageIPakPostProcessor final : public AbstractImageIPakPostProcessor
|
||||
{
|
||||
public:
|
||||
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
|
||||
|
||||
ImageIPakPostProcessor(const ZoneDefinitionContext& zoneDefinition,
|
||||
ISearchPath& searchPath,
|
||||
ZoneAssetCreationStateContainer& zoneStates,
|
||||
IOutputPath& outDir)
|
||||
: AbstractImageIPakPostProcessor(zoneDefinition, searchPath, zoneStates, outDir)
|
||||
class AbstractIPakPostProcessor : public IAssetPostProcessor
|
||||
{
|
||||
}
|
||||
public:
|
||||
AbstractIPakPostProcessor(const ZoneDefinitionContext& zoneDefinition,
|
||||
ISearchPath& searchPath,
|
||||
ZoneAssetCreationStateContainer& zoneStates,
|
||||
IOutputPath& outDir);
|
||||
|
||||
[[nodiscard]] asset_type_t GetHandlingAssetType() const override
|
||||
static bool AppliesToZoneDefinition(const ZoneDefinitionContext& zoneDefinition);
|
||||
|
||||
void PostProcessAsset(XAssetInfoGeneric& assetInfo, AssetCreationContext& context) override;
|
||||
void FinalizeZone(AssetCreationContext& context) override;
|
||||
|
||||
private:
|
||||
void FindNextObjContainer();
|
||||
|
||||
const ZoneDefinitionContext& m_zone_definition;
|
||||
ISearchPath& m_search_path;
|
||||
IPakCreator& m_ipak_creator;
|
||||
IOutputPath& m_out_dir;
|
||||
|
||||
unsigned m_obj_container_index;
|
||||
IPakToCreate* m_current_ipak;
|
||||
unsigned m_current_ipak_start_index;
|
||||
unsigned m_current_ipak_end_index;
|
||||
};
|
||||
|
||||
template<typename AssetType> class IPakPostProcessor final : public AbstractIPakPostProcessor
|
||||
{
|
||||
return AssetType::EnumEntry;
|
||||
}
|
||||
};
|
||||
public:
|
||||
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
|
||||
|
||||
IPakPostProcessor(const ZoneDefinitionContext& zoneDefinition,
|
||||
ISearchPath& searchPath,
|
||||
ZoneAssetCreationStateContainer& zoneStates,
|
||||
IOutputPath& outDir)
|
||||
: AbstractIPakPostProcessor(zoneDefinition, searchPath, zoneStates, outDir)
|
||||
{
|
||||
}
|
||||
|
||||
[[nodiscard]] asset_type_t GetHandlingAssetType() const override
|
||||
{
|
||||
return AssetType::EnumEntry;
|
||||
}
|
||||
};
|
||||
} // namespace image
|
||||
|
||||
Reference in New Issue
Block a user