metaforce/Runtime/CTexture.hpp

56 lines
1.4 KiB
C++
Raw Normal View History

2016-02-13 09:02:47 +00:00
#ifndef __PSHAG_CTEXTURE_HPP__
#define __PSHAG_CTEXTURE_HPP__
#include "GCNTypes.hpp"
2016-02-16 05:50:41 +00:00
#include "IObj.hpp"
#include "IOStreams.hpp"
#include "CGraphics.hpp"
2016-02-15 04:00:26 +00:00
#include "boo/graphicsdev/IGraphicsDataFactory.hpp"
2016-02-13 09:02:47 +00:00
namespace pshag
{
2016-02-16 05:50:41 +00:00
class CVParamTransfer;
class CTexture
{
2016-02-16 05:50:41 +00:00
ETexelFormat x0_fmt;
u16 x4_w;
u16 x6_h;
2016-02-16 05:50:41 +00:00
u32 x8_mips;
boo::GraphicsDataToken m_booToken;
2016-02-15 04:00:26 +00:00
boo::ITexture* m_booTex;
2016-02-16 05:50:41 +00:00
size_t ComputeMippedTexelCount();
size_t ComputeMippedBlockCountDXT1();
void BuildI4FromGCN(CInputStream& in);
void BuildI8FromGCN(CInputStream& in);
void BuildIA4FromGCN(CInputStream& in);
void BuildIA8FromGCN(CInputStream& in);
void BuildC4FromGCN(CInputStream& in);
void BuildC8FromGCN(CInputStream& in);
void BuildC14X2FromGCN(CInputStream& in);
void BuildRGB565FromGCN(CInputStream& in);
void BuildRGB5A3FromGCN(CInputStream& in);
void BuildRGBA8FromGCN(CInputStream& in);
void BuildDXT1FromGCN(CInputStream& in);
public:
2016-02-16 05:50:41 +00:00
CTexture(CInputStream& in);
2016-02-13 00:57:09 +00:00
enum class EClampMode
{
None,
One
};
2016-02-16 05:50:41 +00:00
ETexelFormat GetTexelFormat() const {return x0_fmt;}
u16 GetWidth() const {return x4_w;}
u16 GetHeight() const {return x6_h;}
2016-02-13 00:57:09 +00:00
void Load(int slot, EClampMode clamp);
2016-02-15 04:00:26 +00:00
boo::ITexture* GetBooTexture() {return m_booTex;}
};
2016-02-16 05:50:41 +00:00
std::unique_ptr<IObj> FTextureFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms);
}
2016-02-13 09:02:47 +00:00
#endif // __PSHAG_CTEXTURE_HPP__