2019-12-11 04:51:33 +00:00
|
|
|
#pragma once
|
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
#include "Runtime/Graphics/CTexture.hpp"
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2019-12-11 04:51:33 +00:00
|
|
|
class CPaletteInfo {
|
|
|
|
u32 m_format;
|
|
|
|
u32 m_elementCount;
|
|
|
|
u64 m_dolphinHash;
|
2019-12-11 04:51:23 +00:00
|
|
|
|
2019-12-11 04:51:33 +00:00
|
|
|
public:
|
2020-03-26 01:25:11 +00:00
|
|
|
explicit CPaletteInfo(CInputStream& in)
|
2021-06-07 19:29:18 +00:00
|
|
|
: m_format(in.readUint32Big()), m_elementCount(in.readUint32Big()), m_dolphinHash(in.readUint64Big()) {}
|
2019-12-11 04:51:33 +00:00
|
|
|
};
|
|
|
|
class CTextureInfo {
|
|
|
|
ETexelFormat m_format;
|
|
|
|
u32 m_mipCount;
|
|
|
|
u16 m_width;
|
|
|
|
u16 m_height;
|
|
|
|
u64 m_dolphinHash;
|
|
|
|
std::optional<CPaletteInfo> m_paletteInfo;
|
2019-12-11 04:51:23 +00:00
|
|
|
|
2019-12-11 04:51:33 +00:00
|
|
|
public:
|
2020-03-26 01:25:11 +00:00
|
|
|
explicit CTextureInfo(CInputStream& in)
|
2021-06-07 19:29:18 +00:00
|
|
|
: m_format(ETexelFormat(in.readUint32Big()))
|
|
|
|
, m_mipCount(in.readUint32Big())
|
|
|
|
, m_width(in.readUint16Big())
|
|
|
|
, m_height(in.readUint16Big())
|
|
|
|
, m_dolphinHash(in.readUint64Big()) {
|
2019-12-11 04:51:33 +00:00
|
|
|
bool hasPal = in.readBool();
|
|
|
|
if (hasPal)
|
|
|
|
m_paletteInfo.emplace(in);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
class CTextureCache {
|
|
|
|
public:
|
|
|
|
std::map<CAssetId, CTextureInfo> m_textureInfo;
|
2019-12-11 04:51:23 +00:00
|
|
|
|
2019-12-11 04:51:33 +00:00
|
|
|
public:
|
2020-03-26 01:25:11 +00:00
|
|
|
explicit CTextureCache(CInputStream& in);
|
2019-12-11 04:51:33 +00:00
|
|
|
|
|
|
|
const CTextureInfo* GetTextureInfo(CAssetId id) const;
|
|
|
|
};
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
CFactoryFnReturn FTextureCacheFactory(const metaforce::SObjectTag& tag, CInputStream& in,
|
|
|
|
const metaforce::CVParamTransfer& vparms, CObjectReference* selfRef);
|
2022-02-01 00:06:54 +00:00
|
|
|
} // namespace metaforce
|