rob TP headers blind part 3: J3D round 2

This commit is contained in:
HeartPiece 2023-01-27 13:06:12 +11:00
parent 82cb864976
commit f9bf01ac95
93 changed files with 1040 additions and 676 deletions

View File

@ -63,12 +63,12 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JMath/JMath.cpp">JMath/JMath.cpp</a> | 5890 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JGadget/std-list.cpp">JGadget/std-list.cpp</a> | 5990 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio2/JAI/JAIFx.cpp">JAudio2/JAI/JAIFx.cpp</a> | 6650 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUtility/JUTDirectFile.cpp">JUtility/JUTDirectFile.cpp</a> | 6711 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DBloSaver.cpp">J2D/J2DBloSaver.cpp</a> | 7230 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUtility/JUTVideo.cpp">JUtility/JUTVideo.cpp</a> | 7304 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio2/JAI/JAIDummyObject.cpp">JAudio2/JAI/JAIDummyObject.cpp</a> | 7340 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DModelData.cpp">J3D/J3DModelData.cpp</a> | 7463 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio2/JAI/JAIDummyObject.cpp">JAudio2/JAI/JAIDummyObject.cpp</a> | 7340 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DModelData.cpp">J3D/J3DModelData.cpp</a> | 7479 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUtility/JUTDbPrint.cpp">JUtility/JUTDbPrint.cpp</a> | 7480 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio2/dsp/osdsp_task.c">JAudio2/dsp/osdsp_task.c</a> | 7510 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio2/JAS/JASAudioThread.cpp">JAudio2/JAS/JASAudioThread.cpp</a> | 7528 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JKernel/JKRFileLoader.cpp">JKernel/JKRFileLoader.cpp</a> | 7749 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio/JStudio/jstudio-math.cpp">JStudio/JStudio/jstudio-math.cpp</a> | 8174 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JMessage/control.cpp">JMessage/control.cpp</a> | 8567 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio2/JAU/JAUData.cpp">JAudio2/JAU/JAUData.cpp</a> | 9034 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio2/JAL/JALCalc.cpp">JAudio2/JAL/JALCalc.cpp</a> | 9063 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterialAnm.cpp">J3D/J3DMaterialAnm.cpp</a> | 9305 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio2/JAS/JASDriverIF.cpp">JAudio2/JAS/JASDriverIF.cpp</a> | 9499 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterialAnm.cpp">J3D/J3DMaterialAnm.cpp</a> | 9184 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio2/JAS/JASDriverIF.cpp">JAudio2/JAS/JASDriverIF.cpp</a> | 9499 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUtility/JUTXfb.cpp">JUtility/JUTXfb.cpp</a> | 9531 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio2/JAS/JASBasicWaveBank.cpp">JAudio2/JAS/JASBasicWaveBank.cpp</a> | 9654 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAExtraShape.cpp">JParticle/JPAExtraShape.cpp</a> | 9736 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DJointTree.cpp">J3D/J3DJointTree.cpp</a> | 9807 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAResourceLoader.cpp">JParticle/JPAResourceLoader.cpp</a> | 9814 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAMath.cpp">JParticle/JPAMath.cpp</a> | 10028 |
@ -134,7 +134,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameGeneratorCache.cpp">gameGeneratorCache.cpp</a> | 46523 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gamePlayDataMemCard.cpp">gamePlayDataMemCard.cpp</a> | 48609 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameCaveInfo.cpp">gameCaveInfo.cpp</a> | 49577 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/pelletCarcass.cpp">pelletCarcass.cpp</a> | 55314 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameGenerator.cpp">gameGenerator.cpp</a> | 55928 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/cellPyramid.cpp">cellPyramid.cpp</a> | 57895 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameSeaMgr.cpp">gameSeaMgr.cpp</a> | 60169 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameSeaMgr.cpp">gameSeaMgr.cpp</a> | 60181 |
### <section id="plugProjectKonoU">plugProjectKonoU</section>
| File | Size (bytes) | File | Size (bytes) |

View File

@ -34,9 +34,6 @@ typedef enum _GXCullMode {
} GXCullMode;
#pragma enumalwaysint reset
// TODO: Placeholder
typedef u32 _GXVtxAttrFmtList;
typedef enum _GXPrimitive {
GX_POINTS = 0xb8,
GX_LINES = 0xa8,
@ -669,7 +666,7 @@ typedef struct GXTexObj {
typedef struct _GXVtxDescList {
s32 _00;
u32 _04;
} GXTexDescList;
} GXVtxDescList;
// Compressed Z format
typedef enum _GXZFmt16 {
@ -954,6 +951,20 @@ typedef enum _GXGamma {
GX_GM_2_2,
} GXGamma;
typedef enum _GXCommand {
GX_CMD_LOAD_INDX_A = 0x20,
GX_CMD_LOAD_INDX_B = 0x28,
GX_CMD_LOAD_INDX_C = 0x30,
GX_CMD_LOAD_INDX_D = 0x38,
GX_CMD_LOAD_CP_REG = 0x08,
GX_CMD_LOAD_XF_REG = 0x10,
} GXCommand;
typedef struct _GXTexRegion {
u8 _00[0x10]; // _00
} GXTexRegion;
void __GXSetDirtyState();
void __GXSendFlushPrim();
@ -1137,6 +1148,13 @@ typedef enum _GXFBClamp {
GX_CLAMP_BOTTOM,
} GXFBClamp;
typedef struct _GXVtxAttrFmtList {
GXAttr mAttrib; // _00
GXCompCnt mCompCnt; // _04
GXCompType mCompType; // _08
u8 mCompShift; // _0C
} GXVtxAttrFmtList; // Size: 0x10
typedef GXTlutRegion* GXTlutRegionCallback(_GXTlut);
void GXInvalidateTexAll(void);

View File

@ -242,7 +242,7 @@ struct Mgr : public EnemyMgrBaseAlwaysMovieActor {
EnemyMgrBase::loadModelData();
P2ASSERTLINE(519, mModelData != nullptr);
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
P2ASSERTLINE(523, shape != nullptr);
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
@ -318,7 +318,7 @@ struct Mgr : public EnemyMgrBaseAlwaysMovieActor {
EnemyMgrBase::loadModelData();
P2ASSERTLINE(578, mModelData != nullptr);
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
P2ASSERTLINE(582, shape != nullptr);
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;

View File

@ -1,16 +0,0 @@
#ifndef _JSYSTEM_J3D_J3DMATCOLORANM_H
#define _JSYSTEM_J3D_J3DMATCOLORANM_H
#include "JSystem/J3D/J3DAnmColor.h"
#include "types.h"
struct J3DMatColorAnm {
J3DMatColorAnm();
~J3DMatColorAnm();
u16 _00; // _00
u16 _02; // _02
J3DAnmColor* mAnm; // _04
};
#endif

View File

@ -2,9 +2,10 @@
#define _JSYSTEM_J3D_J3DMATERIAL_H
#include "JSystem/J3D/J3DTevBlock.h"
#include "JSystem/J3D/J3DTevColorAnm.h"
#include "JSystem/J3D/J3DMaterialAnm.h"
#include "JSystem/J3D/J3DTypes.h"
#include "JSystem/J3D/J3DTexture.h"
#include "JSystem/J3D/J3DTexGenBlock.h"
#include "types.h"
struct J3DAnmColor;
@ -22,33 +23,65 @@ struct J3DTexMtxAnm;
struct J3DTexture;
struct JUTNameTab;
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;
}
struct J3DCurrentMtxInfo {
u32 mMtxIdxRegA; // _00
u32 mMtxIdxRegB; // _04
};
struct J3DCurrentMtx : public J3DCurrentMtxInfo {
J3DCurrentMtx()
{
mMtxIdxRegA = 0x3CF3CF00;
mMtxIdxRegB = 0x00FC3FC3;
}
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();
}
// _00-_08 = J3DCurrentMtxInfo
};
/**
* @size{0x4C}
*/
struct J3DMaterial {
/**
* @reifiedAddress{80070C54}
* @reifiedFile{JSystem/J3D/J3DModelLoader.cpp}
*/
inline J3DMaterial()
: _40(0x3CF3CF00)
, _44(0x00F3CF3C)
{
initialize();
}
inline J3DMaterial() { initialize(); }
~J3DMaterial();
virtual void calc(const f32 (*)[4]); // _08
virtual void calcDiffTexMtx(const f32 (*)[4]); // _0C
virtual void makeDisplayList(); // _10
virtual void makeSharedDisplayList(); // _14
virtual void load(); // _18
virtual void loadSharedDL(); // _1C
virtual void patch(); // _20
virtual void diff(u32); // _24
virtual void reset(); // _28
virtual void change(); // _2C
virtual void calc(const Mtx); // _08
virtual void calcDiffTexMtx(const Mtx); // _0C
virtual void makeDisplayList(); // _10
virtual void makeSharedDisplayList(); // _14
virtual void load(); // _18
virtual void loadSharedDL(); // _1C
virtual void patch(); // _20
virtual void diff(u32); // _24
virtual void reset(); // _28
virtual void change(); // _2C
void calcCurrentMtx();
static u32 calcSizeColorBlock(u32);
@ -67,26 +100,47 @@ struct J3DMaterial {
J3DErrType newSingleSharedDisplayList(u32);
void setCurrentMtx();
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; }
J3DShape* getShape() { return mShape; }
J3DJoint* getJoint() { return mJoint; }
J3DMaterialAnm* getMaterialAnm() const
{
if ((u32)mAnm < 0xC0000000) {
return mAnm;
} else {
return nullptr;
}
}
J3DNBTScale* getNBTScale() const { return mTexGenBlock->getNBTScale(); }
u32 getTexNo(u32 idx) const { return mTevBlock->getTexNo(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) { mAnm = i_anm; }
// VTBL _00
J3DMaterial* _04; // _04
J3DShape* mShape; // _08
J3DJoint* mJoint; // _0C
u32 _10; // _10
u16 _14; // _14
u32 _18; // _18
u8 _1C[4]; // _1C
/* RAM address of display list divided by 16? */
u32 _20; // _20
J3DColorBlock* mColorBlock; // _24
J3DTexGenBlock* mTexGenBlock; // _28
J3DTevBlock* mTevBlock; // _2C
J3DIndBlock* mIndBlock; // _30
J3DPEBlock* mPeBlock; // _34
J3DMaterial* _38; // _38
J3DMaterialAnm* _3C; // _3C
u32 _40; // _40
u32 _44; // _44
J3DDisplayListObj* _48; // _48
J3DMaterial* mNext; // _04
J3DShape* mShape; // _08
J3DJoint* mJoint; // _0C
u32 mMaterialMode; // _10
u16 mIndex; // _14
u32 mInvalid; // _18
u8 _1C[4]; // _1C
u32 mDiffFlag; // _20
J3DColorBlock* mColorBlock; // _24
J3DTexGenBlock* mTexGenBlock; // _28
J3DTevBlock* mTevBlock; // _2C
J3DIndBlock* mIndBlock; // _30
J3DPEBlock* mPeBlock; // _34
J3DMaterial* mOrigMaterial; // _38
J3DMaterialAnm* mAnm; // _3C
J3DCurrentMtx mCurrentMtx; // _40
J3DDisplayListObj* mSharedDLObj; // _48
};
/**
@ -111,6 +165,9 @@ struct J3DLockedMaterial : public J3DMaterial {
virtual void change(); // _2C
void initialize();
// _00 = VTBL
// _00-_4C = J3DMaterial
};
/**
@ -127,6 +184,9 @@ struct J3DPatchedMaterial : public J3DMaterial {
virtual void change(); // _2C
void initialize();
// _00 = VTBL
// _00-_4C = J3DMaterial
};
/**
@ -149,15 +209,22 @@ struct J3DMaterialTable {
void entryMatColorAnimator(J3DAnmColor*);
J3DMaterial* getMaterialNodePointer(u16 idx) const { return mMaterials[idx]; }
J3DTexture* getTexture() const { return mTextures; }
JUTNameTab* getTextureName() const { return mTextureNames; }
JUTNameTab* getMaterialName() const { return mMaterialNames; }
u16 getMaterialNum() const { return mMaterialNum; }
bool isLocked() const { return _1C == 1; }
// VTBL _00
u16 mCount1; // _04
u16 mCount2; // _06
J3DMaterial** mMaterials1; // _08
JUTNameTab* _0C; // _0C
J3DMaterial* mMaterials2; // _10
J3DTexture* mTexture; // _14
JUTNameTab* _18; // _18
u16 _1C; // _1C
u16 mMaterialNum; // _04
u16 mUniqueMaterialNum; // _06
J3DMaterial** mMaterials; // _08
JUTNameTab* mMaterialNames; // _0C
J3DMaterial* mUniqueMaterials; // _10
J3DTexture* mTextures; // _14
JUTNameTab* mTextureNames; // _18
u16 _1C; // _1C
};
#endif

View File

@ -3,17 +3,123 @@
#include "types.h"
#include "JSystem/J3D/J3DMatColorAnm.h"
#include "JSystem/J3D/J3DTexMtxAnm.h"
#include "JSystem/J3D/J3DTexNoAnm.h"
#include "JSystem/J3D/J3DTevColorAnm.h"
#include "JSystem/J3D/J3DAnmColor.h"
#include "JSystem/J3D/J3DAnmTexPattern.h"
#include "JSystem/J3D/J3DAnmTextureSRTKey.h"
#include "JSystem/J3D/J3DAnmTevRegKey.h"
struct J3DMaterial;
struct J3DTextureSRTInfo;
struct J3DMatColorAnm {
J3DMatColorAnm();
~J3DMatColorAnm();
void operator=(J3DMatColorAnm const& other)
{
mAnm = other.mAnm;
mIndex = other.mIndex;
mAnmFlag = other.mAnmFlag;
}
void setAnmFlag(bool flag) { mAnmFlag = flag; }
bool getAnmFlag() const { return mAnmFlag; }
void calc(_GXColor* pColor) const { mAnm->getColor(mIndex, pColor); }
u16 mIndex; // _00
u16 mAnmFlag; // _02
J3DAnmColor* mAnm; // _04
};
struct J3DTexNoAnm {
J3DTexNoAnm();
virtual void calc(u16*) const; // _08 (weak)
void operator=(J3DTexNoAnm const& other)
{
mAnm = other.mAnm;
_04 = other._04;
mAnmFlag = other.mAnmFlag;
}
~J3DTexNoAnm();
void setAnmFlag(bool flag) { mAnmFlag = flag; }
bool getAnmFlag() const { return mAnmFlag; }
J3DAnmTexPattern* getAnmTexPattern() { return mAnm; }
// _00 = VTBL
u16 _04; // _04
u16 mAnmFlag; // _06
J3DAnmTexPattern* mAnm; // _08
};
struct J3DTexMtxAnm {
J3DTexMtxAnm();
~J3DTexMtxAnm();
void operator=(J3DTexMtxAnm const& other)
{
mAnm = other.mAnm;
mIndex = other.mIndex;
mAnmFlag = other.mAnmFlag;
}
void setAnmFlag(bool flag) { mAnmFlag = flag; }
void calc(J3DTextureSRTInfo* pSRTInfo) const { mAnm->getTransform(mIndex, pSRTInfo); }
bool getAnmFlag() const { return mAnmFlag; }
u16 mIndex; // _00
u16 mAnmFlag; // _02
J3DAnmTextureSRTKey* mAnm; // _04
};
struct J3DTevColorAnm {
J3DTevColorAnm();
~J3DTevColorAnm();
void operator=(J3DTevColorAnm const& other)
{
mAnm = other.mAnm;
mIndex = other.mIndex;
mAnmFlag = other.mAnmFlag;
}
void setAnmFlag(bool flag) { mAnmFlag = flag; }
bool getAnmFlag() const { return mAnmFlag; }
void calc(GXColorS10* pColor) const { mAnm->getTevColorReg(mIndex, pColor); }
u16 mIndex; // _00
u16 mAnmFlag; // _02
J3DAnmTevRegKey* mAnm; // _04
};
struct J3DTevKColorAnm {
J3DTevKColorAnm();
~J3DTevKColorAnm();
void operator=(J3DTevKColorAnm const& other)
{
mAnm = other.mAnm;
mIndex = other.mIndex;
mAnmFlag = other.mAnmFlag;
}
void setAnmFlag(bool flag) { mAnmFlag = flag; }
bool getAnmFlag() const { return mAnmFlag; }
void calc(GXColor* pColor) const { mAnm->getTevKonstReg(mIndex, pColor); }
u16 mIndex; // _00
u16 mAnmFlag; // _02
J3DAnmTevRegKey* mAnm; // _04
};
struct J3DMaterialAnm {
/**
* @fabricated
*/
J3DMaterialAnm() { initialize(); }
virtual ~J3DMaterialAnm() { } // _08 (weak)
@ -21,12 +127,21 @@ struct J3DMaterialAnm {
void initialize();
// VTBL _00
J3DMatColorAnm mMatColAnmList[2];
J3DTexMtxAnm mTexMtxAnmList[8];
J3DTexNoAnm mTexNoAnmList[8];
J3DTevColorAnm mTevColAnmList[4];
J3DTevKColorAnm mTevKColAnmList[4];
// unused/TP debug inlines to do:
void setMatColorAnm(int, J3DMatColorAnm*);
void setTexMtxAnm(int, J3DTexMtxAnm*);
void setTexNoAnm(int, J3DTexNoAnm*);
void setTevColorAnm(int, J3DTevColorAnm*);
void setTevKColorAnm(int, J3DTevKColorAnm*);
const J3DTexMtxAnm& getTexMtxAnm(int i) const { return mTexMtxAnmList[i]; }
// _00 = VTBL
J3DMatColorAnm mMatColAnmList[2]; // _04
J3DTexMtxAnm mTexMtxAnmList[8]; // _14
J3DTexNoAnm mTexNoAnmList[8]; // _54
J3DTevColorAnm mTevColAnmList[4]; // _B4
J3DTevKColorAnm mTevKColAnmList[4]; // _D4
};
#endif

View File

@ -21,11 +21,6 @@ struct J3DColorChanInfo {
u8 _00[0x8]; // _00
};
struct J3DCurrentMtxInfo {
u32 _00; // _00
u32 _04; // _04
};
struct J3DDisplayListInit {
u32 _00; // _00
u32 _04; // _04

View File

@ -9,6 +9,7 @@
#include "JSystem/J3D/J3DJointTree.h"
#include "JSystem/J3D/J3DTypes.h"
#include "JSystem/J3D/J3DVertexBuffer.h"
#include "JSystem/J3D/J3DMtxBuffer.h"
#include "JSystem/JGeometry.h"
#include "JSystem/J3D/J3DPacket.h"
#include "JSystem/JUtility/JUTNameTab.h"
@ -21,6 +22,45 @@ struct J3DMtxBuffer;
struct J3DShapePacket;
struct J3DSkinDeform;
struct J3DVtxColorCalc;
struct J3DModel;
typedef void (*J3DCalcCallBack)(J3DModel*, u32 timing);
// TODO: name these
enum J3DModelFlags {
J3DMODEL_Unk1 = 0x1,
J3DMODEL_Unk2 = 0x2,
J3DMODEL_Unk3 = 0x4,
J3DMODEL_Unk4 = 0x8,
J3DMODEL_Unk5 = 0x10,
J3DMODEL_Unk6 = 0x20,
J3DMODEL_Unk7 = 0x40,
J3DMODEL_Unk8 = 0x80,
J3DMODEL_Unk9 = 0x100,
J3DMODEL_Unk10 = 0x200,
J3DMODEL_Unk11 = 0x400,
J3DMODEL_Unk12 = 0x800,
J3DMODEL_Unk13 = 0x1000,
J3DMODEL_Unk14 = 0x2000,
J3DMODEL_Unk15 = 0x4000,
J3DMODEL_Unk16 = 0x8000,
J3DMODEL_Unk17 = 0x10000,
J3DMODEL_Unk18 = 0x20000,
J3DMODEL_Unk19 = 0x40000,
J3DMODEL_Unk20 = 0x80000,
J3DMODEL_Unk21 = 0x100000,
J3DMODEL_Unk22 = 0x200000,
J3DMODEL_Unk23 = 0x400000,
J3DMODEL_Unk24 = 0x800000,
J3DMODEL_Unk25 = 0x1000000,
J3DMODEL_Unk26 = 0x2000000,
J3DMODEL_Unk27 = 0x4000000,
J3DMODEL_Unk28 = 0x8000000,
J3DMODEL_Unk29 = 0x10000000,
J3DMODEL_Unk30 = 0x20000000,
J3DMODEL_Unk31 = 0x40000000,
J3DMODEL_Unk32 = 0x80000000,
};
/**
* @size{0xE4}
@ -28,10 +68,6 @@ struct J3DVtxColorCalc;
struct J3DModelData {
J3DModelData();
/**
* @reifiedAddress{80083BB4}
* @reifiedFile{JSystem/J3D/J3DModelLoader.cpp}
*/
virtual ~J3DModelData() { } // _08 (weak)
void clear();
@ -41,11 +77,6 @@ struct J3DModelData {
void simpleCalcMaterial(u16, f32 (*)[4]);
void syncJ3DSysFlags() const;
inline u16 getShapeCount() { return mShapeTable.mCount; }
inline u16 getMaterialCount1() { return mMaterialTable.mCount1; }
/** @fabricated */
inline void init(const J3DModelHierarchy* hierarchy)
{
mJointTree.makeHierarchy(nullptr, &hierarchy, &mMaterialTable, &mShapeTable);
@ -54,30 +85,56 @@ struct J3DModelData {
inline void setTevColor(char* name, J3DGXColorS10& color)
{
u16 idx = mMaterialTable._0C->getIndex(name);
J3DMaterial* mat = mMaterialTable.mMaterials1[idx];
u16 idx = mMaterialTable.mMaterialNames->getIndex(name);
J3DMaterial* mat = mMaterialTable.mMaterials[idx];
mat->mTevBlock->setTevColor(0, color);
}
inline void setTevColor(char* name, u16 r, u16 g, u16 b, u16 a)
{
u16 idx = mMaterialTable._0C->getIndex(name);
J3DMaterial* mat = mMaterialTable.mMaterials1[idx];
u16 idx = mMaterialTable.mMaterialNames->getIndex(name);
J3DMaterial* mat = mMaterialTable.mMaterials[idx];
mat->mTevBlock->setTevColor(0, J3DGXColorS10(r, g, b, a));
}
inline J3DVertexData* getVertexData() { return &mVertexData; }
inline J3DJoint* getJointNodePointer(u16 idx) const { return mJointTree.getJointNodePointer(idx); }
J3DVertexData* getVertexData() { return &mVertexData; }
J3DJoint* getJointNodePointer(u16 idx) const { return mJointTree.getJointNodePointer(idx); }
J3DMaterialTable& getMaterialTable() { return mMaterialTable; }
JUTNameTab* getMaterialName() const { return mMaterialTable.getMaterialName(); }
u16 getShapeNum() const { return mShapeTable.getShapeNum(); }
u16 getMaterialNum() const { return mMaterialTable.getMaterialNum(); }
u16 getJointNum() const { return mJointTree.getJointNum(); }
u16 getDrawMtxNum() const { return mJointTree.getDrawMtxNum(); }
J3DMaterial* getMaterialNodePointer(u16 idx) const { return mMaterialTable.getMaterialNodePointer(idx); }
J3DShape* getShapeNodePointer(u16 idx) const { return mShapeTable.getItem(idx); }
J3DJointTree& getJointTree() { return mJointTree; }
JUTNameTab* getJointName() const { return mJointTree.getJointName(); }
Mtx& getInvJointMtx(s32 idx) const { return mJointTree.getInvJointMtx(idx); }
J3DTexture* getTexture() const { return mMaterialTable.getTexture(); }
JUTNameTab* getTextureName() const { return mMaterialTable.getTextureName(); }
u16 getWEvlpMtxNum() const { return mJointTree.getWEvlpMtxNum(); }
u32 getModelDataType() const { return mJointTree.getModelDataType(); }
void* getVtxNrmArray() const { return mVertexData.getVtxNrmArray(); }
GXColor* getVtxColorArray(u8 idx) const { return mVertexData.getVtxColorArray(idx); }
bool checkFlag(u32 flag) const { return (mModelLoaderFlags & flag) ? true : false; }
u32 getFlag() const { return mModelLoaderFlags; }
u16 checkBumpFlag() const { return mBumpFlag; }
void setBumpFlag(u32 flag) { mBumpFlag = flag; }
bool checkBBoardFlag() const { return mBillboardFlag == 1; }
bool isLocked() { return mMaterialTable.isLocked(); }
void entryTexMtxAnimator(J3DAnmTextureSRTKey* anm) { mMaterialTable.entryTexMtxAnimator(anm); }
void entryTevRegAnimator(J3DAnmTevRegKey* anm) { mMaterialTable.entryTevRegAnimator(anm); }
// VTBL _00
const void* mBmd; // _04
u32 mModelLoaderFlags; // _08
u16 _0C; // _0C
u16 mJointSet; // _0E
u16 mBumpFlag; // _0C
u16 mBillboardFlag; // _0E
J3DJointTree mJointTree; // _10
J3DMaterialTable mMaterialTable; // _58
J3DShapeTable mShapeTable; // _78
JUTNameTab* _84; // _84
J3DVertexData mVertexData; // _88
};
@ -85,27 +142,20 @@ struct J3DModelData {
* @size{0xDC}
*/
struct J3DModel {
/**
* @fabricated
*/
J3DModel(J3DModelData* data, unsigned long p2, unsigned long modelType)
J3DModel(J3DModelData* data, u32 p2, u32 modelType)
{
mVertexBuffer.init();
initialize();
entryModelData(data, p2, modelType);
}
virtual void update(); // _08
virtual void entry(); // _0C
virtual void calc(); // _10
virtual void calcMaterial(); // _14
virtual void calcDiffTexMtx(); // _18
virtual void viewCalc(); // _1C
/**
* @reifiedAddress{800675CC}
* @reifiedFile{JSystem/J3D/J3DModel.cpp}
*/
virtual ~J3DModel() { } // _20 (weak)
virtual ~J3DModel() { } // _20 (weak)
void initialize();
int entryModelData(J3DModelData*, u32, u32);
@ -125,24 +175,50 @@ struct J3DModel {
inline J3DModelData* getModelData() { return mModelData; }
void onFlag(u32 flag) { mFlags.typeView |= flag; }
void offFlag(u32 flag) { mFlags.typeView &= ~flag; }
bool checkFlag(u32 flag) const { return mFlags.typeView & flag; }
bool isCpuSkinningOn() const { return (mFlags.typeView & J3DMODEL_Unk3) && (mFlags.typeView & J3DMODEL_Unk4); }
Mtx& getBaseTRMtx() { return mPosMtx; }
void i_setBaseTRMtx(Mtx m) { PSMTXCopy(m, mPosMtx); }
u32 getMtxCalcMode() const { return mFlags.typeView & J3DMODEL_Unk3; }
J3DVertexBuffer* getVertexBuffer() const { return (J3DVertexBuffer*)&mVertexBuffer; }
J3DMatPacket* getMatPacket(u16 idx) const { return &mMatPackets[idx]; }
J3DShapePacket* getShapePacket(u16 idx) const { return &mShapePackets[idx]; }
Mtx33* getBumpMtxPtr(int idx) const { return mMtxBuffer->getBumpMtxPtr(idx); }
Mtx33* getNrmMtxPtr() const { return mMtxBuffer->getNrmMtxPtr(); }
Mtx* getDrawMtxPtr() const { return mMtxBuffer->getDrawMtxPtr(); }
void setBaseScale(const Vec& scale)
{
mModelScale.x = scale.x;
mModelScale.y = scale.y;
mModelScale.z = scale.z;
}
void setUserArea(u32 area) { mUserArea.typeView = area; }
u32 getUserArea() const { return mUserArea.typeView; }
JGeometry::TVec3f* getBaseScale() { return &mModelScale; }
void setAnmMtx(int i, Mtx m) { mMtxBuffer->setAnmMtx(i, m); }
// _00 VTBL
J3DModelData* mModelData; // _04
BitFlag<u32> _08; // _08 /* bitfield of some sort */
u32 mDisplayListFlag; // _0C
void* _10; // _10
BitFlag<u32> _14; // _14
JGeometry::TVec3<f32> mModelScale; // _18
Mtx mPosMtx; // _24
Mtx _54; // _54
J3DMtxBuffer* mMtxBuffer; // _84
J3DVertexBuffer mVertexBuffer; // _88
J3DMatPacket* mMatPackets; // _C0
J3DShapePacket* mShapePackets; // _C4
J3DDeformData* mDeformData; // _C8
J3DSkinDeform* mSkinDeform; // _CC
J3DVtxColorCalc* mVtxColorCalc; // _D0
u32 _D4; // _D4
void* _D8; // _D8
J3DModelData* mModelData; // _04
BitFlag<u32> mFlags; // _08
u32 mDiffFlag; // _0C
J3DCalcCallBack mCalcCallBack; // _10
BitFlag<u32> mUserArea; // _14
JGeometry::TVec3f mModelScale; // _18
Mtx mPosMtx; // _24
Mtx mInternalView; // _54
J3DMtxBuffer* mMtxBuffer; // _84
J3DVertexBuffer mVertexBuffer; // _88
J3DMatPacket* mMatPackets; // _C0
J3DShapePacket* mShapePackets; // _C4
J3DDeformData* mDeformData; // _C8
J3DSkinDeform* mSkinDeform; // _CC
J3DVtxColorCalc* mVtxColorCalc; // _D0
u32 _D4; // _D4
void* _D8; // _D8
};
struct J3DModelHierarchy {
@ -150,19 +226,4 @@ struct J3DModelHierarchy {
u16 _02;
};
struct J3DSkinDeform {
J3DSkinDeform(); // UNUSED
virtual void deform(J3DVertexBuffer*, J3DMtxBuffer*); // _08
virtual ~J3DSkinDeform() { } // _0C
void deform(J3DModel* model);
// _00 VTBL
unknown _04; // _04
BitFlag<u32> _08; // _08 /* bitfield of some sort */
unknown _0C; // _0C
unknown _10; // _10
BitFlag<u32> _14; // _14
};
#endif

View File

@ -2,6 +2,7 @@
#define _JSYSTEM_J3D_J3DMTXBUFFER_H
#include "Dolphin/mtx.h"
#include "Matrixf.h"
#include "types.h"
struct J3DJointTree;
@ -12,16 +13,16 @@ struct J3DModelData;
* @fabricatedName
*/
struct J3DMtxBufferParent {
J3DJointTree* mJointTree; // _00
u8* _04; // _04
u8* _08; // _08
Mtx* mWorldMatrices; // _0C
Mtx* _10; // _10
Mtx** _14[2]; // _14
Mtx33** _1C[2]; // _1C
Mtx33*** _24[2]; // _24
u32 mModelType; // _2C
u32 mCurrentViewNumber; // _30
J3DJointTree* mJointTree; // _00
u8* mScaleFlags; // _04
u8* mEnvelopeScaleFlags; // _08
Mtx* mWorldMatrices; // _0C
Mtx* mWeightEnvelopeMatrices; // _10
Mtx** mDrawMatrices[2]; // _14
Mtx33** mNormMatrices[2]; // _1C
Mtx33*** mBumpMatrices[2]; // _24
u32 mModelType; // _2C
u32 mCurrentViewNumber; // _30
};
struct J3DMtxBuffer : public J3DMtxBufferParent {
@ -43,6 +44,34 @@ struct J3DMtxBuffer : public J3DMtxBufferParent {
inline Matrixf* getWorldMatrix(int i) { return (Matrixf*)mWorldMatrices[i]; }
void setAnmMtx(int i, Mtx m) { PSMTXCopy(m, mWorldMatrices[i]); }
void setScaleFlag(int idx, u8 flag) { mScaleFlags[idx] = flag; }
u32* getCurrentViewNoPtr() { return &mCurrentViewNumber; }
u8* getScaleFlagArray() const { return mScaleFlags; }
u8 getScaleFlag(u16 idx) const { return mScaleFlags[idx]; }
Mtx** getDrawMtxPtrPtr() const { return mDrawMatrices[1]; }
Mtx* getDrawMtxPtr() const { return mDrawMatrices[1][mCurrentViewNumber]; }
Mtx* getDrawMtx(u16 idx) const { return &mDrawMatrices[1][mCurrentViewNumber][idx]; }
Mtx33** getNrmMtxPtrPtr() const { return mNormMatrices[1]; }
Mtx33* getNrmMtxPtr() const { return mNormMatrices[1][mCurrentViewNumber]; }
Mtx33* getNrmMtx(u16 idx) const { return &mNormMatrices[1][mCurrentViewNumber][idx]; }
Mtx33*** getBumpMtxPtrPtr() const { return mBumpMatrices[1]; }
Mtx33* getBumpMtxPtr(int idx) const { return mBumpMatrices[1][idx][mCurrentViewNumber]; }
void swapDrawMtx()
{
Mtx* tmp = mDrawMatrices[0][mCurrentViewNumber];
mDrawMatrices[0][mCurrentViewNumber] = mDrawMatrices[1][mCurrentViewNumber];
mDrawMatrices[1][mCurrentViewNumber] = tmp;
}
void swapNrmMtx()
{
Mtx33* tmp = mNormMatrices[0][mCurrentViewNumber];
mNormMatrices[0][mCurrentViewNumber] = mNormMatrices[1][mCurrentViewNumber];
mNormMatrices[1][mCurrentViewNumber] = tmp;
}
static Mtx* sNoUseDrawMtxPtr;
static Mtx33* sNoUseNrmMtxPtr;

View File

@ -4,12 +4,14 @@
#include "Dolphin/gx.h"
#include "Dolphin/mtx.h"
#include "JSystem/JGeometry.h"
#include "JSystem/J3D/J3DMaterial.h"
#include "types.h"
struct J3DDrawMtxData;
struct J3DJos32Tree;
struct J3DMaterial;
struct J3DVertexData;
struct JUTNameTab;
struct Vec;
struct J3DShapeDraw;
@ -22,17 +24,25 @@ struct J3DShapeMtx;
struct J3DShapeInitData {
u8 mShapeMtxType; // _00
u16 _02; // _02
u16 mMtxGroupNum; // _02
u16 mVtxDescListIndex; // _04
u16 mShapeMtxInitDataIndex; // _06
u16 mShapeDrawInitDataIndex; // _08
f32 _0C; // _0C
JGeometry::TVec3f _10; // _10
JGeometry::TVec3f _1C; // _1C
f32 mRadius; // _0C
JGeometry::TVec3f mMin; // _10
JGeometry::TVec3f mMax; // _1C
};
struct J3DShape {
enum Flags { IsHidden = 0x1, Invalid = 0xFFFFFFFF };
enum Flags {
IsHidden = 0x1,
SkinPos = 0x4,
SkinNorm = 0x8,
EnableLOD = 0x100,
NoMtx = 0x200,
Invalid = 0xFFFFFFFF,
};
virtual void draw() const; // _08
virtual void drawFast() const; // _0C
virtual void simpleDraw() const; // _10
@ -46,43 +56,67 @@ struct J3DShape {
void makeVcdVatCmd();
void makeVtxArrayCmd();
// VTBL _00
J3DMaterial* _04; // _04
u16 mId; // _08
u16 _0A; // _0A
u32 mFlags; // _0C
f32 _10; // _10
JGeometry::TVec3f _14; // _14
JGeometry::TVec3f _20; // _20
u8* _2C; // _2C
_GXVtxDescList* _30; // _30
u8 mMode; // _34
J3DShapeMtx** _38; // _38
J3DShapeDraw** _3C; // _3C
u32 _40; // _40
u32 _44; // _44
u8 _48; // _48
J3DVertexData* mVtxData; // _4C
J3DDrawMtxData* mDrawMtxData; // _50
s8* mFlagList; // _54
J3DJos32Tree* mTree1; // _58
J3DJos32Tree* mTree2; // _5C
s32* _60; // _60
int _64; // _64
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) { mVtxData = pVtxData; }
void* getVcdVatCmd() const { return mVcdVatCmd; }
void setVcdVatCmd(void* pVatCmd) { mVcdVatCmd = (u8*)pVatCmd; }
void show() { offFlag(IsHidden); }
void hide() { onFlag(IsHidden); }
void setCurrentViewNoPtr(u32* pViewNoPtr) { mCurrentViewNumber = pViewNoPtr; }
void setScaleFlagArray(u8* pScaleFlagArray) { mFlagList = pScaleFlagArray; }
void setTexMtxLoadType(u32 type) { mFlags = (mFlags & 0xFFFF0FFF) | type; }
bool getNBTFlag() const { return mMode; }
u32 getBumpMtxOffset() const { return mBumpMtxOffset; }
J3DMaterial* getMaterial() const { return mMaterial; }
u32 getIndex() const { return mId; }
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]; }
JGeometry::TVec3f* getMin() { return &mMin; }
JGeometry::TVec3f* getMax() { return &mMax; }
static u8* sOldVcdVatCmd;
static u8 sEnvelopeFlag;
// _00 = VTBL
J3DMaterial* mMaterial; // _04
u16 mId; // _08
u16 mMtxGroupNum; // _0A
u32 mFlags; // _0C
f32 mRadius; // _10
JGeometry::TVec3f mMin; // _14
JGeometry::TVec3f mMax; // _20
u8* mVcdVatCmd; // _2C
GXVtxDescList* mVtxDesc; // _30
u8 mMode; // _34
J3DShapeMtx** mShapeMtx; // _38
J3DShapeDraw** mShapeDraw; // _3C
J3DCurrentMtx mCurrentMtx; // _40
u8 _48; // _48
J3DVertexData* mVtxData; // _4C
J3DDrawMtxData* mDrawMtxData; // _50
u8* mFlagList; // _54
J3DJos32Tree* mTree1; // _58, TP has this as Mtx** mDrawMtx
J3DJos32Tree* mTree2; // _5C, TP has this as Mtx33** mNrmMtx
u32* mCurrentViewNumber; // _60
int mBumpMtxOffset; // _64
};
struct J3DShapeMtx {
typedef void (J3DShapeMtx::*LoadMtxIndxFunction)(int, u16) const;
virtual ~J3DShapeMtx() { } // _08 (weak)
virtual int getType() const { return 'SMTX'; } // _0C (weak)
virtual int getUseMtxNum() const { return 1; } // _10 (weak)
virtual u16 getUseMtxIndex(u16) const { return mUseMtxIndex; } // _14 (weak)
virtual void load() const; // _18
virtual void calcNBTScale(const Vec&, f32 (*)[3][3], f32 (*)[3][3]); // _1C
virtual ~J3DShapeMtx() { } // _08 (weak)
virtual int getType() const { return 'SMTX'; } // _0C (weak)
virtual int getUseMtxNum() const { return 1; } // _10 (weak)
virtual u16 getUseMtxIndex(u16) const { return mUseMtxIndex; } // _14 (weak)
virtual void load() const; // _18
virtual void calcNBTScale(const Vec&, Mtx33, f32 Mtx33); // _1C
void loadMtxIndx_PNGP(int, u16) const;
void loadMtxIndx_PCPU(int, u16) const;
@ -106,16 +140,12 @@ struct J3DShapeMtx {
struct J3DShapeDraw {
J3DShapeDraw(const u8*, u32);
virtual ~J3DShapeDraw();
void draw() const;
virtual void _04() = 0;
virtual void _08() = 0;
virtual void _0C() = 0;
virtual void _10() = 0;
virtual void _14() = 0;
// _00 = VTBL
u32 mDlSize; // _04
const u8* mDisplayList; // _08
};
@ -124,27 +154,22 @@ struct J3DShapeTable {
inline J3DShapeTable()
: mCount(0)
, mItems(nullptr)
, mNames(nullptr)
{
}
/**
* @reifiedAddress{8008382C}
* @reifiedFile{JSystem/J3D/J3DModelData.cpp}
*/
virtual ~J3DShapeTable() {}; // _08 (weak)
virtual ~J3DShapeTable() { } // _08 (weak)
void initShapeNodes(J3DDrawMtxData*, J3DVertexData*);
void sortVcdVatCmd();
/** @fabricated */
J3DShape* getItem(u16 index) { return mItems[index]; }
J3DShape* getItem(u16 index) const { return mItems[index]; } // called getShapeNodePointer in TP
u16 getShapeNum() const { return mCount; }
// VTBL _00
u16 mCount; // _04
J3DShape** mItems; // _08
// TODO: Are subsequent JUTNameTab* and J3DVertexData in J3DModelData also
// part of this?
u16 mCount; // _04
J3DShape** mItems; // _08
JUTNameTab* mNames; // _0C
};
struct J3DShapeMtxMulti : public J3DShapeMtx {
@ -153,7 +178,7 @@ struct J3DShapeMtxMulti : public J3DShapeMtx {
virtual int getUseMtxNum() const { return mUseMtxNum; } // _10 (weak)
virtual u16 getUseMtxIndex(unsigned short p1) const { return _0C[p1]; } // _14 (weak)
virtual void load() const; // _18
virtual void calcNBTScale(const Vec&, f32 (*)[3][3], f32 (*)[3][3]); // _1C
virtual void calcNBTScale(const Vec&, Mtx33, Mtx33); // _1C
u16 mUseMtxNum; // _08
u16* _0C; // _0C

View File

@ -6,6 +6,9 @@
#include "JSystem/J3D/J3DShape.h"
#include "types.h"
struct J3DShapeMtxInitData;
struct J3DShapeDrawInitData;
struct J3DShapeFactory {
J3DShapeFactory(const J3DShapeBlock&);
@ -17,14 +20,23 @@ struct J3DShapeFactory {
int calcSizeVcdVatCmdBuffer(u32);
int calcSizeShapeMtx(u32, int, int) const;
J3DShapeInitData* mInitData; // _00
u16* mInitDataIndices; // _04
_GXVtxDescList* mVtxDescLists; // _08
u16* _0C; // _0C
u8* _10; // _10
struct J3DShapeMtxInitData* mMtxInitData; // _14
struct J3DShapeDrawInitData* mDrawInitData; // _18
void* _1C; // _1C
u32 getMtxGroupNum(int no) const { return mInitData[mInitDataIndices[no]].mMtxGroupNum; }
GXVtxDescList* getVtxDescList(int no) const
{
return (GXVtxDescList*)((u8*)mVtxDescLists + mInitData[mInitDataIndices[no]].mVtxDescListIndex);
}
f32 getRadius(int no) const { return mInitData[mInitDataIndices[no]].mRadius; }
JGeometry::TVec3f& getMin(int no) const { return mInitData[mInitDataIndices[no]].mMin; }
JGeometry::TVec3f& getMax(int no) const { return mInitData[mInitDataIndices[no]].mMax; }
J3DShapeInitData* mInitData; // _00
u16* mInitDataIndices; // _04
GXVtxDescList* mVtxDescLists; // _08
u16* mMtxTable; // _0C
u8* mDisplayListData; // _10
J3DShapeMtxInitData* mMtxInitData; // _14
J3DShapeDrawInitData* mDrawInitData; // _18
u8* mVcdVatCmdBuffer; // _1C
};
#endif

View File

@ -0,0 +1,67 @@
#ifndef _JSYSTEM_J3D_J3DSKINDEFORM_H
#define _JSYSTEM_J3D_J3DSKINDEFORM_H
#include "JSystem/J3D/J3DModel.h"
#include "JSystem/J3D/J3DCluster.h"
struct J3DAnmCluster;
enum J3DSkinDeformFlags {
J3DSKIN_Unk1 = 0x1,
J3DSKIN_Unk2 = 0x2,
};
struct J3DDeformData {
J3DDeformData();
u16 mClusterNum; // _00
u16 mClusterKeyNum; // _02
u16 _04; // _04
J3DCluster** mClusters; // _08
J3DClusterKey** mClusterKeys; // _0C
int _10; // _10
u16 _14; // _14
u16 _16; // _16
void* mVtxPos; // _18, check type
void* mVtxNorm; // _1C, check type
int _20; // _20
int _24; // _24
};
struct J3DDeformer {
J3DDeformer(J3DDeformData*);
void deform(J3DVertexBuffer*, u16, f32*);
void deform(J3DVertexBuffer*, u16);
void deform_VtxPosF32(J3DVertexBuffer*, J3DCluster*, J3DClusterKey*, f32*);
void deform_VtxNrmF32(J3DVertexBuffer*, J3DCluster*, J3DClusterKey*, f32*);
void normalizeWeight(int, f32*);
J3DDeformData* mDeformData; // _00
J3DAnmCluster* mAnmCluster; // _04
int _08; // _08
int _0C; // _0C
u32 mFlags; // _10
};
struct J3DSkinDeform {
J3DSkinDeform();
virtual void deform(J3DVertexBuffer*, J3DMtxBuffer*); // _08
virtual ~J3DSkinDeform() { } // _0C
void deform(J3DModel* model);
void setFlag(u32 flag) { mFlags.typeView |= flag; }
void resetFlag(u32 flag) { mFlags.typeView &= ~flag; }
bool checkFlag(u32 flag) const { return mFlags.typeView & flag; }
// _00 VTBL
void* mPosData; // _04
BitFlag<u32> _08; // _08 /* bitfield of some sort */
unknown _0C; // _0C
unknown _10; // _10
BitFlag<u32> mFlags; // _14
};
#endif

View File

@ -15,7 +15,15 @@ struct J3DShapePacket;
struct J3DTexture;
struct J3DSys {
enum DrawMode {
SYSDRAW_Opa = 0,
SYSDRAW_Xlu = 1,
SYSDRAW_Unk3 = 3,
SYSDRAW_Unk4 = 4,
};
J3DSys();
void drawInit();
void reinitGX();
void reinitGenMode();
@ -25,47 +33,90 @@ struct J3DSys {
void reinitTexture();
void reinitTevStages();
void reinitTransform();
void loadPosMtxIndx(int, unsigned short) const;
void loadNrmMtxIndx(int, unsigned short) const;
void loadPosMtxIndx(int, u16) const;
void loadNrmMtxIndx(int, u16) const;
void ErrorReport(J3DErrType) const;
inline void setVtxPos(void* pos) { _10C = (u32)pos; }
Mtx* getViewMtx() { return &mViewMtx; }
void setDrawModeOpaTexEdge() { mDrawMode = SYSDRAW_Opa; }
void setDrawModeXlu() { mDrawMode = SYSDRAW_Xlu; }
void* getVtxPos() const { return mVtxPos; }
void setVtxPos(void* pVtxPos) { mVtxPos = pVtxPos; }
void* getVtxNrm() const { return mVtxNorm; }
void setVtxNrm(void* pVtxNrm) { mVtxNorm = pVtxNrm; }
inline void setVtxNrm(void* nrm) { _110 = (u32)nrm; }
void* getVtxCol() const { return mVtxColor; }
void setVtxCol(GXColor* pVtxCol) { mVtxColor = pVtxCol; }
inline void setVtxCol(GXColor* color) { _114 = (u32)color; }
void setModel(J3DModel* pModel) { mModel = pModel; }
void setShapePacket(J3DShapePacket* pPacket) { mShapePacket = pPacket; }
void setMatPacket(J3DMatPacket* pPacket) { mMatPacket = pPacket; }
void setMaterialMode(u32 mode) { mMaterialMode = mode; }
Mtx _00; // _000
J3DMtxCalc* mMtxCalc; // _030
u32 _34; // _034 /* bitfield */
J3DModel* _38; // _038
J3DMatPacket* mMatPacket; // _03C
J3DShapePacket* mShapePacket; // _040
u32 _44; // _044
J3DDrawBuffer* _48; // _048
J3DDrawBuffer* _4C; // _04C
int _50; // _050
u32 _54; // _054
J3DTexture* _58; // _058
u8 _5C[4]; // _05C
u32 _60; // _060
u8 _64[0xA0]; // _064
Mtx* _104; // _104
Mtx* _108; // _108
/*
* These three might be part of a J3DVertexBuffer.
* See setArray__15J3DVertexBufferCFv.
*/
u32 _10C; // _10C
u32 _110; // _110
u32 _114; // _114 /* bitfield */
void setTexture(J3DTexture* pTex) { mTexture = pTex; }
J3DTexture* getTexture() { return mTexture; }
Vec* _118;
void setNBTScale(Vec* scale) { mNBTScale = scale; }
void onFlag(u32 flag) { mFlags |= flag; }
void offFlag(u32 flag) { mFlags &= ~flag; }
bool checkFlag(u32 flag) { return mFlags & flag; }
void setModelDrawMtx(Mtx* pMtxArr)
{
mModelDrawMtx = pMtxArr;
GXSetArray(GX_POS_MTX_ARRAY, mModelDrawMtx, sizeof(*mModelDrawMtx));
}
void setModelNrmMtx(Mtx* pMtxArr)
{
mModelNormMtx = pMtxArr;
GXSetArray(GX_NRM_MTX_ARRAY, mModelNormMtx, sizeof(*mModelNormMtx));
}
// Type 0: Opa Buffer
// Type 1: Xlu Buffer
void setDrawBuffer(J3DDrawBuffer* buffer, int type) { mDrawBuffer[type] = buffer; }
// Type 0: Opa Buffer
// Type 1: Xlu Buffer
J3DDrawBuffer* getDrawBuffer(int type) { return mDrawBuffer[type]; }
Mtx& getModelDrawMtx(u16 no) const { return mModelDrawMtx[no]; }
J3DShapePacket* getShapePacket() const { return mShapePacket; }
void setViewMtx(Mtx m) { PSMTXCopy(m, mViewMtx); }
J3DModel* getModel() { return mModel; }
static Mtx mCurrentMtx;
static JGeometry::TVec3f mCurrentS;
static JGeometry::TVec3f mParentS;
static u16 sTexCoordScaleTable[8][4];
Mtx mViewMtx; // _000
J3DMtxCalc* mMtxCalc; // _030
u32 mFlags; // _034
J3DModel* mModel; // _038
J3DMatPacket* mMatPacket; // _03C
J3DShapePacket* mShapePacket; // _040
J3DShape* mShape; // _044
J3DDrawBuffer* mDrawBuffer[2]; // _048, 0=Opa, 1=Xlu
DrawMode mDrawMode; // _050
u32 mMaterialMode; // _054
J3DTexture* mTexture; // _058
u8 _5C[4]; // _05C, unknown
u32 mTexCacheRegionNum; // _060
GXTexRegion mTexCacheRegion[8]; // _064
u8 _E4[0x20]; // _0E4, unknown
Mtx* mModelDrawMtx; // _104
Mtx* mModelNormMtx; // _108
void* mVtxPos; // _10C
void* mVtxNorm; // _110
GXColor* mVtxColor; // _114
Vec* mNBTScale; // _118
};
extern J3DSys j3dSys;

View File

@ -1,25 +0,0 @@
#ifndef _JSYSTEM_J3D_J3DTEVCOLORANM_H
#define _JSYSTEM_J3D_J3DTEVCOLORANM_H
#include "types.h"
struct J3DAnmTevRegKey;
struct J3DTevColorAnm {
J3DTevColorAnm();
~J3DTevColorAnm();
u16 mIndex; // _00
u16 _02; // _02
J3DAnmTevRegKey* mKey; // _04
};
struct J3DTevKColorAnm {
J3DTevKColorAnm();
~J3DTevKColorAnm();
u16 mIndex; // _00
u16 _02; // _02
J3DAnmTevRegKey* mKey; // _04
};
#endif

View File

@ -1,15 +0,0 @@
#ifndef _JSYSTEM_J3D_J3DTEXMTXANM_H
#define _JSYSTEM_J3D_J3DTEXMTXANM_H
#include "types.h"
struct J3DTexMtxAnm {
J3DTexMtxAnm();
~J3DTexMtxAnm();
u16 mIndex; // _00
u16 _02; // _02
struct J3DAnmTextureSRTKey* mAnm; // _04
};
#endif

View File

@ -1,19 +0,0 @@
#ifndef _JSYSTEM_J3D_J3DTEXNOANM_H
#define _JSYSTEM_J3D_J3DTEXNOANM_H
#include "types.h"
#include "JSystem/J3D/J3DAnmTexPattern.h"
struct J3DTexNoAnm {
J3DTexNoAnm();
virtual void calc(unsigned short*) const; // _08 (weak)
~J3DTexNoAnm();
u16 _04; // _04
u16 _06; // _06
J3DAnmTexPattern* mAnm; // _08
};
#endif

View File

@ -8,9 +8,9 @@ struct ResTIMG;
struct ResTIMGPair;
struct _UnknownJ3DTextureParent {
u16 _00; // _00
u16 _02; // _02
ResTIMG* _04; // _04
u16 mNum; // _00
u16 _02; // _02
ResTIMG* mRes; // _04
};
/**
@ -18,20 +18,23 @@ struct _UnknownJ3DTextureParent {
*/
struct J3DTexture : _UnknownJ3DTextureParent {
/** @fabricated */
inline J3DTexture(u16 p1, ResTIMG* res)
inline J3DTexture(u16 count, ResTIMG* res)
{
_00 = p1;
_02 = 0;
_04 = res;
mNum = count;
_02 = 0;
mRes = res;
}
virtual ~J3DTexture(); // _08 (weak)
u16 getNum() const { return mNum; }
ResTIMG* getResTIMG(u16 entry) const { return &mRes[entry]; }
// fabricated:
inline void setImageOffset(u32 format) { _04[0].mImageDataOffset = (int)((format + _04[0].mImageDataOffset) - (u32)&_04[0]); }
inline void setImageOffset2(u32 format) { _04[1].mImageDataOffset = (int)((format + _04[1].mImageDataOffset) - (u32)&_04[1]); }
inline void setPaletteOffset(u32 format) { _04[0].mPaletteOffset = (int)((format + _04[0].mPaletteOffset) - (u32)&_04[0]); }
inline void setPaletteOffset2(u32 format) { _04[1].mPaletteOffset = (int)((format + _04[1].mPaletteOffset) - (u32)&_04[1]); }
inline void setImageOffset(u32 format) { mRes[0].mImageDataOffset = (int)((format + mRes[0].mImageDataOffset) - (u32)&mRes[0]); }
inline void setImageOffset2(u32 format) { mRes[1].mImageDataOffset = (int)((format + mRes[1].mImageDataOffset) - (u32)&mRes[1]); }
inline void setPaletteOffset(u32 format) { mRes[0].mPaletteOffset = (int)((format + mRes[0].mPaletteOffset) - (u32)&mRes[0]); }
inline void setPaletteOffset2(u32 format) { mRes[1].mPaletteOffset = (int)((format + mRes[1].mPaletteOffset) - (u32)&mRes[1]); }
// _08 VTBL
};

View File

@ -12,32 +12,39 @@ struct J3DVertexBuffer {
void setArray() const;
void setVertexData(J3DVertexData*);
inline void swapVtxColArrayPointer()
void swapVtxColArrayPointer()
{
GXColor* prev = _14[0];
_14[0] = _14[1];
_14[1] = prev;
GXColor* prev = mVtxColor[0];
mVtxColor[0] = mVtxColor[1];
mVtxColor[1] = prev;
}
inline GXColor* getVtxColArrayPointer(int idx) { return _14[idx]; }
GXColor* getVtxColArrayPointer(int idx) { return mVtxColor[idx]; }
inline void setCurrentVtxCol(GXColor* color) { _34 = color; }
J3DVertexData* getVertexData() const { return mVtxData; }
J3DVertexData* getVertexData() const { return _00; }
void setCurrentVtxPos(void* pVtxPos) { mCurrentVtxPos = pVtxPos; }
J3DVertexData* _00; // _00
void* _04; // _04
u32 _08; // _08
void* _0C; // _0C
u32 _10; // _10
GXColor* _14[2]; // _14
void* _1C; // _1C
u32 _20; // _20
void* _24; // _24
u32 _28; // _28
void* _2C; // _2C
void* _30; // _30
void* _34; // _34
void setCurrentVtxNrm(void* pVtxNrm) { mCurrentVtxNorm = pVtxNrm; }
void setCurrentVtxCol(GXColor* pVtxCol) { mCurrentVtxColor = pVtxCol; }
void frameInit()
{
setCurrentVtxPos(mVtxPos[0]);
setCurrentVtxNrm(mVtxNorm[0]);
setCurrentVtxCol(mVtxColor[0]);
}
J3DVertexData* mVtxData; // _00
void* mVtxPos[2]; // _04
void* mVtxNorm[2]; // _0C
GXColor* mVtxColor[2]; // _14
void* mTransformedVtxPos[2]; // _1C
void* mTransformedVtxNorm[2]; // _24
void* mCurrentVtxPos; // _2C
void* mCurrentVtxNorm; // _30
GXColor* mCurrentVtxColor; // _34
};
#endif

View File

@ -15,28 +15,36 @@ struct J3DVertexData {
bool isCpuSkinningPositionFormat();
bool isCpuSkinningNormalFormat();
inline u32 getColNum() const { return _08; }
inline void* getVtXPosArray() const { return _18; }
inline void* getVtxNrmArray() const { return _1C; }
inline GXColor* getVtxColorArray(u8 idx) const { return &((GXColor*)_24)[idx]; }
void* getVtxPosArray() const { return mVtxPos; }
void* getVtxNrmArray() const { return mVtxNorm; }
GXColor* getVtxColorArray(u8 idx) const { return mVtxColor[idx]; }
void* getVtxTexCoordArray(u8 idx) const { return mVtxTexCoord[idx]; }
void* getVtxNBTArray() const { return mVtxNBT; }
u32 getColNum() const { return mColorNum; }
u32 getNrmNum() const { return mNormNum; }
u32 getVtxNum() const { return mVtxNum; }
GXVtxAttrFmtList* getVtxAttrFmtList() { return mVtxAttrFmtList; }
// TODO: Everything
u32 _00; // _00
u32 _04; // _04
u32 _08; // _08
u32 _0C; // _0C
u32 _10; // _10
_GXVtxAttrFmtList* _14; // _14
void* _18; // _18
void* _1C; // _1C
void* _20; // _20
void* _24; // _24
void* _28; // _28
void* _2C[8]; // _2C
u8 _4C; // _4C
int _50; // _50
u8 _54; // _54
int _58; // _58
void setVtxPosFrac(u8 frac) { mVtxPosFrac = frac; }
void setVtxPosType(GXCompType type) { mVtxPosType = type; }
void setVtxNrmFrac(u8 frac) { mVtxNrmFrac = frac; }
void setVtxNrmType(GXCompType type) { mVtxNrmType = type; }
u32 mVtxNum; // _00
u32 mNormNum; // _04
u32 mColorNum; // _08
u32 mTexCoordNum; // _0C
u32 mPacketNum; // _10
GXVtxAttrFmtList* mVtxAttrFmtList; // _14
void* mVtxPos; // _18
void* mVtxNorm; // _1C
void* mVtxNBT; // _20
GXColor* mVtxColor[2]; // _24
void* mVtxTexCoord[8]; // _2C
u8 mVtxPosFrac; // _4C
GXCompType mVtxPosType; // _50
u8 mVtxNrmFrac; // _54
GXCompType mVtxNrmType; // _58
};
#endif

View File

@ -43,7 +43,7 @@ struct J3DUMtxCacheRef : public J3DUMtxCacheBase {
J3DModelData* modelData = model->mModelData;
int jointCount = modelData->mJointTree.mJointCnt;
if (IS_FLAG(model->_08.typeView, 2)) {
if (model->checkFlag(J3DMODEL_Unk2)) {
J3DUMtxAnmCacheTable* table = getTable();
for (int i = 0; i < jointCount; i++) {
PSMTXCopy(table->mMatrices[i + table->_00 * table->mJointCount], model->mMtxBuffer->mWorldMatrices[i]);

View File

@ -3,7 +3,7 @@
#include "JSystem/J3D/J3DAnmBase.h"
#include "JSystem/J3D/J3DModel.h"
#include "JSystem/J3D/J3DTevColorAnm.h"
#include "JSystem/J3D/J3DMaterialAnm.h"
struct J3DModelData;

View File

@ -56,7 +56,7 @@ struct Model : public MtxObject {
{
Matrixf mtx;
PSMTXIdentity(mtx.mMatrix.mtxView);
PSMTXCopy(mtx.mMatrix.mtxView, j3dSys._00);
PSMTXCopy(mtx.mMatrix.mtxView, j3dSys.mViewMtx);
J3DModel* j3dModel = mJ3dModel;
j3dModel->calc();
j3dModel->calcMaterial();

View File

@ -1531,7 +1531,7 @@ lbl_80068A64:
void J3DAnmColor::searchUpdateMaterialID(J3DModelData* data)
{
for (u16 i = 0; i < _14; i++) {
JUTNameTab* matNameTable = data->mMaterialTable._0C;
JUTNameTab* matNameTable = data->mMaterialTable.mMaterialNames;
int index = matNameTable->getIndex(mNameTab.getName(i));
if (index != -1) {
_18[i] = index;
@ -2490,7 +2490,7 @@ void J3DAnmTevRegKey::searchUpdateMaterialID(J3DModelData* data)
{
u16 i;
for (i = 0; i < mCountTevColorAnm; i++) {
JUTNameTab* nameTable = data->mMaterialTable._0C;
JUTNameTab* nameTable = data->mMaterialTable.mMaterialNames;
int index = nameTable->getIndex(_24.getName(i));
if (index != -1) {
_20[i] = index;
@ -2499,7 +2499,7 @@ void J3DAnmTevRegKey::searchUpdateMaterialID(J3DModelData* data)
}
}
for (i = 0; i < mCountTevKColorAnm; i++) {
JUTNameTab* nameTable = data->mMaterialTable._0C;
JUTNameTab* nameTable = data->mMaterialTable.mMaterialNames;
int index = nameTable->getIndex(_38.getName(i));
if (index != -1) {
_34[i] = index;

View File

@ -2,14 +2,11 @@
#include "JSystem/J3D/J3DAnmTevRegKey.h"
#include "JSystem/J3D/J3DAnmTextureSRTKey.h"
#include "JSystem/J3D/J3DColorBlock.h"
#include "JSystem/J3D/J3DMatColorAnm.h"
#include "JSystem/J3D/J3DMaterialAnm.h"
#include "JSystem/J3D/J3DMaterial.h"
#include "JSystem/J3D/J3DTevBlock.h"
#include "JSystem/J3D/J3DTevColorAnm.h"
#include "JSystem/J3D/J3DTexGenBlock.h"
#include "JSystem/J3D/J3DTexMtx.h"
#include "JSystem/J3D/J3DTexMtxAnm.h"
#include "JSystem/J3D/J3DTypes.h"
#include "types.h"

View File

@ -1,10 +1,7 @@
#include "JSystem/J3D/J3DAnmTevRegKey.h"
#include "JSystem/J3D/J3DAnmTextureSRTKey.h"
#include "JSystem/J3D/J3DMatColorAnm.h"
#include "JSystem/J3D/J3DMaterialAnm.h"
#include "JSystem/J3D/J3DMaterial.h"
#include "JSystem/J3D/J3DTevColorAnm.h"
#include "JSystem/J3D/J3DTexMtxAnm.h"
#include "JSystem/J3D/J3DTexNoAnm.h"
#include "JSystem/J3D/J3DTypes.h"
#include "types.h"

View File

@ -115,18 +115,18 @@ int J3DModel::createShapePacket(J3DModelData* data)
*/
int J3DModel::createMatPacket(J3DModelData* data, u32 p2)
{
if (data->mMaterialTable.mCount1 != 0) {
mMatPackets = new J3DMatPacket[data->mMaterialTable.mCount1];
if (data->mMaterialTable.mMaterialNum != 0) {
mMatPackets = new J3DMatPacket[data->mMaterialTable.mMaterialNum];
}
u16 count = data->mMaterialTable.mCount1;
u16 count = data->mMaterialTable.mMaterialNum;
for (u16 i = 0; i < count; i++) {
J3DMaterial* material = data->mMaterialTable.mMaterials1[i];
J3DMaterial* material = data->mMaterialTable.mMaterials[i];
J3DMatPacket* matPacket = &mMatPackets[i];
J3DShapePacket* shapePacket = &mShapePackets[material->mShape->mId];
matPacket->_30 = material;
matPacket->_28 = shapePacket;
matPacket->addShapePacket(shapePacket);
matPacket->_38 = (u32)data->mMaterialTable.mTexture;
matPacket->_38 = (u32)data->mMaterialTable.mTextures;
matPacket->_34 = material->_20;
if (data->mJointTree.mFlags == 1) {
matPacket->_10 = matPacket->_10 | 1;
@ -357,7 +357,7 @@ int J3DModel::newDifferedTexMtx(J3DTexDiffFlag texDiffFlag)
*/
void J3DModel::lock()
{
int count = mModelData->mMaterialTable.mCount1;
int count = mModelData->mMaterialTable.mMaterialNum;
for (int i = 0; i < count; i++) {
mMatPackets[i]._10 |= 1;
}
@ -371,11 +371,11 @@ void J3DModel::lock()
void J3DModel::makeDL()
{
j3dSys._38 = this;
j3dSys._58 = mModelData->mMaterialTable.mTexture;
u32 count = mModelData->mMaterialTable.mCount1;
j3dSys._58 = mModelData->mMaterialTable.mTextures;
u32 count = mModelData->mMaterialTable.mMaterialNum;
for (u16 i = 0; i < count; i++) {
j3dSys.mMatPacket = &mMatPackets[i];
mModelData->mMaterialTable.mMaterials1[i]->makeDisplayList();
mModelData->mMaterialTable.mMaterials[i]->makeDisplayList();
}
}
@ -398,11 +398,11 @@ void J3DModel::calcMaterial()
}
j3dSys._38 = this;
mModelData->syncJ3DSysFlags();
j3dSys._58 = mModelData->mMaterialTable.mTexture;
u32 count = mModelData->mMaterialTable.mCount1;
j3dSys._58 = mModelData->mMaterialTable.mTextures;
u32 count = mModelData->mMaterialTable.mMaterialNum;
for (u16 i = 0; i < count; i++) {
j3dSys.mMatPacket = &mMatPackets[i];
mModelData->mMaterialTable.mMaterials1[i]->makeDisplayList();
mModelData->mMaterialTable.mMaterials[i]->makeDisplayList();
// TODO: This appears to share code with inside of loop of J3DModelData::simpleCalcMaterial(u16 jointIndex, Mtx*)
// TODO: Similarly, ???
}
@ -529,10 +529,10 @@ lbl_80066B0C:
void J3DModel::calcDiffTexMtx()
{
j3dSys._38 = this;
u32 count = mModelData->mMaterialTable.mCount1;
u32 count = mModelData->mMaterialTable.mMaterialNum;
for (u16 i = 0; i < count; i++) {
j3dSys.mMatPacket = &mMatPackets[i];
J3DMaterial* material = mModelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = mModelData->mMaterialTable.mMaterials[i];
material->calcDiffTexMtx(mMtxBuffer->mWorldMatrices[material->mJoint->getJntNo()]);
}
count = mModelData->mShapeTable.mCount;
@ -653,10 +653,10 @@ lbl_80066C4C:
*/
void J3DModel::diff()
{
u16 count = mModelData->mMaterialTable.mCount1;
u16 count = mModelData->mMaterialTable.mMaterialNum;
for (u16 i = 0; i < count; i++) {
j3dSys.mMatPacket = &mMatPackets[i];
mModelData->mMaterialTable.mMaterials1[i]->diff(mDisplayListFlag);
mModelData->mMaterialTable.mMaterials[i]->diff(mDisplayListFlag);
}
}
@ -920,7 +920,7 @@ void J3DModel::entry()
j3dSys._34 &= ~0x8;
}
mModelData->syncJ3DSysFlags();
j3dSys._58 = mModelData->mMaterialTable.mTexture;
j3dSys._58 = mModelData->mMaterialTable.mTextures;
for (u16 i = 0; i < mModelData->mJointTree.mJointCnt; i++) {
J3DJoint* joint = mModelData->mJointTree.mJoints[i];
if (joint->mMaterial) {
@ -1264,9 +1264,9 @@ void J3DModel::calcBumpMtx()
if (mModelData->_0C != 1) {
return;
}
u16 count = mModelData->mMaterialTable.mCount1;
u16 count = mModelData->mMaterialTable.mMaterialNum;
for (u16 i = 0; i < count; i++) {
J3DMaterial* material = mModelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = mModelData->mMaterialTable.mMaterials[i];
if (material->mTexGenBlock->getNBTScale()->_00 == 1) {
material->mShape->calcNBTScale(material->mTexGenBlock->getNBTScale()->_04, mMtxBuffer->_1C[1][mMtxBuffer->mCurrentViewNumber],
mMtxBuffer->_24[1][i][mMtxBuffer->mCurrentViewNumber]);

View File

@ -87,21 +87,21 @@ J3DModelData::J3DModelData()
*/
void J3DModelData::newSharedDisplayList(u32 flags)
{
// u16 count = mMaterialTable.mCount1;
// u16 count = mMaterialTable.mMaterialNum;
// for (u16 i = 0; i < count; i++) {
// if (flags & J3DMLF_19) {
// mMaterialTable.mMaterials1[i]->newSingleSharedDisplayList(mMaterialTable.mMaterials1[i]->countDLSize());
// mMaterialTable.mMaterials[i]->newSingleSharedDisplayList(mMaterialTable.mMaterials[i]->countDLSize());
// } else {
// mMaterialTable.mMaterials1[i]->newSharedDisplayList(mMaterialTable.mMaterials1[i]->countDLSize());
// mMaterialTable.mMaterials[i]->newSharedDisplayList(mMaterialTable.mMaterials[i]->countDLSize());
// }
// }
u16 count = mMaterialTable.mCount1;
u16 count = mMaterialTable.mMaterialNum;
for (u16 i = 0; i < count; i++) {
if (flags & J3DMLF_19) {
J3DMaterial* material = mMaterialTable.mMaterials1[i];
J3DMaterial* material = mMaterialTable.mMaterials[i];
material->newSingleSharedDisplayList(material->countDLSize());
} else {
J3DMaterial* material = mMaterialTable.mMaterials1[i];
J3DMaterial* material = mMaterialTable.mMaterials[i];
material->newSharedDisplayList(material->countDLSize());
}
}
@ -161,12 +161,12 @@ lbl_8008394C:
*/
void J3DModelData::indexToPtr()
{
j3dSys._58 = mMaterialTable.mTexture;
j3dSys._58 = mMaterialTable.mTextures;
static int sInterruptFlag = OSDisableInterrupts();
OSDisableScheduler();
u16 count = mMaterialTable.mCount1;
u16 count = mMaterialTable.mMaterialNum;
for (u16 i = 0; i < count; i++) {
J3DMaterial* material = mMaterialTable.mMaterials1[i];
J3DMaterial* material = mMaterialTable.mMaterials[i];
GDCurrentDL currentDL;
GDInitGDLObj(&currentDL, material->_48->_00, material->_48->_08);
__GDCurrentDL = &currentDL;
@ -241,10 +241,10 @@ lbl_800839FC:
*/
void J3DModelData::makeSharedDL()
{
j3dSys._58 = mMaterialTable.mTexture;
u16 count = mMaterialTable.mCount1;
j3dSys._58 = mMaterialTable.mTextures;
u16 count = mMaterialTable.mMaterialNum;
for (u16 i = 0; i < count; i++) {
J3DMaterial* material = mMaterialTable.mMaterials1[i];
J3DMaterial* material = mMaterialTable.mMaterials[i];
material->makeSharedDisplayList();
}
}
@ -257,7 +257,7 @@ void J3DModelData::makeSharedDL()
void J3DModelData::simpleCalcMaterial(u16 jointIndex, Mtx) // float (*)[4])
{
syncJ3DSysFlags();
for (J3DMaterial* material = mJointTree.mJoints[jointIndex]->mMaterial; material != nullptr; material = material->_04) {
for (J3DMaterial* material = mJointTree.mJoints[jointIndex]->mMaterial; material != nullptr; material = material->mNext) {
// TODO: ???
}
/*

View File

@ -222,11 +222,11 @@ int J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* data, u32 p2)
int J3DMtxBuffer::createBumpMtxArray(J3DModelData* data, u32 p2)
{
if (data->mJointTree.mFlags == 0) {
u16 materialCount = data->mMaterialTable.mCount1;
u16 materialCount = data->mMaterialTable.mMaterialNum;
u16 bumpMtxCount = 0;
u16 v1 = 0;
for (u16 i = 0; i < materialCount; i++) {
J3DMaterial* material = data->mMaterialTable.mMaterials1[i];
J3DMaterial* material = data->mMaterialTable.mMaterials[i];
if (material->mTexGenBlock->getNBTScale()->_00 == 1) {
bumpMtxCount += material->mShape->countBumpMtxNum();
v1++;
@ -238,10 +238,10 @@ int J3DMtxBuffer::createBumpMtxArray(J3DModelData* data, u32 p2)
}
}
for (int i = 0; i < 2; i++) {
u16 materialCount = data->mMaterialTable.mCount1;
u16 materialCount = data->mMaterialTable.mMaterialNum;
int shapeCount = 0;
for (u16 matIndex = 0; matIndex < materialCount; matIndex++) {
J3DMaterial* material = data->mMaterialTable.mMaterials1[matIndex];
J3DMaterial* material = data->mMaterialTable.mMaterials[matIndex];
if (material->mTexGenBlock->getNBTScale()->_00 == 1) {
_24[i][shapeCount] = new Mtx33*[p2];
material->mShape->_64 = shapeCount;
@ -250,10 +250,10 @@ int J3DMtxBuffer::createBumpMtxArray(J3DModelData* data, u32 p2)
}
}
for (int i = 0; i < 2; i++) {
u16 materialCount = data->mMaterialTable.mCount1;
u16 materialCount = data->mMaterialTable.mMaterialNum;
int j = 0;
for (u16 matIndex = 0; matIndex < materialCount; matIndex++) {
J3DMaterial* material = data->mMaterialTable.mMaterials1[matIndex];
J3DMaterial* material = data->mMaterialTable.mMaterials[matIndex];
if (material->mTexGenBlock->getNBTScale()->_00 == 1) {
for (int k = 0; k < p2; k++) {
_24[i][j][k] = new (0x20) Mtx33[data->mJointTree.mMtxData.mCount];

View File

@ -28,7 +28,7 @@ void J3DShapeTable::sortVcdVatCmd()
for (u16 outerI = 0; outerI < count; outerI++) {
for (u16 innerI = 0; innerI < outerI; innerI++) {
if (mItems[outerI]->isSameVcdVatCmd(mItems[innerI])) {
mItems[outerI]->_2C = mItems[innerI]->_2C;
mItems[outerI]->mVcdVatCmd = mItems[innerI]->mVcdVatCmd;
}
}
}

View File

@ -1,7 +1,7 @@
#include "types.h"
#include "JSystem/J3D/J3DModel.h"
#include "JSystem/J3D/J3DVtxColorCalc.h"
#include "JSystem/J3D/J3DAnmVtxColor.h"
#include "JSystem/J3D/J3DSkinDeform.h"
/*
* --INFO--
@ -10,16 +10,16 @@
*/
void J3DSkinDeform::deform(J3DModel* model)
{
if (IS_FLAG(model->_08.typeView, 4)) {
SET_FLAG(_14.typeView, 2);
if (model->checkFlag(J3DMODEL_Unk3)) {
setFlag(J3DSKIN_Unk2);
} else {
RESET_FLAG(_14.typeView, 2);
resetFlag(J3DSKIN_Unk2);
}
if (IS_FLAG(model->_08.typeView, 8)) {
SET_FLAG(_14.typeView, 1);
if (model->checkFlag(J3DMODEL_Unk4)) {
setFlag(J3DSKIN_Unk1);
} else {
RESET_FLAG(_14.typeView, 1);
resetFlag(J3DSKIN_Unk1);
}
deform(&model->mVertexBuffer, model->mMtxBuffer);
}

View File

@ -8,51 +8,31 @@
#include "JSystem/JKernel/JKRHeap.h"
#include "types.h"
/*
Generated from dpostproc
*/
/*
* --INFO--
* Address: 8005EB80
* Size: 000068
*/
J3DVertexData::J3DVertexData()
// : _00(0)
// , _04(0)
// , _08(0)
// , _0C(0)
// , _10(0)
// , _14(nullptr)
// , _18(nullptr)
// , _1C(nullptr)
// , _20(nullptr)
// , _24(nullptr)
// , _28(nullptr)
// , _2C(static_cast<(int*)[8]>(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr))
// , _4C(0)
// , _50(4)
// , _54(0)
// , _58(4)
{
_00 = 0;
_04 = 0;
_08 = 0;
_0C = 0;
_10 = 0;
_14 = nullptr;
_18 = nullptr;
_1C = nullptr;
_20 = nullptr;
_24 = nullptr;
_28 = nullptr;
mVtxNum = 0;
mNormNum = 0;
mColorNum = 0;
mTexCoordNum = 0;
mPacketNum = 0;
mVtxAttrFmtList = nullptr;
mVtxPos = nullptr;
mVtxNorm = nullptr;
mVtxNBT = nullptr;
mVtxColor[0] = nullptr;
mVtxColor[1] = nullptr;
for (int i = 0; i < 8; i++) {
_2C[i] = nullptr;
mVtxTexCoord[i] = nullptr;
}
_4C = 0;
_50 = 4;
_54 = 0;
_58 = 4;
mVtxPosFrac = 0;
mVtxPosType = GX_F32;
mVtxNrmFrac = 0;
mVtxNrmType = GX_F32;
}
/*
@ -62,20 +42,23 @@ J3DVertexData::J3DVertexData()
*/
void J3DVertexBuffer::setVertexData(J3DVertexData* data)
{
_00 = data;
_04 = data->_18;
_0C = data->_1C;
_14[0] = (GXColor*)data->_24;
_08 = 0;
_10 = 0;
_14[1] = nullptr;
_1C = data->_18;
_24 = data->_1C;
_20 = 0;
_28 = 0;
_2C = _04;
_30 = _0C;
_34 = _14[0];
mVtxData = data;
mVtxPos[0] = data->mVtxPos;
mVtxNorm[0] = data->mVtxNorm;
mVtxColor[0] = data->mVtxColor[0];
mVtxPos[1] = nullptr;
mVtxNorm[1] = nullptr;
mVtxColor[1] = nullptr;
mTransformedVtxPos[0] = data->mVtxPos;
mTransformedVtxNorm[0] = data->mVtxNorm;
mTransformedVtxPos[1] = nullptr;
mTransformedVtxNorm[1] = nullptr;
mCurrentVtxPos = mVtxPos[0];
mCurrentVtxNorm = mVtxNorm[0];
mCurrentVtxColor = mVtxColor[0];
}
/*
@ -85,23 +68,27 @@ void J3DVertexBuffer::setVertexData(J3DVertexData* data)
*/
void J3DVertexBuffer::init()
{
_00 = nullptr;
_08 = 0;
_04 = nullptr;
_10 = 0;
_0C = nullptr;
_14[1] = nullptr;
_14[0] = nullptr;
_20 = 0;
_1C = nullptr;
_28 = 0;
_24 = nullptr;
_2C = nullptr;
_30 = nullptr;
_34 = nullptr;
_2C = _04;
_30 = _0C;
_34 = _14[0];
mVtxData = nullptr;
mVtxPos[1] = nullptr;
mVtxPos[0] = nullptr;
mVtxNorm[1] = nullptr;
mVtxNorm[0] = nullptr;
mVtxColor[1] = nullptr;
mVtxColor[0] = nullptr;
mTransformedVtxPos[1] = nullptr;
mTransformedVtxPos[0] = nullptr;
mTransformedVtxNorm[1] = nullptr;
mTransformedVtxNorm[0] = nullptr;
mCurrentVtxPos = nullptr;
mCurrentVtxNorm = nullptr;
mCurrentVtxColor = nullptr;
mCurrentVtxPos = mVtxPos[0];
mCurrentVtxNorm = mVtxNorm[0];
mCurrentVtxColor = mVtxColor[0];
}
/*
@ -118,9 +105,9 @@ J3DVertexBuffer::~J3DVertexBuffer() { }
*/
void J3DVertexBuffer::setArray() const
{
j3dSys._10C = (u32)_2C;
j3dSys._110 = (u32)_30;
j3dSys._114 = (u32)_34;
j3dSys.mVtxPos = mCurrentVtxPos;
j3dSys.mVtxNorm = mCurrentVtxNorm;
j3dSys.mVtxColor = mCurrentVtxColor;
}
/*
@ -130,22 +117,22 @@ void J3DVertexBuffer::setArray() const
*/
void J3DVertexBuffer::copyVtxColorArray(J3DDeformAttachFlag flag)
{
if (_14[0] == 0 || _14[1] == nullptr) {
if (!mVtxColor[0] || !mVtxColor[1]) {
if (flag & DeformAttach_1) {
for (int i = 0; i < 2; i++) {
if (i == 0 || _14[i] == nullptr) {
_14[i] = (GXColor*)(new (0x20) void*[_00->_08]);
memcpy(_14[i], _00->_24, _00->_08 << 2);
DCStoreRange(_14[i], _00->_08 << 2);
if (i == 0 || !mVtxColor[i]) {
mVtxColor[i] = new (0x20) GXColor[mVtxData->mColorNum];
memcpy(mVtxColor[i], mVtxData->mVtxColor[0], mVtxData->mColorNum << 2);
DCStoreRange(mVtxColor[i], mVtxData->mColorNum << 2);
}
}
} else {
_14[0] = (GXColor*)_00->_24;
if (_14[1] == nullptr) {
_14[1] = (GXColor*)(new (0x20) void*[_00->_08]);
mVtxColor[0] = mVtxData->mVtxColor[0];
if (!mVtxColor[1]) {
mVtxColor[1] = new (0x20) GXColor[mVtxData->mColorNum];
}
memcpy(_14[1], _00->_24, _00->_08 << 2);
DCStoreRange(_14[1], _00->_08 << 2);
memcpy(mVtxColor[1], mVtxData->mVtxColor[0], mVtxData->mColorNum << 2);
DCStoreRange(mVtxColor[1], mVtxData->mColorNum << 2);
}
}
}

View File

@ -8,4 +8,4 @@
* Size: 000098
* Fabricated to generate getUseMtxNum weak function.
*/
void J3DUCountUseMtxNum(J3DModelData* modelData) { modelData->mShapeTable.mItems[0]->_38[0]->getUseMtxNum(); }
void J3DUCountUseMtxNum(J3DModelData* modelData) { modelData->mShapeTable.mItems[0]->mShapeMtx[0]->getUseMtxNum(); }

View File

@ -401,9 +401,9 @@ void AABBWaterBox::attachModel(J3DModelData* modelData, Sys::MatTexAnimation* an
mMatAnimator.start(anm);
calcMatrix();
_34 = _30 + _0C;
for (u16 i = 0; i < mModel->mJ3dModel->mModelData->mMaterialTable.mTexture->_00; i++) {
if (strcmp(mModel->mJ3dModel->mModelData->mMaterialTable._18->getName(i), "fbtex_dummy") == 0) {
_60 = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
for (u16 i = 0; i < mModel->mJ3dModel->mModelData->mMaterialTable.mTextures->_00; i++) {
if (strcmp(mModel->mJ3dModel->mModelData->mMaterialTable.mTextureNames->getName(i), "fbtex_dummy") == 0) {
_60 = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
_64 = i;
}
}

View File

@ -1462,7 +1462,7 @@ void Navi::doEntry()
cursorCols = J3DGXColorS10(0xFF, 0xFF, 0xFF, 0xFF);
}
J3DMaterial* materials = mCursorModel->mJ3dModel->mModelData->mMaterialTable.mMaterials1[0];
J3DMaterial* materials = mCursorModel->mJ3dModel->mModelData->mMaterialTable.mMaterials[0];
if (materials) {
materials->mTevBlock->setTevColor(0, cursorCols);
mCursorModel->mJ3dModel->calcMaterial();

View File

@ -42,7 +42,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
P2ASSERTLINE(56, shape);
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
@ -86,8 +86,8 @@ SysShape::Model* Mgr::createModel()
SysShape::Model* model = new SysShape::Model(mModelData, 0x80000, mModelType);
P2ASSERTLINE(128, model != nullptr);
for (u16 i = 0; i < mModelData->getMaterialCount1(); i++) {
const char* name = mModelData->mMaterialTable._0C->getName(i);
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
const char* name = mModelData->mMaterialTable.mMaterialNames->getName(i);
if (!strcmp(name, "kage_mat")) {
model->mJ3dModel->mMatPackets[i].mShapePacket->newDifferedDisplayList(0x05021200);
}

View File

@ -117,7 +117,7 @@ void Mgr::doSimpleDraw(Viewport* viewport)
P2ASSERTLINE(137, material);
J3DVertexData* vtxData = modelData->getVertexData();
j3dSys.setVtxPos(vtxData->getVtXPosArray());
j3dSys.setVtxPos(vtxData->getVtxPosArray());
j3dSys.setVtxNrm(vtxData->getVtxNrmArray());
j3dSys.setVtxCol(vtxData->getVtxColorArray(0));
J3DShape::sOldVcdVatCmd = nullptr;

View File

@ -39,7 +39,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -76,7 +76,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -58,8 +58,8 @@ SysShape::Model* Mgr::createModel()
SysShape::Model* model = new SysShape::Model(mModelData, 0x80000, mModelType);
P2ASSERTLINE(71, model);
for (u16 i = 0; i < mModelData->getMaterialCount1(); i++) {
const char* name = mModelData->mMaterialTable._0C->getName(i);
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
const char* name = mModelData->mMaterialTable.mMaterialNames->getName(i);
if (!strcmp(name, "mat_shijimi_hane_v")) {
model->mJ3dModel->mMatPackets[i].mShapePacket->newDifferedDisplayList(0x01000000);
}

View File

@ -37,7 +37,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
P2ASSERTLINE(56, shape != nullptr);
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;

View File

@ -613,8 +613,8 @@ void Obj::onInit(CreatureInitArg* initArg)
J3DModelData* modelData = mModel->mJ3dModel->mModelData;
P2ASSERTLINE(166, modelData);
u16 matIdx = modelData->mMaterialTable._0C->getIndex("cc_mat1_v");
_310 = modelData->mMaterialTable.mMaterials1[matIdx];
u16 matIdx = modelData->mMaterialTable.mMaterialNames->getIndex("cc_mat1_v");
_310 = modelData->mMaterialTable.mMaterials[matIdx];
P2ASSERTLINE(171, _310);

View File

@ -41,7 +41,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -53,7 +53,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -186,20 +186,20 @@ void Obj::changeMaterial()
J3DModel* j3dModel = mModel->mJ3dModel;
J3DModelData* modelData = j3dModel->getModelData();
u16 bodyIdx = modelData->mMaterialTable._0C->getIndex("mat_body");
J3DMaterial* bodyMat = modelData->mMaterialTable.mMaterials1[bodyIdx];
u16 bodyIdx = modelData->mMaterialTable.mMaterialNames->getIndex("mat_body");
J3DMaterial* bodyMat = modelData->mMaterialTable.mMaterials[bodyIdx];
bodyMat->mTevBlock->setTevColor(0, mCurrMatBodyColor);
J3DGXColorS10 color1(mCurrClusterEyeColor.mRgb[0], mCurrClusterEyeColor.mRgb[1], mCurrClusterEyeColor.mRgb[2], 255);
u16 eyeIdx1 = modelData->mMaterialTable._0C->getIndex("mat_eye1");
J3DMaterial* eyeMat1 = modelData->mMaterialTable.mMaterials1[eyeIdx1];
u16 eyeIdx1 = modelData->mMaterialTable.mMaterialNames->getIndex("mat_eye1");
J3DMaterial* eyeMat1 = modelData->mMaterialTable.mMaterials[eyeIdx1];
eyeMat1->mTevBlock->setTevColor(0, color1);
J3DGXColorS10 color2(mCurrSideEyeColor.mRgb[0], mCurrSideEyeColor.mRgb[1], mCurrSideEyeColor.mRgb[2], 255);
u16 eyeIdx2 = modelData->mMaterialTable._0C->getIndex("mat_eye2");
J3DMaterial* eyeMat2 = modelData->mMaterialTable.mMaterials1[eyeIdx2];
u16 eyeIdx2 = modelData->mMaterialTable.mMaterialNames->getIndex("mat_eye2");
J3DMaterial* eyeMat2 = modelData->mMaterialTable.mMaterials[eyeIdx2];
eyeMat2->mTevBlock->setTevColor(0, color2);
j3dModel->calcMaterial();

View File

@ -64,7 +64,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -26,18 +26,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -46,7 +46,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -54,7 +54,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -54,7 +54,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}
@ -90,8 +90,8 @@ SysShape::Model* Mgr::createModel()
SysShape::Model* model = new SysShape::Model(mModelData, 0x80000, mModelType);
P2ASSERTLINE(132, model != nullptr);
for (u16 i = 0; i < mModelData->getMaterialCount1(); i++) {
const char* name = mModelData->mMaterialTable._0C->getName(i);
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
const char* name = mModelData->mMaterialTable.mMaterialNames->getName(i);
if (!strcmp(name, "body")) {
model->mJ3dModel->mMatPackets[i].mShapePacket->newDifferedDisplayList(0x01000000);
}
@ -100,7 +100,7 @@ SysShape::Model* Mgr::createModel()
// why is this not inlined here but IS inlined in the other mgrs SMH.
Matrixf mtx;
PSMTXIdentity(mtx.mMatrix.mtxView);
PSMTXCopy(mtx.mMatrix.mtxView, j3dSys._00);
PSMTXCopy(mtx.mMatrix.mtxView, j3dSys.mViewMtx);
J3DModel* j3dModel = model->mJ3dModel;
j3dModel->calc();
j3dModel->calcMaterial();

View File

@ -44,7 +44,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -24,18 +24,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -46,24 +46,24 @@ void Obj::changeMaterial()
modelData = j3dModel->mModelData;
changeTexture = static_cast<Mgr*>(mMgr)->getChangeTexture();
u16 idx = modelData->mMaterialTable._0C->getIndex("karada");
J3DMaterial* karadaMat = modelData->mMaterialTable.mMaterials1[idx];
u16 idx = modelData->mMaterialTable.mMaterialNames->getIndex("karada");
J3DMaterial* karadaMat = modelData->mMaterialTable.mMaterials[idx];
karadaMat->mTevBlock->setTevKColor(0, J3DGXColor(0xF, 0xF, 0xF, 0xFF));
j3dModel->calcMaterial();
j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
changeTexture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)changeTexture);
j3dTexture->setPaletteOffset((u32)changeTexture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -67,10 +67,10 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
updateMaterialAnimation();
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -52,7 +52,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -24,18 +24,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -38,18 +38,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -25,18 +25,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -24,18 +24,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -27,18 +27,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -44,7 +44,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -85,8 +85,8 @@ SysShape::Model* Mgr::createModel()
SysShape::Model* model = new SysShape::Model(mModelData, 0x80000, mModelType);
P2ASSERTLINE(121, model);
for (u16 i = 0; i < mModelData->getMaterialCount1(); i++) {
const char* name = mModelData->mMaterialTable._0C->getName(i);
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
const char* name = mModelData->mMaterialTable.mMaterialNames->getName(i);
if (!strcmp(name, "mat1")) {
model->mJ3dModel->mMatPackets[i].mShapePacket->newDifferedDisplayList(0x01000200);
}

View File

@ -54,7 +54,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -42,7 +42,7 @@ void Mgr::loadModelData()
EnemyMgrBase::loadModelData();
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
J3DShape* shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}
@ -81,8 +81,8 @@ SysShape::Model* Mgr::createModel()
SysShape::Model* model = new SysShape::Model(mModelData, 0x80000, mModelType);
P2ASSERTLINE(147, model != nullptr);
for (u16 i = 0; i < mModelData->getMaterialCount1(); i++) {
const char* name = mModelData->mMaterialTable._0C->getName(i);
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
const char* name = mModelData->mMaterialTable.mMaterialNames->getName(i);
if (!strcmp(name, "mat_babykabuto_body") || !strcmp(name, "mat_babykabuto_eye") || !strcmp(name, "mat_babykabuto_head")) {
model->mJ3dModel->mMatPackets[i].mShapePacket->newDifferedDisplayList(0x04020000);
}

View File

@ -40,7 +40,7 @@ void Mgr::loadModelData()
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}
@ -79,8 +79,8 @@ SysShape::Model* Mgr::createModel()
{
SysShape::Model* model = new SysShape::Model(mModelData, 0x80000, mModelType);
P2ASSERTLINE(148, model);
for (u16 i = 0; i < mModelData->getMaterialCount1(); i++) {
const char* name = mModelData->mMaterialTable._0C->getName(i);
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
const char* name = mModelData->mMaterialTable.mMaterialNames->getName(i);
if (!strcmp(name, "karada")) {
model->mJ3dModel->mMatPackets[(u16)i].mShapePacket->newDifferedDisplayList(0x05020000);
}
@ -89,7 +89,7 @@ SysShape::Model* Mgr::createModel()
// why is this not inlined here but IS inlined in the other mgrs SMH.
Matrixf mtx;
PSMTXIdentity(mtx.mMatrix.mtxView);
PSMTXCopy(mtx.mMatrix.mtxView, j3dSys._00);
PSMTXCopy(mtx.mMatrix.mtxView, j3dSys.mViewMtx);
J3DModel* j3dModel = model->mJ3dModel;
j3dModel->calc();
j3dModel->calcMaterial();

View File

@ -32,24 +32,24 @@ void Koganemushi::Obj::changeMaterial()
modelData = j3dModel->mModelData;
changeTexture = static_cast<Mgr*>(mMgr)->getChangeTexture();
u16 idx = modelData->mMaterialTable._0C->getIndex("karada");
J3DMaterial* karadaMat = modelData->mMaterialTable.mMaterials1[idx];
u16 idx = modelData->mMaterialTable.mMaterialNames->getIndex("karada");
J3DMaterial* karadaMat = modelData->mMaterialTable.mMaterials[idx];
karadaMat->mTevBlock->setTevKColor(0, J3DGXColor(0x3C, 0x3C, 0x3C, 0xFF));
j3dModel->calcMaterial();
j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
changeTexture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)changeTexture);
j3dTexture->setPaletteOffset((u32)changeTexture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -46,7 +46,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -85,8 +85,8 @@ SysShape::Model* Mgr::createModel()
SysShape::Model* model = new SysShape::Model(mModelData, 0x80000, mModelType);
P2ASSERTLINE(121, model != nullptr);
for (u16 i = 0; i < mModelData->getMaterialCount1(); i++) {
const char* name = mModelData->mMaterialTable._0C->getName(i);
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
const char* name = mModelData->mMaterialTable.mMaterialNames->getName(i);
if (!strcmp(name, "mat1")) {
model->mJ3dModel->mMatPackets[i].mShapePacket->newDifferedDisplayList(0x01000200);
}

View File

@ -39,7 +39,7 @@ void Mgr::loadModelData()
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -46,7 +46,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -80,8 +80,8 @@ SysShape::Model* Mgr::createModel()
{
SysShape::Model* model = new SysShape::Model(mModelData, 0x80000, mModelType);
P2ASSERTLINE(136, model);
for (u16 i = 0; i < mModelData->getMaterialCount1(); i++) {
const char* name = mModelData->mMaterialTable._0C->getName(i);
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
const char* name = mModelData->mMaterialTable.mMaterialNames->getName(i);
if (!strcmp(name, "mat_body")) {
model->mJ3dModel->mMatPackets[i].mShapePacket->newDifferedDisplayList(0x04020000);
}

View File

@ -96,15 +96,15 @@ void Obj::changeMaterial()
J3DModel* j3dModel = mModel->mJ3dModel;
J3DModelData* modelData = j3dModel->mModelData;
u16 nameIdx = j3dModel->mModelData->mMaterialTable._0C->getIndex("hanabira1_v");
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[nameIdx];
u16 nameIdx = j3dModel->mModelData->mMaterialTable.mMaterialNames->getIndex("hanabira1_v");
J3DMaterial* material = modelData->mMaterialTable.mMaterials[nameIdx];
material->mTevBlock->setTevColor(0, mRgbColor);
j3dModel->calcMaterial();
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket& packet = j3dModel->mMatPackets[i];
j3dSys.mMatPacket = &j3dModel->mMatPackets[i];
modelData->mMaterialTable.mMaterials1[i]->diff(packet.mShapePacket->mDiffFlag);
modelData->mMaterialTable.mMaterials[i]->diff(packet.mShapePacket->mDiffFlag);
}
}

View File

@ -126,8 +126,8 @@ SysShape::Model* Mgr::createModel()
SysShape::Model* model = new SysShape::Model(mModelData, 0x80000, mModelType);
P2ASSERTLINE(182, model != nullptr);
for (u16 i = 0; i < mModelData->getMaterialCount1(); i++) {
const char* name = mModelData->mMaterialTable._0C->getName(i);
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
const char* name = mModelData->mMaterialTable.mMaterialNames->getName(i);
if (!strcmp(name, "hanabira1_v")) {
model->mJ3dModel->mMatPackets[i].mShapePacket->newDifferedDisplayList(0x01000000);
}

View File

@ -53,7 +53,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -27,18 +27,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -46,7 +46,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -46,7 +46,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -46,7 +46,7 @@ void Mgr::loadModelData()
{
EnemyMgrBase::loadModelData();
J3DShape* shape;
for (u16 j = 0; j < mModelData->getShapeCount(); j++) {
for (u16 j = 0; j < mModelData->getShapeNum(); j++) {
shape = mModelData->mShapeTable.mItems[j];
shape->mFlags = (shape->mFlags & (~0xF000)) | 0x2000;
}

View File

@ -74,8 +74,8 @@ SysShape::Model* Mgr::createModel()
{
SysShape::Model* model = new SysShape::Model(mModelData, 0x80000, mModelType);
P2ASSERTLINE(130, model);
for (u16 i = 0; i < mModelData->getMaterialCount1(); i++) {
const char* name = mModelData->mMaterialTable._0C->getName(i);
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
const char* name = mModelData->mMaterialTable.mMaterialNames->getName(i);
if (!strcmp(name, "mat_dokkuri_main")) {
model->mJ3dModel->mMatPackets[i].mShapePacket->newDifferedDisplayList(0x04020000);
}

View File

@ -25,18 +25,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -30,24 +30,24 @@ void Obj::changeMaterial()
modelData = j3dModel->mModelData;
changeTexture = static_cast<Mgr*>(mMgr)->getChangeTexture();
u16 idx = modelData->mMaterialTable._0C->getIndex("karada");
J3DMaterial* karadaMat = modelData->mMaterialTable.mMaterials1[idx];
u16 idx = modelData->mMaterialTable.mMaterialNames->getIndex("karada");
J3DMaterial* karadaMat = modelData->mMaterialTable.mMaterials[idx];
karadaMat->mTevBlock->setTevKColor(0, J3DGXColor(0x64, 0x64, 0x64, 0xFF));
j3dModel->calcMaterial();
j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
changeTexture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)changeTexture);
j3dTexture->setPaletteOffset((u32)changeTexture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -25,18 +25,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -30,8 +30,8 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture0;
J3DTexture* j3dTexture0 = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture0 = &j3dTexture0->_04[0];
J3DTexture* j3dTexture0 = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture0 = &j3dTexture0->mRes[0];
texture0->copyTo(newTexture0);
@ -39,18 +39,18 @@ void Obj::changeMaterial()
j3dTexture0->setPaletteOffset((u32)texture0);
ResTIMG* newTexture1;
J3DTexture* j3dTexture1 = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture1 = &j3dTexture1->_04[1];
J3DTexture* j3dTexture1 = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture1 = &j3dTexture1->mRes[1];
texture1->copyTo(newTexture1);
j3dTexture1->setImageOffset2((u32)texture1);
j3dTexture1->setPaletteOffset2((u32)texture1);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -28,18 +28,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -76,8 +76,8 @@ SysShape::Model* Mgr::createModel()
{
SysShape::Model* model = new SysShape::Model(mModelData, 0x80000, mModelType);
for (u16 i = 0; i < mModelData->getMaterialCount1(); i++) {
const char* name = mModelData->mMaterialTable._0C->getName(i);
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
const char* name = mModelData->mMaterialTable.mMaterialNames->getName(i);
if (!strcmp(name, "osiri_1_2") || !strcmp(name, "atama_2")) {
model->mJ3dModel->mMatPackets[i].mShapePacket->newDifferedDisplayList(0x04020000);
}

View File

@ -76,8 +76,8 @@ SysShape::Model* Mgr::createModel()
{
SysShape::Model* model = new SysShape::Model(mModelData, 0x80000, mModelType);
for (u16 i = 0; i < mModelData->getMaterialCount1(); i++) {
const char* name = mModelData->mMaterialTable._0C->getName(i);
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
const char* name = mModelData->mMaterialTable.mMaterialNames->getName(i);
if (!strcmp(name, "lambert4")) {
model->mJ3dModel->mMatPackets[i].mShapePacket->newDifferedDisplayList(0x04020000);
}

View File

@ -147,8 +147,8 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture0;
J3DTexture* j3dTexture0 = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture0 = &j3dTexture0->_04[0];
J3DTexture* j3dTexture0 = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture0 = &j3dTexture0->mRes[0];
texture0->copyTo(newTexture0);
@ -156,18 +156,18 @@ void Obj::changeMaterial()
j3dTexture0->setPaletteOffset((u32)texture0);
ResTIMG* newTexture1;
J3DTexture* j3dTexture1 = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture1 = &j3dTexture1->_04[1];
J3DTexture* j3dTexture1 = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture1 = &j3dTexture1->mRes[1];
texture1->copyTo(newTexture1);
j3dTexture1->setImageOffset2((u32)texture1);
j3dTexture1->setPaletteOffset2((u32)texture1);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -28,18 +28,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -31,8 +31,8 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture0;
J3DTexture* j3dTexture0 = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture0 = j3dTexture0->_04;
J3DTexture* j3dTexture0 = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture0 = j3dTexture0->mRes;
texture0->copyTo(newTexture0);
@ -40,18 +40,18 @@ void Obj::changeMaterial()
j3dTexture0->setPaletteOffset((u32)texture0);
ResTIMG* newTexture1;
J3DTexture* j3dTexture1 = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture1 = &j3dTexture1->_04[1];
J3DTexture* j3dTexture1 = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture1 = &j3dTexture1->mRes[1];
texture1->copyTo(newTexture1);
j3dTexture1->setImageOffset2((u32)texture1);
j3dTexture1->setPaletteOffset2((u32)texture1);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -371,7 +371,7 @@ SysShape::Model* EnemyMgrBase::createModel()
Matrixf identity;
PSMTXIdentity(identity.mMatrix.mtxView);
PSMTXCopy(identity.mMatrix.mtxView, j3dSys._00);
PSMTXCopy(identity.mMatrix.mtxView, j3dSys.mViewMtx);
J3DModel* j3dModel = model->mJ3dModel;
j3dModel->calc();

View File

@ -154,12 +154,12 @@ void Mgr::draw(Viewport* viewport)
{
J3DModelData* modelData = mModelData[i];
J3DMaterial* material = modelData->mJointTree.mJoints[0]->mMaterial;
j3dSys._10C = (u32)modelData->mVertexData._18;
j3dSys._110 = (u32)modelData->mVertexData._1C;
j3dSys._114 = (u32)modelData->mVertexData._24;
j3dSys.mVtxPos = modelData->mVertexData.mVtxPos;
j3dSys.mVtxNorm = modelData->mVertexData.mVtxNorm;
j3dSys.mVtxColor = modelData->mVertexData.mVtxColor[0];
J3DShape::sOldVcdVatCmd = 0;
for (material; material != nullptr; material = material->_04) {
for (material; material != nullptr; material = material->mNext) {
material->loadSharedDL();
material->mShape->loadPreDrawSetting();

View File

@ -29,18 +29,18 @@ void Obj::changeMaterial()
j3dModel->calcMaterial();
ResTIMG* newTexture;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTexture;
newTexture = j3dTexture->_04;
J3DTexture* j3dTexture = mModel->mJ3dModel->mModelData->mMaterialTable.mTextures;
newTexture = j3dTexture->mRes;
texture->copyTo(newTexture);
j3dTexture->setImageOffset((u32)texture);
j3dTexture->setPaletteOffset((u32)texture);
for (u16 i = 0; i < modelData->mMaterialTable.mCount1; i++) {
for (u16 i = 0; i < modelData->mMaterialTable.mMaterialNum; i++) {
J3DMatPacket* packet = &j3dModel->mMatPackets[i];
j3dSys.mMatPacket = packet;
J3DMaterial* material = modelData->mMaterialTable.mMaterials1[i];
J3DMaterial* material = modelData->mMaterialTable.mMaterials[i];
material->diff(packet->mShapePacket->mDiffFlag);
}
}

View File

@ -54,9 +54,9 @@ void DrawBuffer::draw()
{
P2ASSERTLINE(57, mBuffer != nullptr);
if (isFlag(DRAWBUFF_Unk1)) {
j3dSys._50 = 4;
j3dSys.mDrawMode = J3DSys::SYSDRAW_Unk4;
} else {
j3dSys._50 = 3;
j3dSys.mDrawMode = J3DSys::SYSDRAW_Unk3;
}
mBuffer->draw();

View File

@ -176,10 +176,10 @@ void Model::enableMaterialAnim(J3DModelData* data, int p2)
{
switch (p2) {
case 0:
for (int i = 0; i < data->mMaterialTable.mCount1; i++) {
for (int i = 0; i < data->mMaterialTable.mMaterialNum; i++) {
J3DMaterialAnm* anm = new J3DMaterialAnm();
data->mMaterialTable.mMaterials1[i]->change();
data->mMaterialTable.mMaterials1[i]->mAnm = anm;
data->mMaterialTable.mMaterials[i]->change();
data->mMaterialTable.mMaterials[i]->mAnm = anm;
}
break;
case 1:
@ -306,10 +306,10 @@ void Model::enableMaterialAnim(int p1)
switch (p1) {
case 0:
J3DModelData* data = mJ3dModel->mModelData;
for (int i = 0; i < data->mMaterialTable.mCount1; i++) {
for (int i = 0; i < data->mMaterialTable.mMaterialNum; i++) {
J3DMaterialAnm* anm = new J3DMaterialAnm();
data->mMaterialTable.mMaterials1[i]->change();
data->mMaterialTable.mMaterials1[i]->mAnm = anm;
data->mMaterialTable.mMaterials[i]->change();
data->mMaterialTable.mMaterials[i]->mAnm = anm;
}
break;
case 1:
@ -803,13 +803,13 @@ void Model::jointVisible(bool newVisibility, int jointIndex)
{
if (newVisibility != false) {
for (J3DMaterial* material = mJ3dModel->mModelData->mJointTree.mJoints[(u16)jointIndex]->mMaterial; material != nullptr;
material = material->_04) {
material = material->mNext) {
material->mShape->mFlags &= ~J3DShape::IsHidden;
}
return;
}
for (J3DMaterial* material = mJ3dModel->mModelData->mJointTree.mJoints[(u16)jointIndex]->mMaterial; material != nullptr;
material = material->_04) {
material = material->mNext) {
material->mShape->mFlags |= J3DShape::IsHidden;
}
/*
@ -868,7 +868,7 @@ void Model::hide()
{
for (u16 i = 0; i < mJointCount; i++) {
for (J3DMaterial* material = mJ3dModel->mModelData->mJointTree.mJoints[i]->mMaterial; material != nullptr;
material = material->_04) {
material = material->mNext) {
material->mShape->mFlags |= J3DShape::IsHidden;
}
}
@ -883,7 +883,7 @@ void Model::show()
{
for (u16 i = 0; i < mJointCount; i++) {
for (J3DMaterial* material = mJ3dModel->mModelData->mJointTree.mJoints[i]->mMaterial; material != nullptr;
material = material->_04) {
material = material->mNext) {
material->mShape->mFlags &= ~J3DShape::IsHidden;
}
}