some J3D progress

This commit is contained in:
PikHacker 2023-11-21 15:58:05 -05:00
parent 8f46e92375
commit 9721d4eb41
22 changed files with 565 additions and 1682 deletions

View File

@ -37,7 +37,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASInstRand.cpp">JAudio//JAS/JASInstRand.cpp</a> | 2295 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio/object-id.cpp">JStudio/object-id.cpp</a> | 2697 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JAudio/control.cpp">JStudio_JAudio/control.cpp</a> | 3630 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASInstSense.cpp">JAudio//JAS/JASInstSense.cpp</a> | 3632 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAISoundTable.cpp">JAudio//JAI/JAISoundTable.cpp</a> | 4353 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JGadget/linklist.cpp">JGadget/linklist.cpp</a> | 4370 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASSeqCtrl.cpp">JAudio//JAS/JASSeqCtrl.cpp</a> | 4504 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterialAnm.cpp">J3D/J3DMaterialAnm.cpp</a> | 4846 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASSeqCtrl.cpp">JAudio//JAS/JASSeqCtrl.cpp</a> | 4504 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterialAnm.cpp">J3D/J3DMaterialAnm.cpp</a> | 4854 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/dsp/dsptask.c">JAudio//dsp/dsptask.c</a> | 5887 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JGadget/std-list.cpp">JGadget/std-list.cpp</a> | 5970 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAIFx.cpp">JAudio//JAI/JAIFx.cpp</a> | 6646 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DJointTree.cpp">J3D/J3DJointTree.cpp</a> | 6775 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DBloSaver.cpp">J2D/J2DBloSaver.cpp</a> | 7037 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAIDummyObject.cpp">JAudio//JAI/JAIDummyObject.cpp</a> | 7337 |
@ -54,27 +54,27 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JGadget/std-vector.cpp">JGadget/std-vector.cpp</a> | 16317 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASAiCtrl.cpp">JAudio//JAS/JASAiCtrl.cpp</a> | 18564 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAEmitterManager.cpp">JParticle/JPAEmitterManager.cpp</a> | 18984 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DTransform.cpp">J3D/J3DTransform.cpp</a> | 19091 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAIObject.cpp">JAudio//JAI/JAIObject.cpp</a> | 19207 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAISystemInterface.cpp">JAudio//JAI/JAISystemInterface.cpp</a> | 19427 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JAudio/object-sound.cpp">JStudio_JAudio/object-sound.cpp</a> | 20069 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JMessage/resource.cpp">JMessage/resource.cpp</a> | 20333 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JParticle/object-particle.cpp">JStudio_JParticle/object-particle.cpp</a> | 20658 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DModelLoaderCalcSize.cpp">J3D/J3DModelLoaderCalcSize.cpp</a> | 21406 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASHeapCtrl.cpp">JAudio//JAS/JASHeapCtrl.cpp</a> | 21650 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASBNKParser.cpp">JAudio//JAS/JASBNKParser.cpp</a> | 21685 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DCluster.cpp">J3D/J3DCluster.cpp</a> | 22640 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DWindow.cpp">J2D/J2DWindow.cpp</a> | 22691 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DJoint.cpp">J3D/J3DJoint.cpp</a> | 23487 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JKernel/JKRHeap.cpp">JKernel/JKRHeap.cpp</a> | 23843 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMtxBuffer.cpp">J3D/J3DMtxBuffer.cpp</a> | 23877 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JStage/object-light.cpp">JStudio_JStage/object-light.cpp</a> | 24139 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPADynamicsBlock.cpp">JParticle/JPADynamicsBlock.cpp</a> | 24232 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DPacket.cpp">J3D/J3DPacket.cpp</a> | 24694 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUtility/JUTConsole.cpp">JUtility/JUTConsole.cpp</a> | 24735 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DShape.cpp">J3D/J3DShape.cpp</a> | 25165 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterialAttach.cpp">J3D/J3DMaterialAttach.cpp</a> | 26458 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3DU/J3DUMotion.cpp">J3DU/J3DUMotion.cpp</a> | 26723 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DShape.cpp">J3D/J3DShape.cpp</a> | 19458 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JAudio/object-sound.cpp">JStudio_JAudio/object-sound.cpp</a> | 20069 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JMessage/resource.cpp">JMessage/resource.cpp</a> | 20333 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JParticle/object-particle.cpp">JStudio_JParticle/object-particle.cpp</a> | 20658 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DModelLoaderCalcSize.cpp">J3D/J3DModelLoaderCalcSize.cpp</a> | 21406 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASHeapCtrl.cpp">JAudio//JAS/JASHeapCtrl.cpp</a> | 21650 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASBNKParser.cpp">JAudio//JAS/JASBNKParser.cpp</a> | 21685 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DCluster.cpp">J3D/J3DCluster.cpp</a> | 22640 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DWindow.cpp">J2D/J2DWindow.cpp</a> | 22691 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DJoint.cpp">J3D/J3DJoint.cpp</a> | 23487 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JKernel/JKRHeap.cpp">JKernel/JKRHeap.cpp</a> | 23843 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMtxBuffer.cpp">J3D/J3DMtxBuffer.cpp</a> | 23898 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JStage/object-light.cpp">JStudio_JStage/object-light.cpp</a> | 24139 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPADynamicsBlock.cpp">JParticle/JPADynamicsBlock.cpp</a> | 24232 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DPacket.cpp">J3D/J3DPacket.cpp</a> | 24694 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUtility/JUTConsole.cpp">JUtility/JUTConsole.cpp</a> | 24735 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterialAttach.cpp">J3D/J3DMaterialAttach.cpp</a> | 26177 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3DU/J3DUMotion.cpp">J3DU/J3DUMotion.cpp</a> | 26723 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAIAnimation.cpp">JAudio//JAI/JAIAnimation.cpp</a> | 26939 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DTextBoxEx.cpp">J2D/J2DTextBoxEx.cpp</a> | 27064 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterial.cpp">J3D/J3DMaterial.cpp</a> | 29166 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JStage/object-camera.cpp">JStudio_JStage/object-camera.cpp</a> | 29527 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DMaterial.cpp">J2D/J2DMaterial.cpp</a> | 30596 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio/stb.cpp">JStudio/stb.cpp</a> | 30738 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DModel.cpp">J3D/J3DModel.cpp</a> | 31045 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAIBasic.cpp">JAudio//JAI/JAIBasic.cpp</a> | 31617 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DModel.cpp">J3D/J3DModel.cpp</a> | 28908 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterial.cpp">J3D/J3DMaterial.cpp</a> | 29166 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JStage/object-camera.cpp">JStudio_JStage/object-camera.cpp</a> | 29527 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DMaterial.cpp">J2D/J2DMaterial.cpp</a> | 30596 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio/stb.cpp">JStudio/stb.cpp</a> | 30738 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAIBasic.cpp">JAudio//JAI/JAIBasic.cpp</a> | 31617 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DPane.cpp">J2D/J2DPane.cpp</a> | 32332 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASDSPInterface.cpp">JAudio//JAS/JASDSPInterface.cpp</a> | 33950 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JStage/object-actor.cpp">JStudio_JStage/object-actor.cpp</a> | 35160 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DScreen.cpp">J2D/J2DScreen.cpp</a> | 37221 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio/fvb.cpp">JStudio/fvb.cpp</a> | 37468 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAParticle.cpp">JParticle/JPAParticle.cpp</a> | 39461 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterialFactory_v21.cpp">J3D/J3DMaterialFactory_v21.cpp</a> | 39590 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASChannel.cpp">JAudio//JAS/JASChannel.cpp</a> | 39720 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DMaterialFactory.cpp">J2D/J2DMaterialFactory.cpp</a> | 39925 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASAramStream.cpp">JAudio//JAS/JASAramStream.cpp</a> | 40048 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUtility/JUTException.cpp">JUtility/JUTException.cpp</a> | 40644 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DShapeMtx.cpp">J3D/J3DShapeMtx.cpp</a> | 47592 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JMessage/processor.cpp">JMessage/processor.cpp</a> | 48602 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DPrint.cpp">J2D/J2DPrint.cpp</a> | 53420 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUtility/JUTGamePad.cpp">JUtility/JUTGamePad.cpp</a> | 59409 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DTevs.cpp">J3D/J3DTevs.cpp</a> | 59735 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUtility/JUTException.cpp">JUtility/JUTException.cpp</a> | 40644 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DTevs.cpp">J3D/J3DTevs.cpp</a> | 43878 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DShapeMtx.cpp">J3D/J3DShapeMtx.cpp</a> | 47785 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JMessage/processor.cpp">JMessage/processor.cpp</a> | 48602 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DPrint.cpp">J2D/J2DPrint.cpp</a> | 53420 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUtility/JUTGamePad.cpp">JUtility/JUTGamePad.cpp</a> | 59409 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAIStreamMgr.cpp">JAudio//JAI/JAIStreamMgr.cpp</a> | 61961 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DAnimation.cpp">J3D/J3DAnimation.cpp</a> | 65982 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAI/JAISeMgr.cpp">JAudio//JAI/JAISeMgr.cpp</a> | 68545 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JAudio/JSystem/JAS/JASSeqParser.cpp">JAudio//JAS/JASSeqParser.cpp</a> | 68852 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JParticle/JPAFieldBlock.cpp">JParticle/JPAFieldBlock.cpp</a> | 69327 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J2D/J2DWindowEx.cpp">J2D/J2DWindowEx.cpp</a> | 72302 |

View File

@ -80,6 +80,13 @@ static inline void __GDWriteF32(f32 data)
__GDWrite(((u8*)&data)[3]);
}
inline void GDOverflowCheck(u32 len)
{
if (__GDCurrentDL->pDisplayListData + len > __GDCurrentDL->end) {
GDOverflowed();
}
}
////////////////////////////////////////////
#ifdef __cplusplus

View File

@ -68,6 +68,13 @@ inline void J3DGDWriteXFCmd(u16 param_1, u32 param_2)
J3DGDWrite_u32(param_2);
}
inline void J3DGDWriteXFCmdHdr(u16 cmd, u8 len)
{
J3DGDWrite_u8(0x10);
J3DGDWrite_u16(len - 1);
J3DGDWrite_u16(cmd);
}
inline void J3DGDSetNumChans(u8 numChans) { J3DGDWriteXFCmd(0x1009, numChans); }
inline void J3DGDSetNumTexGens(u8 numTexGens) { J3DGDWriteXFCmd(0x103f, numTexGens); }

View File

@ -79,22 +79,6 @@ struct J3DTevSwapModeTableInfo {
struct J3DTexCoord2Info {
};
struct J3DTexMtxInfo {
u8 _00; // _00
u8 _01; // _01
u8 _02; // _02
u8 _03; // _03
f32 _04; // _04
f32 _08; // _08
f32 _0C; // _0C
f32 _10; // _10
f32 _14; // _14
u16 _18; // _18
f32 _1C; // _1C
f32 _20; // _20
Mtx44 _24; // _24
};
/**
* @size{0x14C}
*/

View File

@ -26,6 +26,38 @@ struct J3DModel;
typedef void (*J3DCalcCallBack)(J3DModel*, u32 timing);
// This belongs... somewhere
void J3DCalcViewBaseMtx(Mtx view, Vec const& scale, const Mtx& base, Mtx dst)
{
Mtx m;
m[0][0] = base[0][0] * scale.x;
m[0][1] = base[0][1] * scale.y;
m[0][2] = base[0][2] * scale.z;
m[0][3] = base[0][3];
m[1][0] = base[1][0] * scale.x;
m[1][1] = base[1][1] * scale.y;
m[1][2] = base[1][2] * scale.z;
m[1][3] = base[1][3];
m[2][0] = base[2][0] * scale.x;
m[2][1] = base[2][1] * scale.y;
m[2][2] = base[2][2] * scale.z;
m[2][3] = base[2][3];
PSMTXConcat(view, m, dst);
}
struct J3DUnkCalc1 {
virtual void calc(J3DModel* model);
};
struct J3DUnkCalc2 {
virtual void unk();
virtual void calc(J3DModelData* mpModelData);
};
// TODO: name these
enum J3DModelFlags {
J3DMODEL_Unk1 = 0x1,
@ -208,6 +240,7 @@ struct J3DModel {
void setUserArea(u32 area) { mUserArea = area; }
u32 getUserArea() const { return mUserArea; }
void setAnmMtx(int i, Mtx m) { mMtxBuffer->setAnmMtx(i, m); }
MtxP getAnmMtx(int p1) { return mMtxBuffer->getAnmMtx(p1); }
// void setBaseScale(const Vec& scale) { mModelScale = scale; }
Vec* getBaseScale() { return &mModelScale; }
@ -228,8 +261,8 @@ struct J3DModel {
J3DDeformData* mDeformData; // _C8
J3DSkinDeform* mSkinDeform; // _CC
J3DVtxColorCalc* mVtxColorCalc; // _D0
u32 _D4; // _D4
void* _D8; // _D8
J3DUnkCalc1* mUnkCalc1; // _D4
J3DUnkCalc2* mUnkCalc2; // _D8
};
struct J3DModelHierarchy {

View File

@ -98,7 +98,7 @@ struct J3DSys {
static Mtx mCurrentMtx;
static Vec mCurrentS;
static Vec mParentS;
static u16 sTexCoordScaleTable[8][4];
static J3DTexCoordScaleInfo sTexCoordScaleTable[8];
Mtx mViewMtx; // _000
J3DMtxCalc* mMtxCalc; // _030
@ -123,6 +123,12 @@ struct J3DSys {
Vec* mNBTScale; // _118
};
enum J3DSysFlag {
J3DSysFlag_SkinPosCpu = 0x00000004,
J3DSysFlag_SkinNrmCpu = 0x00000008,
J3DSysFlag_PostTexMtx = 0x40000000,
};
extern J3DSys j3dSys;
extern s32 j3dDefaultViewNo;

View File

@ -8,6 +8,19 @@
#include "JSystem/J3D/J3DTypes.h"
#include "types.h"
struct J3DTexMtxInfo {
// I think these exist in TP but not here
// void operator=(J3DTexMtxInfo const&);
// void setEffectMtx(Mtx);
u8 mProjection; // _00
u8 mInfo; // _01
Vec mCenter; // _04
J3DTextureSRTInfo mSRT; // _10
Mtx44 mEffectMtx; // _24
}; // Size: 0x64
struct J3DTexMtx {
void calc(const f32 (*)[4]);
void calcTexMtx(const f32 (*)[4]);
@ -17,14 +30,12 @@ struct J3DTexMtx {
void loadTexMtx(u32) const;
void loadPostTexMtx(u32) const;
u8 _00; // _00
s8 mFlags; // _01
u8 _02; // _02
u8 _03; // _03
Vec _04; // _04
J3DTextureSRTInfo mSrtInfo; // _10
Mtx44 _24; // _24
Mtx _64; // _64
J3DTexMtxInfo& getTexMtxInfo() { return mTexMtxInfo; }
Mtx& getMtx() { return mMtx; }
// void setEffectMtx(Mtx effectMtx) { mTexMtxInfo.setEffectMtx(effectMtx); }
J3DTexMtxInfo mTexMtxInfo; // _00
Mtx mMtx; // _64
};
namespace J3DDifferedTexMtx {

View File

@ -5,6 +5,7 @@
#include "JSystem/J3D/J3DTypes.h"
extern Mtx j3dDefaultMtx;
extern Vec j3dDefaultScale;
void J3DCalcBBoardMtx(f32 (*)[4]);
void J3DCalcYBBoardMtx(f32 (*)[4]);

View File

@ -364,8 +364,8 @@ struct J3DTransformInfo {
extern const J3DTransformInfo j3dDefaultTransformInfo;
struct J3DNBTScaleInfo {
u8 _00; // _00
JGeometry::TVec3f _04; // _04
u8 _00; // _00
Vec _04; // _04
// f32 _08; // _08
// f32 _0C; // _0C
@ -375,8 +375,8 @@ extern const J3DNBTScaleInfo j3dDefaultNBTScaleInfo;
struct J3DNBTScale {
inline J3DNBTScale()
: _00(j3dDefaultNBTScaleInfo._00)
, _04(j3dDefaultNBTScaleInfo._04)
: mbHasScale(j3dDefaultNBTScaleInfo._00)
, mScale(j3dDefaultNBTScaleInfo._04)
{
// _04.x = j3dDefaultNBTScaleInfo._04;
// _04.y = j3dDefaultNBTScaleInfo._08;
@ -385,17 +385,27 @@ struct J3DNBTScale {
/** @fabricated */
inline J3DNBTScale(const J3DNBTScaleInfo& info)
: _00(info._00)
, _04(info._04)
: mbHasScale(info._00)
, mScale(info._04)
{
// _04.x = info._04;
// _04.y = info._08;
// _04.z = info._0C;
}
u8 _00; // _00
JGeometry::TVec3f _04;
Vec* getScale() { return &mScale; }
u8 mbHasScale; // _00
Vec mScale;
};
struct J3DTexCoordScaleInfo {
u16 _00;
u16 _02;
u16 _04;
u16 _06;
};
void loadNBTScale(J3DNBTScale&);
void loadTexCoordGens(u32, J3DTexCoord*);

View File

@ -21,7 +21,7 @@ struct ResTIMG {
u8 mWrapS; // _06
u8 mWrapT; // _07
u8 mPaletteFormat; // _08
u8 mLutFormat; // _09
u8 mColorFormat; // _09
u16 mPaletteEntryCount; // _0A
u32 mPaletteOffset; // _0C
GXBool mIsMIPmapEnabled; // _10

View File

@ -615,7 +615,7 @@ void J2DAnmTexPattern::searchUpdateMaterialID(J2DScreen* screen)
}
mImgPtrArray[i].mImg = var2;
if (var2 && var2->mPaletteFormat) {
JUTPalette* palette = new JUTPalette(GX_TLUT0, (GXTlutFmt)var2->mLutFormat, (JUTTransparency)var2->mTransparency,
JUTPalette* palette = new JUTPalette(GX_TLUT0, (GXTlutFmt)var2->mColorFormat, (JUTTransparency)var2->mTransparency,
var2->mPaletteEntryCount, ((u8*)var2) + var2->mPaletteOffset);
mImgPtrArray[i].mPalette = palette;
}

View File

@ -71,7 +71,7 @@ void J3DMaterialAnm::calc(J3DMaterial* material) const
}
for (u32 i = 0; i < 8; i++) {
if (mTexMtxAnmList[i].getAnmFlag()) {
J3DTextureSRTInfo* info = &material->mTexGenBlock->getTexMtx(i)->mSrtInfo;
J3DTextureSRTInfo* info = &material->mTexGenBlock->getTexMtx(i)->mTexMtxInfo.mSRT;
mTexMtxAnmList[i].calc(info);
}
}

View File

@ -3,19 +3,6 @@
#include "JSystem/J3D/J3DMaterialAnm.h"
#include "JSystem/J3D/J3DMaterial.h"
#include "JSystem/J3D/J3DTypes.h"
#include "types.h"
/*
Generated from dpostproc
.section .data, "wa" # 0x8049E220 - 0x804EFC20
.global __vt__16J3DMaterialTable
__vt__16J3DMaterialTable:
.4byte 0
.4byte 0
.4byte __dt__16J3DMaterialTableFv
.4byte 0
*/
/*
* --INFO--

View File

@ -1,5 +1,3 @@
#include "Dolphin/mtx.h"
#include "Dolphin/os.h"
#include "JSystem/J3D/J3DDisplayListObj.h"
#include "JSystem/J3D/J3DModel.h"
#include "JSystem/J3D/J3DMtxBuffer.h"
@ -8,7 +6,9 @@
#include "JSystem/J3D/J3DTexGenBlock.h"
#include "JSystem/J3D/J3DTexMtx.h"
#include "JSystem/J3D/J3DTypes.h"
#include "types.h"
#include "JSystem/J3D/J3DSkinDeform.h"
#include "JSystem/J3D/J3DVtxColorCalc.h"
#include "JSystem/J3D/J3DTransform.h"
/*
* --INFO--
@ -33,8 +33,8 @@ void J3DModel::initialize()
mDeformData = nullptr;
mSkinDeform = nullptr;
mVtxColorCalc = nullptr;
_D4 = 0;
_D8 = nullptr;
mUnkCalc1 = 0;
mUnkCalc2 = nullptr;
}
/*
@ -358,26 +358,36 @@ void J3DModel::makeDL()
*/
void J3DModel::calcMaterial()
{
if (mFlags & 4) {
j3dSys.mFlags |= 0x4;
j3dSys.setModel(this);
if (checkFlag(4)) {
j3dSys.onFlag(4);
} else {
j3dSys.mFlags &= ~0x4;
j3dSys.offFlag(4);
}
if (mFlags & 8) {
j3dSys.mFlags |= 0x8;
if (checkFlag(8)) {
j3dSys.onFlag(8);
} else {
j3dSys.mFlags &= ~0x8;
j3dSys.offFlag(8);
}
j3dSys.mModel = this;
mModelData->syncJ3DSysFlags();
j3dSys.mTexture = mModelData->mMaterialTable.mTextures;
u32 count = mModelData->mMaterialTable.mMaterialNum;
for (u16 i = 0; i < count; i++) {
j3dSys.mMatPacket = &mMatPackets[i];
mModelData->mMaterialTable.mMaterials[i]->makeDisplayList();
// TODO: This appears to share code with inside of loop of J3DModelData::simpleCalcMaterial(u16 jointIndex, Mtx*)
// TODO: Similarly, ???
j3dSys.setTexture(mModelData->getTexture());
u16 matNum = mModelData->getMaterialNum();
for (u16 i = 0; i < matNum; i++) {
j3dSys.setMatPacket(&mMatPackets[i]);
J3DMaterial* material = mModelData->getMaterialNodePointer(i);
if (material->getMaterialAnm() != nullptr) {
material->getMaterialAnm()->calc(material);
}
int jntNo = material->getJoint()->getJntNo();
material->calc(getAnmMtx(jntNo));
}
/*
stwu r1, -0x20(r1)
mflr r0
@ -515,7 +525,7 @@ void J3DModel::calcDiffTexMtx()
J3DTexMtx* texMtx1 = block->getTexMtx(j);
J3DTexMtxObj* v1 = packet->mTexMtxObj;
if (texMtx1 && v1) {
PSMTXCopy(texMtx1->_64, v1->mTexMtx[j]);
PSMTXCopy(texMtx1->mMtx, v1->mTexMtx[j]);
}
}
}
@ -676,200 +686,56 @@ void J3DModel::update()
*/
void J3DModel::calc()
{
if ((mFlags & 4) != 0) {
j3dSys.mFlags |= 4;
j3dSys.setModel(this);
if (checkFlag(J3DMODEL_SkinPosCpu)) {
j3dSys.onFlag(J3DSysFlag_SkinPosCpu);
} else {
j3dSys.mFlags &= ~4;
j3dSys.offFlag(J3DSysFlag_SkinPosCpu);
}
if ((mFlags & 8) != 0) {
j3dSys.mFlags |= 8;
if (checkFlag(J3DMODEL_SkinNrmCpu)) {
j3dSys.onFlag(J3DSysFlag_SkinNrmCpu);
} else {
j3dSys.mFlags &= ~8;
j3dSys.offFlag(J3DSysFlag_SkinNrmCpu);
}
j3dSys.mModel = this;
mModelData->syncJ3DSysFlags();
mVertexBuffer.mCurrentVtxPos = mVertexBuffer.mVtxPos[0];
mVertexBuffer.mCurrentVtxNorm = mVertexBuffer.mVtxNorm[0];
mVertexBuffer.mCurrentVtxColor = mVertexBuffer.mVtxColor[0];
if (_D8 != nullptr) {
// _D8->something(mModelData);
getModelData()->syncJ3DSysFlags();
mVertexBuffer.frameInit();
if (mUnkCalc2 != nullptr) {
mUnkCalc2->calc(getModelData());
}
if (mDeformData != nullptr) {
// mDeformData->deform(this);
mDeformData->deform(this);
}
if (mVtxColorCalc != nullptr) {
// mVtxColorCalc->calc(this);
mVtxColorCalc->calc(this);
}
if (_D4 != nullptr) {
// _D4->something(this);
if (mUnkCalc1 != nullptr) {
mUnkCalc1->calc(this);
}
if ((mFlags & 2) != 0) {
J3DJointTree* jointTree = &mModelData->mJointTree;
j3dSys.mModel = this;
// jointTree->calc(mMtxBuffer, j3dDefaultScale, j3dDefaultMtx);
j3dSys.setModel(this);
if (checkFlag(2)) {
getModelData()->getJointTree().calc(mMtxBuffer, j3dDefaultScale, j3dDefaultMtx);
} else {
J3DJointTree* jointTree = &mModelData->mJointTree;
j3dSys.mModel = this;
jointTree->calc(mMtxBuffer, mModelScale, mPosMtx);
}
if (mModelData->mJointTree.mEnvelopeCnt != 0 && (mFlags & 0x10) == 0 && (mModelData->mModelLoaderFlags & J3DMLF_09) == 0) {
mMtxBuffer->calcWeightEnvelopeMtx();
getModelData()->getJointTree().calc(mMtxBuffer, mModelScale, mPosMtx);
}
calcWeightEnvelopeMtx();
if (mSkinDeform != nullptr) {
// mSkinDeform->deform(this);
mSkinDeform->deform(this);
}
if (mCalcCallBack != nullptr) {
// _10(this, 0);
mCalcCallBack(this, 0);
}
/*
stwu r1, -0x10(r1)
mflr r0
lis r4, j3dSys@ha
stw r0, 0x14(r1)
stw r31, 0xc(r1)
addi r31, r4, j3dSys@l
stw r30, 8(r1)
mr r30, r3
stw r30, 0x38(r31)
lwz r0, 8(r3)
rlwinm. r0, r0, 0, 0x1d, 0x1d
beq lbl_80066E14
lwz r0, 0x34(r31)
ori r0, r0, 4
stw r0, 0x34(r31)
b lbl_80066E20
lbl_80066E14:
lwz r0, 0x34(r31)
rlwinm r0, r0, 0, 0x1e, 0x1c
stw r0, 0x34(r31)
lbl_80066E20:
lwz r0, 8(r30)
rlwinm. r0, r0, 0, 0x1c, 0x1c
beq lbl_80066E44
lis r3, j3dSys@ha
addi r3, r3, j3dSys@l
lwz r0, 0x34(r3)
ori r0, r0, 8
stw r0, 0x34(r3)
b lbl_80066E58
lbl_80066E44:
lis r3, j3dSys@ha
addi r3, r3, j3dSys@l
lwz r0, 0x34(r3)
rlwinm r0, r0, 0, 0x1d, 0x1b
stw r0, 0x34(r3)
lbl_80066E58:
lwz r3, 4(r30)
bl syncJ3DSysFlags__12J3DModelDataCFv
lwz r0, 0x8c(r30)
stw r0, 0xb4(r30)
lwz r0, 0x94(r30)
stw r0, 0xb8(r30)
lwz r0, 0x9c(r30)
stw r0, 0xbc(r30)
lwz r3, 0xd8(r30)
cmplwi r3, 0
beq lbl_80066E98
lwz r12, 0(r3)
lwz r4, 4(r30)
lwz r12, 0xc(r12)
mtctr r12
bctrl
lbl_80066E98:
lwz r3, 0xc8(r30)
cmplwi r3, 0
beq lbl_80066EAC
mr r4, r30
bl deform__13J3DDeformDataFP8J3DModel
lbl_80066EAC:
lwz r3, 0xd0(r30)
cmplwi r3, 0
beq lbl_80066EC0
mr r4, r30
bl calc__15J3DVtxColorCalcFP8J3DModel
lbl_80066EC0:
lwz r3, 0xd4(r30)
cmplwi r3, 0
beq lbl_80066EE0
lwz r12, 0(r3)
mr r4, r30
lwz r12, 8(r12)
mtctr r12
bctrl
lbl_80066EE0:
stw r30, 0x38(r31)
lwz r0, 8(r30)
rlwinm. r0, r0, 0, 0x1e, 0x1e
beq lbl_80066F1C
lwz r3, 4(r30)
lis r5, j3dDefaultScale@ha
lwzu r12, 0x10(r3)
lis r6, j3dDefaultMtx@ha
lwz r4, 0x84(r30)
addi r5, r5, j3dDefaultScale@l
lwz r12, 8(r12)
addi r6, r6, j3dDefaultMtx@l
mtctr r12
bctrl
b lbl_80066F3C
lbl_80066F1C:
lwz r3, 4(r30)
addi r5, r30, 0x18
lwzu r12, 0x10(r3)
addi r6, r30, 0x24
lwz r4, 0x84(r30)
lwz r12, 8(r12)
mtctr r12
bctrl
lbl_80066F3C:
lwz r3, 4(r30)
lhz r0, 0x2e(r3)
cmplwi r0, 0
beq lbl_80066F6C
lwz r0, 8(r30)
rlwinm. r0, r0, 0, 0x1b, 0x1b
bne lbl_80066F6C
lwz r0, 8(r3)
rlwinm. r0, r0, 0, 0x17, 0x17
bne lbl_80066F6C
lwz r3, 0x84(r30)
bl calcWeightEnvelopeMtx__12J3DMtxBufferFv
lbl_80066F6C:
lwz r3, 0xcc(r30)
cmplwi r3, 0
beq lbl_80066F80
mr r4, r30
bl deform__13J3DSkinDeformFP8J3DModel
lbl_80066F80:
lwz r12, 0x10(r30)
cmplwi r12, 0
beq lbl_80066F9C
mr r3, r30
li r4, 0
mtctr r12
bctrl
lbl_80066F9C:
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
lwz r30, 8(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
@ -985,6 +851,37 @@ lbl_8006707C:
*/
void J3DModel::viewCalc()
{
mMtxBuffer->swapDrawMtx();
mMtxBuffer->swapNrmMtx();
if (mModelData->checkFlag(0x10)) {
if (getMtxCalcMode() == 2) {
J3DCalcViewBaseMtx(*j3dSys.getViewMtx(), mModelScale, mPosMtx, (MtxP)&mInternalView);
}
} else if (isCpuSkinningOn()) {
if (getMtxCalcMode() == 2) {
J3DCalcViewBaseMtx(*j3dSys.getViewMtx(), mModelScale, mPosMtx, (MtxP)&mInternalView);
}
} else if (checkFlag(J3DMODEL_SkinPosCpu)) {
mMtxBuffer->calcDrawMtx(getMtxCalcMode(), mModelScale, mPosMtx);
calcNrmMtx();
calcBumpMtx();
DCStoreRangeNoSync(getDrawMtxPtr(), mModelData->getDrawMtxNum() * sizeof(Mtx));
DCStoreRange(getNrmMtxPtr(), mModelData->getDrawMtxNum() * sizeof(Mtx33));
} else if (checkFlag(J3DMODEL_SkinNrmCpu)) {
mMtxBuffer->calcDrawMtx(getMtxCalcMode(), mModelScale, mPosMtx);
calcBBoardMtx();
DCStoreRange(getDrawMtxPtr(), mModelData->getDrawMtxNum() * sizeof(Mtx));
} else {
mMtxBuffer->calcDrawMtx(getMtxCalcMode(), mModelScale, mPosMtx);
calcNrmMtx();
calcBBoardMtx();
calcBumpMtx();
DCStoreRangeNoSync(getDrawMtxPtr(), mModelData->getDrawMtxNum() * sizeof(Mtx));
DCStoreRange(getNrmMtxPtr(), mModelData->getDrawMtxNum() * sizeof(Mtx33));
}
prepareShapePackets();
/*
stwu r1, -0x70(r1)
mflr r0
@ -1233,20 +1130,20 @@ void J3DModel::calcNrmMtx() { mMtxBuffer->calcNrmMtx(); }
*/
void J3DModel::calcBumpMtx()
{
if (mModelData->mBumpFlag != 1) {
return;
}
u16 count = mModelData->mMaterialTable.mMaterialNum;
for (u16 i = 0; i < count; i++) {
J3DMaterial* material = mModelData->mMaterialTable.mMaterials[i];
if (material->mTexGenBlock->getNBTScale()->_00 == 1) {
material->mShape->calcNBTScale(material->mTexGenBlock->getNBTScale()->_04,
mMtxBuffer->mNormMatrices[1][mMtxBuffer->mCurrentViewNumber],
mMtxBuffer->mBumpMatrices[1][i][mMtxBuffer->mCurrentViewNumber]);
DCStoreRange(mMtxBuffer->mBumpMatrices[1][i][mMtxBuffer->mCurrentViewNumber],
mModelData->mJointTree.mMtxData.mCount * sizeof(Mtx33));
if (getModelData()->checkBumpFlag() == 1) {
u32 bumpMtxIdx = 0;
u16 materialNum = getModelData()->getMaterialNum();
for (u16 i = 0; i < materialNum; i++) {
J3DMaterial* material = getModelData()->getMaterialNodePointer(i);
if (material->getNBTScale()->mbHasScale == 1) {
material->getShape()->calcNBTScale(*material->getNBTScale()->getScale(), getNrmMtxPtr(), getBumpMtxPtr(bumpMtxIdx));
DCStoreRange(getBumpMtxPtr(bumpMtxIdx), getModelData()->getDrawMtxNum() * 0x24);
bumpMtxIdx++;
}
}
}
/*
stwu r1, -0x30(r1)
mflr r0
@ -1342,6 +1239,19 @@ void J3DModel::calcBBoardMtx()
*/
void J3DModel::prepareShapePackets()
{
u16 shapeNum = getModelData()->getShapeNum();
for (u16 i = 0; i < shapeNum; i++) {
J3DShape* xx = mModelData->getShapeNodePointer(i);
J3DShapePacket* pkt = getShapePacket(i);
pkt->setMtxBuffer(mMtxBuffer);
if (getMtxCalcMode() == 2) {
pkt->setBaseMtxPtr(&mInternalView);
} else {
pkt->setBaseMtxPtr(&j3dSys.mViewMtx);
}
}
/*
lwz r6, 4(r3)
lis r4, j3dSys@ha
@ -1378,23 +1288,3 @@ lbl_800675BC:
blr
*/
}
/*
* --INFO--
* Address: 800675CC
* Size: 000064
* __dt__8J3DModelFv
*/
// J3DModel::~J3DModel()
// {
// }
/*
* --INFO--
* Address: 80067630
* Size: 000048
* __dt__12J3DMtxBufferFv
*/
// J3DMtxBuffer::~J3DMtxBuffer()
// {
// }

View File

@ -227,7 +227,7 @@ int J3DMtxBuffer::createBumpMtxArray(J3DModelData* data, u32 p2)
u16 v1 = 0;
for (u16 i = 0; i < materialCount; i++) {
J3DMaterial* material = data->mMaterialTable.mMaterials[i];
if (material->mTexGenBlock->getNBTScale()->_00 == 1) {
if (material->mTexGenBlock->getNBTScale()->mbHasScale == 1) {
bumpMtxCount += material->mShape->countBumpMtxNum();
v1++;
}
@ -242,7 +242,7 @@ int J3DMtxBuffer::createBumpMtxArray(J3DModelData* data, u32 p2)
int shapeCount = 0;
for (u16 matIndex = 0; matIndex < materialCount; matIndex++) {
J3DMaterial* material = data->mMaterialTable.mMaterials[matIndex];
if (material->mTexGenBlock->getNBTScale()->_00 == 1) {
if (material->mTexGenBlock->getNBTScale()->mbHasScale == 1) {
mBumpMatrices[i][shapeCount] = new Mtx33*[p2];
material->mShape->mBumpMtxOffset = shapeCount;
shapeCount += 1;
@ -254,7 +254,7 @@ int J3DMtxBuffer::createBumpMtxArray(J3DModelData* data, u32 p2)
int j = 0;
for (u16 matIndex = 0; matIndex < materialCount; matIndex++) {
J3DMaterial* material = data->mMaterialTable.mMaterials[matIndex];
if (material->mTexGenBlock->getNBTScale()->_00 == 1) {
if (material->mTexGenBlock->getNBTScale()->mbHasScale == 1) {
for (int k = 0; k < p2; k++) {
mBumpMatrices[i][j][k] = new (0x20) Mtx33[data->mJointTree.mMtxData.mCount];
}

View File

@ -106,7 +106,7 @@ void J3DShape::makeVtxArrayCmd()
else
stride[vtxAttr->mAttr - GX_VA_POS] = 0x06;
array[vtxAttr->mAttr - GX_VA_POS] = mVtxData->getVtxPosArray();
mVtxData->setVtxPosFrac(vtxAttr->mCount);
mVtxData->setVtxPosFrac(vtxAttr->mFrac);
mVtxData->setVtxPosType(vtxAttr->mType);
} break;
case GX_VA_NRM: {
@ -115,7 +115,7 @@ void J3DShape::makeVtxArrayCmd()
else
stride[vtxAttr->mAttr - GX_VA_POS] = 0x06;
array[vtxAttr->mAttr - GX_VA_POS] = mVtxData->getVtxNrmArray();
mVtxData->setVtxNrmFrac(vtxAttr->mCount);
mVtxData->setVtxNrmFrac(vtxAttr->mFrac);
mVtxData->setVtxNrmType(vtxAttr->mType);
} break;
case GX_VA_CLR0:
@ -160,241 +160,6 @@ void J3DShape::makeVtxArrayCmd()
else
GDSetArrayRaw((GXAttr)(i + GX_VA_POS), nullptr, stride[i]);
}
/*
stwu r1, -0x60(r1)
mflr r0
stw r0, 0x64(r1)
li r0, 0
stw r31, 0x5c(r1)
addi r31, r1, 0x14
stw r30, 0x58(r1)
addi r30, r1, 8
stw r29, 0x54(r1)
lwz r4, 0x4c(r3)
stb r0, 8(r1)
lwz r4, 0x14(r4)
stw r0, 0x14(r1)
stb r0, 9(r1)
stw r0, 0x18(r1)
stb r0, 0xa(r1)
stw r0, 0x1c(r1)
stb r0, 0xb(r1)
stw r0, 0x20(r1)
stb r0, 0xc(r1)
stw r0, 0x24(r1)
stb r0, 0xd(r1)
stw r0, 0x28(r1)
stb r0, 0xe(r1)
stw r0, 0x2c(r1)
stb r0, 0xf(r1)
stw r0, 0x30(r1)
stb r0, 0x10(r1)
stw r0, 0x34(r1)
stb r0, 0x11(r1)
stw r0, 0x38(r1)
stb r0, 0x12(r1)
stw r0, 0x3c(r1)
stb r0, 0x13(r1)
stw r0, 0x40(r1)
b lbl_80060CC0
lbl_80060B34:
cmpwi r6, 0xa
beq lbl_80060BC4
bge lbl_80060B4C
cmpwi r6, 9
bge lbl_80060B60
b lbl_80060CBC
lbl_80060B4C:
cmpwi r6, 0x15
bge lbl_80060CBC
cmpwi r6, 0xd
bge lbl_80060C64
b lbl_80060C28
lbl_80060B60:
lwz r0, 8(r4)
cmpwi r0, 4
bne lbl_80060B80
addi r5, r1, 8
addi r0, r6, -9
li r6, 0xc
stbx r6, r5, r0
b lbl_80060B90
lbl_80060B80:
addi r5, r1, 8
addi r0, r6, -9
li r6, 6
stbx r6, r5, r0
lbl_80060B90:
lwz r9, 0x4c(r3)
addi r7, r1, 0x14
lwz r5, 0(r4)
lwz r8, 0x18(r9)
lbz r0, 0xc(r4)
slwi r5, r5, 2
addi r6, r5, -36
stb r0, 0x4c(r9)
lwz r0, 8(r4)
lwz r5, 0x4c(r3)
stwx r8, r7, r6
stw r0, 0x50(r5)
b lbl_80060CBC
lbl_80060BC4:
lwz r0, 8(r4)
cmpwi r0, 4
bne lbl_80060BE4
addi r5, r1, 8
addi r0, r6, -9
li r6, 0xc
stbx r6, r5, r0
b lbl_80060BF4
lbl_80060BE4:
addi r5, r1, 8
addi r0, r6, -9
li r6, 6
stbx r6, r5, r0
lbl_80060BF4:
lwz r9, 0x4c(r3)
addi r7, r1, 0x14
lwz r5, 0(r4)
lwz r8, 0x1c(r9)
lbz r0, 0xc(r4)
slwi r5, r5, 2
addi r6, r5, -36
stb r0, 0x54(r9)
lwz r0, 8(r4)
lwz r5, 0x4c(r3)
stwx r8, r7, r6
stw r0, 0x58(r5)
b lbl_80060CBC
lbl_80060C28:
lwz r5, 0(r4)
addi r8, r6, -9
lwz r7, 0x4c(r3)
addi r9, r1, 8
addi r0, r5, -11
slwi r6, r5, 2
rlwinm r5, r0, 2, 0x16, 0x1d
li r10, 4
addi r0, r5, 0x24
stbx r10, r9, r8
lwzx r7, r7, r0
addi r5, r1, 0x14
addi r0, r6, -36
stwx r7, r5, r0
b lbl_80060CBC
lbl_80060C64:
lwz r0, 8(r4)
cmpwi r0, 4
bne lbl_80060C84
addi r5, r1, 8
addi r0, r6, -9
li r6, 8
stbx r6, r5, r0
b lbl_80060C94
lbl_80060C84:
addi r5, r1, 8
addi r0, r6, -9
li r6, 4
stbx r6, r5, r0
lbl_80060C94:
lwz r6, 0(r4)
addi r5, r1, 0x14
lwz r8, 0x4c(r3)
addi r0, r6, -13
slwi r6, r6, 2
rlwinm r7, r0, 2, 0x16, 0x1d
addi r7, r7, 0x2c
addi r0, r6, -36
lwzx r6, r8, r7
stwx r6, r5, r0
lbl_80060CBC:
addi r4, r4, 0x10
lbl_80060CC0:
lwz r6, 0(r4)
cmpwi r6, 0xff
bne lbl_80060B34
lwz r6, 0x30(r3)
li r0, 0
stb r0, 0x48(r3)
b lbl_80060D34
lbl_80060CDC:
cmpwi r4, 0x19
bne lbl_80060D14
lwz r0, 4(r6)
cmpwi r0, 0
beq lbl_80060D14
li r4, 1
lbz r0, 9(r1)
stb r4, 0x34(r3)
mulli r5, r0, 3
lwz r4, 0x4c(r3)
lwz r0, 0x20(r4)
stb r5, 9(r1)
stw r0, 0x18(r1)
b lbl_80060D30
lbl_80060D14:
cmpwi r4, 0
bne lbl_80060D30
lwz r0, 4(r6)
cmpwi r0, 0
beq lbl_80060D30
li r0, 1
stb r0, 0x48(r3)
lbl_80060D30:
addi r6, r6, 8
lbl_80060D34:
lwz r4, 0(r6)
cmpwi r4, 0xff
bne lbl_80060CDC
li r29, 0
lbl_80060D44:
lwz r4, 0(r31)
cmplwi r4, 0
beq lbl_80060D60
lbz r5, 0(r30)
addi r3, r29, 9
bl GDSetArray
b lbl_80060D70
lbl_80060D60:
lbz r5, 0(r30)
addi r3, r29, 9
li r4, 0
bl GDSetArrayRaw
lbl_80060D70:
addi r29, r29, 1
addi r30, r30, 1
cmplwi r29, 0xc
addi r31, r31, 4
blt lbl_80060D44
lwz r0, 0x64(r1)
lwz r31, 0x5c(r1)
lwz r30, 0x58(r1)
lwz r29, 0x54(r1)
mtlr r0
addi r1, r1, 0x60
blr
*/
}
/*
@ -424,50 +189,6 @@ void J3DShape::makeVcdVatCmd()
__GDSetCurrent(nullptr);
OSEnableScheduler();
OSRestoreInterrupts(sInterruptFlag);
/*
stwu r1, -0x20(r1)
mflr r0
stw r0, 0x24(r1)
stw r31, 0x1c(r1)
mr r31, r3
lbz r0, init$1729@sda21(r13)
extsb. r0, r0
bne lbl_80060DD0
bl OSDisableInterrupts
li r0, 1
stw r3, sInterruptFlag$1728@sda21(r13)
stb r0, init$1729@sda21(r13)
lbl_80060DD0:
bl OSDisableScheduler
lwz r4, 0x2c(r31)
addi r3, r1, 8
li r5, 0xc0
bl GDInitGDLObj
addi r0, r1, 8
stw r0, __GDCurrentDL@sda21(r13)
lwz r3, 0x30(r31)
bl GDSetVtxDescv
mr r3, r31
bl makeVtxArrayCmd__8J3DShapeFv
lwz r4, 0x4c(r31)
li r3, 0
lbz r5, 0x34(r31)
lwz r4, 0x14(r4)
bl J3DGDSetVtxAttrFmtv__F9_GXVtxFmtPC17_GXVtxAttrFmtListb
bl GDPadCurr32
bl GDFlushCurrToMem
li r0, 0
stw r0, __GDCurrentDL@sda21(r13)
bl OSEnableScheduler
lwz r3, sInterruptFlag$1728@sda21(r13)
bl OSRestoreInterrupts
lwz r0, 0x24(r1)
lwz r31, 0x1c(r1)
mtlr r0
addi r1, r1, 0x20
blr
*/
}
/*

View File

@ -416,7 +416,7 @@ void J3DDifferedTexMtx::loadExecute(const float (*p1)[4])
} else {
for (u16 i = 0; i < tmo->mUserArea; i++) {
J3DTexMtx* blockTexMtx = block->getTexMtx(i);
switch (blockTexMtx->mFlags & 0x3F) {
switch (blockTexMtx->mTexMtxInfo.mInfo & 0x3F) {
case 3:
case 9:
PSMTXConcat(tmo->mBaseMtxPtr[i], p1, v88);
@ -441,10 +441,10 @@ void J3DDifferedTexMtx::loadExecute(const float (*p1)[4])
break;
case 5: {
Mtx v216;
if ((blockTexMtx->mFlags & 0x80) == 0) {
J3DGetTextureMtxOld(blockTexMtx->mSrtInfo, blockTexMtx->_04, v216);
} else if ((blockTexMtx->mFlags & 0x80) == 1) {
J3DGetTextureMtxMayaOld(blockTexMtx->mSrtInfo, v216);
if ((blockTexMtx->mTexMtxInfo.mInfo & 0x80) == 0) {
J3DGetTextureMtxOld(blockTexMtx->mTexMtxInfo.mSRT, blockTexMtx->mTexMtxInfo.mCenter, v216);
} else if ((blockTexMtx->mTexMtxInfo.mInfo & 0x80) == 1) {
J3DGetTextureMtxMayaOld(blockTexMtx->mTexMtxInfo.mSRT, v216);
}
J3DMtxProjConcat(v216, tmo->mBaseMtxPtr[i * 2], v88);
Mtx v152;
@ -459,10 +459,10 @@ void J3DDifferedTexMtx::loadExecute(const float (*p1)[4])
}
case 11: {
Mtx v216;
if ((blockTexMtx->mFlags & 0x80) == 0) {
J3DGetTextureMtx(blockTexMtx->mSrtInfo, blockTexMtx->_04, v216);
} else if ((blockTexMtx->mFlags & 0x80) == 1) {
J3DGetTextureMtxMaya(blockTexMtx->mSrtInfo, v216);
if ((blockTexMtx->mTexMtxInfo.mInfo & 0x80) == 0) {
J3DGetTextureMtx(blockTexMtx->mTexMtxInfo.mSRT, blockTexMtx->mTexMtxInfo.mCenter, v216);
} else if ((blockTexMtx->mTexMtxInfo.mInfo & 0x80) == 1) {
J3DGetTextureMtxMaya(blockTexMtx->mTexMtxInfo.mSRT, v216);
}
PSMTXConcat(v216, qMtx, v216);
J3DMtxProjConcat(v216, tmo->mBaseMtxPtr[i * 2], v88);
@ -478,10 +478,10 @@ void J3DDifferedTexMtx::loadExecute(const float (*p1)[4])
}
case 10: {
Mtx v216;
if ((blockTexMtx->mFlags & 0x80) == 0) {
J3DGetTextureMtx(blockTexMtx->mSrtInfo, blockTexMtx->_04, v216);
} else if ((blockTexMtx->mFlags & 0x80) == 1) {
J3DGetTextureMtxMaya(blockTexMtx->mSrtInfo, v216);
if ((blockTexMtx->mTexMtxInfo.mInfo & 0x80) == 0) {
J3DGetTextureMtx(blockTexMtx->mTexMtxInfo.mSRT, blockTexMtx->mTexMtxInfo.mCenter, v216);
} else if ((blockTexMtx->mTexMtxInfo.mInfo & 0x80) == 1) {
J3DGetTextureMtxMaya(blockTexMtx->mTexMtxInfo.mSRT, v216);
}
PSMTXConcat(v216, qMtx2, v216);
J3DMtxProjConcat(v216, tmo->mBaseMtxPtr[i * 2], v88);
@ -501,7 +501,7 @@ void J3DDifferedTexMtx::loadExecute(const float (*p1)[4])
mtxToLoad = tmo->mBaseMtxPtr + i;
break;
}
GXLoadTexMtxImm(*mtxToLoad, i * 3 + 30, (GXTexMtxType)blockTexMtx->_00);
GXLoadTexMtxImm(*mtxToLoad, i * 3 + 30, (GXTexMtxType)blockTexMtx->mTexMtxInfo.mProjection);
}
}
/*

View File

@ -8,7 +8,7 @@ J3DSys j3dSys;
Mtx J3DSys::mCurrentMtx;
Vec J3DSys::mCurrentS;
Vec J3DSys::mParentS;
u16 J3DSys::sTexCoordScaleTable[8][4];
J3DTexCoordScaleInfo J3DSys::sTexCoordScaleTable[8];
static GXColor ColorBlack = { 0x00, 0x00, 0x00, 0x00 };
static GXColor ColorWhite = { 0xFF, 0xFF, 0xFF, 0xFF };
@ -47,10 +47,10 @@ J3DSys::J3DSys()
mVtxColor = nullptr;
for (u32 i = 0; i < 8; i++) {
sTexCoordScaleTable[i][0] = 1;
sTexCoordScaleTable[i][1] = 1;
sTexCoordScaleTable[i][2] = 0;
sTexCoordScaleTable[i][3] = 0;
sTexCoordScaleTable[i]._00 = 1;
sTexCoordScaleTable[i]._02 = 1;
sTexCoordScaleTable[i]._04 = 0;
sTexCoordScaleTable[i]._06 = 0;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ JUTTexture::JUTTexture(int sizeX, int sizeY, GXTexFmt textureFormat)
img->mWrapS = GX_CLAMP;
img->mWrapT = GX_CLAMP;
img->mPaletteFormat = 0;
img->mLutFormat = GX_TL_IA8;
img->mColorFormat = GX_TL_IA8;
img->mPaletteEntryCount = 0;
img->mPaletteOffset = 0;
img->mIsMIPmapEnabled = GX_FALSE;
@ -96,11 +96,11 @@ void JUTTexture::storeTIMG(const ResTIMG* img, u8 lutID)
}
if (!mEmbPalette || !(mFlags & TEXFLAG_Unk2)) {
mEmbPalette = new JUTPalette(tlut, (GXTlutFmt)mTexInfo->mLutFormat, (JUTTransparency)mTexInfo->mTransparency,
mEmbPalette = new JUTPalette(tlut, (GXTlutFmt)mTexInfo->mColorFormat, (JUTTransparency)mTexInfo->mTransparency,
mTexInfo->mPaletteEntryCount, (void*)((u32)mTexInfo + mTexInfo->mPaletteOffset));
mFlags = (mFlags & TEXFLAG_Unk1) | TEXFLAG_Unk2;
} else {
mEmbPalette->storeTLUT(tlut, (GXTlutFmt)mTexInfo->mLutFormat, (JUTTransparency)mTexInfo->mTransparency,
mEmbPalette->storeTLUT(tlut, (GXTlutFmt)mTexInfo->mColorFormat, (JUTTransparency)mTexInfo->mTransparency,
mTexInfo->mPaletteEntryCount, (void*)((u32)mTexInfo + mTexInfo->mPaletteOffset));
}

View File

@ -196,20 +196,20 @@ void AABBWaterBox::doEntry()
Mtx copyMatrix;
PSMTXIdentity(copyMatrix);
J3DTexMtx* texMtx = mModel->mJ3dModel->mModelData->mMaterialTable.mMaterials[0]->mTexGenBlock->getTexMtx(3); // good lord
texMtx->_24[0][0] = copyMatrix[0][0];
texMtx->_24[0][1] = copyMatrix[0][1];
texMtx->_24[0][2] = copyMatrix[0][2];
texMtx->_24[0][3] = copyMatrix[0][3];
texMtx->_24[1][0] = copyMatrix[1][0];
texMtx->_24[1][1] = copyMatrix[1][1];
texMtx->_24[1][2] = copyMatrix[1][2];
texMtx->_24[1][3] = copyMatrix[1][3];
texMtx->_24[2][0] = copyMatrix[2][0];
texMtx->_24[2][1] = copyMatrix[2][1];
texMtx->_24[2][2] = copyMatrix[2][2];
texMtx->_24[2][3] = copyMatrix[2][3];
texMtx->_24[3][0] = texMtx->_24[3][1] = texMtx->_24[3][2] = 0.0f;
texMtx->_24[3][3] = 1.0f;
texMtx->mTexMtxInfo.mEffectMtx[0][0] = copyMatrix[0][0];
texMtx->mTexMtxInfo.mEffectMtx[0][1] = copyMatrix[0][1];
texMtx->mTexMtxInfo.mEffectMtx[0][2] = copyMatrix[0][2];
texMtx->mTexMtxInfo.mEffectMtx[0][3] = copyMatrix[0][3];
texMtx->mTexMtxInfo.mEffectMtx[1][0] = copyMatrix[1][0];
texMtx->mTexMtxInfo.mEffectMtx[1][1] = copyMatrix[1][1];
texMtx->mTexMtxInfo.mEffectMtx[1][2] = copyMatrix[1][2];
texMtx->mTexMtxInfo.mEffectMtx[1][3] = copyMatrix[1][3];
texMtx->mTexMtxInfo.mEffectMtx[2][0] = copyMatrix[2][0];
texMtx->mTexMtxInfo.mEffectMtx[2][1] = copyMatrix[2][1];
texMtx->mTexMtxInfo.mEffectMtx[2][2] = copyMatrix[2][2];
texMtx->mTexMtxInfo.mEffectMtx[2][3] = copyMatrix[2][3];
texMtx->mTexMtxInfo.mEffectMtx[3][0] = texMtx->mTexMtxInfo.mEffectMtx[3][1] = texMtx->mTexMtxInfo.mEffectMtx[3][2] = 0.0f;
texMtx->mTexMtxInfo.mEffectMtx[3][3] = 1.0f;
u16 id = getFbTexIndex();
J3DTexture* texData = getFbTexture();
@ -246,20 +246,20 @@ void AABBWaterBox::doEntry()
if (mFbTexture) {
J3DTexMtx* texMtx = mModel->mJ3dModel->mModelData->mMaterialTable.mMaterials[0]->mTexGenBlock->getTexMtx(3); // good lord x2
texMtx->_24[0][0] = copyMatrix[0][0];
texMtx->_24[0][1] = copyMatrix[0][1];
texMtx->_24[0][2] = copyMatrix[0][2];
texMtx->_24[0][3] = copyMatrix[0][3];
texMtx->_24[1][0] = copyMatrix[1][0];
texMtx->_24[1][1] = copyMatrix[1][1];
texMtx->_24[1][2] = copyMatrix[1][2];
texMtx->_24[1][3] = copyMatrix[1][3];
texMtx->_24[2][0] = copyMatrix[2][0];
texMtx->_24[2][1] = copyMatrix[2][1];
texMtx->_24[2][2] = copyMatrix[2][2];
texMtx->_24[2][3] = copyMatrix[2][3];
texMtx->_24[3][0] = texMtx->_24[3][1] = texMtx->_24[3][2] = 0.0f;
texMtx->_24[3][3] = 1.0f;
texMtx->mTexMtxInfo.mEffectMtx[0][0] = copyMatrix[0][0];
texMtx->mTexMtxInfo.mEffectMtx[0][1] = copyMatrix[0][1];
texMtx->mTexMtxInfo.mEffectMtx[0][2] = copyMatrix[0][2];
texMtx->mTexMtxInfo.mEffectMtx[0][3] = copyMatrix[0][3];
texMtx->mTexMtxInfo.mEffectMtx[1][0] = copyMatrix[1][0];
texMtx->mTexMtxInfo.mEffectMtx[1][1] = copyMatrix[1][1];
texMtx->mTexMtxInfo.mEffectMtx[1][2] = copyMatrix[1][2];
texMtx->mTexMtxInfo.mEffectMtx[1][3] = copyMatrix[1][3];
texMtx->mTexMtxInfo.mEffectMtx[2][0] = copyMatrix[2][0];
texMtx->mTexMtxInfo.mEffectMtx[2][1] = copyMatrix[2][1];
texMtx->mTexMtxInfo.mEffectMtx[2][2] = copyMatrix[2][2];
texMtx->mTexMtxInfo.mEffectMtx[2][3] = copyMatrix[2][3];
texMtx->mTexMtxInfo.mEffectMtx[3][0] = texMtx->mTexMtxInfo.mEffectMtx[3][1] = texMtx->mTexMtxInfo.mEffectMtx[3][2] = 0.0f;
texMtx->mTexMtxInfo.mEffectMtx[3][3] = 1.0f;
u16 id = getFbTexIndex();
J3DTexture* texData = getFbTexture();

View File

@ -243,21 +243,21 @@ void Object::changeMaterial()
mModel->mJ3dModel->calcMaterial();
J3DTexMtx* texMtx = mFbMaterial->mTexGenBlock->getTexMtx(1);
texMtx->_24[0][0] = copyMatrix[0][0];
texMtx->_24[0][1] = copyMatrix[0][1];
texMtx->_24[0][2] = copyMatrix[0][2];
texMtx->_24[0][3] = copyMatrix[0][3];
texMtx->_24[1][0] = copyMatrix[1][0];
texMtx->_24[1][1] = copyMatrix[1][1];
texMtx->_24[1][2] = copyMatrix[1][2];
texMtx->_24[1][3] = copyMatrix[1][3];
texMtx->_24[2][0] = copyMatrix[2][0];
texMtx->_24[2][1] = copyMatrix[2][1];
texMtx->_24[2][2] = copyMatrix[2][2];
texMtx->_24[2][3] = copyMatrix[2][3];
texMtx->_24[3][0] = texMtx->_24[3][1] = texMtx->_24[3][2] = 0.0f;
texMtx->_24[3][3] = 1.0f;
J3DTexMtx* texMtx = mFbMaterial->mTexGenBlock->getTexMtx(1);
texMtx->mTexMtxInfo.mEffectMtx[0][0] = copyMatrix[0][0];
texMtx->mTexMtxInfo.mEffectMtx[0][1] = copyMatrix[0][1];
texMtx->mTexMtxInfo.mEffectMtx[0][2] = copyMatrix[0][2];
texMtx->mTexMtxInfo.mEffectMtx[0][3] = copyMatrix[0][3];
texMtx->mTexMtxInfo.mEffectMtx[1][0] = copyMatrix[1][0];
texMtx->mTexMtxInfo.mEffectMtx[1][1] = copyMatrix[1][1];
texMtx->mTexMtxInfo.mEffectMtx[1][2] = copyMatrix[1][2];
texMtx->mTexMtxInfo.mEffectMtx[1][3] = copyMatrix[1][3];
texMtx->mTexMtxInfo.mEffectMtx[2][0] = copyMatrix[2][0];
texMtx->mTexMtxInfo.mEffectMtx[2][1] = copyMatrix[2][1];
texMtx->mTexMtxInfo.mEffectMtx[2][2] = copyMatrix[2][2];
texMtx->mTexMtxInfo.mEffectMtx[2][3] = copyMatrix[2][3];
texMtx->mTexMtxInfo.mEffectMtx[3][0] = texMtx->mTexMtxInfo.mEffectMtx[3][1] = texMtx->mTexMtxInfo.mEffectMtx[3][2] = 0.0f;
texMtx->mTexMtxInfo.mEffectMtx[3][3] = 1.0f;
u16 id = mFbTextureID;
const ResTIMG* xfb = gameSystem->getXfbTexture()->getTexInfo();