mirror of
https://github.com/zeldaret/ss
synced 2026-07-07 21:40:42 -04:00
LightTexture OK
This commit is contained in:
+1
-1
@@ -886,7 +886,7 @@ config.libs = [
|
||||
Object(Matching, "egg/gfx/eggIScnProc.cpp"),
|
||||
Object(NonMatching, "egg/gfx/eggLightManager.cpp"),
|
||||
Object(NonMatching, "egg/gfx/eggLightObject.cpp"),
|
||||
Object(NonMatching, "egg/gfx/eggLightTexture.cpp"),
|
||||
Object(Matching, "egg/gfx/eggLightTexture.cpp"),
|
||||
Object(Matching, "egg/gfx/eggLightTextureMgr.cpp"),
|
||||
Object(Matching, "egg/gfx/eggModelEx.cpp"),
|
||||
Object(Matching, "egg/gfx/eggPostEffectBase.cpp"),
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
/* 0x24 */ u8 mType;
|
||||
/* 0x25 */ u16 field_0x25;
|
||||
/* 0x27 */ u8 field_0x27;
|
||||
/* 0x28 */ u8 _0x28[4];
|
||||
/* 0x28 */ u32 field_0x28;
|
||||
/* 0x2C */ f32 field_0x2C;
|
||||
/* 0x30 */ u8 _0x30[4];
|
||||
/* 0x34 */ char mName2[32];
|
||||
@@ -54,9 +54,9 @@ public:
|
||||
static void initialize(u16 textureSize, Heap *pHeap);
|
||||
static void loadTextureFromResTimg(int index, EGG::ResTIMG *img);
|
||||
static void initDrawSetting(u16, u16, u16, u16);
|
||||
void addLight(const EGG::LightObject&);
|
||||
void addLight(const EGG::LightObject &);
|
||||
|
||||
void fn_804AC0E0(int, const GXColor&, bool);
|
||||
void fn_804AC0E0(int, const GXColor &, bool);
|
||||
void draw(int);
|
||||
static void beginDebugDraw();
|
||||
void debugDraw(int);
|
||||
@@ -64,30 +64,41 @@ public:
|
||||
const char *getName() const {
|
||||
return mName1;
|
||||
}
|
||||
|
||||
|
||||
f32 getFloat(u16 idx) const {
|
||||
return mpFloatData[idx];
|
||||
}
|
||||
|
||||
static void getTexDimensions(u16*, u16*, u16*, u16*, u16);
|
||||
|
||||
private:
|
||||
|
||||
static void fn_804AB270();
|
||||
static void fn_804AB310(const GXColor &color);
|
||||
static void fn_804AB440();
|
||||
static void fn_804AB600();
|
||||
|
||||
static void fn_804AC0A0(int, int*, int*);
|
||||
static void loadTextureData(int index, void *data, GXTexFmt fmt);
|
||||
void setFloat(u16 idx, f32 val) {
|
||||
mpFloatData[idx] = val;
|
||||
}
|
||||
|
||||
u8 getByte1(u16 idx) const {
|
||||
return mpByteData1[idx];
|
||||
}
|
||||
void offByte1(u16 idx) {
|
||||
mpByteData1[idx] &= ~1;
|
||||
}
|
||||
void onByte1(u16 idx) {
|
||||
mpByteData1[idx] |= 1;
|
||||
}
|
||||
|
||||
u8 getByte2(u16 idx) const {
|
||||
return mpByteData2[idx];
|
||||
}
|
||||
void setByte2(u16 idx, u8 val) const {
|
||||
mpByteData2[idx] = val;
|
||||
}
|
||||
|
||||
static void getTexDimensions(u16 *, u16 *, u16 *, u16 *, u16);
|
||||
|
||||
private:
|
||||
static void fn_804AB270();
|
||||
static void fn_804AB310(const GXColor &color);
|
||||
static void fn_804AB440();
|
||||
static void fn_804AB600();
|
||||
|
||||
static void fn_804AC0A0(int, int *, int *);
|
||||
static void loadTextureData(int index, void *data, GXTexFmt fmt);
|
||||
|
||||
// TODO enum
|
||||
int GetLightType() const {
|
||||
@@ -101,12 +112,12 @@ private:
|
||||
/* 0x37 */ u8 mLightType;
|
||||
/* 0x38 */ Vector3f field_0x38;
|
||||
/* 0x44 */ f32 *mpFloatData;
|
||||
/* 0x48 */ char *mpByteData1;
|
||||
/* 0x48 */ u8 *mpByteData1;
|
||||
/* 0x4C */ u8 *mpByteData2;
|
||||
/* 0x50 */ f32 field_0x50;
|
||||
/* 0x54 */ char mName1[0x20];
|
||||
/* 0x74 */ char mName2[0x20];
|
||||
/* 0x94 */ u16 field_0x94;
|
||||
/* 0x94 */ s16 field_0x94;
|
||||
/* 0x98 */ f32 field_0x98;
|
||||
/* 0x9C */ u8 field_0x9C;
|
||||
/* 0x9D */ u8 field_0x9D;
|
||||
@@ -114,7 +125,7 @@ private:
|
||||
/* 0x9F */ u8 field_0x9F;
|
||||
|
||||
static u16 sTextureSize;
|
||||
|
||||
|
||||
static u16 sDrawWidth;
|
||||
static u16 sDrawHeight;
|
||||
static u16 sDrawPosX;
|
||||
|
||||
@@ -227,7 +227,7 @@ LightTexture::LightTexture(const char *name, const LightTextureManager *mgr)
|
||||
}
|
||||
field_0x9C = 0;
|
||||
mpFloatData = new float[mNumData];
|
||||
mpByteData1 = new char[mNumData];
|
||||
mpByteData1 = new u8[mNumData];
|
||||
mpByteData2 = new u8[mNumData];
|
||||
for (int i = 0; i < mNumData; i++) {
|
||||
mpByteData2[i] = 0;
|
||||
@@ -590,9 +590,129 @@ void LightTexture::addLight(const EGG::LightObject &obj) {
|
||||
|
||||
field_0x9F++;
|
||||
}
|
||||
|
||||
void LightTexture::SetBinaryInner(const Bin &bin) {
|
||||
// TODO
|
||||
switch (bin.mHeader.mVersion) {
|
||||
case 0: {
|
||||
const struct Data {
|
||||
/* 0x00 */ u16 mNumEntries;
|
||||
/* 0x02 */ u8 _pad_02[2];
|
||||
/* 0x04 */ char mName[32];
|
||||
/* 0x24 */ u8 mType;
|
||||
/* 0x25 */ u8 _pad_25[3];
|
||||
/* 0x28 */ u32 field_0x28;
|
||||
/* 0x2C */ SubData mSubData[1];
|
||||
} &data = *(const Data *)&bin.mData;
|
||||
mLightType = data.mType;
|
||||
int numData = (u16)MIN(data.mNumEntries, (u16)mNumData);
|
||||
|
||||
const SubData *pSub = data.mSubData;
|
||||
for (int i = 0; numData > 0; numData--, i++, pSub++) {
|
||||
if (data.field_0x28 & (1 << i)) {
|
||||
onByte1(i);
|
||||
} else {
|
||||
offByte1(i);
|
||||
}
|
||||
setFloat(i, pSub->mIntensity);
|
||||
setByte2(i, pSub->mGradientUsed);
|
||||
}
|
||||
|
||||
field_0x35 = 0;
|
||||
field_0x50 = 1.f;
|
||||
field_0x36 &= ~1;
|
||||
field_0x36 &= ~2;
|
||||
mName2[0] = '\0';
|
||||
field_0x94 = -1;
|
||||
|
||||
} break;
|
||||
case 1:
|
||||
case 2: {
|
||||
const struct Data {
|
||||
/* 0x00 */ u16 mNumEntries;
|
||||
/* 0x02 */ u8 field_0x02;
|
||||
/* 0x03 */ u8 field_0x03;
|
||||
/* 0x04 */ char mName[32];
|
||||
/* 0x24 */ u8 mType;
|
||||
/* 0x25 */ u8 _pad_25[3];
|
||||
/* 0x28 */ u32 field_0x28;
|
||||
/* 0x2C */ f32 field_0x2C;
|
||||
/* 0x30 */ u8 _30[8];
|
||||
/* 0x38 */ SubData mSubData[1];
|
||||
} &data = *(const Data *)&bin.mData;
|
||||
|
||||
mLightType = data.mType;
|
||||
int numData = (u16)MIN(data.mNumEntries, (u16)mNumData);
|
||||
|
||||
const SubData *pSub = data.mSubData;
|
||||
for (int i = 0; numData > 0; numData--, i++, pSub++) {
|
||||
if (bin.mHeader.mVersion == 1) {
|
||||
if (data.field_0x28 & (1 << i)) {
|
||||
onByte1(i);
|
||||
} else {
|
||||
offByte1(i);
|
||||
}
|
||||
} else if (pSub->field_0x05 & 1) {
|
||||
onByte1(i);
|
||||
} else {
|
||||
offByte1(i);
|
||||
}
|
||||
setFloat(i, pSub->mIntensity);
|
||||
setByte2(i, pSub->mGradientUsed);
|
||||
}
|
||||
|
||||
if (data.field_0x02 & 1) {
|
||||
field_0x36 |= 1;
|
||||
} else {
|
||||
field_0x36 &= ~1;
|
||||
}
|
||||
|
||||
field_0x35 = data.field_0x03;
|
||||
field_0x50 = data.field_0x2C;
|
||||
field_0x36 &= ~2;
|
||||
mName2[0] = '\0';
|
||||
field_0x94 = -1;
|
||||
field_0x98 = 1.f;
|
||||
|
||||
} break;
|
||||
case 3: {
|
||||
const BinData &data = bin.mData;
|
||||
mLightType = data.mType;
|
||||
int numData = (u16)MIN(data.mNumEntries, (u16)mNumData);
|
||||
|
||||
const SubData *pSub = data.mSubData;
|
||||
for (int i = 0; numData > 0; numData--, i++, pSub++) {
|
||||
if (bin.mHeader.mVersion == 1) {
|
||||
if (data.field_0x28 & (1 << i)) {
|
||||
onByte1(i);
|
||||
} else {
|
||||
offByte1(i);
|
||||
}
|
||||
} else if (pSub->field_0x05 & 1) {
|
||||
onByte1(i);
|
||||
} else {
|
||||
offByte1(i);
|
||||
}
|
||||
setFloat(i, pSub->mIntensity);
|
||||
setByte2(i, pSub->mGradientUsed);
|
||||
}
|
||||
|
||||
if (data.field_0x02 & 1) {
|
||||
field_0x36 |= 1;
|
||||
} else {
|
||||
field_0x36 &= ~1;
|
||||
}
|
||||
field_0x35 = data.field_0x03;
|
||||
field_0x50 = data.field_0x2C;
|
||||
|
||||
if (data.field_0x02 & 2) {
|
||||
field_0x36 |= 2;
|
||||
} else {
|
||||
field_0x36 &= ~2;
|
||||
}
|
||||
std::strcpy(mName2, data.mName2);
|
||||
field_0x94 = -1;
|
||||
field_0x98 = data.field_0x54;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void LightTexture::GetBinaryInner(Bin *pOutBin) const {
|
||||
|
||||
Reference in New Issue
Block a user