mirror of https://github.com/AxioDL/metaforce.git
Add texture info lookup
This commit is contained in:
parent
f46648f1ec
commit
b507799478
|
@ -59,7 +59,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CTexture(ETexelFormat, s16, s16, s32);
|
CTexture(ETexelFormat, s16, s16, s32);
|
||||||
CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex);
|
CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex, const CTextureInfo* inf);
|
||||||
enum class EClampMode { None, One };
|
enum class EClampMode { None, One };
|
||||||
ETexelFormat GetTexelFormat() const { return x0_fmt; }
|
ETexelFormat GetTexelFormat() const { return x0_fmt; }
|
||||||
ETexelFormat GetMemoryCardTexelFormat() const {
|
ETexelFormat GetMemoryCardTexelFormat() const {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
#include "CTexture.hpp"
|
#include "Runtime/Graphics/CTexture.hpp"
|
||||||
#include "CSimplePool.hpp"
|
|
||||||
#include "CToken.hpp"
|
#include "Runtime/CSimplePool.hpp"
|
||||||
#include "Graphics/CGraphics.hpp"
|
#include "Runtime/CToken.hpp"
|
||||||
|
#include "Runtime/Graphics/CGraphics.hpp"
|
||||||
#include "Runtime/CTextureCache.hpp"
|
#include "Runtime/CTextureCache.hpp"
|
||||||
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
static logvisor::Module Log("urde::CTextureBoo");
|
static logvisor::Module Log("urde::CTextureBoo");
|
||||||
|
@ -691,7 +693,7 @@ void CTexture::BuildDXT3(const void* data, size_t length) {
|
||||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||||
m_booTex =
|
m_booTex =
|
||||||
ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::DXT3, boo::TextureClampMode::Repeat, data, length)
|
ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::DXT3, boo::TextureClampMode::Repeat, data, length)
|
||||||
.get();
|
.get();
|
||||||
return true;
|
return true;
|
||||||
} BooTrace);
|
} BooTrace);
|
||||||
}
|
}
|
||||||
|
@ -704,7 +706,8 @@ CTexture::CTexture(ETexelFormat fmt, s16 w, s16 h, s32 mips) : x0_fmt(fmt), x4_w
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex) {
|
CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex, const CTextureInfo* inf) {
|
||||||
|
m_textureInfo = inf;
|
||||||
std::unique_ptr<u8[]> owned = std::move(in);
|
std::unique_ptr<u8[]> owned = std::move(in);
|
||||||
athena::io::MemoryReader r(owned.get(), length);
|
athena::io::MemoryReader r(owned.get(), length);
|
||||||
x0_fmt = ETexelFormat(r.readUint32Big());
|
x0_fmt = ETexelFormat(r.readUint32Big());
|
||||||
|
@ -864,7 +867,9 @@ const boo::ObjToken<boo::ITexture>& CTexture::GetFontTexture(EFontType tp) {
|
||||||
CFactoryFnReturn FTextureFactory(const urde::SObjectTag& tag, std::unique_ptr<u8[]>&& in, u32 len,
|
CFactoryFnReturn FTextureFactory(const urde::SObjectTag& tag, std::unique_ptr<u8[]>&& in, u32 len,
|
||||||
const urde::CVParamTransfer& vparms, CObjectReference* selfRef) {
|
const urde::CVParamTransfer& vparms, CObjectReference* selfRef) {
|
||||||
u32 u32Owned = vparms.GetOwnedObj<u32>();
|
u32 u32Owned = vparms.GetOwnedObj<u32>();
|
||||||
return TToken<CTexture>::GetIObjObjectFor(std::make_unique<CTexture>(std::move(in), len, u32Owned == SBIG('OTEX')));
|
const CTextureInfo* inf = g_TextureCache->GetTextureInfo(tag.id);
|
||||||
|
return TToken<CTexture>::GetIObjObjectFor(
|
||||||
|
std::make_unique<CTexture>(std::move(in), len, u32Owned == SBIG('OTEX'), inf));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
Loading…
Reference in New Issue