summaryrefslogtreecommitdiff
path: root/include/egg
diff options
context:
space:
mode:
authorelijah-thomas774 <elijahthomas774@gmail.com>2025-03-23 21:01:23 -0400
committerelijah-thomas774 <elijahthomas774@gmail.com>2025-03-23 21:01:23 -0400
commit922f04831486a555f34da2db20312183491ef03e (patch)
tree6df087662eb3b485cba0addfc53a156fe4ded5de /include/egg
parent31728178d9d83de43cb1dfd9a1ff1f8cf568edd6 (diff)
parent263813895ae1319ba125a4286c38892b0b478db5 (diff)
Merge branch '🥚' of https://github.com/robojumper/ss into pr/142
Diffstat (limited to 'include/egg')
-rw-r--r--include/egg/gfx/eggG3DUtility.h2
-rw-r--r--include/egg/gfx/eggLightManager.h61
-rw-r--r--include/egg/gfx/eggLightObject.h48
-rw-r--r--include/egg/gfx/eggLightTextureMgr.h1
4 files changed, 99 insertions, 13 deletions
diff --git a/include/egg/gfx/eggG3DUtility.h b/include/egg/gfx/eggG3DUtility.h
index cc1c9175..bb26c177 100644
--- a/include/egg/gfx/eggG3DUtility.h
+++ b/include/egg/gfx/eggG3DUtility.h
@@ -18,6 +18,8 @@ public:
void *param_6, int param_7, int param_8
);
+ static void setUpLightSet(nw4r::g3d::LightSetting&, nw4r::g3d::ResAnmScn, int);
+
private:
static MEMAllocator *sAllocator;
};
diff --git a/include/egg/gfx/eggLightManager.h b/include/egg/gfx/eggLightManager.h
index d1ed1cb8..c715dcef 100644
--- a/include/egg/gfx/eggLightManager.h
+++ b/include/egg/gfx/eggLightManager.h
@@ -4,6 +4,9 @@
#include "egg/egg_types.h"
#include "egg/gfx/eggLightObject.h"
#include "egg/prim/eggBinary.h"
+#include "nw4r/g3d/g3d_light.h"
+#include "nw4r/g3d/res/g3d_resanmamblight.h"
+#include "nw4r/g3d/res/g3d_resanmscn.h"
#include "nw4r/types_nw4r.h"
#include "rvl/GX/GXLight.h"
#include "rvl/GX/GXTypes.h"
@@ -20,18 +23,36 @@ class LightManager : public IBinary<LightManager> {
union Counts {
struct {
/* 0x00 */ u8 mNumEggLightObjects;
- /* 0x01 */ u8 mNumUnks;
+ /* 0x01 */ u8 mNumAmbientObjects;
};
};
- struct Unk1 {
- /* 0x00 */ GXColor mColor;
- /* 0x04 */ const char *mStr;
+ struct AmbientObject {
+ /* 0x00 */ nw4r::g3d::AmbLightObj mLightObj;
+ /* 0x04 */ const char *mLightName;
/* 0x08 */ u8 field_0x08;
};
public:
- struct BinData {};
+ struct BinAmbient {
+ /* 0x00 */ u8 field_0x00;
+ /* 0x01 */ u8 field_0x01;
+ /* 0x02 */ u8 field_0x02;
+ /* 0x03 */ u8 field_0x03;
+ /* 0x04 */ u8 field_0x04;
+ /* 0x05 */ u8 field_0x05;
+ /* 0x06 */ u8 field_0x06;
+ /* 0x07 */ u8 field_0x07;
+ };
+
+ struct BinData {
+ /* 0x00 */ u16 mNumLightObjects;
+ /* 0x02 */ u16 mNumAmbientObjects;
+ /* 0x04 */ GXColor mColor;
+ /* 0x08 */ u8 _0x08[0x18 - 0x08];
+ /* 0x18 */ LightObject::Bin mObjData[1];
+ };
+
// vt at 0x00
LightManager(u32, u32, u8);
virtual ~LightManager();
@@ -44,28 +65,46 @@ public:
virtual void CalcView(const nw4r::math::MTX34 &, u8, nw4r::g3d::ScnRoot *);
virtual void DoneDraw();
+ void LoadLightSet(int, u32 *, u32 *, u32 *, u32 *, GXColor *);
+
+ void LoadScnLightInner(nw4r::g3d::ResAnmScn, f32, s16, u32);
+
+ void AnmScnRes_GetAmbLightColor(AmbientObject *, nw4r::g3d::ResAnmAmbLight, f32) const;
+
+ void CopyToG3D_Ambient(nw4r::g3d::ScnRoot *) const;
+ void CopyToG3D_World(nw4r::g3d::ScnRoot *) const;
+ void CopyToG3D_View(nw4r::g3d::ScnRoot *, const nw4r::math::MTX34 &) const;
+
void BecomeInvalidLight(int);
LightTextureManager *GetTextureMgr() const {
return mpTextureMgr;
}
+ static u16 CheckedNumLightObjs(u8 num) {
+ return num < 8 ? num : 8;
+ }
+
+ const LightObject *GetLightObject(int i) const {
+ return &mpLightData[i].mLightObject;
+ }
+
LightObject *GetLightObject(int i) {
return &mpLightData[i].mLightObject;
}
- /* 0x04 */ Counts mCounts0x04;
- /* 0x06 */ Counts mCounts0x06;
+ /* 0x04 */ Counts mCounts;
+ /* 0x06 */ Counts mSavedCounts;
/* 0x08 */ LightData *mpLightData;
- /* 0x0C */ Unk1 *mpUnk1;
+ /* 0x0C */ AmbientObject *mpAmbientObjects;
/* 0x10 */ GXLightObj *mpLightObjs;
/* 0x14 */ LightTextureManager *mpTextureMgr;
/* 0x18 */ GXColor mColor;
- /* 0x1C */ u8 field_0x1C;
+ /* 0x1C */ u8 mNumGxObjsPerEggObj;
/* 0x1D */ u8 field_0x1D;
/* 0x1E */ u16 mFlags;
- /* 0x20 */ u32 field_0x20;
- /* 0x24 */ s16 field_0x24;
+ /* 0x20 */ nw4r::g3d::ResAnmScn mResAnmScn;
+ /* 0x24 */ s16 mRefNumber;
};
} // namespace EGG
diff --git a/include/egg/gfx/eggLightObject.h b/include/egg/gfx/eggLightObject.h
index ac7f8ceb..afef331c 100644
--- a/include/egg/gfx/eggLightObject.h
+++ b/include/egg/gfx/eggLightObject.h
@@ -7,12 +7,32 @@
#include "nw4r/math/math_types.h"
#include "rvl/GX/GXLight.h"
#include "rvl/GX/GXTypes.h"
+#include "rvl/MTX/mtx.h"
namespace EGG {
class LightObject : public IBinary<LightObject> {
public:
- struct BinData {};
+ struct BinData {
+ /* 0x00 */ u8 mSpotFn;
+ /* 0x01 */ u8 mDistAttnFn;
+ /* 0x02 */ u8 field_0x02;
+ /* 0x03 */ u8 field_0x03;
+ /* 0x04 */ u16 mIndex;
+ /* 0x06 */ u16 mFlags;
+ /* 0x08 */ Vec mPos;
+ /* 0x14 */ Vec mAt;
+ /* 0x20 */ f32 field_0x20;
+ /* 0x24 */ GXColor mWhite;
+ /* 0x28 */ GXColor mBlack;
+ /* 0x2C */ f32 field_0x2C;
+ /* 0x30 */ f32 field_0x30;
+ /* 0x34 */ f32 field_0x34;
+ /* 0x38 */ f32 field_0x38;
+ /* 0x3C */ u16 field_0x3C;
+ /* 0x3E */ u16 field_0x3E;
+ };
+
LightObject();
virtual ~LightObject() {}
@@ -66,10 +86,34 @@ public:
field_0xA0 = 0;
}
- void ClearFlag4() {
+ void ClearFlag2() {
mFlags = mFlags & 0xFFFE;
}
+ bool CheckFlag1() const {
+ return (mFlags & 1) != 0;
+ }
+
+ void SetOtherFlag1() {
+ field_0xA0 |= 1;
+ }
+
+ void ClearOtherFlag1() {
+ field_0xA0 = field_0xA0 & ~1;
+ }
+
+ bool CheckFlag2() const {
+ return (mFlags & 2) != 0;
+ }
+
+ u16 GetField0x06() const {
+ return field_0x06;
+ }
+
+ void UpdatePosAt(LightObject &other) {
+ SetPosAt(other.mPos, other.mAt);
+ }
+
private:
/* 0x04 */ u16 mIndex;
/* 0x06 */ u16 field_0x06;
diff --git a/include/egg/gfx/eggLightTextureMgr.h b/include/egg/gfx/eggLightTextureMgr.h
index 18e0cc8b..4225e0db 100644
--- a/include/egg/gfx/eggLightTextureMgr.h
+++ b/include/egg/gfx/eggLightTextureMgr.h
@@ -30,6 +30,7 @@ public:
int replaceModelTextures(nw4r::g3d::ResMdl) const;
int replaceModelTexture(u16, nw4r::g3d::ResMdl) const;
void drawAndCaptureTexture(f32, f32, f32, f32);
+ void frameReset();
// Inofficial
static const void *getLtexFromLmap(const void *lmap, u16 index);