2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 21:07:42 +00:00

Initial CModel implementation

This commit is contained in:
Jack Andersen
2016-03-29 13:14:14 -10:00
parent 2e028d9049
commit 6b1c435d0c
7 changed files with 243 additions and 16 deletions

View File

@@ -15,18 +15,27 @@ using CFactoryFnReturn = std::unique_ptr<IObj>;
using FFactoryFunc = std::function<CFactoryFnReturn(const urde::SObjectTag& tag,
urde::CInputStream& in,
const urde::CVParamTransfer& vparms)>;
using FMemFactoryFunc = std::function<CFactoryFnReturn(const urde::SObjectTag& tag,
std::unique_ptr<u8[]>&& in, u32 len,
const urde::CVParamTransfer& vparms)>;
class CFactoryMgr
{
std::unordered_map<FourCC, FFactoryFunc> m_factories;
std::unordered_map<FourCC, FMemFactoryFunc> m_memFactories;
public:
CFactoryFnReturn MakeObject(const SObjectTag& tag, urde::CInputStream& in,
const CVParamTransfer& paramXfer);
CFactoryFnReturn MakeObjectFromMemory(const SObjectTag& tag, void* buf, int size, bool compressed,
bool CanMakeMemory(const urde::SObjectTag& tag) const;
CFactoryFnReturn MakeObjectFromMemory(const SObjectTag& tag, std::unique_ptr<u8[]>&& buf, int size, bool compressed,
const CVParamTransfer& paramXfer);
void AddFactory(FourCC key, FFactoryFunc func)
{
m_factories[key] = func;
}
void AddFactory(FourCC key, FMemFactoryFunc func)
{
m_memFactories[key] = func;
}
};
}