From a61e3491f7c46b698514af50464cf71ba76bd3a3 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Fri, 12 Apr 2024 00:10:30 -0600 Subject: d_a_e_fz work, doxygen revamp (#2127) * initial freezard actor struct + setActionMode OK * daE_FZ_Draw * setReflectAngle * mBoundSoundset * daE_FZ_Execute & execute * demoDelete * daE_FZ_Delete & _delete * CreateHeap * useHeapInit * cc_set * mtx_set * action WIP * way_gake_check * executeRollMove * executeMove * draw WIP * executeDamage * checkpoint * create * checkpoint * daE_FZ_c::executeWait * checkpoint * daE_FZ_c::damage_check almost done * rm asm * rm headers * setup_profile WIP + doxygen update * fix merge issues * docs fix? * fix2 * doxygen updates * setup g_profile_E_FZ, profile setup script WIP * update github actions * update progress.md --- include/JSystem/J3DGraphBase/J3DDrawBuffer.h | 5 +- include/JSystem/J3DGraphBase/J3DGD.h | 1 - include/JSystem/J3DGraphBase/J3DMatBlock.h | 173 +++++++++++++- include/JSystem/J3DGraphBase/J3DMaterial.h | 273 +++++++++++----------- include/JSystem/J3DGraphBase/J3DPacket.h | 21 +- include/JSystem/J3DGraphBase/J3DShape.h | 327 ++++++++++++++------------- include/JSystem/J3DGraphBase/J3DShapeDraw.h | 4 + include/JSystem/J3DGraphBase/J3DShapeMtx.h | 32 +++ include/JSystem/J3DGraphBase/J3DStruct.h | 29 ++- include/JSystem/J3DGraphBase/J3DSys.h | 9 +- include/JSystem/J3DGraphBase/J3DTevs.h | 36 +++ include/JSystem/J3DGraphBase/J3DTexture.h | 199 ++++++++-------- include/JSystem/J3DGraphBase/J3DTransform.h | 4 + include/JSystem/J3DGraphBase/J3DVertex.h | 13 +- 14 files changed, 738 insertions(+), 388 deletions(-) (limited to 'include/JSystem/J3DGraphBase') diff --git a/include/JSystem/J3DGraphBase/J3DDrawBuffer.h b/include/JSystem/J3DGraphBase/J3DDrawBuffer.h index 714de468dd..e58be9e6a9 100644 --- a/include/JSystem/J3DGraphBase/J3DDrawBuffer.h +++ b/include/JSystem/J3DGraphBase/J3DDrawBuffer.h @@ -2,7 +2,6 @@ #define J3DDRAWBUFFER_H #include "JSystem/J3DGraphBase/J3DSys.h" -#include "dolphin/types.h" // matches debug inline f32 J3DCalcZValue(register MtxP m, register Vec v) { @@ -37,6 +36,10 @@ class J3DShapePacket; typedef int (J3DDrawBuffer::*sortFunc)(J3DMatPacket*); typedef void (J3DDrawBuffer::*drawFunc)() const; +/** + * @ingroup jsystem-j3d + * + */ class J3DDrawBuffer { public: enum EDrawType { diff --git a/include/JSystem/J3DGraphBase/J3DGD.h b/include/JSystem/J3DGraphBase/J3DGD.h index 1a10836999..53e63508c4 100644 --- a/include/JSystem/J3DGraphBase/J3DGD.h +++ b/include/JSystem/J3DGraphBase/J3DGD.h @@ -2,7 +2,6 @@ #define J3DGD_H #include "dolphin/gd/GDBase.h" -#include "dolphin/gx.h" inline void J3DGDWrite_u8(u8 param) { __GDWrite(param); diff --git a/include/JSystem/J3DGraphBase/J3DMatBlock.h b/include/JSystem/J3DGraphBase/J3DMatBlock.h index d488d0b703..9634fb3b09 100644 --- a/include/JSystem/J3DGraphBase/J3DMatBlock.h +++ b/include/JSystem/J3DGraphBase/J3DMatBlock.h @@ -1,23 +1,34 @@ #ifndef J3DMATBLOCK_H #define J3DMATBLOCK_H -#include "JSystem/J3DGraphBase/J3DStruct.h" #include "JSystem/J3DGraphBase/J3DTevs.h" #include "JSystem/J3DGraphBase/J3DTexture.h" #include "dolphin/types.h" +/** + * @ingroup jsystem-j3d + * + */ struct J3DGXColorS10 : public GXColorS10 { /* 8000E460 */ J3DGXColorS10() {} J3DGXColorS10(J3DGXColorS10 const& other) { __memcpy(this, &other, sizeof(J3DGXColorS10)); } J3DGXColorS10(GXColorS10 const& color) : GXColorS10(color) {} }; +/** + * @ingroup jsystem-j3d + * + */ struct J3DGXColor : public GXColor { /* 8000E538 */ J3DGXColor() {} J3DGXColor(J3DGXColor const& other) { __memcpy(this, &other, sizeof(J3DGXColor)); } J3DGXColor(GXColor const& color) : GXColor(color) {} }; +/** + * @ingroup jsystem-j3d + * + */ struct J3DNBTScale : public J3DNBTScaleInfo { J3DNBTScale() {} J3DNBTScale(J3DNBTScaleInfo const& info) { @@ -29,6 +40,10 @@ struct J3DNBTScale : public J3DNBTScaleInfo { extern const J3DNBTScaleInfo j3dDefaultNBTScaleInfo; +/** + * @ingroup jsystem-j3d + * + */ class J3DTexGenBlock { public: /* 80317354 */ virtual void reset(J3DTexGenBlock*); @@ -72,6 +87,10 @@ struct J3DTexGenBlockNull : public J3DTexGenBlock { /* 80332AD0 */ virtual ~J3DTexGenBlockNull(); // {} }; +/** + * @ingroup jsystem-j3d + * + */ class J3DTexGenBlockPatched : public J3DTexGenBlock { public: J3DTexGenBlockPatched() { @@ -108,6 +127,10 @@ public: /* 0x58 */ u32 mTexMtxOffset; }; // Size: 0x5C +/** + * @ingroup jsystem-j3d + * + */ class J3DTexGenBlockBasic : public J3DTexGenBlockPatched { public: J3DTexGenBlockBasic() : mNBTScale(j3dDefaultNBTScaleInfo) { @@ -128,6 +151,10 @@ public: /* 0x5C */ J3DNBTScale mNBTScale; }; // Size: 0x6C +/** + * @ingroup jsystem-j3d + * + */ class J3DTexGenBlock4 : public J3DTexGenBlockPatched { public: J3DTexGenBlock4() : mNBTScale(j3dDefaultNBTScaleInfo) { @@ -148,6 +175,10 @@ public: /* 0x5C */ J3DNBTScale mNBTScale; }; // Size: 0x6C +/** + * @ingroup jsystem-j3d + * + */ class J3DTevBlock { public: /* 80317350 */ virtual void reset(J3DTevBlock*); @@ -210,6 +241,10 @@ protected: /* 0x4 */ u32 mTexNoOffset; }; +/** + * @ingroup jsystem-j3d + * + */ class J3DTevBlockNull : public J3DTevBlock { public: J3DTevBlockNull() { initialize(); } @@ -221,6 +256,10 @@ public: /* 80332A44 */ virtual ~J3DTevBlockNull(); // {} }; +/** + * @ingroup jsystem-j3d + * + */ class J3DTevBlockPatched : public J3DTevBlock { public: J3DTevBlockPatched() { @@ -283,6 +322,10 @@ public: /* 0xD4 */ u32 mTevRegOffset; }; // Size: 0xD8 +/** + * @ingroup jsystem-j3d + * + */ class J3DTevBlock4 : public J3DTevBlock { public: J3DTevBlock4() { @@ -355,6 +398,10 @@ public: /* 0x90 */ u32 mTevRegOffset; }; // Size: 0x94 +/** + * @ingroup jsystem-j3d + * + */ class J3DTevBlock2 : public J3DTevBlock { public: J3DTevBlock2() { @@ -427,6 +474,10 @@ public: /* 0x68 */ u32 mTevRegOffset; }; // Size: 0x6C +/** + * @ingroup jsystem-j3d + * + */ class J3DTevBlock16 : public J3DTevBlock { public: J3DTevBlock16() { @@ -499,6 +550,10 @@ public: /* 0x170 */ u32 mTevRegOffset; }; // Size: 0x174 +/** + * @ingroup jsystem-j3d + * + */ class J3DTevBlock1 : public J3DTevBlock { public: J3DTevBlock1() { @@ -551,6 +606,10 @@ 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; @@ -558,6 +617,10 @@ struct J3DZModeInfo { /* 0x3 */ u8 pad; }; +/** + * @ingroup jsystem-j3d + * + */ struct J3DZMode { J3DZMode() : mZModeID(j3dDefaultZModeID) {} J3DZMode(J3DZModeInfo const& info) : mZModeID(calcZModeID(info.field_0x0, info.field_0x1, info.field_0x2)) {} @@ -569,6 +632,10 @@ struct J3DZMode { /* 0x0 */ u16 mZModeID; }; +/** + * @ingroup jsystem-j3d + * + */ struct J3DBlendInfo { void operator=(J3DBlendInfo const& other) { *(int*)&mType = *(int*)&other.mType; @@ -581,6 +648,10 @@ struct J3DBlendInfo { extern const J3DBlendInfo j3dDefaultBlendInfo; +/** + * @ingroup jsystem-j3d + * + */ struct J3DBlend : public J3DBlendInfo { J3DBlend() : J3DBlendInfo(j3dDefaultBlendInfo) {} J3DBlend(J3DBlendInfo const& info) : J3DBlendInfo(info) {} @@ -588,12 +659,20 @@ struct J3DBlend : public J3DBlendInfo { extern const J3DFogInfo j3dDefaultFogInfo; +/** + * @ingroup jsystem-j3d + * + */ struct J3DFog : public J3DFogInfo { J3DFog() { *(J3DFogInfo*)this = j3dDefaultFogInfo; } J3DFogInfo* getFogInfo() { return this; } void setFogInfo(J3DFogInfo info) { *(J3DFogInfo*)this = info; } }; +/** + * @ingroup jsystem-j3d + * + */ struct J3DAlphaCompInfo { /* 0x0 */ u8 field_0x0; /* 0x1 */ u8 field_0x1; @@ -616,6 +695,10 @@ inline u32 calcAlphaCmpID(u32 param_1, u32 param_2, u32 param_3) { // return param_1 * 0x20 + param_2 * 8 + param_3; // } +/** + * @ingroup jsystem-j3d + * + */ struct J3DAlphaComp { J3DAlphaComp() : mID(j3dDefaultAlphaCmpID), mRef0(0), mRef1(0) {} J3DAlphaComp(u16 id) : mID(id), mRef0(0), mRef1(0) {} @@ -641,6 +724,10 @@ struct J3DAlphaComp { /* 0x03 */ u8 mRef1; }; // Size: 0x4 +/** + * @ingroup jsystem-j3d + * + */ class J3DPEBlock { public: /* 80317348 */ virtual void reset(J3DPEBlock*); @@ -674,12 +761,20 @@ public: virtual ~J3DPEBlock() {} }; +/** + * @ingroup jsystem-j3d + * + */ struct J3DPEBlockNull : public J3DPEBlock { /* 803329A0 */ virtual void load(); // {} /* 803329A4 */ virtual u32 getType(); // { return 'PENL'; } /* 803329B0 */ virtual ~J3DPEBlockNull(); // {} }; +/** + * @ingroup jsystem-j3d + * + */ class J3DPEBlockXlu : public J3DPEBlock { public: /* 8031E98C */ virtual void load(); @@ -688,6 +783,10 @@ public: /* 80323264 */ virtual ~J3DPEBlockXlu(); }; +/** + * @ingroup jsystem-j3d + * + */ class J3DPEBlockTexEdge : public J3DPEBlock { public: /* 8031E6C8 */ virtual void load(); @@ -696,6 +795,10 @@ public: /* 803232CC */ virtual ~J3DPEBlockTexEdge(); }; +/** + * @ingroup jsystem-j3d + * + */ class J3DPEBlockOpa : public J3DPEBlock { public: /* 8031E408 */ virtual void load(); @@ -704,6 +807,10 @@ public: /* 80323334 */ virtual ~J3DPEBlockOpa(); }; +/** + * @ingroup jsystem-j3d + * + */ class J3DPEBlockFull : public J3DPEBlock { public: J3DPEBlockFull() { @@ -750,6 +857,10 @@ public: /* 0x3C */ u32 mFogOffset; }; // Size: 0x40 +/** + * @ingroup jsystem-j3d + * + */ class J3DPEBlockFogOff : public J3DPEBlock { public: J3DPEBlockFogOff() { @@ -787,6 +898,10 @@ public: /* 0x0F */ u8 mDither; }; // Size: 0x10 +/** + * @ingroup jsystem-j3d + * + */ struct J3DIndTexCoordScaleInfo { /* 0x0 */ u8 mScaleS; /* 0x1 */ u8 mScaleT; @@ -796,6 +911,10 @@ struct J3DIndTexCoordScaleInfo { extern const J3DIndTexCoordScaleInfo j3dDefaultIndTexCoordScaleInfo; +/** + * @ingroup jsystem-j3d + * + */ struct J3DIndTexCoordScale : public J3DIndTexCoordScaleInfo { /* 8000E0E4 */ J3DIndTexCoordScale() : J3DIndTexCoordScaleInfo(j3dDefaultIndTexCoordScaleInfo) {} J3DIndTexCoordScale(J3DIndTexCoordScaleInfo const& info) : J3DIndTexCoordScaleInfo(info) {} @@ -804,12 +923,20 @@ struct J3DIndTexCoordScale : public J3DIndTexCoordScaleInfo { extern J3DIndTexMtxInfo const j3dDefaultIndTexMtxInfo; +/** + * @ingroup jsystem-j3d + * + */ struct J3DIndTexMtx : public J3DIndTexMtxInfo { /* 8000E0F0 */ J3DIndTexMtx() { *(J3DIndTexMtxInfo*)this = j3dDefaultIndTexMtxInfo; } J3DIndTexMtx(J3DIndTexMtxInfo const& info) { *(J3DIndTexMtxInfo*)this = info; } /* 8000E064 */ ~J3DIndTexMtx() {} }; // Size: 0x1C +/** + * @ingroup jsystem-j3d + * + */ struct J3DIndTexOrderInfo { /* 0x0 */ u8 mMap; /* 0x1 */ u8 mCoord; @@ -819,11 +946,19 @@ struct J3DIndTexOrderInfo { extern const J3DIndTexOrderInfo j3dDefaultIndTexOrderNull; +/** + * @ingroup jsystem-j3d + * + */ struct J3DIndTexOrder : public J3DIndTexOrderInfo { /* 8000E128 */ J3DIndTexOrder() : J3DIndTexOrderInfo(j3dDefaultIndTexOrderNull) {} J3DIndTexOrder(J3DIndTexOrderInfo const& info) : J3DIndTexOrderInfo(info) {} }; // Size: 0x04 +/** + * @ingroup jsystem-j3d + * + */ class J3DIndBlock { public: /* 8031734C */ virtual void reset(J3DIndBlock*); @@ -845,6 +980,10 @@ public: /* 8031726C */ virtual ~J3DIndBlock(); }; +/** + * @ingroup jsystem-j3d + * + */ class J3DIndBlockNull : public J3DIndBlock { public: /* 803173A0 */ virtual void reset(J3DIndBlock*); @@ -854,6 +993,10 @@ public: /* 803173B0 */ virtual ~J3DIndBlockNull(); }; +/** + * @ingroup jsystem-j3d + * + */ class J3DIndBlockFull : public J3DIndBlock { public: J3DIndBlockFull() { @@ -885,6 +1028,10 @@ public: /* 0x6C */ J3DIndTexCoordScale mIndTexCoordScale[4]; }; // Size: 0x7C +/** + * @ingroup jsystem-j3d + * + */ struct J3DColorChanInfo { /* 0x0 */ u8 field_0x0; /* 0x1 */ u8 field_0x1; @@ -901,6 +1048,10 @@ extern const J3DColorChanInfo j3dDefaultColorChanInfo; } */ +/** + * @ingroup jsystem-j3d + * + */ struct J3DColorChan { /* 8000E47C */ J3DColorChan() { setColorChanInfo(j3dDefaultColorChanInfo); @@ -940,6 +1091,10 @@ struct J3DColorChan { /* 0x0 */ u16 mColorChanID; }; +/** + * @ingroup jsystem-j3d + * + */ class J3DColorBlock { public: /* 80317324 */ virtual void load(); @@ -978,11 +1133,19 @@ public: /* 80317138 */ virtual ~J3DColorBlock() {} }; +/** + * @ingroup jsystem-j3d + * + */ struct J3DColorBlockNull : public J3DColorBlock { /* 80332B2C */ virtual u32 getType(); // { return 'CLNL'; } /* 80332B38 */ virtual ~J3DColorBlockNull(); // {} }; +/** + * @ingroup jsystem-j3d + * + */ class J3DColorBlockLightOn : public J3DColorBlock { public: J3DColorBlockLightOn() { @@ -1035,6 +1198,10 @@ public: /* 0x48 */ u32 mColorChanOffset; }; // Size: 0x4C +/** + * @ingroup jsystem-j3d + * + */ class J3DColorBlockLightOff : public J3DColorBlock { public: J3DColorBlockLightOff() { @@ -1078,6 +1245,10 @@ public: /* 0x1C */ u32 mColorChanOffset; }; // Size: 0x20 +/** + * @ingroup jsystem-j3d + * + */ class J3DColorBlockAmbientOn : public J3DColorBlockLightOff { public: J3DColorBlockAmbientOn() { diff --git a/include/JSystem/J3DGraphBase/J3DMaterial.h b/include/JSystem/J3DGraphBase/J3DMaterial.h index fd9fce606a..79545e01e8 100644 --- a/include/JSystem/J3DGraphBase/J3DMaterial.h +++ b/include/JSystem/J3DGraphBase/J3DMaterial.h @@ -1,131 +1,142 @@ -#ifndef J3DMATERIAL_H -#define J3DMATERIAL_H - -#include "JSystem/J3DGraphBase/J3DMatBlock.h" -#include "JSystem/J3DGraphBase/J3DPacket.h" -#include "JSystem/J3DGraphBase/J3DShape.h" -#include "JSystem/J3DGraphBase/J3DTexture.h" -#include "dolphin/types.h" - -class J3DJoint; -class J3DMaterialAnm; - -class J3DMaterial { -public: - /* 803157A0 */ static J3DColorBlock* createColorBlock(u32); - /* 803159A0 */ static J3DTexGenBlock* createTexGenBlock(u32); - /* 80315B04 */ static J3DTevBlock* createTevBlock(int); - /* 80315E78 */ static J3DIndBlock* createIndBlock(int); - /* 80315F60 */ static J3DPEBlock* createPEBlock(u32, u32); - /* 80316100 */ static u32 calcSizeColorBlock(u32); - /* 80316150 */ static u32 calcSizeTexGenBlock(u32); - /* 8031617C */ static u32 calcSizeTevBlock(int); - /* 803161C4 */ static u32 calcSizeIndBlock(int); - /* 803161D8 */ static u32 calcSizePEBlock(u32, u32); - /* 80316240 */ void initialize(); - /* 80316290 */ u32 countDLSize(); - /* 80316344 */ void makeDisplayList_private(J3DDisplayListObj*); - /* 80316AB0 */ void setCurrentMtx(); - /* 80316AC8 */ void calcCurrentMtx(); - /* 80316D68 */ void copy(J3DMaterial*); - /* 80316E90 */ s32 newSharedDisplayList(u32); - /* 80316F24 */ s32 newSingleSharedDisplayList(u32); - - /* 803169DC */ virtual void calc(f32 const (*)[4]); - /* 80316A54 */ virtual void calcDiffTexMtx(f32 const (*)[4]); - /* 80316620 */ virtual void makeDisplayList(); - /* 80316668 */ virtual void makeSharedDisplayList(); - /* 8031668C */ virtual void load(); - /* 803166DC */ virtual void loadSharedDL(); - /* 80316740 */ virtual void patch(); - /* 803167D8 */ virtual void diff(u32); - /* 80316E14 */ virtual void reset(); - /* 80316E70 */ virtual void change(); - - J3DMaterial() { initialize(); } - ~J3DMaterial() {} - J3DMaterial* getNext() const { return mNext; } - J3DShape* getShape() const { return mShape; } - J3DTevBlock* getTevBlock() const { return mTevBlock; } - J3DColorBlock* getColorBlock() const { return mColorBlock; } - J3DTexGenBlock* getTexGenBlock() const { return mTexGenBlock; } - J3DDisplayListObj* getSharedDisplayListObj() const { return mSharedDLObj; } - J3DIndBlock* getIndBlock() const { return mIndBlock; } - J3DShape* getShape() { return mShape; } - J3DJoint* getJoint() { return mJoint; } - J3DMaterialAnm* getMaterialAnm() const { - if ((u32)mMaterialAnm < 0xC0000000) { - return mMaterialAnm; - } else { - return NULL; - } - } - J3DNBTScale* getNBTScale() const { return mTexGenBlock->getNBTScale(); } - u16 getTexNo(u32 idx) const { return mTevBlock->getTexNo(idx); } - GXColor* getTevKColor(u32 param_0) { return mTevBlock->getTevKColor(param_0); } - GXColorS10* getTevColor(u32 param_0) { return mTevBlock->getTevColor(param_0); } - J3DFog* getFog() { return mPEBlock->getFog(); } - J3DTexMtx* getTexMtx(u32 idx) { return mTexGenBlock->getTexMtx(idx); } - u16 getIndex() { return mIndex; } - bool isDrawModeOpaTexEdge() { return (mMaterialMode & 3) == 0; } - J3DPEBlock* getPEBlock() { return mPEBlock; } - void onInvalid() { mInvalid = 1; } - u32 getTexGenNum() const { return mTexGenBlock->getTexGenNum(); } - u8 getTevStageNum() const { return mTevBlock->getTevStageNum(); } - J3DTexCoord* getTexCoord(u32 idx) { return mTexGenBlock->getTexCoord(idx); } - - void setTevColor(u32 i, const J3DGXColorS10* i_color) { mTevBlock->setTevColor(i, i_color); } - void setTevKColor(u32 i, const J3DGXColor* i_color) { mTevBlock->setTevKColor(i, i_color); } - void setMaterialAnm(J3DMaterialAnm* i_anm) { mMaterialAnm = i_anm; } - void setCullMode(u8 i_mode) { mColorBlock->setCullMode(i_mode); } - void setTexMtx(u32 idx, J3DTexMtx* mtx) { mTexGenBlock->setTexMtx(idx, mtx); } - -public: - /* 0x04 */ J3DMaterial* mNext; - /* 0x08 */ J3DShape* mShape; - /* 0x0C */ J3DJoint* mJoint; - /* 0x10 */ u32 mMaterialMode; - /* 0x14 */ u16 mIndex; - /* 0x18 */ u32 mInvalid; - /* 0x1C */ u32 field_0x1c; - /* 0x20 */ u32 mDiffFlag; - /* 0x24 */ J3DColorBlock* mColorBlock; - /* 0x28 */ J3DTexGenBlock* mTexGenBlock; - /* 0x2C */ J3DTevBlock* mTevBlock; - /* 0x30 */ J3DIndBlock* mIndBlock; - /* 0x34 */ J3DPEBlock* mPEBlock; - /* 0x38 */ J3DMaterial* mpOrigMaterial; - /* 0x3C */ J3DMaterialAnm* mMaterialAnm; - /* 0x40 */ J3DCurrentMtx mCurrentMtx; - /* 0x48 */ J3DDisplayListObj* mSharedDLObj; -}; - -class J3DPatchedMaterial : public J3DMaterial { -public: - /* 80316FB8 */ void initialize(); - - /* 80316FD8 */ virtual void makeDisplayList(); - /* 80316FDC */ virtual void makeSharedDisplayList(); - /* 80316FE0 */ virtual void load(); - /* 80316FFC */ virtual void loadSharedDL(); - /* 8031703C */ virtual void reset(); - /* 80317040 */ virtual void change(); -}; - -class J3DLockedMaterial : public J3DMaterial { -public: - J3DLockedMaterial() { initialize(); } - /* 80317044 */ void initialize(); - - /* 803170D0 */ virtual void calc(f32 const (*)[4]); - /* 80317064 */ virtual void makeDisplayList(); - /* 80317068 */ virtual void makeSharedDisplayList(); - /* 8031706C */ virtual void load(); - /* 80317088 */ virtual void loadSharedDL(); - /* 803170C8 */ virtual void patch(); - /* 803170CC */ virtual void diff(u32); - /* 803170D4 */ virtual void reset(); - /* 803170D8 */ virtual void change(); -}; - -#endif /* J3DMATERIAL_H */ +#ifndef J3DMATERIAL_H +#define J3DMATERIAL_H + +#include "JSystem/J3DGraphBase/J3DMatBlock.h" +#include "JSystem/J3DGraphBase/J3DPacket.h" +#include "JSystem/J3DGraphBase/J3DShape.h" +#include "dolphin/types.h" + +class J3DJoint; +class J3DMaterialAnm; + +/** + * @ingroup jsystem-j3d + * + */ +class J3DMaterial { +public: + /* 803157A0 */ static J3DColorBlock* createColorBlock(u32); + /* 803159A0 */ static J3DTexGenBlock* createTexGenBlock(u32); + /* 80315B04 */ static J3DTevBlock* createTevBlock(int); + /* 80315E78 */ static J3DIndBlock* createIndBlock(int); + /* 80315F60 */ static J3DPEBlock* createPEBlock(u32, u32); + /* 80316100 */ static u32 calcSizeColorBlock(u32); + /* 80316150 */ static u32 calcSizeTexGenBlock(u32); + /* 8031617C */ static u32 calcSizeTevBlock(int); + /* 803161C4 */ static u32 calcSizeIndBlock(int); + /* 803161D8 */ static u32 calcSizePEBlock(u32, u32); + /* 80316240 */ void initialize(); + /* 80316290 */ u32 countDLSize(); + /* 80316344 */ void makeDisplayList_private(J3DDisplayListObj*); + /* 80316AB0 */ void setCurrentMtx(); + /* 80316AC8 */ void calcCurrentMtx(); + /* 80316D68 */ void copy(J3DMaterial*); + /* 80316E90 */ s32 newSharedDisplayList(u32); + /* 80316F24 */ s32 newSingleSharedDisplayList(u32); + + /* 803169DC */ virtual void calc(f32 const (*)[4]); + /* 80316A54 */ virtual void calcDiffTexMtx(f32 const (*)[4]); + /* 80316620 */ virtual void makeDisplayList(); + /* 80316668 */ virtual void makeSharedDisplayList(); + /* 8031668C */ virtual void load(); + /* 803166DC */ virtual void loadSharedDL(); + /* 80316740 */ virtual void patch(); + /* 803167D8 */ virtual void diff(u32); + /* 80316E14 */ virtual void reset(); + /* 80316E70 */ virtual void change(); + + J3DMaterial() { initialize(); } + ~J3DMaterial() {} + J3DMaterial* getNext() const { return mNext; } + J3DShape* getShape() const { return mShape; } + J3DTevBlock* getTevBlock() const { return mTevBlock; } + J3DColorBlock* getColorBlock() const { return mColorBlock; } + J3DTexGenBlock* getTexGenBlock() const { return mTexGenBlock; } + J3DDisplayListObj* getSharedDisplayListObj() const { return mSharedDLObj; } + J3DIndBlock* getIndBlock() const { return mIndBlock; } + J3DShape* getShape() { return mShape; } + J3DJoint* getJoint() { return mJoint; } + J3DMaterialAnm* getMaterialAnm() const { + if ((u32)mMaterialAnm < 0xC0000000) { + return mMaterialAnm; + } else { + return NULL; + } + } + J3DNBTScale* getNBTScale() const { return mTexGenBlock->getNBTScale(); } + u16 getTexNo(u32 idx) const { return mTevBlock->getTexNo(idx); } + GXColor* getTevKColor(u32 param_0) { return mTevBlock->getTevKColor(param_0); } + GXColorS10* getTevColor(u32 param_0) { return mTevBlock->getTevColor(param_0); } + J3DFog* getFog() { return mPEBlock->getFog(); } + J3DTexMtx* getTexMtx(u32 idx) { return mTexGenBlock->getTexMtx(idx); } + u16 getIndex() { return mIndex; } + bool isDrawModeOpaTexEdge() { return (mMaterialMode & 3) == 0; } + J3DPEBlock* getPEBlock() { return mPEBlock; } + void onInvalid() { mInvalid = 1; } + u32 getTexGenNum() const { return mTexGenBlock->getTexGenNum(); } + u8 getTevStageNum() const { return mTevBlock->getTevStageNum(); } + J3DTexCoord* getTexCoord(u32 idx) { return mTexGenBlock->getTexCoord(idx); } + + void setTevColor(u32 i, const J3DGXColorS10* i_color) { mTevBlock->setTevColor(i, i_color); } + void setTevKColor(u32 i, const J3DGXColor* i_color) { mTevBlock->setTevKColor(i, i_color); } + void setMaterialAnm(J3DMaterialAnm* i_anm) { mMaterialAnm = i_anm; } + void setCullMode(u8 i_mode) { mColorBlock->setCullMode(i_mode); } + void setTexMtx(u32 idx, J3DTexMtx* mtx) { mTexGenBlock->setTexMtx(idx, mtx); } + +public: + /* 0x04 */ J3DMaterial* mNext; + /* 0x08 */ J3DShape* mShape; + /* 0x0C */ J3DJoint* mJoint; + /* 0x10 */ u32 mMaterialMode; + /* 0x14 */ u16 mIndex; + /* 0x18 */ u32 mInvalid; + /* 0x1C */ u32 field_0x1c; + /* 0x20 */ u32 mDiffFlag; + /* 0x24 */ J3DColorBlock* mColorBlock; + /* 0x28 */ J3DTexGenBlock* mTexGenBlock; + /* 0x2C */ J3DTevBlock* mTevBlock; + /* 0x30 */ J3DIndBlock* mIndBlock; + /* 0x34 */ J3DPEBlock* mPEBlock; + /* 0x38 */ J3DMaterial* mpOrigMaterial; + /* 0x3C */ J3DMaterialAnm* mMaterialAnm; + /* 0x40 */ J3DCurrentMtx mCurrentMtx; + /* 0x48 */ J3DDisplayListObj* mSharedDLObj; +}; + +/** + * @ingroup jsystem-j3d + * + */ +class J3DPatchedMaterial : public J3DMaterial { +public: + /* 80316FB8 */ void initialize(); + + /* 80316FD8 */ virtual void makeDisplayList(); + /* 80316FDC */ virtual void makeSharedDisplayList(); + /* 80316FE0 */ virtual void load(); + /* 80316FFC */ virtual void loadSharedDL(); + /* 8031703C */ virtual void reset(); + /* 80317040 */ virtual void change(); +}; + +/** + * @ingroup jsystem-j3d + * + */ +class J3DLockedMaterial : public J3DMaterial { +public: + J3DLockedMaterial() { initialize(); } + /* 80317044 */ void initialize(); + + /* 803170D0 */ virtual void calc(f32 const (*)[4]); + /* 80317064 */ virtual void makeDisplayList(); + /* 80317068 */ virtual void makeSharedDisplayList(); + /* 8031706C */ virtual void load(); + /* 80317088 */ virtual void loadSharedDL(); + /* 803170C8 */ virtual void patch(); + /* 803170CC */ virtual void diff(u32); + /* 803170D4 */ virtual void reset(); + /* 803170D8 */ virtual void change(); +}; + +#endif /* J3DMATERIAL_H */ diff --git a/include/JSystem/J3DGraphBase/J3DPacket.h b/include/JSystem/J3DGraphBase/J3DPacket.h index e43349aeb8..ce01c85b1e 100644 --- a/include/JSystem/J3DGraphBase/J3DPacket.h +++ b/include/JSystem/J3DGraphBase/J3DPacket.h @@ -3,7 +3,6 @@ #include "JSystem/J3DGraphBase/J3DSys.h" #include "dolphin/gd/GDBase.h" -#include "dolphin/types.h" class J3DMatPacket; @@ -59,6 +58,10 @@ inline int calcDifferedBufferSize_TevStageDirectSize(int param_1) { return param_1 * 5; } +/** + * @ingroup jsystem-j3d + * + */ class J3DDisplayListObj { public: J3DDisplayListObj() { @@ -90,6 +93,10 @@ public: /* 0xC */ u32 mCapacity; }; // Size: 0x10 +/** + * @ingroup jsystem-j3d + * + */ class J3DPacket { public: J3DPacket() { @@ -121,6 +128,10 @@ public: /* 0x0C */ void* mpUserData; }; // Size: 0x10 +/** + * @ingroup jsystem-j3d + * + */ class J3DDrawPacket : public J3DPacket { public: J3DDrawPacket(); @@ -156,6 +167,10 @@ public: /* 0x24 */ J3DTexMtxObj* mpTexMtxObj; }; // Size: 0x28 +/** + * @ingroup jsystem-j3d + * + */ class J3DShapePacket : public J3DDrawPacket { public: J3DShapePacket(); @@ -184,6 +199,10 @@ public: /* 0x38 */ J3DModel* mpModel; }; // Size: 0x3C +/** + * @ingroup jsystem-j3d + * + */ class J3DMatPacket : public J3DDrawPacket { public: J3DMatPacket(); diff --git a/include/JSystem/J3DGraphBase/J3DShape.h b/include/JSystem/J3DGraphBase/J3DShape.h index e045b31edc..7e7b96aaef 100644 --- a/include/JSystem/J3DGraphBase/J3DShape.h +++ b/include/JSystem/J3DGraphBase/J3DShape.h @@ -1,158 +1,169 @@ -#ifndef J3DSHAPE_H -#define J3DSHAPE_H - -#include "JSystem/J3DGraphBase/J3DShapeDraw.h" -#include "JSystem/J3DGraphBase/J3DShapeMtx.h" -#include "dolphin/gx.h" -#include "dolphin/types.h" - -class J3DCurrentMtxInfo { -public: - u32 mMtxIdxRegA; - u32 mMtxIdxRegB; -}; - -static inline void J3DFifoWriteCPCmd(u8 cmd, u32 param) { - GXWGFifo.u8 = GX_CMD_LOAD_CP_REG; - GXWGFifo.u8 = cmd; - GXWGFifo.u32 = param; -} - -static inline void J3DFifoWriteXFCmd(u16 cmd, u16 len) { - GXWGFifo.u8 = GX_CMD_LOAD_XF_REG; - GXWGFifo.u16 = (len - 1); - GXWGFifo.u16 = cmd; -} - -class J3DCurrentMtx : public J3DCurrentMtxInfo { -public: - J3DCurrentMtx() { - mMtxIdxRegA = 0x3cf3cf00; - mMtxIdxRegB = 0x00f3cf3c; - } - - J3DCurrentMtx& operator=(J3DCurrentMtxInfo const& info) { - mMtxIdxRegA = info.mMtxIdxRegA; - mMtxIdxRegB = info.mMtxIdxRegB; - return *this; - } - - u32 getMtxIdxRegA() const { return mMtxIdxRegA; } - u32 getMtxIdxRegB() const { return mMtxIdxRegB; } - - inline void load() const { - J3DFifoWriteCPCmd(0x30, getMtxIdxRegA()); // CP_MATINDEX_A - J3DFifoWriteCPCmd(0x40, getMtxIdxRegB()); // CP_MATINDEX_B - J3DFifoWriteXFCmd(0x1018, 2); - GXWGFifo.u32 = getMtxIdxRegA(); - GXWGFifo.u32 = getMtxIdxRegB(); - } - - void setCurrentTexMtx(u8 param_1, u8 param_2, u8 param_3, u8 param_4, - u8 param_5, u8 param_6, u8 param_7, u8 param_8) { - mMtxIdxRegA = ((param_1 & 0xff) << 6) | (param_2 << 0xc)| (param_3 << 0x12) | (param_4 << 0x18); - mMtxIdxRegB = (param_5) | param_6 << 6 | param_7 << 0xc | param_8 << 0x12; - } -}; - -class J3DMaterial; -class J3DVertexData; -class J3DDrawMtxData; - -enum J3DShpFlag { - J3DShpFlag_Visible = 0x0001, - J3DShpFlag_SkinPosCpu = 0x0004, - J3DShpFlag_SkinNrmCpu = 0x0008, - J3DShpFlag_Hidden = 0x0010, - J3DShpFlag_EnableLod = 0x0100, - J3DShpFlag_NoMtx = 0x0200, -}; - -class J3DShape { -public: - J3DShape() { - initialize(); - } - - enum { - kVcdVatDLSize = 0xC0, - }; - - /* 80314B48 */ void initialize(); - /* 80314BB8 */ void addTexMtxIndexInDL(_GXAttr, u32); - /* 80314CBC */ void addTexMtxIndexInVcd(_GXAttr); - /* 80314DA8 */ void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]); - /* 80314E28 */ u32 countBumpMtxNum() const; - /* 80314EEC */ void loadVtxArray() const; - /* 80314F5C */ bool isSameVcdVatCmd(J3DShape*); - /* 80314F98 */ void makeVtxArrayCmd(); - /* 80315260 */ void makeVcdVatCmd(); - /* 80315300 */ void loadPreDrawSetting() const; - /* 80315398 */ void setArrayAndBindPipeline() const; - - /* 803155E0 */ virtual void draw() const; - /* 8031544C */ virtual void drawFast() const; - /* 80315628 */ virtual void simpleDraw() const; - /* 803156AC */ virtual void simpleDrawCache() const; - - void onFlag(u32 flag) { mFlags |= flag; } - void offFlag(u32 flag) { mFlags &= ~flag; } - bool checkFlag(u32 flag) const { return !!(mFlags & flag); } - void setDrawMtxDataPointer(J3DDrawMtxData* pMtxData) { mDrawMtxData = pMtxData; } - void setVertexDataPointer(J3DVertexData* pVtxData) { mVertexData = pVtxData; } - void* getVcdVatCmd() const { return mVcdVatCmd; } - void setVcdVatCmd(void* pVatCmd) { mVcdVatCmd = (u8*)pVatCmd; } - void show() { offFlag(J3DShpFlag_Visible); } - void hide() { onFlag(J3DShpFlag_Visible); } - void setCurrentViewNoPtr(u32* pViewNoPtr) { mCurrentViewNo = pViewNoPtr; } - void setCurrentMtx(J3DCurrentMtx& mtx) { mCurrentMtx = mtx; } - void setScaleFlagArray(u8* pScaleFlagArray) { mScaleFlagArray = pScaleFlagArray; } - void setDrawMtx(Mtx** pDrawMtx) { mDrawMtx = pDrawMtx; } - void setNrmMtx(Mtx33** pNrmMtx) { mNrmMtx = pNrmMtx; } - void setTexMtxLoadType(u32 type) { mFlags = (mFlags & 0xFFFF0FFF) | type; } - bool getNBTFlag() const { return mHasNBT; } - u32 getBumpMtxOffset() const { return mBumpMtxOffset; } - GXVtxDescList* getVtxDesc() const { return mVtxDesc; } - - J3DMaterial* getMaterial() const { return mMaterial; } - u32 getIndex() const { return mIndex; } - u32 getPipeline() const { return (mFlags >> 2) & 0x07; } - u32 getTexMtxLoadType() const { return mFlags & 0xF000; } - u32 getMtxGroupNum() const { return mMtxGroupNum; } - J3DShapeDraw* getShapeDraw(u32 idx) const { return mShapeDraw[idx]; } - J3DShapeMtx* getShapeMtx(u32 idx) const { return mShapeMtx[idx]; } - Vec* getMin() { return &mMin; } - Vec* getMax() { return &mMax; } - - static void resetVcdVatCache() { sOldVcdVatCmd = NULL; } - - static void* sOldVcdVatCmd; - -private: - friend struct J3DShapeFactory; - friend class J3DJointTree; - - /* 0x04 */ J3DMaterial* mMaterial; - /* 0x08 */ u16 mIndex; - /* 0x0A */ u16 mMtxGroupNum; - /* 0x0C */ u32 mFlags; - /* 0x10 */ f32 mRadius; - /* 0x14 */ Vec mMin; - /* 0x20 */ Vec mMax; - /* 0x2C */ u8* mVcdVatCmd; - /* 0x30 */ GXVtxDescList* mVtxDesc; - /* 0x34 */ bool mHasNBT; - /* 0x38 */ J3DShapeMtx** mShapeMtx; - /* 0x3C */ J3DShapeDraw** mShapeDraw; - /* 0x40 */ J3DCurrentMtx mCurrentMtx; - /* 0x48 */ bool mHasPNMTXIdx; - /* 0x4C */ J3DVertexData* mVertexData; - /* 0x50 */ J3DDrawMtxData* mDrawMtxData; - /* 0x54 */ u8* mScaleFlagArray; - /* 0x58 */ Mtx** mDrawMtx; - /* 0x5C */ Mtx33** mNrmMtx; - /* 0x60 */ u32* mCurrentViewNo; - /* 0x64 */ u32 mBumpMtxOffset; -}; - -#endif /* J3DSHAPE_H */ +#ifndef J3DSHAPE_H +#define J3DSHAPE_H + +#include "JSystem/J3DGraphBase/J3DShapeDraw.h" +#include "JSystem/J3DGraphBase/J3DShapeMtx.h" +#include "dolphin/gx.h" + +/** + * @ingroup jsystem-j3d + * + */ +class J3DCurrentMtxInfo { +public: + u32 mMtxIdxRegA; + u32 mMtxIdxRegB; +}; + +static inline void J3DFifoWriteCPCmd(u8 cmd, u32 param) { + GXWGFifo.u8 = GX_CMD_LOAD_CP_REG; + GXWGFifo.u8 = cmd; + GXWGFifo.u32 = param; +} + +static inline void J3DFifoWriteXFCmd(u16 cmd, u16 len) { + GXWGFifo.u8 = GX_CMD_LOAD_XF_REG; + GXWGFifo.u16 = (len - 1); + GXWGFifo.u16 = cmd; +} + +/** + * @ingroup jsystem-j3d + * + */ +class J3DCurrentMtx : public J3DCurrentMtxInfo { +public: + J3DCurrentMtx() { + mMtxIdxRegA = 0x3cf3cf00; + mMtxIdxRegB = 0x00f3cf3c; + } + + J3DCurrentMtx& operator=(J3DCurrentMtxInfo const& info) { + mMtxIdxRegA = info.mMtxIdxRegA; + mMtxIdxRegB = info.mMtxIdxRegB; + return *this; + } + + u32 getMtxIdxRegA() const { return mMtxIdxRegA; } + u32 getMtxIdxRegB() const { return mMtxIdxRegB; } + + inline void load() const { + J3DFifoWriteCPCmd(0x30, getMtxIdxRegA()); // CP_MATINDEX_A + J3DFifoWriteCPCmd(0x40, getMtxIdxRegB()); // CP_MATINDEX_B + J3DFifoWriteXFCmd(0x1018, 2); + GXWGFifo.u32 = getMtxIdxRegA(); + GXWGFifo.u32 = getMtxIdxRegB(); + } + + void setCurrentTexMtx(u8 param_1, u8 param_2, u8 param_3, u8 param_4, + u8 param_5, u8 param_6, u8 param_7, u8 param_8) { + mMtxIdxRegA = ((param_1 & 0xff) << 6) | (param_2 << 0xc)| (param_3 << 0x12) | (param_4 << 0x18); + mMtxIdxRegB = (param_5) | param_6 << 6 | param_7 << 0xc | param_8 << 0x12; + } +}; + +class J3DMaterial; +class J3DVertexData; +class J3DDrawMtxData; + +enum J3DShpFlag { + J3DShpFlag_Visible = 0x0001, + J3DShpFlag_SkinPosCpu = 0x0004, + J3DShpFlag_SkinNrmCpu = 0x0008, + J3DShpFlag_Hidden = 0x0010, + J3DShpFlag_EnableLod = 0x0100, + J3DShpFlag_NoMtx = 0x0200, +}; + +/** + * @ingroup jsystem-j3d + * + */ +class J3DShape { +public: + J3DShape() { + initialize(); + } + + enum { + kVcdVatDLSize = 0xC0, + }; + + /* 80314B48 */ void initialize(); + /* 80314BB8 */ void addTexMtxIndexInDL(_GXAttr, u32); + /* 80314CBC */ void addTexMtxIndexInVcd(_GXAttr); + /* 80314DA8 */ void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]); + /* 80314E28 */ u32 countBumpMtxNum() const; + /* 80314EEC */ void loadVtxArray() const; + /* 80314F5C */ bool isSameVcdVatCmd(J3DShape*); + /* 80314F98 */ void makeVtxArrayCmd(); + /* 80315260 */ void makeVcdVatCmd(); + /* 80315300 */ void loadPreDrawSetting() const; + /* 80315398 */ void setArrayAndBindPipeline() const; + + /* 803155E0 */ virtual void draw() const; + /* 8031544C */ virtual void drawFast() const; + /* 80315628 */ virtual void simpleDraw() const; + /* 803156AC */ virtual void simpleDrawCache() const; + + void onFlag(u32 flag) { mFlags |= flag; } + void offFlag(u32 flag) { mFlags &= ~flag; } + bool checkFlag(u32 flag) const { return !!(mFlags & flag); } + void setDrawMtxDataPointer(J3DDrawMtxData* pMtxData) { mDrawMtxData = pMtxData; } + void setVertexDataPointer(J3DVertexData* pVtxData) { mVertexData = pVtxData; } + void* getVcdVatCmd() const { return mVcdVatCmd; } + void setVcdVatCmd(void* pVatCmd) { mVcdVatCmd = (u8*)pVatCmd; } + void show() { offFlag(J3DShpFlag_Visible); } + void hide() { onFlag(J3DShpFlag_Visible); } + void setCurrentViewNoPtr(u32* pViewNoPtr) { mCurrentViewNo = pViewNoPtr; } + void setCurrentMtx(J3DCurrentMtx& mtx) { mCurrentMtx = mtx; } + void setScaleFlagArray(u8* pScaleFlagArray) { mScaleFlagArray = pScaleFlagArray; } + void setDrawMtx(Mtx** pDrawMtx) { mDrawMtx = pDrawMtx; } + void setNrmMtx(Mtx33** pNrmMtx) { mNrmMtx = pNrmMtx; } + void setTexMtxLoadType(u32 type) { mFlags = (mFlags & 0xFFFF0FFF) | type; } + bool getNBTFlag() const { return mHasNBT; } + u32 getBumpMtxOffset() const { return mBumpMtxOffset; } + GXVtxDescList* getVtxDesc() const { return mVtxDesc; } + + J3DMaterial* getMaterial() const { return mMaterial; } + u32 getIndex() const { return mIndex; } + u32 getPipeline() const { return (mFlags >> 2) & 0x07; } + u32 getTexMtxLoadType() const { return mFlags & 0xF000; } + u32 getMtxGroupNum() const { return mMtxGroupNum; } + J3DShapeDraw* getShapeDraw(u32 idx) const { return mShapeDraw[idx]; } + J3DShapeMtx* getShapeMtx(u32 idx) const { return mShapeMtx[idx]; } + Vec* getMin() { return &mMin; } + Vec* getMax() { return &mMax; } + + static void resetVcdVatCache() { sOldVcdVatCmd = NULL; } + + static void* sOldVcdVatCmd; + +private: + friend struct J3DShapeFactory; + friend class J3DJointTree; + + /* 0x04 */ J3DMaterial* mMaterial; + /* 0x08 */ u16 mIndex; + /* 0x0A */ u16 mMtxGroupNum; + /* 0x0C */ u32 mFlags; + /* 0x10 */ f32 mRadius; + /* 0x14 */ Vec mMin; + /* 0x20 */ Vec mMax; + /* 0x2C */ u8* mVcdVatCmd; + /* 0x30 */ GXVtxDescList* mVtxDesc; + /* 0x34 */ bool mHasNBT; + /* 0x38 */ J3DShapeMtx** mShapeMtx; + /* 0x3C */ J3DShapeDraw** mShapeDraw; + /* 0x40 */ J3DCurrentMtx mCurrentMtx; + /* 0x48 */ bool mHasPNMTXIdx; + /* 0x4C */ J3DVertexData* mVertexData; + /* 0x50 */ J3DDrawMtxData* mDrawMtxData; + /* 0x54 */ u8* mScaleFlagArray; + /* 0x58 */ Mtx** mDrawMtx; + /* 0x5C */ Mtx33** mNrmMtx; + /* 0x60 */ u32* mCurrentViewNo; + /* 0x64 */ u32 mBumpMtxOffset; +}; + +#endif /* J3DSHAPE_H */ diff --git a/include/JSystem/J3DGraphBase/J3DShapeDraw.h b/include/JSystem/J3DGraphBase/J3DShapeDraw.h index 2293fd6337..8863f868d8 100644 --- a/include/JSystem/J3DGraphBase/J3DShapeDraw.h +++ b/include/JSystem/J3DGraphBase/J3DShapeDraw.h @@ -3,6 +3,10 @@ #include "dolphin/types.h" +/** + * @ingroup jsystem-j3d + * + */ class J3DShapeDraw { public: /* 80314924 */ u32 countVertex(u32); diff --git a/include/JSystem/J3DGraphBase/J3DShapeMtx.h b/include/JSystem/J3DGraphBase/J3DShapeMtx.h index 222d35a0a1..590b95a3ff 100644 --- a/include/JSystem/J3DGraphBase/J3DShapeMtx.h +++ b/include/JSystem/J3DGraphBase/J3DShapeMtx.h @@ -6,6 +6,10 @@ class J3DTexMtx; class J3DTexGenBlock; +/** + * @ingroup jsystem-j3d + * + */ class J3DTexMtxObj { public: Mtx& getMtx(u16 idx) { return mpTexMtx[idx]; } @@ -17,6 +21,10 @@ public: /* 0x08 */ u16 mTexMtxNum; }; +/** + * @ingroup jsystem-j3d + * + */ class J3DDifferedTexMtx { public: /* 8031322C */ static void loadExecute(f32 const (*)[4]); @@ -33,6 +41,10 @@ public: class J3DShapeMtx; typedef void (J3DShapeMtx::*J3DShapeMtx_LoadFunc)(int, u16) const; +/** + * @ingroup jsystem-j3d + * + */ class J3DShapeMtx { public: J3DShapeMtx(u16 useMtxIndex) @@ -71,6 +83,10 @@ protected: class J3DShapeMtxConcatView; typedef void (J3DShapeMtxConcatView::*J3DShapeMtxConcatView_LoadFunc)(int, u16) const; +/** + * @ingroup jsystem-j3d + * + */ class J3DShapeMtxConcatView : public J3DShapeMtx { public: J3DShapeMtxConcatView(u16 useMtxIndex) @@ -94,6 +110,10 @@ public: static MtxP sMtxPtrTbl[2]; }; +/** + * @ingroup jsystem-j3d + * + */ class J3DShapeMtxYBBoardConcatView : public J3DShapeMtxConcatView { public: J3DShapeMtxYBBoardConcatView(u16 useMtxIndex) @@ -105,6 +125,10 @@ public: /* 803143E4 */ virtual void load() const; }; +/** + * @ingroup jsystem-j3d + * + */ class J3DShapeMtxBBoardConcatView : public J3DShapeMtxConcatView { public: J3DShapeMtxBBoardConcatView(u16 useMtxIndex) @@ -116,6 +140,10 @@ public: /* 803142D4 */ virtual void load() const; }; +/** + * @ingroup jsystem-j3d + * + */ class J3DShapeMtxMulti : public J3DShapeMtx { public: J3DShapeMtxMulti(u16 useMtxIndex, u16 useMtxNum, u16* useMtxIndexTable) @@ -136,6 +164,10 @@ private: /* 0xC */ u16* mUseMtxIndexTable; }; +/** + * @ingroup jsystem-j3d + * + */ class J3DShapeMtxMultiConcatView : public J3DShapeMtxConcatView { public: J3DShapeMtxMultiConcatView(u16 useMtxIndex, u16 useMtxNum, u16* useMtxIndexTable) diff --git a/include/JSystem/J3DGraphBase/J3DStruct.h b/include/JSystem/J3DGraphBase/J3DStruct.h index 13e097cf3e..c019217e5d 100644 --- a/include/JSystem/J3DGraphBase/J3DStruct.h +++ b/include/JSystem/J3DGraphBase/J3DStruct.h @@ -3,9 +3,12 @@ #include "dolphin/gx/GXStruct.h" #include "dolphin/mtx.h" -#include "dolphin/mtx/mtx44.h" #include "dolphin/mtx/vec.h" +/** + * @ingroup jsystem-j3d + * + */ class J3DLightInfo { public: /* 803256C4 */ J3DLightInfo& operator=(J3DLightInfo const&); @@ -19,6 +22,10 @@ public: extern "C" extern J3DLightInfo const j3dDefaultLightInfo; +/** + * @ingroup jsystem-j3d + * + */ class J3DLightObj { public: /* 80018C0C */ J3DLightObj() { mInfo = j3dDefaultLightInfo; } @@ -34,6 +41,10 @@ public: /* 0x34 */ GXLightObj mLightObj; }; // Size = 0x74 +/** + * @ingroup jsystem-j3d + * + */ struct J3DTextureSRTInfo { /* 0x00 */ f32 mScaleX; /* 0x04 */ f32 mScaleY; @@ -60,6 +71,10 @@ struct J3DTextureSRTInfo { } }; // Size: 0x14 +/** + * @ingroup jsystem-j3d + * + */ struct J3DTexMtxInfo { /* 80325718 */ J3DTexMtxInfo& operator=(J3DTexMtxInfo const&); /* 80325794 */ void setEffectMtx(Mtx); @@ -73,12 +88,20 @@ struct J3DTexMtxInfo { /* 0x24 */ Mtx44 mEffectMtx; }; // Size: 0x64 +/** + * @ingroup jsystem-j3d + * + */ struct J3DIndTexMtxInfo { J3DIndTexMtxInfo& operator=(J3DIndTexMtxInfo const&); /* 0x00 */ Mtx23 field_0x0; /* 0x18 */ u8 field_0x18; }; // Size: 0x1C +/** + * @ingroup jsystem-j3d + * + */ struct J3DFogInfo { /* 80325800 */ J3DFogInfo& operator=(J3DFogInfo const&); @@ -93,6 +116,10 @@ struct J3DFogInfo { /* 0x18 */ GXFogAdjTable field_0x18; }; // Size: 0x2C +/** + * @ingroup jsystem-j3d + * + */ struct J3DNBTScaleInfo { /* 8032587C */ J3DNBTScaleInfo& operator=(J3DNBTScaleInfo const&); diff --git a/include/JSystem/J3DGraphBase/J3DSys.h b/include/JSystem/J3DGraphBase/J3DSys.h index 774f303fc1..2a2f667109 100644 --- a/include/JSystem/J3DGraphBase/J3DSys.h +++ b/include/JSystem/J3DGraphBase/J3DSys.h @@ -2,7 +2,6 @@ #define J3DSYS_H #include "dolphin/gx.h" -#include "dolphin/types.h" // Perhaps move to a new J3DEnum.h? enum J3DError { @@ -23,6 +22,10 @@ class J3DShape; class J3DDrawBuffer; class J3DTexture; +/** + * @ingroup jsystem-j3d + * + */ struct J3DTexCoordScaleInfo { /* 0x0 */ u16 field_0x00; /* 0x2 */ u16 field_0x02; @@ -36,6 +39,10 @@ enum J3DSysFlag { J3DSysFlag_PostTexMtx = 0x40000000, }; +/** + * @ingroup jsystem-j3d + * + */ struct J3DSys { /* 0x000 */ Mtx mViewMtx; /* 0x030 */ J3DMtxCalc* mCurrentMtxCalc; diff --git a/include/JSystem/J3DGraphBase/J3DTevs.h b/include/JSystem/J3DGraphBase/J3DTevs.h index 6453019814..a7b668bd2c 100644 --- a/include/JSystem/J3DGraphBase/J3DTevs.h +++ b/include/JSystem/J3DGraphBase/J3DTevs.h @@ -3,6 +3,10 @@ #include "dolphin/types.h" +/** + * @ingroup jsystem-j3d + * + */ struct J3DTevStageInfo { /* 0x0 */ u8 field_0x0; /* 0x1 */ u8 mTevColorOp; @@ -28,6 +32,10 @@ struct J3DTevStageInfo { extern J3DTevStageInfo const j3dDefaultTevStageInfo; +/** + * @ingroup jsystem-j3d + * + */ struct J3DTevSwapModeTableInfo { /* 0x0 */ u8 field_0x0; /* 0x1 */ u8 field_0x1; @@ -37,6 +45,10 @@ struct J3DTevSwapModeTableInfo { extern const J3DTevSwapModeTableInfo j3dDefaultTevSwapModeTable; +/** + * @ingroup jsystem-j3d + * + */ struct J3DTevSwapModeInfo { /* 0x0 */ u8 mRasSel; /* 0x1 */ u8 mTexSel; @@ -46,6 +58,10 @@ struct J3DTevSwapModeInfo { extern J3DTevSwapModeInfo const j3dDefaultTevSwapMode; +/** + * @ingroup jsystem-j3d + * + */ struct J3DTevStage { /* 8000E230 */ J3DTevStage(); void setTevColorOp(u8 param_1, u8 param_2, u8 param_3, u8 param_4, u8 param_5) { @@ -120,6 +136,10 @@ struct J3DTevStage { /* 0x7 */ u8 mTevSwapModeInfo; }; +/** + * @ingroup jsystem-j3d + * + */ struct J3DIndTevStageInfo { /* 0x0 */ u8 mIndStage; /* 0x1 */ u8 mIndFormat; @@ -135,6 +155,10 @@ struct J3DIndTevStageInfo { extern J3DIndTevStageInfo const j3dDefaultIndTevStageInfo; +/** + * @ingroup jsystem-j3d + * + */ struct J3DIndTevStage { /* 8000E14C */ J3DIndTevStage() : mInfo(0) { setIndTevStageInfo(j3dDefaultIndTevStageInfo); } J3DIndTevStage(J3DIndTevStageInfo const& info) : mInfo(0) { setIndTevStageInfo(info); } @@ -162,6 +186,10 @@ struct J3DIndTevStage { /* 0x0 */ u32 mInfo; }; +/** + * @ingroup jsystem-j3d + * + */ struct J3DTevOrderInfo { void operator=(const J3DTevOrderInfo& other) { *(u32*) this = *(u32*)&other; @@ -175,6 +203,10 @@ struct J3DTevOrderInfo { extern const J3DTevOrderInfo j3dDefaultTevOrderInfoNull; +/** + * @ingroup jsystem-j3d + * + */ struct J3DTevOrder : public J3DTevOrderInfo { /* 8000E140 */ J3DTevOrder() : J3DTevOrderInfo(j3dDefaultTevOrderInfoNull) {} J3DTevOrder(const J3DTevOrderInfo& info) : J3DTevOrderInfo(info) {} @@ -182,6 +214,10 @@ struct J3DTevOrder : public J3DTevOrderInfo { u8 getTexMap() { return mTexMap; } }; +/** + * @ingroup jsystem-j3d + * + */ struct J3DTevSwapModeTable { /* 8000E134 */ J3DTevSwapModeTable(); J3DTevSwapModeTable(J3DTevSwapModeTableInfo const& info) { diff --git a/include/JSystem/J3DGraphBase/J3DTexture.h b/include/JSystem/J3DGraphBase/J3DTexture.h index 6deb7e563f..479d674ed8 100644 --- a/include/JSystem/J3DGraphBase/J3DTexture.h +++ b/include/JSystem/J3DGraphBase/J3DTexture.h @@ -1,92 +1,107 @@ -#ifndef J3DTEXTURE_H -#define J3DTEXTURE_H - -#include "JSystem/J3DGraphBase/J3DStruct.h" -#include "JSystem/JUtility/JUTTexture.h" -#include "dolphin/mtx.h" -#include "dolphin/types.h" - -class J3DTexture { -private: - /* 0x0 */ u16 mNum; - /* 0x2 */ u16 field_0x2; - /* 0x4 */ ResTIMG* mpRes; - -public: - J3DTexture(u16 num, ResTIMG* res) : mNum(num), field_0x2(0), mpRes(res) {} - /* 8031204C */ void loadGX(u16, _GXTexMapID) const; - /* 803121A4 */ void entryNum(u16); - /* 8031221C */ void addResTIMG(u16, ResTIMG const*); - /* 803366A4 */ virtual ~J3DTexture() {} - - u16 getNum() const { return mNum; } - ResTIMG* getResTIMG(u16 entry) const { return &mpRes[entry]; } - void setResTIMG(u16 entry, const ResTIMG& timg) { - mpRes[entry] = timg; - mpRes[entry].imageOffset = ((mpRes[entry].imageOffset + (u32)&timg - (u32)(mpRes + entry))); - mpRes[entry].paletteOffset = ((mpRes[entry].paletteOffset + (u32)&timg - (u32)(mpRes + entry))); - } -}; - -extern J3DTexMtxInfo const j3dDefaultTexMtxInfo; - -class J3DTexMtx { -public: - J3DTexMtx() { - mTexMtxInfo = j3dDefaultTexMtxInfo; - } - J3DTexMtx(const J3DTexMtxInfo& info) { - mTexMtxInfo = info; - } - /* 803238C4 */ void load(u32) const; - /* 80323900 */ void calc(const Mtx); - /* 80323920 */ void calcTexMtx(const Mtx); - /* 80323C0C */ void calcPostTexMtx(const Mtx); - /* 80324358 */ void loadTexMtx(u32) const; - /* 803243BC */ void loadPostTexMtx(u32) const; - - J3DTexMtxInfo& getTexMtxInfo() { return mTexMtxInfo; } - Mtx& getMtx() { return mMtx; } - void setEffectMtx(Mtx effectMtx) { mTexMtxInfo.setEffectMtx(effectMtx); } - -private: - /* 0x00 */ J3DTexMtxInfo mTexMtxInfo; - /* 0x64 */ Mtx mMtx; -}; // Size: 0x94 - -struct J3DTexCoordInfo { - /* 0x0 */ u8 mTexGenType; - /* 0x1 */ u8 mTexGenSrc; - /* 0x2 */ u8 mTexGenMtx; - /* 0x3 */ u8 pad; -}; - -extern J3DTexCoordInfo const j3dDefaultTexCoordInfo[8]; - -struct J3DTexCoord : public J3DTexCoordInfo { - /* 8000E464 */ J3DTexCoord() { - setTexCoordInfo(j3dDefaultTexCoordInfo[0]); - resetTexMtxReg(); - } - J3DTexCoord(J3DTexCoordInfo const& info) { - setTexCoordInfo(info); - resetTexMtxReg(); - } - void setTexCoordInfo(J3DTexCoordInfo const& info) { - __memcpy(this, &info, sizeof(J3DTexCoordInfo)); - } - - u8 getTexGenType() { return mTexGenType; } - u8 getTexGenSrc() { return mTexGenSrc; } - u8 getTexGenMtx() { return mTexGenMtx & 0xff; } - u16 getTexMtxReg() { return mTexMtxReg & 0xff; } - void setTexGenMtx(u8 param_1) { mTexGenMtx = param_1; } - - void resetTexMtxReg() { - mTexMtxReg = mTexGenMtx; - } - - /* 0x4 */ u16 mTexMtxReg; -}; // Size: 0x6 - -#endif /* J3DTEXTURE_H */ +#ifndef J3DTEXTURE_H +#define J3DTEXTURE_H + +#include "JSystem/J3DGraphBase/J3DStruct.h" +#include "JSystem/JUtility/JUTTexture.h" +#include "dolphin/types.h" + +/** + * @ingroup jsystem-j3d + * + */ +class J3DTexture { +private: + /* 0x0 */ u16 mNum; + /* 0x2 */ u16 field_0x2; + /* 0x4 */ ResTIMG* mpRes; + +public: + J3DTexture(u16 num, ResTIMG* res) : mNum(num), field_0x2(0), mpRes(res) {} + /* 8031204C */ void loadGX(u16, _GXTexMapID) const; + /* 803121A4 */ void entryNum(u16); + /* 8031221C */ void addResTIMG(u16, ResTIMG const*); + /* 803366A4 */ virtual ~J3DTexture() {} + + u16 getNum() const { return mNum; } + ResTIMG* getResTIMG(u16 entry) const { return &mpRes[entry]; } + void setResTIMG(u16 entry, const ResTIMG& timg) { + mpRes[entry] = timg; + mpRes[entry].imageOffset = ((mpRes[entry].imageOffset + (u32)&timg - (u32)(mpRes + entry))); + mpRes[entry].paletteOffset = ((mpRes[entry].paletteOffset + (u32)&timg - (u32)(mpRes + entry))); + } +}; + +extern J3DTexMtxInfo const j3dDefaultTexMtxInfo; + +/** + * @ingroup jsystem-j3d + * + */ +class J3DTexMtx { +public: + J3DTexMtx() { + mTexMtxInfo = j3dDefaultTexMtxInfo; + } + J3DTexMtx(const J3DTexMtxInfo& info) { + mTexMtxInfo = info; + } + /* 803238C4 */ void load(u32) const; + /* 80323900 */ void calc(const Mtx); + /* 80323920 */ void calcTexMtx(const Mtx); + /* 80323C0C */ void calcPostTexMtx(const Mtx); + /* 80324358 */ void loadTexMtx(u32) const; + /* 803243BC */ void loadPostTexMtx(u32) const; + + J3DTexMtxInfo& getTexMtxInfo() { return mTexMtxInfo; } + Mtx& getMtx() { return mMtx; } + void setEffectMtx(Mtx effectMtx) { mTexMtxInfo.setEffectMtx(effectMtx); } + +private: + /* 0x00 */ J3DTexMtxInfo mTexMtxInfo; + /* 0x64 */ Mtx mMtx; +}; // Size: 0x94 + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DTexCoordInfo { + /* 0x0 */ u8 mTexGenType; + /* 0x1 */ u8 mTexGenSrc; + /* 0x2 */ u8 mTexGenMtx; + /* 0x3 */ u8 pad; +}; + +extern J3DTexCoordInfo const j3dDefaultTexCoordInfo[8]; + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DTexCoord : public J3DTexCoordInfo { + /* 8000E464 */ J3DTexCoord() { + setTexCoordInfo(j3dDefaultTexCoordInfo[0]); + resetTexMtxReg(); + } + J3DTexCoord(J3DTexCoordInfo const& info) { + setTexCoordInfo(info); + resetTexMtxReg(); + } + void setTexCoordInfo(J3DTexCoordInfo const& info) { + __memcpy(this, &info, sizeof(J3DTexCoordInfo)); + } + + u8 getTexGenType() { return mTexGenType; } + u8 getTexGenSrc() { return mTexGenSrc; } + u8 getTexGenMtx() { return mTexGenMtx & 0xff; } + u16 getTexMtxReg() { return mTexMtxReg & 0xff; } + void setTexGenMtx(u8 param_1) { mTexGenMtx = param_1; } + + void resetTexMtxReg() { + mTexMtxReg = mTexGenMtx; + } + + /* 0x4 */ u16 mTexMtxReg; +}; // Size: 0x6 + +#endif /* J3DTEXTURE_H */ diff --git a/include/JSystem/J3DGraphBase/J3DTransform.h b/include/JSystem/J3DGraphBase/J3DTransform.h index 5ffe0a73d9..0a327c4c48 100644 --- a/include/JSystem/J3DGraphBase/J3DTransform.h +++ b/include/JSystem/J3DGraphBase/J3DTransform.h @@ -6,6 +6,10 @@ struct J3DTextureSRTInfo; +/** + * @ingroup jsystem-j3d + * + */ struct J3DTransformInfo { /* 0x00 */ JGeometry::TVec3 mScale; /* 0x0C */ JGeometry::TVec3 mRotation; diff --git a/include/JSystem/J3DGraphBase/J3DVertex.h b/include/JSystem/J3DGraphBase/J3DVertex.h index 4e5129a3bf..f100736965 100644 --- a/include/JSystem/J3DGraphBase/J3DVertex.h +++ b/include/JSystem/J3DGraphBase/J3DVertex.h @@ -3,13 +3,16 @@ #include "dolphin/gx/GXAttr.h" #include "dolphin/mtx/vec.h" -#include "dolphin/types.h" typedef struct _GXColor GXColor; class J3DModel; class J3DAnmVtxColor; class J3DVertexBuffer; +/** + * @ingroup jsystem-j3d + * + */ struct J3DVtxColorCalc { /* 8032E180 */ void calc(J3DModel*); virtual void calc(J3DVertexBuffer*); @@ -19,6 +22,10 @@ struct J3DVtxColorCalc { /* 0x8 */ J3DAnmVtxColor* mpVtxColor; }; +/** + * @ingroup jsystem-j3d + * + */ class J3DVertexData { public: J3DVertexData(); @@ -61,6 +68,10 @@ private: /* 0x58 */ GXCompType mVtxNrmType; }; +/** + * @ingroup jsystem-j3d + * + */ class J3DVertexBuffer { public: J3DVertexBuffer() { init(); } -- cgit v1.2.3