Skip to content

Commit

Permalink
J3DMatBlock, J3DMaterialFactory work (#2233)
Browse files Browse the repository at this point in the history
  • Loading branch information
randomsalience authored Nov 1, 2024
1 parent 09423b6 commit 21cb606
Show file tree
Hide file tree
Showing 17 changed files with 891 additions and 5,273 deletions.
846 changes: 423 additions & 423 deletions include/JSystem/J3DGraphBase/J3DMatBlock.h

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions include/JSystem/J3DGraphBase/J3DMaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class J3DMaterial {
*/
class J3DPatchedMaterial : public J3DMaterial {
public:
J3DPatchedMaterial() { initialize(); }
/* 80316FB8 */ void initialize();

/* 80316FD8 */ virtual void makeDisplayList();
Expand Down
4 changes: 2 additions & 2 deletions include/JSystem/J3DGraphBase/J3DShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class J3DCurrentMtx : public J3DCurrentMtxInfo {
}

void setCurrentTexMtx(u8 param_1, u8 param_2, u8 param_3, u8 param_4,
u8 param_5, u8 param_6, u8 param_7, u8 param_8) {
mMtxIdxRegA = ((param_1 & 0xff) << 6) | (param_2 << 0xc)| (param_3 << 0x12) | (param_4 << 0x18);
u8 param_5, u8 param_6, u8 param_7, u8 param_8) {
mMtxIdxRegA = (param_1 << 6) | (param_2 << 0xc) | (param_3 << 0x12) | (param_4 << 0x18);
mMtxIdxRegB = (param_5) | param_6 << 6 | param_7 << 0xc | param_8 << 0x12;
}
};
Expand Down
4 changes: 2 additions & 2 deletions include/JSystem/J3DGraphBase/J3DShapeMtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class J3DShapeMtx {
/* 80313BF0 */ virtual void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);

static J3DShapeMtx_LoadFunc sMtxLoadPipeline[4];
static u16 sMtxLoadCache[10 + 2 /* padding */];
static u16 sMtxLoadCache[10];
static u32 sCurrentPipeline;
static u8* sCurrentScaleFlag;
static u8 sNBTFlag;
Expand Down Expand Up @@ -190,4 +190,4 @@ class J3DShapeMtxMultiConcatView : public J3DShapeMtxConcatView {
/* 0xC */ u16* mUseMtxIndexTable;
};

#endif /* J3DSHAPEMTX_H */
#endif /* J3DSHAPEMTX_H */
1 change: 1 addition & 0 deletions include/JSystem/J3DGraphBase/J3DTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct J3DTexCoord : public J3DTexCoordInfo {
u8 getTexGenMtx() { return mTexGenMtx & 0xff; }
u16 getTexMtxReg() { return mTexMtxReg & 0xff; }
void setTexGenMtx(u8 param_1) { mTexGenMtx = param_1; }
void setTexMtxReg(u16 reg) { mTexMtxReg = reg; }
J3DTexCoord& operator=(const J3DTexCoord& other) {
// Fake match (__memcpy or = doesn't match)
*(u32*)this = *(u32*)&other;
Expand Down
4 changes: 2 additions & 2 deletions include/JSystem/J3DGraphLoader/J3DMaterialFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ class J3DMaterialFactory {
u16 getMaterialID(int idx) const { return mpMaterialID[idx]; }
u8 getMaterialMode(int idx) const { return mpMaterialInitData[mpMaterialID[idx]].mMaterialMode; }

static u32 getMdlDataFlag_TevStageNum(u32 flags) { return (flags >> 0x10) & 0x1f; }
static u32 getMdlDataFlag_TexGenFlag(u32 flags) { return flags & 0x0c000000; }
static int getMdlDataFlag_TevStageNum(u32 flags) { return (flags >> 0x10) & 0x1f; }
static int getMdlDataFlag_TexGenFlag(u32 flags) { return flags & 0x0c000000; }
static u32 getMdlDataFlag_ColorFlag(u32 flags) { return flags & 0xc0000000; }
static u32 getMdlDataFlag_PEFlag(u32 flags) { return flags & 0x30000000; }

Expand Down
6 changes: 6 additions & 0 deletions include/JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ class J3DMaterialFactory_v21 {
/* 80334074 */ J3DNBTScale newNBTScale(int) const;

u16 getMaterialID(u16 idx) { return mpMaterialID[idx]; }
u8 getMaterialMode(int idx) const { return mpMaterialInitData[mpMaterialID[idx]].mMaterialMode; }

static int getMdlDataFlag_TevStageNum(u32 flags) { return (flags >> 0x10) & 0x1f; }
static int getMdlDataFlag_TexGenFlag(u32 flags) { return flags & 0x0c000000; }
static u32 getMdlDataFlag_ColorFlag(u32 flags) { return flags & 0xc0000000; }
static u32 getMdlDataFlag_PEFlag(u32 flags) { return flags & 0x30000000; }

/* 0x00 */ u16 mMaterialNum;
/* 0x04 */ J3DMaterialInitData_v21* mpMaterialInitData;
Expand Down
3,487 changes: 193 additions & 3,294 deletions src/JSystem/J3DGraphBase/J3DMatBlock.cpp

Large diffs are not rendered by default.

Loading

0 comments on commit 21cb606

Please sign in to comment.