From b3e8dc4d58d6c962469a5b0f1c22f198414d3589 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sun, 21 Dec 2025 00:35:20 -0500 Subject: [PATCH] Reorganize J3D structs (no change in weak order) --- include/JSystem/J3DGraphBase/J3DMatBlock.h | 235 +++++---------------- include/JSystem/J3DGraphBase/J3DStruct.h | 216 +++++++++++++++++-- include/JSystem/J3DGraphBase/J3DTevs.h | 152 ++++++------- include/JSystem/J3DGraphBase/J3DTexture.h | 16 -- src/JSystem/J3DGraphBase/J3DMatBlock.cpp | 10 - 5 files changed, 312 insertions(+), 317 deletions(-) diff --git a/include/JSystem/J3DGraphBase/J3DMatBlock.h b/include/JSystem/J3DGraphBase/J3DMatBlock.h index 4b082e193e4..256e95deb50 100644 --- a/include/JSystem/J3DGraphBase/J3DMatBlock.h +++ b/include/JSystem/J3DGraphBase/J3DMatBlock.h @@ -63,53 +63,6 @@ struct J3DGXColor : public GXColor { } }; -extern const J3DNBTScaleInfo j3dDefaultNBTScaleInfo; - -/** - * @ingroup jsystem-j3d - * - */ -struct J3DNBTScale : public J3DNBTScaleInfo { - J3DNBTScale() { - mbHasScale = j3dDefaultNBTScaleInfo.mbHasScale; - mScale.x = j3dDefaultNBTScaleInfo.mScale.x; - mScale.y = j3dDefaultNBTScaleInfo.mScale.y; - mScale.z = j3dDefaultNBTScaleInfo.mScale.z; - } - - J3DNBTScale(J3DNBTScaleInfo const& info) { - mbHasScale = info.mbHasScale; - mScale.x = info.mScale.x; - mScale.y = info.mScale.y; - mScale.z = info.mScale.z; - } - - Vec* getScale() { return &mScale; } -}; - -/** - * @ingroup jsystem-j3d - * - */ -struct J3DColorChanInfo { - /* 0x0 */ u8 mEnable; - /* 0x1 */ u8 mMatSrc; - /* 0x2 */ u8 mLightMask; - /* 0x3 */ u8 mDiffuseFn; - /* 0x4 */ u8 mAttnFn; - /* 0x5 */ u8 mAmbSrc; - /* 0x6 */ u8 pad[2]; -}; - -extern const J3DColorChanInfo j3dDefaultColorChanInfo; - -static inline u32 setChanCtrlMacro(u8 enable, GXColorSrc ambSrc, GXColorSrc matSrc, u32 lightMask, - GXDiffuseFn diffuseFn, GXAttnFn attnFn) { - return matSrc << 0 | enable << 1 | (lightMask & 0x0F) << 2 | ambSrc << 6 | - ((attnFn == GX_AF_SPEC) ? GX_DF_NONE : diffuseFn) << 7 | (attnFn != GX_AF_NONE) << 9 | - (attnFn != GX_AF_SPEC) << 10 | (lightMask >> 4 & 0x0F) << 11; -} - inline u16 calcColorChanID(u16 enable, u8 matSrc, u8 lightMask, u8 diffuseFn, u8 attnFn, u8 ambSrc) { u32 reg = 0; reg = (reg & ~0x0002) | enable << 1; @@ -129,6 +82,13 @@ inline u16 calcColorChanID(u16 enable, u8 matSrc, u8 lightMask, u8 diffuseFn, u8 return reg; } +static inline u32 setChanCtrlMacro(u8 enable, GXColorSrc ambSrc, GXColorSrc matSrc, u32 lightMask, + GXDiffuseFn diffuseFn, GXAttnFn attnFn) { + return matSrc << 0 | enable << 1 | (lightMask & 0x0F) << 2 | ambSrc << 6 | + ((attnFn == GX_AF_SPEC) ? GX_DF_NONE : diffuseFn) << 7 | (attnFn != GX_AF_NONE) << 9 | + (attnFn != GX_AF_SPEC) << 10 | (lightMask >> 4 & 0x0F) << 11; +} + #ifdef DECOMPCTX // Hack to mitigate fake mismatches when building from decompctx output - // see comment in sqrtf in math.h @@ -139,7 +99,8 @@ static u8 AttnArr[] = {2, 0, 2, 1}; * @ingroup jsystem-j3d * */ -struct J3DColorChan { +class J3DColorChan { +public: J3DColorChan() { setColorChanInfo(j3dDefaultColorChanInfo); } @@ -438,6 +399,16 @@ public: /* 0x48 */ u32 mColorChanOffset; }; // Size: 0x4C +/** + * @ingroup jsystem-j3d + * + */ +class J3DColorBlockNull : public J3DColorBlock { +public: + virtual u32 getType() { return 'CLNL'; } + virtual ~J3DColorBlockNull() {} +}; + /** * @ingroup jsystem-j3d * @@ -471,20 +442,6 @@ public: virtual ~J3DTexGenBlock() {} }; -struct J3DTexGenBlockNull : public J3DTexGenBlock { - virtual void calc(f32 const (*)[4]) {} - virtual void calcWithoutViewMtx(f32 const (*)[4]) {} - virtual void calcPostTexMtx(f32 const (*)[4]) {} - virtual void calcPostTexMtxWithoutViewMtx(f32 const (*)[4]) {} - virtual void load() {} - virtual void patch() {} - virtual void diff(u32) {} - virtual void diffTexMtx() {} - virtual void diffTexGen() {} - virtual u32 getType() { return 'TGNL'; } - virtual ~J3DTexGenBlockNull() {} -}; - /** * @ingroup jsystem-j3d * @@ -595,6 +552,21 @@ public: /* 0x5C */ J3DNBTScale mNBTScale; }; // Size: 0x6C +class J3DTexGenBlockNull : public J3DTexGenBlock { +public: + virtual void calc(f32 const (*)[4]) {} + virtual void calcWithoutViewMtx(f32 const (*)[4]) {} + virtual void calcPostTexMtx(f32 const (*)[4]) {} + virtual void calcPostTexMtxWithoutViewMtx(f32 const (*)[4]) {} + virtual void load() {} + virtual void patch() {} + virtual void diff(u32) {} + virtual void diffTexMtx() {} + virtual void diffTexGen() {} + virtual u32 getType() { return 'TGNL'; } + virtual ~J3DTexGenBlockNull() {} +}; + /** * @ingroup jsystem-j3d * @@ -604,11 +576,11 @@ public: virtual void reset(J3DTevBlock*) {} virtual void load() {} virtual void diff(u32); - virtual void diffTexNo(); - virtual void diffTevReg(); - virtual void diffTexCoordScale(); - virtual void diffTevStage(); - virtual void diffTevStageIndirect(); + virtual void diffTexNo() {} + virtual void diffTevReg() {} + virtual void diffTexCoordScale() {} + virtual void diffTevStage() {} + virtual void diffTevStageIndirect() {} virtual void patch() {} virtual void patchTexNo() {} virtual void patchTevReg() {} @@ -1436,23 +1408,10 @@ public: /* 0x170 */ u32 mTevRegOffset; }; // Size: 0x174 -extern const u16 j3dDefaultZModeID; - inline u16 calcZModeID(u8 param_0, u8 param_1, u8 param_2) { return param_1 * 2 + param_0 * 0x10 + param_2; } -/** - * @ingroup jsystem-j3d - * - */ -struct J3DZModeInfo { - /* 0x0 */ u8 field_0x0; - /* 0x1 */ u8 field_0x1; - /* 0x2 */ u8 field_0x2; - /* 0x3 */ u8 pad; -}; - extern u8 j3dZModeTable[96]; /** @@ -1499,22 +1458,6 @@ struct J3DZMode { /* 0x0 */ u16 mZModeID; }; -/** - * @ingroup jsystem-j3d - * - */ -struct J3DBlendInfo { - void operator=(J3DBlendInfo const& other) { - __memcpy(this, &other, sizeof(J3DBlendInfo)); - } - /* 0x0 */ u8 mType; - /* 0x1 */ u8 mSrcFactor; - /* 0x2 */ u8 mDstFactor; - /* 0x3 */ u8 mOp; -}; - -extern const J3DBlendInfo j3dDefaultBlendInfo; - /** * @ingroup jsystem-j3d * @@ -1543,8 +1486,6 @@ struct J3DBlend : public J3DBlendInfo { void setBlendInfo(const J3DBlendInfo& i_blendInfo) { *static_cast(this) = i_blendInfo; } }; -extern const J3DFogInfo j3dDefaultFogInfo; - /** * @ingroup jsystem-j3d * @@ -1562,32 +1503,6 @@ struct J3DFog : public J3DFogInfo { } }; -/** - * @ingroup jsystem-j3d - * - */ -struct J3DAlphaCompInfo { - /* 0x0 */ u8 mComp0; - /* 0x1 */ u8 mRef0; - /* 0x2 */ u8 mOp; - /* 0x3 */ u8 mComp1; - /* 0x4 */ u8 mRef1; - /* 0x5 */ u8 field_0x5; - /* 0x6 */ u8 field_0x6; - /* 0x7 */ u8 field_0x7; - - J3DAlphaCompInfo& operator=(const J3DAlphaCompInfo& other) { - mComp0 = other.mComp0; - mRef0 = other.mRef0; - mOp = other.mOp; - mComp1 = other.mComp1; - mRef1 = other.mRef1; - return *this; - } -}; - -extern const u16 j3dDefaultAlphaCmpID; - inline u16 calcAlphaCmpID(u8 comp0, u8 op, u8 comp1) { return (comp0 << 5) + (op << 3) + (comp1); } @@ -1643,23 +1558,6 @@ struct J3DAlphaComp { /* 0x03 */ u8 mRef1; }; // Size: 0x4 -/** - * @ingroup jsystem-j3d - * - */ -struct J3DIndTexOrderInfo { - /* 0x0 */ u8 mCoord; - /* 0x1 */ u8 mMap; - /* 0x2 */ u8 field_0x2; - /* 0x3 */ u8 field_0x3; - - void operator=(J3DIndTexOrderInfo const& other) { - __memcpy(this, &other, sizeof(J3DIndTexOrderInfo)); - } -}; // Size: 0x04 - -extern const J3DIndTexOrderInfo j3dDefaultIndTexOrderNull; - /** * @ingroup jsystem-j3d * @@ -1684,8 +1582,6 @@ struct J3DIndTexOrder : public J3DIndTexOrderInfo { u8 getCoord() const { return (GXTexCoordID)mCoord; } }; // Size: 0x04 -extern J3DIndTexMtxInfo const j3dDefaultIndTexMtxInfo; - /** * @ingroup jsystem-j3d * @@ -1702,24 +1598,6 @@ struct J3DIndTexMtx : public J3DIndTexMtxInfo { } }; // Size: 0x1C -/** - * @ingroup jsystem-j3d - * - */ -struct J3DIndTexCoordScaleInfo { - /* 0x0 */ u8 mScaleS; - /* 0x1 */ u8 mScaleT; - /* 0x2 */ u8 field_0x2; - /* 0x3 */ u8 field_0x3; - - J3DIndTexCoordScaleInfo& operator=(const J3DIndTexCoordScaleInfo& other) { - __memcpy(this, &other, sizeof(J3DIndTexCoordScaleInfo)); - return *this; - } -}; // Size: 0x4 - -extern const J3DIndTexCoordScaleInfo j3dDefaultIndTexCoordScaleInfo; - /** * @ingroup jsystem-j3d * @@ -1774,19 +1652,6 @@ public: virtual ~J3DIndBlock() {} }; -/** - * @ingroup jsystem-j3d - * - */ -class J3DIndBlockNull : public J3DIndBlock { -public: - virtual void diff(u32) {} - virtual void load() {} - virtual void reset(J3DIndBlock*) {} - virtual u32 getType() { return 'IBLN'; } - virtual ~J3DIndBlockNull() {} -}; - /** * @ingroup jsystem-j3d * @@ -1852,6 +1717,19 @@ public: /* 0x6C */ J3DIndTexCoordScale mIndTexCoordScale[4]; }; // Size: 0x7C +/** + * @ingroup jsystem-j3d + * + */ +class J3DIndBlockNull : public J3DIndBlock { +public: + virtual void diff(u32) {} + virtual void load() {} + virtual void reset(J3DIndBlock*) {} + virtual u32 getType() { return 'IBLN'; } + virtual ~J3DIndBlockNull() {} +}; + /** * @ingroup jsystem-j3d * @@ -2056,13 +1934,4 @@ public: /* 0x3C */ u32 mFogOffset; }; // Size: 0x40 -/** - * @ingroup jsystem-j3d - * - */ -struct J3DColorBlockNull : public J3DColorBlock { - virtual u32 getType() { return 'CLNL'; } - virtual ~J3DColorBlockNull() {} -}; - #endif /* J3DMATBLOCK_H */ diff --git a/include/JSystem/J3DGraphBase/J3DStruct.h b/include/JSystem/J3DGraphBase/J3DStruct.h index 24fdb5c265f..3f9bafe12ce 100644 --- a/include/JSystem/J3DGraphBase/J3DStruct.h +++ b/include/JSystem/J3DGraphBase/J3DStruct.h @@ -4,13 +4,13 @@ #include #include "dolphin/mtx.h" #include "dolphin/mtx.h" +#include "global.h" /** * @ingroup jsystem-j3d * */ -class J3DLightInfo { -public: +struct J3DLightInfo { J3DLightInfo& operator=(J3DLightInfo const&); /* 0x00 */ Vec mLightPosition; @@ -20,27 +20,6 @@ public: /* 0x28 */ Vec mDistAtten; }; // Size = 0x34 -extern "C" extern J3DLightInfo const j3dDefaultLightInfo; - -/** - * @ingroup jsystem-j3d - * - */ -class J3DLightObj { -public: - J3DLightObj() { mInfo = j3dDefaultLightInfo; } - void load(u32) const; - - J3DLightInfo* getLightInfo() { return &mInfo; } - J3DLightObj& operator=(J3DLightObj const& other) { - mInfo = other.mInfo; - return *this; - } - - /* 0x00 */ J3DLightInfo mInfo; - /* 0x34 */ GXLightObj mLightObj; -}; // Size = 0x74 - /** * @ingroup jsystem-j3d * @@ -146,4 +125,195 @@ struct J3DNBTScaleInfo { /* 0x4 */ Vec mScale; }; // Size: 0x10 +/** + * @ingroup jsystem-j3d + * + */ +struct J3DIndTexOrderInfo { + /* 0x0 */ u8 mCoord; + /* 0x1 */ u8 mMap; + /* 0x2 */ u8 field_0x2; + /* 0x3 */ u8 field_0x3; + + void operator=(J3DIndTexOrderInfo const& other) { + __memcpy(this, &other, sizeof(J3DIndTexOrderInfo)); + } +}; // Size: 0x04 + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DTevSwapModeInfo { + /* 0x0 */ u8 mRasSel; + /* 0x1 */ u8 mTexSel; + /* 0x2 */ u8 field_0x2; + /* 0x3 */ u8 field_0x3; +}; // Size: 0x4 + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DTevSwapModeTableInfo { + /* 0x0 */ u8 field_0x0; + /* 0x1 */ u8 field_0x1; + /* 0x2 */ u8 field_0x2; + /* 0x3 */ u8 field_0x3; +}; // Size: 0x4 + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DTevStageInfo { + /* 0x0 */ u8 field_0x0; + /* 0x1 */ u8 mTevColorOp; + /* 0x2 */ u8 mTevColorAB; + /* 0x3 */ u8 mTevColorCD; + /* 0x4 */ u8 field_0x4; + /* 0x5 */ u8 mTevAlphaOp; + /* 0x6 */ u8 mTevAlphaAB; + /* 0x7 */ u8 mTevSwapModeInfo; + /* 0x8 */ u8 field_0x8; + /* 0x8 */ u8 field_0x9; + /* 0x8 */ u8 field_0xa; + /* 0x8 */ u8 field_0xb; + /* 0x8 */ u8 field_0xc; + /* 0x8 */ u8 field_0xd; + /* 0x8 */ u8 field_0xe; + /* 0x8 */ u8 field_0xf; + /* 0x8 */ u8 field_0x10; + /* 0x8 */ u8 field_0x11; + /* 0x8 */ u8 field_0x12; + /* 0x8 */ u8 field_0x13; +}; + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DIndTevStageInfo { + /* 0x0 */ u8 mIndStage; + /* 0x1 */ u8 mIndFormat; + /* 0x2 */ u8 mBiasSel; + /* 0x3 */ u8 mMtxSel; + /* 0x4 */ u8 mWrapS; + /* 0x5 */ u8 mWrapT; + /* 0x6 */ u8 mPrev; + /* 0x7 */ u8 mLod; + /* 0x8 */ u8 mAlphaSel; + /* 0x9 */ u8 pad[3]; +}; + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DTexCoordInfo { + /* 0x0 */ u8 mTexGenType; + /* 0x1 */ u8 mTexGenSrc; + /* 0x2 */ u8 mTexGenMtx; + /* 0x3 */ u8 pad; + + J3DTexCoordInfo& operator=(const J3DTexCoordInfo& other) { + __memcpy(this, &other, sizeof(J3DTexCoordInfo)); + return *this; + } +}; + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DIndTexCoordScaleInfo { + /* 0x0 */ u8 mScaleS; + /* 0x1 */ u8 mScaleT; + /* 0x2 */ u8 field_0x2; + /* 0x3 */ u8 field_0x3; + + J3DIndTexCoordScaleInfo& operator=(const J3DIndTexCoordScaleInfo& other) { + __memcpy(this, &other, sizeof(J3DIndTexCoordScaleInfo)); + return *this; + } +}; // Size: 0x4 + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DBlendInfo { + void operator=(J3DBlendInfo const& other) { + __memcpy(this, &other, sizeof(J3DBlendInfo)); + } + /* 0x0 */ u8 mType; + /* 0x1 */ u8 mSrcFactor; + /* 0x2 */ u8 mDstFactor; + /* 0x3 */ u8 mOp; +}; + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DTevOrderInfo { + void operator=(const J3DTevOrderInfo& other) { + *(u32*) this = *(u32*)&other; + } + + /* 0x0 */ u8 mTexCoord; + /* 0x1 */ u8 mTexMap; + /* 0x2 */ u8 mColorChan; + /* 0x3 */ u8 field_0x3; // Maybe padding +}; + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DColorChanInfo { + /* 0x0 */ u8 mEnable; + /* 0x1 */ u8 mMatSrc; + /* 0x2 */ u8 mLightMask; + /* 0x3 */ u8 mDiffuseFn; + /* 0x4 */ u8 mAttnFn; + /* 0x5 */ u8 mAmbSrc; + /* 0x6 */ u8 pad[2]; +}; + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DZModeInfo { + /* 0x0 */ u8 field_0x0; + /* 0x1 */ u8 field_0x1; + /* 0x2 */ u8 field_0x2; + /* 0x3 */ u8 pad; +}; + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DAlphaCompInfo { + /* 0x0 */ u8 mComp0; + /* 0x1 */ u8 mRef0; + /* 0x2 */ u8 mOp; + /* 0x3 */ u8 mComp1; + /* 0x4 */ u8 mRef1; + /* 0x5 */ u8 field_0x5; + /* 0x6 */ u8 field_0x6; + /* 0x7 */ u8 field_0x7; + + J3DAlphaCompInfo& operator=(const J3DAlphaCompInfo& other) { + mComp0 = other.mComp0; + mRef0 = other.mRef0; + mOp = other.mOp; + mComp1 = other.mComp1; + mRef1 = other.mRef1; + return *this; + } +}; + #endif /* J3DSTRUCT_H */ diff --git a/include/JSystem/J3DGraphBase/J3DTevs.h b/include/JSystem/J3DGraphBase/J3DTevs.h index 239bd335c53..1f7d6dfa593 100644 --- a/include/JSystem/J3DGraphBase/J3DTevs.h +++ b/include/JSystem/J3DGraphBase/J3DTevs.h @@ -4,61 +4,34 @@ #include "dolphin/types.h" #include #include "JSystem/J3DGraphBase/J3DGD.h" +#include "JSystem/J3DGraphBase/J3DStruct.h" -/** - * @ingroup jsystem-j3d - * - */ -struct J3DTevStageInfo { - /* 0x0 */ u8 field_0x0; - /* 0x1 */ u8 mTevColorOp; - /* 0x2 */ u8 mTevColorAB; - /* 0x3 */ u8 mTevColorCD; - /* 0x4 */ u8 field_0x4; - /* 0x5 */ u8 mTevAlphaOp; - /* 0x6 */ u8 mTevAlphaAB; - /* 0x7 */ u8 mTevSwapModeInfo; - /* 0x8 */ u8 field_0x8; - /* 0x8 */ u8 field_0x9; - /* 0x8 */ u8 field_0xa; - /* 0x8 */ u8 field_0xb; - /* 0x8 */ u8 field_0xc; - /* 0x8 */ u8 field_0xd; - /* 0x8 */ u8 field_0xe; - /* 0x8 */ u8 field_0xf; - /* 0x8 */ u8 field_0x10; - /* 0x8 */ u8 field_0x11; - /* 0x8 */ u8 field_0x12; - /* 0x8 */ u8 field_0x13; -}; +extern u8 j3dTevSwapTableTable[1024]; -extern J3DTevStageInfo const j3dDefaultTevStageInfo; - -/** - * @ingroup jsystem-j3d - * - */ -struct J3DTevSwapModeTableInfo { - /* 0x0 */ u8 field_0x0; - /* 0x1 */ u8 field_0x1; - /* 0x2 */ u8 field_0x2; - /* 0x3 */ u8 field_0x3; -}; // Size: 0x4 +extern const J3DLightInfo j3dDefaultLightInfo; +extern const J3DTexCoordInfo j3dDefaultTexCoordInfo[8]; +extern const J3DTexMtxInfo j3dDefaultTexMtxInfo; +extern const J3DIndTexMtxInfo j3dDefaultIndTexMtxInfo; +extern const J3DTevStageInfo j3dDefaultTevStageInfo; +extern const J3DIndTevStageInfo j3dDefaultIndTevStageInfo; +extern const J3DFogInfo j3dDefaultFogInfo; +extern const J3DNBTScaleInfo j3dDefaultNBTScaleInfo; +extern const GXColor j3dDefaultColInfo; +extern const GXColor j3dDefaultAmbInfo; +extern const u8 j3dDefaultColorChanNum; +extern const J3DTevOrderInfo j3dDefaultTevOrderInfoNull; +extern const J3DIndTexOrderInfo j3dDefaultIndTexOrderNull; +extern const GXColorS10 j3dDefaultTevColor; +extern const J3DIndTexCoordScaleInfo j3dDefaultIndTexCoordScaleInfo; +extern const GXColor j3dDefaultTevKColor; +extern const J3DTevSwapModeInfo j3dDefaultTevSwapMode; extern const J3DTevSwapModeTableInfo j3dDefaultTevSwapModeTable; - -/** - * @ingroup jsystem-j3d - * - */ -struct J3DTevSwapModeInfo { - /* 0x0 */ u8 mRasSel; - /* 0x1 */ u8 mTexSel; - /* 0x2 */ u8 field_0x2; - /* 0x3 */ u8 field_0x3; -}; // Size: 0x4 - -extern J3DTevSwapModeInfo const j3dDefaultTevSwapMode; +extern const J3DBlendInfo j3dDefaultBlendInfo; +extern const J3DColorChanInfo j3dDefaultColorChanInfo; +extern const u8 j3dDefaultTevSwapTableID; +extern const u16 j3dDefaultAlphaCmpID; +extern const u16 j3dDefaultZModeID; /** * @ingroup jsystem-j3d @@ -173,25 +146,6 @@ struct J3DTevStage { /* 0x7 */ u8 mTevSwapModeInfo; }; -/** - * @ingroup jsystem-j3d - * - */ -struct J3DIndTevStageInfo { - /* 0x0 */ u8 mIndStage; - /* 0x1 */ u8 mIndFormat; - /* 0x2 */ u8 mBiasSel; - /* 0x3 */ u8 mMtxSel; - /* 0x4 */ u8 mWrapS; - /* 0x5 */ u8 mWrapT; - /* 0x6 */ u8 mPrev; - /* 0x7 */ u8 mLod; - /* 0x8 */ u8 mAlphaSel; - /* 0x9 */ u8 pad[3]; -}; - -extern J3DIndTevStageInfo const j3dDefaultIndTevStageInfo; - /** * @ingroup jsystem-j3d * @@ -237,21 +191,6 @@ struct J3DIndTevStage { /* 0x0 */ u32 mInfo; }; -/** - * @ingroup jsystem-j3d - * - */ -struct J3DTevOrderInfo { - void operator=(const J3DTevOrderInfo& other) { - *(u32*) this = *(u32*)&other; - } - - /* 0x0 */ u8 mTexCoord; - /* 0x1 */ u8 mTexMap; - /* 0x2 */ u8 mColorChan; - /* 0x3 */ u8 field_0x3; // Maybe padding -}; - extern const J3DTevOrderInfo j3dDefaultTevOrderInfoNull; /** @@ -303,6 +242,49 @@ struct J3DTevSwapModeTable { /* 0x0 */ u8 mIdx; }; // Size: 0x1 +/** + * @ingroup jsystem-j3d + * + */ +class J3DLightObj { +public: + J3DLightObj() { mInfo = j3dDefaultLightInfo; } + void load(u32) const; + + J3DLightInfo* getLightInfo() { return &mInfo; } + J3DLightObj& operator=(J3DLightObj const& other) { + mInfo = other.mInfo; + return *this; + } + + /* 0x00 */ J3DLightInfo mInfo; + /* 0x34 */ GXLightObj mLightObj; +}; // Size = 0x74 + +extern const J3DNBTScaleInfo j3dDefaultNBTScaleInfo; + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DNBTScale : public J3DNBTScaleInfo { + J3DNBTScale() { + mbHasScale = j3dDefaultNBTScaleInfo.mbHasScale; + mScale.x = j3dDefaultNBTScaleInfo.mScale.x; + mScale.y = j3dDefaultNBTScaleInfo.mScale.y; + mScale.z = j3dDefaultNBTScaleInfo.mScale.z; + } + + J3DNBTScale(J3DNBTScaleInfo const& info) { + mbHasScale = info.mbHasScale; + mScale.x = info.mScale.x; + mScale.y = info.mScale.y; + mScale.z = info.mScale.z; + } + + Vec* getScale() { return &mScale; } +}; + extern const GXColor j3dDefaultColInfo; extern const GXColor j3dDefaultAmbInfo; extern const GXColorS10 j3dDefaultTevColor; diff --git a/include/JSystem/J3DGraphBase/J3DTexture.h b/include/JSystem/J3DGraphBase/J3DTexture.h index a049f0ba990..0927e08a477 100644 --- a/include/JSystem/J3DGraphBase/J3DTexture.h +++ b/include/JSystem/J3DGraphBase/J3DTexture.h @@ -71,22 +71,6 @@ private: /* 0x64 */ Mtx mMtx; }; // Size: 0x94 -/** - * @ingroup jsystem-j3d - * - */ -struct J3DTexCoordInfo { - /* 0x0 */ u8 mTexGenType; - /* 0x1 */ u8 mTexGenSrc; - /* 0x2 */ u8 mTexGenMtx; - /* 0x3 */ u8 pad; - - J3DTexCoordInfo& operator=(const J3DTexCoordInfo& other) { - __memcpy(this, &other, sizeof(J3DTexCoordInfo)); - return *this; - } -}; - extern J3DTexCoordInfo const j3dDefaultTexCoordInfo[8]; /** diff --git a/src/JSystem/J3DGraphBase/J3DMatBlock.cpp b/src/JSystem/J3DGraphBase/J3DMatBlock.cpp index 0e3b64eef5a..6aa780fdfe2 100644 --- a/src/JSystem/J3DGraphBase/J3DMatBlock.cpp +++ b/src/JSystem/J3DGraphBase/J3DMatBlock.cpp @@ -2019,13 +2019,3 @@ void J3DTexGenBlockPatched::calcPostTexMtxWithoutViewMtx(f32 const (*param_0)[4] } } } - -void J3DTevBlock::diffTevReg() {} - -void J3DTevBlock::diffTevStageIndirect() {} - -void J3DTevBlock::diffTevStage() {} - -void J3DTevBlock::diffTexCoordScale() {} - -void J3DTevBlock::diffTexNo() {}