diff options
| author | LagoLunatic <LagoLunatic@users.noreply.github.com> | 2025-12-21 07:13:21 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-21 14:13:21 +0200 |
| commit | 48f1d47690d0a43a77f7ae210b0cf21a6bc835bc (patch) | |
| tree | 9f3ce13fff39faf2f96ff324636e66bfd0292460 /include/JSystem/J3DGraphBase | |
| parent | 69bdaaca19c2166fa4c63aa66ee7d715db4cfa01 (diff) | |
Work on weak order (#2979)
* JAUSectionHeap OK
* Slightly improve d_camera weak func order (12 -> 10)
* Minor d_a_alink fixes
* weak_order_diff.py: Change to take source file as cli argument instead of .o file
For cli autocompletion to work.
* Reorganize J3D structs (no change in weak order)
Diffstat (limited to 'include/JSystem/J3DGraphBase')
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DMatBlock.h | 235 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DStruct.h | 216 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DTevs.h | 152 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DTexture.h | 16 |
4 files changed, 312 insertions, 307 deletions
diff --git a/include/JSystem/J3DGraphBase/J3DMatBlock.h b/include/JSystem/J3DGraphBase/J3DMatBlock.h index 4b082e193e..256e95deb5 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); } @@ -442,6 +403,16 @@ public: * @ingroup jsystem-j3d * */ +class J3DColorBlockNull : public J3DColorBlock { +public: + virtual u32 getType() { return 'CLNL'; } + virtual ~J3DColorBlockNull() {} +}; + +/** + * @ingroup jsystem-j3d + * + */ class J3DTexGenBlock { public: virtual void reset(J3DTexGenBlock*) {} @@ -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]; /** @@ -1503,22 +1462,6 @@ struct J3DZMode { * @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 - * - */ struct J3DBlend : public J3DBlendInfo { J3DBlend() { J3DBlendInfo::operator=(j3dDefaultBlendInfo); @@ -1543,8 +1486,6 @@ struct J3DBlend : public J3DBlendInfo { void setBlendInfo(const J3DBlendInfo& i_blendInfo) { *static_cast<J3DBlendInfo*>(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); } @@ -1647,23 +1562,6 @@ struct J3DAlphaComp { * @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 - * - */ struct J3DIndTexOrder : public J3DIndTexOrderInfo { J3DIndTexOrder() { J3DIndTexOrderInfo::operator=(j3dDefaultIndTexOrderNull); @@ -1684,8 +1582,6 @@ struct J3DIndTexOrder : public J3DIndTexOrderInfo { u8 getCoord() const { return (GXTexCoordID)mCoord; } }; // Size: 0x04 -extern J3DIndTexMtxInfo const j3dDefaultIndTexMtxInfo; - /** * @ingroup jsystem-j3d * @@ -1706,24 +1602,6 @@ struct J3DIndTexMtx : public J3DIndTexMtxInfo { * @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 - * - */ struct J3DIndTexCoordScale : public J3DIndTexCoordScaleInfo { J3DIndTexCoordScale() { J3DIndTexCoordScaleInfo::operator=(j3dDefaultIndTexCoordScaleInfo); @@ -1778,19 +1656,6 @@ public: * @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 - * - */ class J3DIndBlockFull : public J3DIndBlock { public: J3DIndBlockFull() { @@ -1856,6 +1721,19 @@ public: * @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 + * + */ class J3DPEBlock { public: virtual void reset(J3DPEBlock*) {} @@ -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 24fdb5c265..3f9bafe12c 100644 --- a/include/JSystem/J3DGraphBase/J3DStruct.h +++ b/include/JSystem/J3DGraphBase/J3DStruct.h @@ -4,13 +4,13 @@ #include <dolphin/gx.h> #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 239bd335c5..1f7d6dfa59 100644 --- a/include/JSystem/J3DGraphBase/J3DTevs.h +++ b/include/JSystem/J3DGraphBase/J3DTevs.h @@ -4,61 +4,34 @@ #include "dolphin/types.h" #include <dolphin/gx.h> #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 @@ -177,25 +150,6 @@ struct J3DTevStage { * @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 - * - */ struct J3DIndTevStage { J3DIndTevStage() : mInfo(0) { setIndTevStageInfo(j3dDefaultIndTevStageInfo); } J3DIndTevStage(J3DIndTevStageInfo const& info) : mInfo(0) { setIndTevStageInfo(info); } @@ -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 a049f0ba99..0927e08a47 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]; /** |
