metaforce/Runtime/CTextureCache.hpp

51 lines
1.2 KiB
C++
Raw Normal View History

#pragma once
2022-02-16 05:21:24 +00:00
#include "Runtime/RetroTypes.hpp"
#include "Runtime/Graphics/CTexture.hpp"
2022-02-16 05:21:24 +00:00
#include <map>
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)
: m_format(in.ReadLong()), m_elementCount(in.ReadLong()), m_dolphinHash(in.ReadLongLong()) {}
};
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)
: m_format(ETexelFormat(in.ReadLong()))
, m_mipCount(in.ReadLong())
, m_width(in.ReadShort())
, m_height(in.ReadShort())
, m_dolphinHash(in.ReadLongLong()) {
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