2019-12-11 04:51:33 +00:00
|
|
|
#include "Runtime/CTextureCache.hpp"
|
|
|
|
#include "Runtime/CToken.hpp"
|
2019-12-11 04:51:23 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2019-12-11 04:51:33 +00:00
|
|
|
CTextureCache::CTextureCache(CInputStream& in) {
|
|
|
|
u32 textureCount = in.readUint32Big();
|
|
|
|
for (u32 i = 0; i < textureCount; ++i) {
|
|
|
|
CAssetId uid(in);
|
|
|
|
if (m_textureInfo.find(uid) == m_textureInfo.end())
|
|
|
|
m_textureInfo.emplace(uid, CTextureInfo(in));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const CTextureInfo* CTextureCache::GetTextureInfo(CAssetId id) const {
|
|
|
|
auto it = m_textureInfo.find(id);
|
|
|
|
if (it == m_textureInfo.end())
|
|
|
|
return nullptr;
|
|
|
|
return &it->second;
|
|
|
|
}
|
|
|
|
|
2020-04-24 01:15:30 +00:00
|
|
|
CFactoryFnReturn FTextureCacheFactory([[maybe_unused]] const SObjectTag& tag, CInputStream& in,
|
|
|
|
[[maybe_unused]] const CVParamTransfer& vparms,
|
|
|
|
[[maybe_unused]] CObjectReference* selfRef) {
|
2019-12-11 04:51:33 +00:00
|
|
|
return TToken<CTextureCache>::GetIObjObjectFor(std::make_unique<CTextureCache>(in));
|
|
|
|
}
|
|
|
|
}
|