// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #pragma once #include "Engine/Core/Types/StringView.h" #include "Engine/Core/Collections/Dictionary.h" struct AssetInfo; class Asset; class IAssetUpgrader; /// /// The asset objects factory. /// class FLAXENGINE_API IAssetFactory { public: typedef Dictionary Collection; /// /// Gets the all registered assets factories. Key is asset typename, value is the factory object. /// static Collection& Get() { static Collection Factories(1024); return Factories; } public: /// /// Finalizes an instance of the class. /// virtual ~IAssetFactory() { } public: /// /// Determines whenever the virtual assets are supported by this asset tpe factory. /// /// True if can create virtual assets, otherwise false. virtual bool SupportsVirtualAssets() const { return false; } /// /// Creates new asset instance. /// /// The asset info structure. /// Created asset object. virtual Asset* New(const AssetInfo& info) = 0; /// /// Creates new virtual asset instance. Virtual assets are temporary and exist until application exit. /// /// The asset info structure. /// Created asset object. virtual Asset* NewVirtual(const AssetInfo& info) = 0; /// /// Gets the asset upgrader. /// /// Asset upgrader, or null if not used. virtual IAssetUpgrader* GetUpgrader() const { return nullptr; } };