2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CTEXTURE_HPP__
|
|
|
|
#define __URDE_CTEXTURE_HPP__
|
2016-02-06 00:34:40 +00:00
|
|
|
|
|
|
|
#include "GCNTypes.hpp"
|
2016-03-31 00:38:03 +00:00
|
|
|
#include "CFactoryMgr.hpp"
|
2016-02-16 05:50:41 +00:00
|
|
|
#include "IObj.hpp"
|
|
|
|
#include "IOStreams.hpp"
|
2016-03-04 23:04:53 +00:00
|
|
|
#include "Graphics/CGraphics.hpp"
|
2016-02-15 04:00:26 +00:00
|
|
|
#include "boo/graphicsdev/IGraphicsDataFactory.hpp"
|
2016-02-06 00:34:40 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2016-02-06 00:34:40 +00:00
|
|
|
{
|
2016-02-16 05:50:41 +00:00
|
|
|
class CVParamTransfer;
|
2016-02-06 00:34:40 +00:00
|
|
|
|
|
|
|
class CTexture
|
|
|
|
{
|
2016-02-16 05:50:41 +00:00
|
|
|
ETexelFormat x0_fmt;
|
2016-02-06 00:34:40 +00:00
|
|
|
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-07-27 19:07:46 +00:00
|
|
|
boo::ITexture* m_paletteTex;
|
2016-12-23 06:41:39 +00:00
|
|
|
std::unique_ptr<u8[]> m_otex;
|
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);
|
2016-09-03 05:19:22 +00:00
|
|
|
void BuildRGBA8(const void* data, size_t length);
|
|
|
|
void BuildC8(const void* data, size_t length);
|
2016-02-16 05:50:41 +00:00
|
|
|
|
2016-02-06 00:34:40 +00:00
|
|
|
public:
|
2017-01-04 04:08:30 +00:00
|
|
|
CTexture(ETexelFormat, s16, s16, s32);
|
2016-12-23 06:41:39 +00:00
|
|
|
CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex);
|
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;}
|
2016-12-23 06:41:39 +00:00
|
|
|
ETexelFormat GetMemoryCardTexelFormat() const
|
|
|
|
{return x0_fmt == ETexelFormat::C8PC ? ETexelFormat::C8 : ETexelFormat::RGB5A3;}
|
2016-02-06 00:34:40 +00:00
|
|
|
u16 GetWidth() const {return x4_w;}
|
|
|
|
u16 GetHeight() const {return x6_h;}
|
2016-03-31 02:44:43 +00:00
|
|
|
void Load(int slot, EClampMode clamp) const;
|
2016-02-15 04:00:26 +00:00
|
|
|
boo::ITexture* GetBooTexture() {return m_booTex;}
|
2016-08-03 21:53:03 +00:00
|
|
|
boo::ITexture* GetPaletteTexture() {return m_paletteTex;}
|
2016-12-23 06:41:39 +00:00
|
|
|
std::unique_ptr<u8[]> BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut,
|
|
|
|
std::unique_ptr<u8[]>& paletteOut) const;
|
2016-02-06 00:34:40 +00:00
|
|
|
};
|
|
|
|
|
2016-04-01 01:00:37 +00:00
|
|
|
CFactoryFnReturn FTextureFactory(const urde::SObjectTag& tag,
|
|
|
|
std::unique_ptr<u8[]>&& in, u32 len,
|
2016-09-02 19:32:57 +00:00
|
|
|
const urde::CVParamTransfer& vparms,
|
|
|
|
CObjectReference* selfRef);
|
2016-02-16 05:50:41 +00:00
|
|
|
|
2016-02-06 00:34:40 +00:00
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CTEXTURE_HPP__
|