metaforce/Runtime/CTextureCache.hpp

47 lines
1.2 KiB
C++
Raw Normal View History

#pragma once
#include "Runtime/RetroTypes.hpp"
#include "Runtime/Graphics/CTexture.hpp"
2021-04-10 08:42:06 +00:00
namespace metaforce {
class CPaletteInfo {
u32 m_format;
u32 m_elementCount;
u64 m_dolphinHash;
2019-12-11 04:51:23 +00:00
public:
explicit CPaletteInfo(CInputStream& in)
2021-06-07 19:29:18 +00:00
: m_format(in.readUint32Big()), m_elementCount(in.readUint32Big()), m_dolphinHash(in.readUint64Big()) {}
};
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
public:
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()) {
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
public:
explicit CTextureCache(CInputStream& in);
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