some J3D/misc cleanup (#2628)

* some j3d cleanup

* begin using uintptr_t

* j3dgraphbase cleanup

* j3dgraphanimator cleanup
This commit is contained in:
TakaRikka
2025-09-04 17:56:59 +03:00
committed by GitHub
parent ee8b843996
commit b45a089e15
290 changed files with 4221 additions and 3605 deletions
+3 -3
View File
@@ -22251,9 +22251,9 @@ sMtxPtrTbl__21J3DShapeMtxConcatView = .sbss:0x804515B8; // type:object size:0x8
sTexGenBlock__17J3DDifferedTexMtx = .sbss:0x804515C0; // type:object size:0x4 scope:global align:4 data:4byte
sTexMtxObj__17J3DDifferedTexMtx = .sbss:0x804515C4; // type:object size:0x4 scope:global align:4 data:4byte
sInterruptFlag$903 = .sbss:0x804515C8; // type:object size:0x4 scope:local align:4 data:4byte
sInitInterruptFlag = .sbss:0x804515CC; // type:object size:0x1 scope:local align:1 data:byte
init$465 = .sbss:0x804515CC; // type:object size:0x1 scope:local align:1 data:byte
sOldVcdVatCmd__8J3DShape = .sbss:0x804515D0; // type:object size:0x4 scope:global align:4 data:4byte
data_804515D4 = .sbss:0x804515D4; // type:object size:0x4 scope:local align:4 data:byte
sEnvelopeFlag__8J3DShape = .sbss:0x804515D4; // type:object size:0x4 scope:local align:4 data:byte
SizeOfJ3DColorBlockLightOffLoad = .sbss:0x804515D8; // type:object size:0x4 scope:global align:4 data:4byte
SizeOfJ3DColorBlockAmbientOnLoad = .sbss:0x804515DC; // type:object size:0x4 scope:global align:4 data:4byte
entryNum__13J3DDrawBuffer = .sbss:0x804515E0; // type:object size:0x4 scope:global align:4 data:4byte
@@ -26427,7 +26427,7 @@ j2dDefaultAlphaCmp = .sdata2:0x804561AE; // type:object size:0x2 scope:global al
@1171 = .sdata2:0x804563B8; // type:object size:0x8 scope:local align:8 data:double
j3dDefaultColInfo = .sdata2:0x804563C0; // type:object size:0x4 scope:global align:4 data:4byte
j3dDefaultAmbInfo = .sdata2:0x804563C4; // type:object size:0x4 scope:global align:4 data:4byte
data_804563C8 = .sdata2:0x804563C8; // type:object size:0x1 scope:global align:1 data:byte
j3dDefaultNumChans = .sdata2:0x804563C8; // type:object size:0x1 scope:global align:1 data:byte
j3dDefaultTevOrderInfoNull = .sdata2:0x804563CC; // type:object size:0x4 scope:global align:4 data:4byte
j3dDefaultIndTexOrderNull = .sdata2:0x804563D0; // type:object size:0x4 scope:global align:4 data:4byte
j3dDefaultTevColor = .sdata2:0x804563D4; // type:object size:0x8 scope:global align:4 data:4byte
+4 -4
View File
@@ -56,10 +56,10 @@ class J2DAnmVtxColor : public J2DAnmBase {
public:
J2DAnmVtxColor() {
mKind = KIND_VTX_COLOR;
for (s32 i = 0; i < ARRAY_SIZE(mAnmTableNum); i++) {
for (s32 i = 0; i < ARRAY_SIZEU(mAnmTableNum); i++) {
mAnmTableNum[i] = NULL;
}
for (s32 i = 0; i < ARRAY_SIZE(mVtxColorIndexData); i++) {
for (s32 i = 0; i < ARRAY_SIZEU(mVtxColorIndexData); i++) {
mVtxColorIndexData[i] = NULL;
}
}
@@ -88,7 +88,7 @@ struct J3DTextureSRTInfo;
class J2DAnmVtxColorKey : public J2DAnmVtxColor {
public:
J2DAnmVtxColorKey() {
for (s32 i = 0; i < ARRAY_SIZE(mInfoTable); i++) {
for (s32 i = 0; i < ARRAY_SIZEU(mInfoTable); i++) {
mInfoTable[i] = NULL;
}
}
@@ -109,7 +109,7 @@ public:
class J2DAnmVtxColorFull : public J2DAnmVtxColor {
public:
J2DAnmVtxColorFull() {
for (s32 i = 0; i < ARRAY_SIZE(mInfoTable); i++) {
for (s32 i = 0; i < ARRAY_SIZEU(mInfoTable); i++) {
mInfoTable[i] = NULL;
}
}
+11
View File
@@ -0,0 +1,11 @@
#ifndef J3DASSERT_H
#define J3DASSERT_H
#include "JSystem/JUtility/JUTAssert.h"
#define J3D_ASSERT_NULLPTR(LINE, COND) JUT_ASSERT_MSG(LINE, (COND) != 0, "Error : null pointer.")
#define J3D_ASSERT_RANGE(LINE, COND) JUT_ASSERT_MSG(LINE, (COND) != 0, "Error : range over.")
#define J3D_ASSERT_NONZEROARG(LINE, COND) JUT_ASSERT_MSG(LINE, (COND) != 0, "Error : non-zero argument is specified 0.")
#define J3D_ASSERT_ALLOCMEM(LINE, COND) JUT_ASSERT_MSG(LINE, (COND) != 0, "Error : allocate memory.")
#endif /* J3DASSERT_H */
+34 -30
View File
@@ -476,10 +476,10 @@ public:
mFrame = 0.0f;
}
J3DAnmBase(s16 i_frameMax) {
J3DAnmBase(s16 frameMax) {
mAttribute = 0;
field_0x5 = 0;
mFrameMax = i_frameMax;
mFrameMax = frameMax;
mFrame = 0.0f;
}
@@ -515,7 +515,7 @@ public:
/* 0x18 */ s16 field_0x18;
/* 0x1A */ s16 field_0x1a;
/* 0x1C */ u16 field_0x1c;
/* 0x1E */ s16 field_0x1e;
/* 0x1E */ u16 field_0x1e;
}; // Size: 0x20
/**
@@ -533,8 +533,8 @@ public:
/* 8003B8D0 */ virtual ~J3DAnmTransformKey() {}
/* 8003C800 */ virtual s32 getKind() const { return 8; }
/* 8003C808 */ virtual void getTransform(u16 param_0, J3DTransformInfo* param_1) const {
calcTransform(mFrame, param_0, param_1);
/* 8003C808 */ virtual void getTransform(u16 jointNo, J3DTransformInfo* pTransform) const {
calcTransform(mFrame, jointNo, pTransform);
}
/* 0x20 */ int mDecShift;
@@ -585,25 +585,25 @@ public:
/* 8032C198 */ virtual ~J3DAnmTextureSRTKey() {}
/* 8032C220 */ virtual s32 getKind() const { return 4; }
void getTransform(u16 param_0, J3DTextureSRTInfo* pSRTInfo) const {
calcTransform(getFrame(), param_0, pSRTInfo);
void getTransform(u16 jointNo, J3DTextureSRTInfo* pSRTInfo) const {
calcTransform(getFrame(), jointNo, pSRTInfo);
}
u16 getUpdateMaterialID(u16 idx) const {
J3D_ASSERT(1029, idx < mTrackNum / 3, "Error : range over.");
J3D_ASSERT_RANGE(1029, idx < mTrackNum / 3);
return mUpdateMaterialID[idx];
}
u16 getUpdateMaterialNum() const { return mTrackNum / 3; }
u16 getPostUpdateMaterialNum() const { return field_0x4a / 3; }
int getUpdateTexMtxID(u16 idx) const {
J3D_ASSERT(1017, idx < mTrackNum / 3, "Error : range over.");
J3D_ASSERT_RANGE(1017, idx < mTrackNum / 3);
return mUpdateTexMtxID[idx];
}
bool isValidUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx] != 0xffff; }
u32 getTexMtxCalcType() { return mTexMtxCalcType; }
Vec* getSRTCenter(u16 idx) {
J3D_ASSERT(1047, idx < mTrackNum / 3, "Error : range over.");
J3D_ASSERT_RANGE(1047, idx < mTrackNum / 3);
return &mSRTCenter[idx];
}
@@ -650,7 +650,7 @@ public:
/* 8032BD94 */ virtual s32 getKind() const { return 2; }
u16 getUpdateMaterialID(u16 idx) const {
J3D_ASSERT(2288, idx < mUpdateMaterialNum, "Error : range over.");
J3D_ASSERT_RANGE(2288, idx < mUpdateMaterialNum);
return mUpdateMaterialID[idx];
}
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
@@ -684,19 +684,19 @@ public:
u16 getKRegUpdateMaterialNum() const { return mKRegUpdateMaterialNum; }
u16 getCRegUpdateMaterialID(u16 idx) const {
J3D_ASSERT(2100, idx < mCRegUpdateMaterialNum, "Error : range over.");
J3D_ASSERT_RANGE(2100, idx < mCRegUpdateMaterialNum);
return mCRegUpdateMaterialID[idx];
}
u16 getKRegUpdateMaterialID(u16 idx) const {
J3D_ASSERT(2140, idx < mKRegUpdateMaterialNum, "Error : range over.");
J3D_ASSERT_RANGE(2140, idx < mKRegUpdateMaterialNum);
return mKRegUpdateMaterialID[idx];
}
const J3DAnmCRegKeyTable* getAnmCRegKeyTable() const { return mAnmCRegKeyTable; }
const J3DAnmKRegKeyTable* getAnmKRegKeyTable() const { return mAnmKRegKeyTable; }
const J3DAnmCRegKeyTable* getAnmCRegKeyTable() { return mAnmCRegKeyTable; }
const J3DAnmKRegKeyTable* getAnmKRegKeyTable() { return mAnmKRegKeyTable; }
bool isValidCRegUpdateMaterialID(u16 idx) { return mCRegUpdateMaterialID[idx] != 0xffff; }
bool isValidKRegUpdateMaterialID(u16 idx) { return mKRegUpdateMaterialID[idx] != 0xffff; }
bool isValidCRegUpdateMaterialID(u16 idx) const { return mCRegUpdateMaterialID[idx] != 0xffff; }
bool isValidKRegUpdateMaterialID(u16 idx) const { return mKRegUpdateMaterialID[idx] != 0xffff; }
/* 0x0C */ u16 mCRegUpdateMaterialNum;
/* 0x0E */ u16 mKRegUpdateMaterialNum;
@@ -740,7 +740,7 @@ public:
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
bool isValidUpdateMaterialID(u16 id) const { return mUpdateMaterialID[id] != 0xFFFF; }
u16 getUpdateMaterialID(u16 idx) const {
J3D_ASSERT(1578, idx < mUpdateMaterialNum, "Error : range over.");
J3D_ASSERT_RANGE(1578, idx < mUpdateMaterialNum);
return mUpdateMaterialID[idx];
}
@@ -851,7 +851,7 @@ public:
*/
class J3DAnmCluster : public J3DAnmBase {
public:
J3DAnmCluster(s16 param_1, f32* param_2) : J3DAnmBase(param_1) { mWeight = param_2; }
J3DAnmCluster(s16 frameMax, f32* pWeight) : J3DAnmBase(frameMax) { mWeight = pWeight; }
/* 8032BCAC */ virtual ~J3DAnmCluster() {}
/* 8032BF44 */ virtual s32 getKind() const { return 3; }
@@ -866,7 +866,7 @@ public:
*/
class J3DAnmClusterFull : public J3DAnmCluster {
public:
J3DAnmClusterFull() : J3DAnmCluster(0, 0) { mAnmTable = NULL; }
J3DAnmClusterFull() : J3DAnmCluster(0, NULL) { mAnmTable = NULL; }
/* 8032BCAC */ virtual ~J3DAnmClusterFull() {}
/* 8032BF44 */ virtual s32 getKind() const { return 12; }
@@ -965,10 +965,10 @@ public:
}; // Size: 0x14
struct J3DMtxCalcAnmBase: public J3DMtxCalc {
J3DMtxCalcAnmBase(J3DAnmTransform* param_0) { mAnmTransform = param_0; }
J3DMtxCalcAnmBase(J3DAnmTransform* pAnmTransform) { mAnmTransform = pAnmTransform; }
/* 8000D8EC */ ~J3DMtxCalcAnmBase() {}
/* 80014FB8 */ J3DAnmTransform* getAnmTransform() { return mAnmTransform; }
/* 80014FC0 */ void setAnmTransform(J3DAnmTransform* param_0) { mAnmTransform = param_0; }
/* 80014FC0 */ void setAnmTransform(J3DAnmTransform* pAnmTransform) { mAnmTransform = pAnmTransform; }
J3DAnmTransform* mAnmTransform;
};
@@ -980,29 +980,33 @@ struct J3DMtxCalcAnimationAdaptorBase {
template <typename A0>
struct J3DMtxCalcAnimationAdaptorDefault : public J3DMtxCalcAnimationAdaptorBase {
J3DMtxCalcAnimationAdaptorDefault(J3DAnmTransform* param_0) {}
void calc(J3DMtxCalcAnmBase* param_0) {
J3DMtxCalcAnimationAdaptorDefault(J3DAnmTransform* pAnmTransform) {}
void calc(J3DMtxCalcAnmBase* pMtxCalc) {
J3DTransformInfo transform;
J3DTransformInfo* transform_p;
if (param_0->getAnmTransform() != NULL) {
if (pMtxCalc->getAnmTransform() != NULL) {
u16 jnt_no = J3DMtxCalc::getJoint()->getJntNo();
param_0->getAnmTransform()->getTransform(jnt_no, &transform);
pMtxCalc->getAnmTransform()->getTransform(jnt_no, &transform);
transform_p = &transform;
} else {
transform_p = &J3DMtxCalc::getJoint()->getTransformInfo();
}
A0::calcTransform(*transform_p);
}
};
template <typename A0, typename B0>
struct J3DMtxCalcAnimation : public J3DMtxCalcAnmBase {
J3DMtxCalcAnimation(J3DAnmTransform* param_0) : J3DMtxCalcAnmBase(param_0), field_0x8(param_0) {}
J3DMtxCalcAnimation(J3DAnmTransform* pAnmTransform) : J3DMtxCalcAnmBase(pAnmTransform), field_0x8(pAnmTransform) {}
~J3DMtxCalcAnimation() {}
void setAnmTransform(J3DAnmTransform* param_0) {
mAnmTransform = param_0;
field_0x8.change(param_0);
void setAnmTransform(J3DAnmTransform* pAnmTransform) {
mAnmTransform = pAnmTransform;
field_0x8.change(pAnmTransform);
}
void init(const Vec& param_0, const Mtx& param_1) { B0::init(param_0, param_1); }
void calc() { field_0x8.calc(this); }
@@ -1,8 +1,7 @@
#ifndef J3DCLUSTER_H
#define J3DCLUSTER_H
#include "JSystem/JUtility/JUTAssert.h"
#include "dolphin/types.h"
#include "JSystem/J3DAssert.h"
class J3DDeformer;
class J3DClusterKey;
@@ -81,13 +80,13 @@ public:
/* 8032E364 */ void setAnm(J3DAnmCluster*);
J3DCluster* getClusterPointer(u16 index) {
J3D_ASSERT(186, (index < mClusterNum), "Error : range over.");
J3D_ASSERT_RANGE(186, (index < mClusterNum));
return &mClusterPointer[index];
}
u16 getClusterNum() const { return mClusterNum; }
u16 getClusterKeyNum() const { return mClusterKeyNum; }
J3DClusterKey* getClusterKeyPointer(u16 i) {
J3D_ASSERT(199, (i < mClusterKeyNum), "Error : range over.");
J3D_ASSERT_RANGE(199, (i < mClusterKeyNum));
return &mClusterKeyPointer[i];
}
f32* getVtxPos() { return mVtxPos; }
+14 -3
View File
@@ -3,6 +3,7 @@
#include "JSystem/J3DGraphBase/J3DTransform.h"
#include "JSystem/J3DGraphBase/J3DSys.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
class J3DAnmTransform;
class J3DJoint;
@@ -29,7 +30,7 @@ public:
static J3DMtxBuffer* getMtxBuffer() { return mMtxBuffer; }
static J3DJoint* getJoint() {
J3D_ASSERT(185, mJoint != NULL, "Error : null pointer.")
J3D_ASSERT_NULLPTR(185, mJoint != NULL)
return mJoint;
}
static void setJoint(J3DJoint* joint) { mJoint = joint; }
@@ -51,7 +52,17 @@ public:
/* 8032F254 */ void entryIn();
/* 8032F3F8 */ void recursiveCalc();
u32 getType() const { return 'NJNT'; }
J3DMaterial* getMesh() { return mMesh; }
void addMesh(J3DMaterial* pMesh) {
if (mMesh != NULL) {
pMesh->setNext(mMesh);
}
mMesh = pMesh;
}
u16 getJntNo() const { return mJntNo; }
u8 getScaleCompensate() const { return mScaleCompensate; }
J3DJoint* getYounger() { return mYounger; }
@@ -67,13 +78,13 @@ public:
J3DMtxCalc* getMtxCalc() { return mMtxCalc; }
J3DMtxCalc* getCurrentMtxCalc() { return mCurrentMtxCalc; };
J3DJoint* getChild() { return mChild; }
u8 getMtxType() { return (mKind & 0xf0) >> 4; }
u8 getMtxType() const { return (mKind & 0xf0) >> 4; }
void setMtxType(u8 type) { mKind = (mKind & ~0xf0) | (type << 4); }
f32 getRadius() const { return mBoundingSphereRadius; }
static J3DMtxCalc* mCurrentMtxCalc;
inline u8 getKind() { return mKind & 15; }
u8 getKind() { return mKind & 15; }
private:
friend struct J3DJointFactory;
@@ -64,14 +64,14 @@ public:
JUTNameTab* getJointName() const { return mJointName; }
J3DJoint* getRootNode() { return mRootNode; }
J3DJoint* getJointNodePointer(u16 idx) const {
J3D_ASSERT(139, idx < mJointNum, "Error : range over.");
J3D_ASSERT_RANGE(139, idx < mJointNum);
return mJointNodePointer[idx];
}
J3DMtxCalc* getBasicMtxCalc() const { return mBasicMtxCalc; }
J3DMtxCalc* getBasicMtxCalc() { return mBasicMtxCalc; }
Mtx& getInvJointMtx(int idx) { return mInvJointMtx[idx]; }
u32 getModelDataType() const { return mModelDataType; }
void setModelDataType(u32 type) { mModelDataType = type; }
bool checkFlag(u32 flag) { return mFlags & flag; }
bool checkFlag(u32 flag) const { return mFlags & flag ? true : false; }
void setFlag(u32 flag) { mFlags = flag; }
private:
@@ -3,9 +3,6 @@
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
typedef struct _GXColor GXColor;
typedef struct _GXColorS10 GXColorS10;
/**
* @ingroup jsystem-j3d
*
@@ -13,11 +10,14 @@ typedef struct _GXColorS10 GXColorS10;
class J3DMatColorAnm {
public:
/* 8003B2B8 */ ~J3DMatColorAnm() {}
/* 8003B2F4 */ J3DMatColorAnm() : field_0x0(0), mAnmFlag(1), mAnmColor(NULL) {}
J3DMatColorAnm(u16 param_1, J3DAnmColor* param_2) {
J3DMatColorAnm(u16 param_1, J3DAnmColor* pAnmColor) {
field_0x0 = param_1;
mAnmFlag = 1;
mAnmColor = param_2;
mAnmColor = pAnmColor;
J3D_ASSERT_NULLPTR(56, pAnmColor != NULL);
}
void operator=(J3DMatColorAnm const& other) {
@@ -28,7 +28,11 @@ public:
void setAnmFlag(bool flag) { mAnmFlag = flag; }
bool getAnmFlag() const { return mAnmFlag; }
void calc(_GXColor* pColor) const { mAnmColor->getColor(field_0x0, pColor); }
void calc(GXColor* pColor) const {
J3D_ASSERT_NULLPTR(507, pColor != NULL);
mAnmColor->getColor(field_0x0, pColor);
}
private:
/* 0x0 */ u16 field_0x0;
@@ -36,6 +40,43 @@ private:
/* 0x4 */ J3DAnmColor* mAnmColor;
}; // Size: 0x8
/**
* @ingroup jsystem-j3d
*
*/
class J3DTexMtxAnm {
public:
/* 8003B264 */ ~J3DTexMtxAnm() {}
/* 8003B2A0 */ J3DTexMtxAnm() : field_0x0(0), mAnmFlag(1), mAnmTransform(NULL) {}
J3DTexMtxAnm(u16 param_1, J3DAnmTextureSRTKey* pSRTKey) {
field_0x0 = param_1;
mAnmFlag = 1;
mAnmTransform = pSRTKey;
J3D_ASSERT_NULLPTR(134, pSRTKey != NULL);
}
void operator=(J3DTexMtxAnm const& other) {
mAnmTransform = other.mAnmTransform;
field_0x0 = other.field_0x0;
mAnmFlag = other.mAnmFlag;
}
void setAnmFlag(bool flag) { mAnmFlag = flag; }
void calc(J3DTextureSRTInfo* pSRTInfo) const {
J3D_ASSERT_NULLPTR(519, pSRTInfo != NULL);
mAnmTransform->getTransform(field_0x0, pSRTInfo);
}
bool getAnmFlag() const { return mAnmFlag; }
private:
/* 0x0 */ u16 field_0x0;
/* 0x2 */ u16 mAnmFlag;
/* 0x4 */ J3DAnmTextureSRTKey* mAnmTransform;
}; // Size: 0x8
/**
* @ingroup jsystem-j3d
*
@@ -44,11 +85,14 @@ class J3DTexNoAnm {
public:
/* 8003B1F8 */ ~J3DTexNoAnm() {}
/* 8003B240 */ J3DTexNoAnm() : field_0x4(0), mAnmFlag(1), mAnmTexPattern(NULL) {}
J3DTexNoAnm(u16 param_1, J3DAnmTexPattern* param_2) {
J3DTexNoAnm(u16 param_1, J3DAnmTexPattern* pAnmTexPattern) {
field_0x4 = param_1;
mAnmFlag = 1;
mAnmTexPattern = param_2;
mAnmTexPattern = pAnmTexPattern;
J3D_ASSERT_NULLPTR(214, pAnmTexPattern != NULL);
}
/* 8003C82C */ virtual void calc(u16* param_0) const { mAnmTexPattern->getTexNo(field_0x4, param_0); }
void operator=(J3DTexNoAnm const& other) {
@@ -71,49 +115,19 @@ private:
* @ingroup jsystem-j3d
*
*/
class J3DTexMtxAnm {
class J3DTevColorAnm {
public:
/* 8003B264 */ ~J3DTexMtxAnm() {}
/* 8003B2A0 */ J3DTexMtxAnm() : field_0x0(0), mAnmFlag(1), mAnmTransform(NULL) {}
J3DTexMtxAnm(u16 param_1, J3DAnmTextureSRTKey* param_2) {
/* 8003B1A4 */ ~J3DTevColorAnm() {}
/* 8003B1E0 */ J3DTevColorAnm() : field_0x0(0), mAnmFlag(1), mAnmTevReg(NULL) {}
J3DTevColorAnm(u16 param_1, J3DAnmTevRegKey* pTevRegKey) {
field_0x0 = param_1;
mAnmFlag = 1;
mAnmTransform = param_2;
mAnmTevReg = pTevRegKey;
J3D_ASSERT_NULLPTR(293, pTevRegKey != NULL);
}
void operator=(J3DTexMtxAnm const& other) {
mAnmTransform = other.mAnmTransform;
field_0x0 = other.field_0x0;
mAnmFlag = other.mAnmFlag;
}
void setAnmFlag(bool flag) { mAnmFlag = flag; }
void calc(J3DTextureSRTInfo* pSRTInfo) const {
mAnmTransform->getTransform(field_0x0, pSRTInfo);
}
bool getAnmFlag() const { return mAnmFlag; }
private:
/* 0x0 */ u16 field_0x0;
/* 0x2 */ u16 mAnmFlag;
/* 0x4 */ J3DAnmTextureSRTKey* mAnmTransform;
}; // Size: 0x8
/**
* @ingroup jsystem-j3d
*
*/
class J3DTevKColorAnm {
public:
/* 8003B150 */ ~J3DTevKColorAnm() {}
/* 8003B18C */ J3DTevKColorAnm() : field_0x0(0), mAnmFlag(1), mAnmTevReg(NULL) {}
J3DTevKColorAnm(u16 param_1, J3DAnmTevRegKey* param_2) {
field_0x0 = param_1;
mAnmFlag = 1;
mAnmTevReg = param_2;
}
void operator=(J3DTevKColorAnm const& other) {
void operator=(J3DTevColorAnm const& other) {
mAnmTevReg = other.mAnmTevReg;
field_0x0 = other.field_0x0;
mAnmFlag = other.mAnmFlag;
@@ -121,7 +135,11 @@ public:
void setAnmFlag(bool flag) { mAnmFlag = flag; }
bool getAnmFlag() const { return mAnmFlag; }
void calc(_GXColor* pColor) const { mAnmTevReg->getTevKonstReg(field_0x0, pColor); }
void calc(GXColorS10* pColor) const {
J3D_ASSERT_NULLPTR(545, pColor != NULL);
mAnmTevReg->getTevColorReg(field_0x0, pColor);
}
private:
/* 0x0 */ u16 field_0x0;
@@ -133,17 +151,19 @@ private:
* @ingroup jsystem-j3d
*
*/
class J3DTevColorAnm {
class J3DTevKColorAnm {
public:
/* 8003B1A4 */ ~J3DTevColorAnm() {}
/* 8003B1E0 */ J3DTevColorAnm() : field_0x0(0), mAnmFlag(1), mAnmTevReg(NULL) {}
J3DTevColorAnm(u16 param_1, J3DAnmTevRegKey* param_2) {
/* 8003B150 */ ~J3DTevKColorAnm() {}
/* 8003B18C */ J3DTevKColorAnm() : field_0x0(0), mAnmFlag(1), mAnmTevReg(NULL) {}
J3DTevKColorAnm(u16 param_1, J3DAnmTevRegKey* pTevRegKey) {
field_0x0 = param_1;
mAnmFlag = 1;
mAnmTevReg = param_2;
mAnmTevReg = pTevRegKey;
J3D_ASSERT_NULLPTR(371, pTevRegKey != NULL);
}
void operator=(J3DTevColorAnm const& other) {
void operator=(J3DTevKColorAnm const& other) {
mAnmTevReg = other.mAnmTevReg;
field_0x0 = other.field_0x0;
mAnmFlag = other.mAnmFlag;
@@ -151,7 +171,11 @@ public:
void setAnmFlag(bool flag) { mAnmFlag = flag; }
bool getAnmFlag() const { return mAnmFlag; }
void calc(_GXColorS10* pColor) const { mAnmTevReg->getTevColorReg(field_0x0, pColor); }
void calc(GXColor* pColor) const {
J3D_ASSERT_NULLPTR(558, pColor != NULL);
mAnmTevReg->getTevKonstReg(field_0x0, pColor);
}
private:
/* 0x0 */ u16 field_0x0;
@@ -1,8 +1,7 @@
#ifndef J3DMATERIALATTACH_H
#define J3DMATERIALATTACH_H
#include "JSystem/JUtility/JUTAssert.h"
#include "dolphin/types.h"
#include "JSystem/J3DAssert.h"
class J3DMaterial;
class J3DTexture;
@@ -33,7 +32,7 @@ public:
/* 8032F604 */ virtual ~J3DMaterialTable();
J3DMaterial* getMaterialNodePointer(u16 idx) const {
J3D_ASSERT(92, idx < mMaterialNum, "Error : range over.");
J3D_ASSERT_RANGE(92, idx < mMaterialNum);
return mMaterialNodePointer[idx];
}
+20 -16
View File
@@ -6,15 +6,15 @@
#include "dolphin/types.h"
enum J3DMdlFlag {
J3DMdlFlag_None = 0x0,
/* 0x00001 */ J3DMdlFlag_Unk00001 = 0x1,
/* 0x00002 */ J3DMdlFlag_Unk00002 = 0x2,
/* 0x00004 */ J3DMdlFlag_SkinPosCpu = 0x4,
/* 0x00008 */ J3DMdlFlag_SkinNrmCpu = 0x8,
/* 0x00010 */ J3DMdlFlag_Unk00010 = 0x10,
/* 0x20000 */ J3DMdlFlag_Unk20000 = 0x20000,
/* 0x40000 */ J3DMdlFlag_Unk40000 = 0x40000,
/* 0x80000 */ J3DMdlFlag_Unk80000 = 0x80000,
J3DMdlFlag_None = 0x0,
/* 0x00001 */ J3DMdlFlag_Unk1 = 0x1,
/* 0x00002 */ J3DMdlFlag_UseDefaultJ3D = 0x2,
/* 0x00004 */ J3DMdlFlag_SkinPosCpu = 0x4,
/* 0x00008 */ J3DMdlFlag_SkinNrmCpu = 0x8,
/* 0x00010 */ J3DMdlFlag_EnableLOD = 0x10,
/* 0x20000 */ J3DMdlFlag_UseSharedDL = 0x20000,
/* 0x40000 */ J3DMdlFlag_UseSingleDL = 0x40000,
/* 0x80000 */ J3DMdlFlag_DifferedDLBuffer = 0x80000,
};
/**
@@ -45,9 +45,10 @@ public:
J3DModel() {
initialize();
}
J3DModel(J3DModelData* param_0, u32 param_1, u32 param_2) {
J3DModel(J3DModelData* pModelData, u32 mdlFlags, u32 mtxBufferFlag) {
initialize();
entryModelData(param_0, param_1, param_2);
entryModelData(pModelData, mdlFlags, mtxBufferFlag);
}
/* 80327100 */ void initialize();
@@ -66,6 +67,8 @@ public:
/* 803281B4 */ void calcBumpMtx();
/* 803282B8 */ void calcBBoardMtx();
/* 803282EC */ void prepareShapePackets();
void ptrToIndex();
void makeDL();
/* 80327CA4 */ virtual void update();
/* 80327E4C */ virtual void entry();
@@ -85,21 +88,22 @@ public:
Mtx& getBaseTRMtx() { return mBaseTransformMtx; }
void setBaseTRMtx(Mtx m) { MTXCopy(m, mBaseTransformMtx); }
u32 getMtxCalcMode() const { return mFlags & 0x03; }
u32 getMtxCalcMode() { return mFlags & (J3DMdlFlag_Unk1 | J3DMdlFlag_UseDefaultJ3D); }
J3DVertexBuffer* getVertexBuffer() { return (J3DVertexBuffer*)&mVertexBuffer; }
J3DMatPacket* getMatPacket(u16 idx) const { return &mMatPacket[idx]; }
J3DShapePacket* getShapePacket(u16 idx) const { return &mShapePacket[idx]; }
J3DMtxBuffer* getMtxBuffer() const { return mMtxBuffer; }
J3DMtxBuffer* getMtxBuffer() { return mMtxBuffer; }
void setScaleFlag(int idx, u8 flag) { mMtxBuffer->setScaleFlag(idx, flag); }
Mtx33* getBumpMtxPtr(int idx) const { return mMtxBuffer->getBumpMtxPtr(idx); }
Mtx33* getNrmMtxPtr() const { return mMtxBuffer->getNrmMtxPtr(); }
Mtx* getDrawMtxPtr() const { return mMtxBuffer->getDrawMtxPtr(); }
Mtx33* getBumpMtxPtr(int idx) { return mMtxBuffer->getBumpMtxPtr(idx); }
Mtx33* getNrmMtxPtr() { return mMtxBuffer->getNrmMtxPtr(); }
Mtx* getDrawMtxPtr() { return mMtxBuffer->getDrawMtxPtr(); }
void setBaseScale(const Vec& scale) { mBaseScale = scale; }
void setUserArea(u32 area) { mUserArea = area; }
u32 getUserArea() const { return mUserArea; }
Vec* getBaseScale() { return &mBaseScale; }
void setAnmMtx(int jointNo, Mtx m) { mMtxBuffer->setAnmMtx(jointNo, m); }
MtxP getAnmMtx(int jointNo) { return mMtxBuffer->getAnmMtx(jointNo); }
MtxP getWeightAnmMtx(int i) { return mMtxBuffer->getWeightAnmMtx(i); }
J3DSkinDeform* getSkinDeform() { return mSkinDeform; }
/* 0x04 */ J3DModelData* mModelData;
@@ -8,7 +8,6 @@
#include "JSystem/J3DGraphBase/J3DSys.h"
#include "JSystem/J3DGraphBase/J3DVertex.h"
typedef struct _GXColor GXColor;
class JUTNameTab;
/**
@@ -68,7 +67,7 @@ public:
bool checkFlag(u32 flag) const { return (mFlags & flag) ? true : false; }
u32 getFlag() const { return mFlags; }
void const* getRawData() const { return mpRawData; }
u16 checkBumpFlag() const { return mbHasBumpArray; }
bool checkBumpFlag() const { return mbHasBumpArray == 1; }
void setBumpFlag(u32 flag) { mbHasBumpArray = flag; }
bool checkBBoardFlag() const { return mbHasBillboard == 1; }
bool isLocked() { return mMaterialTable.isLocked(); }
+13 -14
View File
@@ -25,28 +25,28 @@ public:
/* 80326D3C */ void calcNrmMtx();
/* 80326EF0 */ void calcBBoardMtx();
MtxP getAnmMtx(int idx) const { return mpAnmMtx[idx]; }
MtxP getAnmMtx(int idx) { return mpAnmMtx[idx]; }
void setAnmMtx(int i, Mtx m) { MTXCopy(m, (MtxP)mpAnmMtx[i]); }
MtxP getWeightAnmMtx(int idx) const { return mpWeightEvlpMtx[idx]; }
MtxP getUserAnmMtx(int idx) const { return mpUserAnmMtx[idx]; }
MtxP getWeightAnmMtx(int idx) { return mpWeightEvlpMtx[idx]; }
MtxP getUserAnmMtx(int idx) { return mpUserAnmMtx[idx]; }
void setScaleFlag(int idx, u8 flag) { mpScaleFlagArr[idx] = flag; }
u32* getCurrentViewNoPtr() { return &mCurrentViewNo; }
u8* getScaleFlagArray() const { return mpScaleFlagArr; }
u8 getScaleFlag(int idx) const { return mpScaleFlagArr[idx]; }
u8 getEnvScaleFlag(int idx) const { return mpEvlpScaleFlagArr[idx]; }
Mtx** getDrawMtxPtrPtr() const { return mpDrawMtxArr[1]; }
Mtx* getDrawMtxPtr() const { return mpDrawMtxArr[1][mCurrentViewNo]; }
Mtx* getDrawMtx(int idx) const { return &mpDrawMtxArr[1][mCurrentViewNo][idx]; }
Mtx33** getNrmMtxPtrPtr() const { return mpNrmMtxArr[1]; }
Mtx33* getNrmMtxPtr() const { return mpNrmMtxArr[1][mCurrentViewNo]; }
Mtx33* getNrmMtx(u16 idx) const { return &mpNrmMtxArr[1][mCurrentViewNo][idx]; }
Mtx** getDrawMtxPtrPtr() { return mpDrawMtxArr[1]; }
Mtx* getDrawMtxPtr() { return mpDrawMtxArr[1][mCurrentViewNo]; }
Mtx* getDrawMtx(int idx) { return &mpDrawMtxArr[1][mCurrentViewNo][idx]; }
Mtx33** getNrmMtxPtrPtr() { return mpNrmMtxArr[1]; }
Mtx33* getNrmMtxPtr() { return mpNrmMtxArr[1][mCurrentViewNo]; }
Mtx33* getNrmMtx(int idx) { return &mpNrmMtxArr[1][mCurrentViewNo][idx]; }
Mtx33*** getBumpMtxPtrPtr() const { return mpBumpMtxArr[1]; }
Mtx33* getBumpMtxPtr(int idx) const { return mpBumpMtxArr[1][idx][mCurrentViewNo]; }
Mtx33* getBumpMtxPtr(int idx) { return mpBumpMtxArr[1][idx][mCurrentViewNo]; }
J3DJointTree* getJointTree() const { return mJointTree; }
void setNrmMtx(int idx, Mtx* mtx) {
J3DPSMtx33CopyFrom34(*mtx, mpNrmMtxArr[1][mCurrentViewNo][idx]);
void setNrmMtx(int idx, Mtx mtx) {
J3DPSMtx33CopyFrom34(mtx, mpNrmMtxArr[1][mCurrentViewNo][idx]);
}
void swapDrawMtx() {
@@ -66,7 +66,6 @@ public:
static Mtx* sNoUseDrawMtxPtr;
static Mtx33* sNoUseNrmMtxPtr;
private:
/* 0x00 */ J3DJointTree* mJointTree;
/* 0x04 */ u8* mpScaleFlagArr;
/* 0x08 */ u8* mpEvlpScaleFlagArr;
@@ -75,7 +74,7 @@ private:
/* 0x14 */ Mtx** mpDrawMtxArr[2];
/* 0x1C */ Mtx33** mpNrmMtxArr[2];
/* 0x24 */ Mtx33*** mpBumpMtxArr[2];
/* 0x2C */ u32 mFlags;
/* 0x2C */ u32 mMtxNum;
/* 0x30 */ u32 mCurrentViewNo;
/* 0x34 */ Mtx* mpUserAnmMtx;
@@ -27,7 +27,7 @@ public:
u16 getShapeNum() const { return mShapeNum; }
J3DShape* getShapeNodePointer(u16 idx) const {
J3D_ASSERT(85, idx < mShapeNum, "Error : range over.");
J3D_ASSERT_RANGE(85, idx < mShapeNum);
return mShapeNodePointer[idx];
}
@@ -53,14 +53,14 @@ public:
Mtx3P getNrmMtx(int i) { return mNrmMtx[i]; }
void onFlag(u32 flag) { mFlags |= flag; }
void offFlag(u32 flag) { mFlags &= ~flag; }
bool checkFlag(u32 flag) { return mFlags & flag; }
bool checkFlag(u32 flag) { return mFlags & flag ? true : false; }
/* 8032E064 */ virtual void deform(J3DVertexBuffer*, J3DMtxBuffer*);
/* 8032E1B0 */ virtual ~J3DSkinDeform();
static u16* sWorkArea_WEvlpMixMtx[1024];
static f32* sWorkArea_WEvlpMixWeight[1024];
static u16 sWorkArea_MtxReg[1024 + 4 /* padding */];
static u16 sWorkArea_MtxReg[1024];
private:
/* 0x04 */ u16* mPosData;
@@ -89,7 +89,7 @@ public:
/* 8032EBCC */ void normalizeWeight(int, f32*);
void offFlag(u32 i_flag) { mFlags &= ~i_flag; }
bool checkFlag(u32 i_flag) { return mFlags & i_flag; }
bool checkFlag(u32 i_flag) { return mFlags & i_flag ? true : false; }
void setAnmCluster(J3DAnmCluster* anm) { mAnmCluster = anm; }
void normalize(f32* i_vec) { VECNormalize((Vec*)i_vec, (Vec*)i_vec); }
+28 -23
View File
@@ -33,8 +33,23 @@ class J3DDrawPacket;
class J3DMatPacket;
class J3DShapePacket;
typedef int (J3DDrawBuffer::*sortFunc)(J3DMatPacket*);
typedef void (J3DDrawBuffer::*drawFunc)() const;
enum J3DDrawBufDrawMode {
J3DDrawBufDrawMode_Head,
J3DDrawBufDrawMode_Tail,
J3DDrawBufDrawMode_MAX,
};
enum J3DDrawBufSortMode {
J3DDrawBufSortMode_Mat,
J3DDrawBufSortMode_MatAnm,
J3DDrawBufSortMode_Z,
J3DDrawBufSortMode_Model,
J3DDrawBufSortMode_Invalid,
J3DDrawBufSortMode_Non,
J3DDrawBufSortMode_MAX,
};
/**
* @ingroup jsystem-j3d
@@ -42,24 +57,13 @@ typedef void (J3DDrawBuffer::*drawFunc)() const;
*/
class J3DDrawBuffer {
public:
enum EDrawType {
DRAW_HEAD,
DRAW_TAIL,
};
enum ESortType {
SORT_MAT,
SORT_MAT_ANM,
SORT_Z,
SORT_MODEL,
SORT_INVALID,
SORT_NON,
};
typedef int (J3DDrawBuffer::*sortFunc)(J3DMatPacket*);
typedef void (J3DDrawBuffer::*drawFunc)() const;
J3DDrawBuffer() { initialize(); }
~J3DDrawBuffer();
void initialize();
J3DError allocBuffer(u32);
int allocBuffer(u32);
void frameInit();
int entryMatSort(J3DMatPacket*);
int entryMatAnmSort(J3DMatPacket*);
@@ -72,18 +76,19 @@ public:
void drawHead() const;
void drawTail() const;
u32 getEntryTableSize() { return mBufSize; }
u32 getEntryTableSize() { return mEntryTableSize; }
int getSortMode() { return mSortMode; }
inline void calcZRatio();
void setNonSort() { mSortType = 5; }
void setZSort() { mSortType = 2; }
void setNonSort() { mSortMode = J3DDrawBufSortMode_Non; }
void setZSort() { mSortMode = J3DDrawBufSortMode_Z; }
void setZMtx(MtxP mtx) { mpZMtx = mtx; }
public:
/* 0x00 */ J3DPacket** mpBuf;
/* 0x04 */ u32 mBufSize;
/* 0x08 */ u32 mDrawType;
/* 0x0C */ u32 mSortType;
/* 0x00 */ J3DPacket** mpBuffer;
/* 0x04 */ u32 mEntryTableSize;
/* 0x08 */ u32 mDrawMode;
/* 0x0C */ u32 mSortMode;
/* 0x10 */ f32 mZNear;
/* 0x14 */ f32 mZFar;
/* 0x18 */ f32 mZRatio;
+67
View File
@@ -0,0 +1,67 @@
#ifndef J3DFIFO_H
#define J3DFIFO_H
#include <dolphin/gx.h>
#include <dolphin/gd.h>
inline void J3DFifoLoadBPCmd(u32 regval) {
GXCmd1u8(GX_LOAD_BP_REG);
GXCmd1u32(regval);
}
inline void J3DFifoWriteXFCmdHdr(u16 addr, u8 len) {
GXCmd1u8(GX_LOAD_XF_REG);
GXCmd1u16(len - 1);
GXCmd1u16(addr);
}
inline void J3DFifoLoadIndx(u8 cmd, u16 indx, u16 addr) {
GXWGFifo.u8 = cmd;
GXWGFifo.u16 = indx;
GXWGFifo.u16 = addr;
}
inline void J3DFifoWriteCPCmd(u8 cmd, u32 param) {
GXWGFifo.u8 = GX_LOAD_CP_REG;
GXWGFifo.u8 = cmd;
GXWGFifo.u32 = param;
}
inline void J3DFifoLoadCPCmd(u8 reg, u32 value) {
GXCmd1u8(GX_LOAD_CP_REG);
GXCmd1u8(reg);
GXCmd1u32(value);
}
inline void J3DFifoWriteXFCmd(u16 cmd, u16 len) {
GXWGFifo.u8 = GX_LOAD_XF_REG;
GXWGFifo.u16 = (len - 1);
GXWGFifo.u16 = cmd;
}
inline void J3DFifoLoadXFCmdHdr(u16 addr, u8 len) {
GXCmd1u8(GX_LOAD_XF_REG);
GXCmd1u16(len - 1);
GXCmd1u16(addr);
}
inline void J3DFifoLoadPosMtxIndx(u16 index, u32 addr) {
GXCmd1u8(GX_LOAD_INDX_A);
GXCmd1u16(index);
GXCmd1u16(((sizeof(Vec) - 1) << 12) | (u16)(addr * 4));
}
inline void J3DFifoLoadNrmMtxIndx3x3(u16 index, u32 addr) {
GXCmd1u8(GX_LOAD_INDX_B);
GXCmd1u16(index);
GXCmd1u16(((9 - 1) << 12) | (u16)((addr * 3) + 0x400));
}
void J3DFifoLoadPosMtxImm(f32 (*)[4], u32);
void J3DFifoLoadNrmMtxImm(f32 (*)[4], u32);
void J3DFifoLoadNrmMtxImm3x3(f32 (*)[3], u32);
void J3DFifoLoadNrmMtxToTexMtx(f32 (*)[4], u32);
void J3DFifoLoadNrmMtxToTexMtx3x3(f32 (*)[3], u32);
void J3DFifoLoadTexCached(GXTexMapID, u32, GXTexCacheSize, u32, GXTexCacheSize);
#endif /* J3DFIFO_H */
+34 -48
View File
@@ -2,64 +2,62 @@
#define J3DGD_H
#include <dolphin/gx.h>
#include "dolphin/gd/GDBase.h"
#include <dolphin/gd.h>
inline void J3DGDWrite_u8(u8 param) {
__GDWrite(param);
inline void J3DGDWrite_u8(u8 data) {
__GDWrite(data);
}
inline void J3DGDWrite_u16(u16 param) {
__GDWrite((param & 0xffff) >> 8);
__GDWrite(param & 0xff);
inline void J3DGDWrite_u16(u16 data) {
__GDWrite((u8)((data >> 8)));
__GDWrite((u8)((data >> 0) & 0xFF));
}
inline void J3DGDWrite_u32(u32 param) {
__GDWrite((param >> 24) & 0xff);
__GDWrite((param >> 16) & 0xff);
__GDWrite((param >> 8) & 0xff);
__GDWrite(param & 0xff);
inline void J3DGDWrite_u32(u32 data) {
__GDWrite((u8)((data >> 24) & 0xFF));
__GDWrite((u8)((data >> 16) & 0xFF));
__GDWrite((u8)((data >> 8) & 0xFF));
__GDWrite((u8)((data >> 0) & 0xFF));
}
inline void J3DGDWrite_f32(f32 param) {
u32 tmp = *(u32*)&param;
J3DGDWrite_u32(tmp);
inline void J3DGDWrite_f32(f32 data) {
union {
f32 f;
u32 u;
} fid;
fid.f = data;
J3DGDWrite_u32(fid.u);
}
inline void J3DGDWriteBPCmd(u32 cmd) {
J3DGDWrite_u8(0x61);
J3DGDWrite_u32(cmd);
inline void J3DGDWriteBPCmd(u32 regval) {
J3DGDWrite_u8(GX_LOAD_BP_REG);
J3DGDWrite_u32(regval);
}
inline void J3DFifoLoadBPCmd(u32 cmd) {
GXWGFifo.u8 = 0x61;
GXWGFifo.u32 = cmd;
}
inline void J3DGDWriteXFCmd(u16 addr, u32 cmd) {
J3DGDWrite_u8(0x10);
inline void J3DGDWriteXFCmd(u16 addr, u32 val) {
J3DGDWrite_u8(GX_LOAD_XF_REG);
J3DGDWrite_u16(0);
J3DGDWrite_u16(addr);
J3DGDWrite_u32(cmd);
J3DGDWrite_u32(val);
}
inline void J3DGDWriteXFCmdHdr(u16 addr, u8 len) {
J3DGDWrite_u8(0x10);
J3DGDWrite_u8(GX_LOAD_XF_REG);
J3DGDWrite_u16(len - 1);
J3DGDWrite_u16(addr);
}
inline void J3DFifoWriteXFCmdHdr(u16 addr, u8 len) {
GXWGFifo.u8 = 0x10;
GXWGFifo.u16 = len - 1;
GXWGFifo.u16 = addr;
inline void J3DGXCmd1f32ptr(f32* data) {
GXCmd1u32(*(u32*)data);
}
inline void J3DGXCmd1f32ptr(f32* value) {
GXWGFifo.u32 = *(u32*)value;
}
inline void J3DGXCmd1f32(f32 value) {
GXWGFifo.u32 = *(u32*)&value;
inline void J3DGXCmd1f32(f32 data) {
union {
f32 f;
u32 u;
} fid;
fid.f = data;
GXCmd1u32(fid.u);
}
inline void J3DGDWriteCPCmd(u8 reg, u32 value) {
@@ -96,18 +94,6 @@ void J3DGDSetTevKColor(GXTevKColorID, GXColor);
void J3DGDSetTevColorS10(GXTevRegID, GXColorS10);
void J3DGDSetFog(GXFogType, f32, f32, f32, f32, GXColor);
void J3DGDSetFogRangeAdj(u8, u16, _GXFogAdjTable*);
void J3DFifoLoadPosMtxImm(f32 (*)[4], u32);
void J3DFifoLoadNrmMtxImm(f32 (*)[4], u32);
void J3DFifoLoadNrmMtxImm3x3(f32 (*)[3], u32);
void J3DFifoLoadNrmMtxToTexMtx(f32 (*)[4], u32);
void J3DFifoLoadNrmMtxToTexMtx3x3(f32 (*)[3], u32);
void J3DFifoLoadTexCached(GXTexMapID, u32, GXTexCacheSize, u32, GXTexCacheSize);
static inline void J3DFifoLoadIndx(u8 cmd, u16 indx, u16 addr) {
GXWGFifo.u8 = cmd;
GXWGFifo.u16 = indx;
GXWGFifo.u16 = addr;
}
inline void J3DGDSetNumChans(u8 numChans) {
J3DGDWriteXFCmd(0x1009, numChans);
File diff suppressed because it is too large Load Diff
+17 -2
View File
@@ -4,7 +4,7 @@
#include "JSystem/J3DGraphBase/J3DMatBlock.h"
#include "JSystem/J3DGraphBase/J3DPacket.h"
#include "JSystem/J3DGraphBase/J3DShape.h"
#include "dolphin/types.h"
#include <stdint.h>
class J3DJoint;
class J3DMaterialAnm;
@@ -56,7 +56,7 @@ public:
J3DIndBlock* getIndBlock() { return mIndBlock; }
J3DJoint* getJoint() { return mJoint; }
J3DMaterialAnm* getMaterialAnm() {
if ((u32)mMaterialAnm < 0xC0000000) {
if ((uintptr_t)mMaterialAnm < 0xC0000000) {
return mMaterialAnm;
} else {
return NULL;
@@ -89,6 +89,21 @@ public:
void setZCompLoc(u8 i_comploc) { mPEBlock->setZCompLoc(i_comploc); }
void setMaterialMode(u32 i_mode) { mMaterialMode = i_mode; }
void addShape(J3DShape* pShape) {
J3D_ASSERT_NULLPTR(618, pShape != NULL);
mShape = pShape;
}
void setNext(J3DMaterial* pMaterial) {
J3D_ASSERT_NULLPTR(623, pMaterial != NULL);
mNext = pMaterial;
}
void setJoint(J3DJoint* pJoint) {
J3D_ASSERT_NULLPTR(628, pJoint != NULL);
mJoint = pJoint;
}
public:
/* 0x04 */ J3DMaterial* mNext;
/* 0x08 */ J3DShape* mShape;
+75 -37
View File
@@ -3,6 +3,7 @@
#include "JSystem/J3DGraphBase/J3DSys.h"
#include "dolphin/gd/GDBase.h"
#include <stdint.h>
class J3DMatPacket;
@@ -16,27 +17,42 @@ class J3DTexMtx;
class J3DTexMtxObj;
class J3DTexture;
inline u32 getDiffFlag_LightObjNum(u32 param_1) {
return (param_1 & 0xf0) >> 4;
enum J3DDiffFlag {
J3DDiffFlag_MatColor = 0x1,
J3DDiffFlag_ColorChan = 0x2,
J3DDiffFlag_AmbColor = 0x4,
J3DDiffFlag_TexGen = 0x1000,
J3DDiffFlag_TevReg = 0x1000000,
J3DDiffFlag_KonstColor = 0x2000000, // is this right?
J3DDiffFlag_TexCoordScale = 0x4000000,
J3DDiffFlag_TevStageIndirect = 0x8000000,
J3DDiffFlag_Fog = 0x10000000,
J3DDiffFlag_Blend = 0x20000000,
J3DDiffFlag_Unk40000000 = 0x40000000,
J3DDiffFlag_Changed = 0x80000000,
};
inline u32 getDiffFlag_LightObjNum(u32 diffFlags) {
return (diffFlags & 0xf0) >> 4;
}
inline u32 getDiffFlag_TexGenNum(u32 param_1) {
return (param_1 & 0xf00) >> 8;
inline u32 getDiffFlag_TexGenNum(u32 diffFlags) {
return (diffFlags & 0xf00) >> 8;
}
inline int calcDifferedBufferSize_TexMtxSize(int param_1) {
inline int calcDifferedBufferSize_TexMtxSize(u32 param_1) {
return param_1 * 0x35;
}
inline int calcDifferedBufferSize_TexGenSize(int param_1) {
inline int calcDifferedBufferSize_TexGenSize(u32 param_1) {
return param_1 * 0x3d + 10;
}
inline u32 getDiffFlag_TexNoNum(u32 param_1) {
return (param_1 & 0xf0000) >> 0x10;
inline u32 getDiffFlag_TexNoNum(u32 diffFlags) {
return (diffFlags & 0xf0000) >> 0x10;
}
inline int calcDifferedBufferSize_TexNoSize(int param_1) {
inline int calcDifferedBufferSize_TexNoSize(u32 param_1) {
return param_1 * 0x37;
}
@@ -46,15 +62,15 @@ inline u32 calcDifferedBufferSize_TexNoAndTexCoordScaleSize(u32 param_1) {
return res;
}
inline u32 getDiffFlag_TevStageNum(u32 param_1) {
return (param_1 & 0xf00000) >> 0x14;
inline u32 getDiffFlag_TevStageNum(u32 diffFlags) {
return (diffFlags & 0xf00000) >> 0x14;
}
inline int calcDifferedBufferSize_TevStageSize(int param_1) {
inline int calcDifferedBufferSize_TevStageSize(u32 param_1) {
return param_1 * 10;
}
inline int calcDifferedBufferSize_TevStageDirectSize(int param_1) {
inline int calcDifferedBufferSize_TevStageDirectSize(u32 param_1) {
return param_1 * 5;
}
@@ -65,15 +81,15 @@ inline int calcDifferedBufferSize_TevStageDirectSize(int param_1) {
class J3DDisplayListObj {
public:
J3DDisplayListObj() {
mpData[0] = NULL;
mpData[1] = NULL;
mpDisplayList[0] = NULL;
mpDisplayList[1] = NULL;
mSize = 0;
mCapacity = 0;
mMaxSize = 0;
}
J3DError newDisplayList(u32);
J3DError newSingleDisplayList(u32);
J3DError single_To_Double();
int single_To_Double();
void setSingleDisplayList(void*, u32);
void swapBuffer();
void callDL() const;
@@ -82,15 +98,15 @@ public:
void beginPatch();
u32 endPatch();
u8* getDisplayList(int idx) const { return (u8*)mpData[idx]; }
u32 getDisplayListSize() const { return mSize; }
u8* getDisplayList(int idx) { return (u8*)mpDisplayList[idx]; }
u32 getDisplayListSize() { return mSize; }
static GDLObj sGDLObj;
static s32 sInterruptFlag;
/* 0x0 */ void* mpData[2];
/* 0x0 */ void* mpDisplayList[2];
/* 0x8 */ u32 mSize;
/* 0xC */ u32 mCapacity;
/* 0xC */ u32 mMaxSize;
}; // Size: 0x10
/**
@@ -102,7 +118,7 @@ public:
J3DPacket() {
mpNextPacket = NULL;
mpFirstChild = NULL;
mpUserData = NULL;
mpUserArea = NULL;
}
void addChildPacket(J3DPacket*);
@@ -115,8 +131,8 @@ public:
mpFirstChild = NULL;
}
void* getUserArea() { return mpUserData; }
void setUserArea(u32 area) { mpUserData = (void*)area; }
void* getUserArea() const { return mpUserArea; }
void setUserArea(uintptr_t area) { mpUserArea = (void*)area; }
virtual int entry(J3DDrawBuffer*);
virtual void draw();
@@ -125,7 +141,7 @@ public:
public:
/* 0x04 */ J3DPacket* mpNextPacket;
/* 0x08 */ J3DPacket* mpFirstChild;
/* 0x0C */ void* mpUserData;
/* 0x0C */ void* mpUserArea;
}; // Size: 0x10
/**
@@ -140,29 +156,34 @@ public:
J3DError newSingleDisplayList(u32);
virtual void draw();
J3DDisplayListObj* getDisplayListObj() const { return mpDisplayListObj; }
J3DDisplayListObj* getDisplayListObj() { return mpDisplayListObj; }
void setDisplayListObj(J3DDisplayListObj* pObj) { mpDisplayListObj = pObj; }
void beginPatch() { mpDisplayListObj->beginPatch(); }
void endPatch() { mpDisplayListObj->endPatch(); }
void callDL() const { getDisplayListObj()->callDL(); }
void callDL() const { mpDisplayListObj->callDL(); }
void beginDL() { mpDisplayListObj->beginDL(); }
void endDL() { mpDisplayListObj->endDL(); }
void* getDisplayList(int i) { return mpDisplayListObj->mpDisplayList[i]; }
u32 getDisplayListSize() const { return mpDisplayListObj->mSize; }
enum {
LOCKED = 0x01,
};
bool checkFlag(u32 flag) const { return (mFlags & flag) != 0; }
bool checkFlag(u32 flag) const { return (mFlags & flag) ? true : false; }
void onFlag(u32 flag) { mFlags |= flag; }
void offFlag(u32 flag) { mFlags &= ~flag; }
void lock() { onFlag(LOCKED); }
void unlock() { offFlag(LOCKED); }
J3DTexMtxObj* getTexMtxObj() const { return mpTexMtxObj; }
J3DTexMtxObj* getTexMtxObj() { return mpTexMtxObj; }
bool isLocked() const { return checkFlag(1); }
public:
/* 0x10 */ u32 mFlags;
/* 0x14 */ char mPad0[0x0C]; // unk
/* 0x14 */ char unk_0x14[0x20 - 0x14];
/* 0x20 */ J3DDisplayListObj* mpDisplayListObj;
/* 0x24 */ J3DTexMtxObj* mpTexMtxObj;
}; // Size: 0x28
@@ -175,15 +196,23 @@ class J3DShapePacket : public J3DDrawPacket {
public:
J3DShapePacket();
u32 calcDifferedBufferSize(u32);
J3DError newDifferedDisplayList(u32);
int newDifferedDisplayList(u32);
void prepareDraw() const;
void drawFast();
virtual ~J3DShapePacket();
virtual void draw();
void setShape(J3DShape* pShape) { mpShape = pShape; }
void setModel(J3DModel* pModel) { mpModel = pModel; }
void setShape(J3DShape* pShape) {
J3D_ASSERT_NULLPTR(523, pShape != NULL);
mpShape = pShape;
}
void setModel(J3DModel* pModel) {
J3D_ASSERT_NULLPTR(533, pModel != NULL);
mpModel = pModel;
}
void setMtxBuffer(J3DMtxBuffer* pMtxBuffer) { mpMtxBuffer = pMtxBuffer; }
void setBaseMtxPtr(Mtx* pMtx) { mpBaseMtxPtr = pMtx; }
@@ -214,13 +243,22 @@ public:
J3DMaterial* getMaterial() const { return mpMaterial; }
J3DShapePacket* getShapePacket() const { return mpShapePacket; }
void setShapePacket(J3DShapePacket* packet) { mpShapePacket = packet; }
void setMaterial(J3DMaterial* pMaterial) { mpMaterial = pMaterial; }
void setTexture(J3DTexture* pTexture) { mpTexture = pTexture; }
void setMaterial(J3DMaterial* pMaterial) {
J3D_ASSERT_NULLPTR(646, pMaterial != NULL);
mpMaterial = pMaterial;
}
void setTexture(J3DTexture* pTexture) {
J3D_ASSERT_NULLPTR(651, pTexture != NULL);
mpTexture = pTexture;
}
void setInitShapePacket(J3DShapePacket* packet) { mpInitShapePacket = packet; }
void setMaterialID(u32 id) { mDiffFlag = id; }
void setMaterialAnmID(J3DMaterialAnm* materialAnm) { mpMaterialAnm = materialAnm; }
bool isChanged() const { return mDiffFlag & 0x80000000; }
bool isEnabled_Diff() const { return mpInitShapePacket->getDisplayListObj() != NULL; }
BOOL isChanged() { return mDiffFlag & J3DDiffFlag_Changed; }
bool isEnabled_Diff() { return mpInitShapePacket->getDisplayListObj() != NULL; }
virtual ~J3DMatPacket();
virtual int entry(J3DDrawBuffer*);

Some files were not shown because too many files have changed in this diff Show More