mirror of
https://github.com/zeldaret/ss
synced 2026-07-11 22:50:06 -04:00
Rough outline for LightTextureManager
This commit is contained in:
@@ -12,13 +12,14 @@ class LightTextureManager;
|
||||
|
||||
class LightTexture : public CapTexture, public IBinary<LightTexture> {
|
||||
public:
|
||||
#pragma pack(push, 1)
|
||||
struct SubData {
|
||||
/* 0x00 */ f32 mIntensity;
|
||||
/* 0x04 */ u8 mGradientUsed;
|
||||
/* 0x05 */ u8 field_0x05;
|
||||
/* 0x06 */ u8 _0x06[2];
|
||||
};
|
||||
|
||||
|
||||
// Implicit +0x10 from BinHeader
|
||||
struct BinData {
|
||||
/* 0x00 */ u16 mNumEntries;
|
||||
@@ -26,29 +27,34 @@ public:
|
||||
/* 0x03 */ u8 field_0x03;
|
||||
/* 0x04 */ char mName[32];
|
||||
/* 0x24 */ u8 mType;
|
||||
/* 0x25 */ u8 _0x25[7];
|
||||
/* 0x25 */ u16 field_0x25;
|
||||
/* 0x27 */ u8 field_0x27;
|
||||
/* 0x28 */ u8 _0x28[4];
|
||||
/* 0x2C */ f32 field_0x2C;
|
||||
/* 0x30 */ u8 _0x30[4];
|
||||
/* 0x34 */ char mName2[32];
|
||||
/* 0x54 */ f32 field_0x54;
|
||||
|
||||
u8 _0x00[0x1D];
|
||||
u8 _0x00[0x20];
|
||||
SubData mSubData[1];
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
LightTexture(const char *name, const LightTextureManager *mgr);
|
||||
virtual ~LightTexture();
|
||||
|
||||
|
||||
virtual void configure() override; // at 0xC
|
||||
|
||||
virtual void SetBinaryInner(const Bin &) override;
|
||||
virtual void GetBinaryInner(Bin *) const override;
|
||||
virtual size_t GetBinarySize() const override;
|
||||
|
||||
|
||||
static void initialize(u16 textureSize, Heap *pHeap);
|
||||
|
||||
private:
|
||||
const char *getName() const {
|
||||
return mName1;
|
||||
}
|
||||
|
||||
private:
|
||||
f32 getFloat(u16 idx) const {
|
||||
return mpFloatData[idx];
|
||||
}
|
||||
|
||||
@@ -1,29 +1,57 @@
|
||||
#ifndef EGG_LIGHT_TEXTURE_MGR_H
|
||||
#define EGG_LIGHT_TEXTURE_MGR_H
|
||||
|
||||
|
||||
#include "egg/gfx/eggLightTexture.h"
|
||||
#include "egg/prim/eggBinary.h"
|
||||
#include "nw4r/g3d/res/g3d_resmdl.h"
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class LightManager;
|
||||
class LightObject;
|
||||
|
||||
class LightTextureManager : public IBinary<LightTextureManager> {
|
||||
public:
|
||||
struct BinData {};
|
||||
struct BinData {
|
||||
u16 mDataCount;
|
||||
u8 _0x02[14];
|
||||
BinHeader mSubData[1];
|
||||
};
|
||||
LightTextureManager(const LightManager *lightMgr);
|
||||
virtual ~LightTextureManager();
|
||||
virtual void SetBinaryInner(const Bin &) override;
|
||||
virtual void GetBinaryInner(Bin *) const override;
|
||||
virtual size_t GetBinarySize() const override;
|
||||
|
||||
void replaceModelTextures(nw4r::g3d::ResMdl) const;
|
||||
u16 createTexture(const char *name);
|
||||
bool setBinaryToTexture(const void *data);
|
||||
bool deleteTexture(int idx);
|
||||
|
||||
void replaceModelTextures(nw4r::g3d::ResMdl) const;
|
||||
void drawAndCaptureTexture(f32, f32, f32, f32);
|
||||
|
||||
// Inofficial
|
||||
static const void *getLtexFromLmap(const void *lmap, u16 index);
|
||||
int createTexturesFromBin(const void *bin);
|
||||
u16 createTextureFromBin(const void *bin);
|
||||
|
||||
u16 getMaxNumLightTextures() const {
|
||||
return mMaxNumTextures;
|
||||
}
|
||||
|
||||
u16 getNumLightTextures() const {
|
||||
return mTextureCount;
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x04 */ u8 field_0x04;
|
||||
/* 0x06 */ u16 mTextureCount;
|
||||
/* 0x08 */ LightTexture **mpTextures;
|
||||
/* 0x0C */ const LightManager *mpLightMgr;
|
||||
/* 0x10 */ u32 field_0x10;
|
||||
/* 0x14 */ u16 mMaxNumTextures;
|
||||
/* 0x16 */ u8 field_0x16;
|
||||
/* 0x18 */ LightObject **mpObjects;
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -92,6 +92,7 @@ public:
|
||||
|
||||
|
||||
static u16 s_commandFlag;
|
||||
static u16 s_flag;
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -53,11 +53,17 @@ public:
|
||||
// These functions below are automatically provided, you should not need to
|
||||
// touch them to implement de-/serialization for your type. They will parse
|
||||
// the binary header and then invoke the above virtual functions.
|
||||
void GetBinary(void *pData) const;
|
||||
void SetBinary(const void *);
|
||||
void GetBinary(void *pData) const;
|
||||
void SetBinaryBlend(const void *a, const void *b, f32 blend);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void IBinary<T>::SetBinary(const void *a) {
|
||||
const Bin *pBinA = reinterpret_cast<const Bin *>(a);
|
||||
SetBinaryInner(*pBinA);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void IBinary<T>::GetBinary(void *pData) const {
|
||||
Bin *pBin = reinterpret_cast<Bin *>(pData);
|
||||
@@ -74,12 +80,6 @@ void IBinary<T>::GetBinary(void *pData) const {
|
||||
GetBinaryInner(pBin);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void IBinary<T>::SetBinary(const void *a) {
|
||||
const Bin *pBinA = reinterpret_cast<const Bin *>(a);
|
||||
SetBinaryInner(*pBinA);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void IBinary<T>::SetBinaryBlend(const void *a, const void *b, f32 blend) {
|
||||
const Bin *pBinA = reinterpret_cast<const Bin *>(a);
|
||||
|
||||
Reference in New Issue
Block a user