mirror of
https://github.com/zeldaret/tp
synced 2026-07-07 14:13:27 -04:00
some J3D/misc cleanup (#2628)
* some j3d cleanup * begin using uintptr_t * j3dgraphbase cleanup * j3dgraphanimator cleanup
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
@@ -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; }
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
@@ -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); }
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
@@ -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*)¶m;
|
||||
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
@@ -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;
|
||||
|
||||
@@ -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*);
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#define J3DSHAPE_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DShapeDraw.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/gx.h"
|
||||
#include "mtx.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
#include "JSystem/J3DGraphBase/J3DFifo.h"
|
||||
#include <dolphin/mtx.h>
|
||||
|
||||
class J3DShapeMtx;
|
||||
|
||||
@@ -18,18 +18,6 @@ public:
|
||||
u32 mMtxIdxRegB;
|
||||
};
|
||||
|
||||
static inline void J3DFifoWriteCPCmd(u8 cmd, u32 param) {
|
||||
GXWGFifo.u8 = GX_LOAD_CP_REG;
|
||||
GXWGFifo.u8 = cmd;
|
||||
GXWGFifo.u32 = param;
|
||||
}
|
||||
|
||||
static inline void J3DFifoWriteXFCmd(u16 cmd, u16 len) {
|
||||
GXWGFifo.u8 = GX_LOAD_XF_REG;
|
||||
GXWGFifo.u16 = (len - 1);
|
||||
GXWGFifo.u16 = cmd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
@@ -50,10 +38,10 @@ public:
|
||||
u32 getMtxIdxRegA() const { return mMtxIdxRegA; }
|
||||
u32 getMtxIdxRegB() const { return mMtxIdxRegB; }
|
||||
|
||||
inline void load() const {
|
||||
J3DFifoWriteCPCmd(0x30, mMtxIdxRegA); // CP_MATINDEX_A
|
||||
J3DFifoWriteCPCmd(0x40, mMtxIdxRegB); // CP_MATINDEX_B
|
||||
J3DFifoWriteXFCmd(0x1018, 2);
|
||||
void load() const {
|
||||
J3DFifoLoadCPCmd(CP_REG_MTXIDXA_ID, mMtxIdxRegA);
|
||||
J3DFifoLoadCPCmd(CP_REG_MTXIDXB_ID, mMtxIdxRegB);
|
||||
J3DFifoLoadXFCmdHdr(GX_XF_REG_MATRIXINDEX0, 2);
|
||||
GXCmd1u32(mMtxIdxRegA);
|
||||
GXCmd1u32(mMtxIdxRegB);
|
||||
}
|
||||
@@ -65,110 +53,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class J3DMaterial;
|
||||
class J3DVertexData;
|
||||
class J3DDrawMtxData;
|
||||
|
||||
enum J3DShpFlag {
|
||||
J3DShpFlag_Visible = 0x0001,
|
||||
J3DShpFlag_SkinPosCpu = 0x0004,
|
||||
J3DShpFlag_SkinNrmCpu = 0x0008,
|
||||
J3DShpFlag_Hidden = 0x0010,
|
||||
J3DShpFlag_EnableLod = 0x0100,
|
||||
J3DShpFlag_NoMtx = 0x0200,
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*/
|
||||
class J3DShape {
|
||||
public:
|
||||
J3DShape() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
enum {
|
||||
kVcdVatDLSize = 0xC0,
|
||||
};
|
||||
|
||||
/* 80314B48 */ void initialize();
|
||||
/* 80314BB8 */ void addTexMtxIndexInDL(_GXAttr, u32);
|
||||
/* 80314CBC */ void addTexMtxIndexInVcd(_GXAttr);
|
||||
/* 80314DA8 */ void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
|
||||
/* 80314E28 */ u16 countBumpMtxNum() const;
|
||||
/* 80314EEC */ void loadVtxArray() const;
|
||||
/* 80314F5C */ bool isSameVcdVatCmd(J3DShape*);
|
||||
/* 80314F98 */ void makeVtxArrayCmd();
|
||||
/* 80315260 */ void makeVcdVatCmd();
|
||||
/* 80315300 */ void loadPreDrawSetting() const;
|
||||
/* 80315398 */ void setArrayAndBindPipeline() const;
|
||||
|
||||
/* 803155E0 */ virtual void draw() const;
|
||||
/* 8031544C */ virtual void drawFast() const;
|
||||
/* 80315628 */ virtual void simpleDraw() const;
|
||||
/* 803156AC */ virtual void simpleDrawCache() const;
|
||||
|
||||
void onFlag(u32 flag) { mFlags |= flag; }
|
||||
void offFlag(u32 flag) { mFlags &= ~flag; }
|
||||
bool checkFlag(u32 flag) const { return !!(mFlags & flag); }
|
||||
void setDrawMtxDataPointer(J3DDrawMtxData* pMtxData) { mDrawMtxData = pMtxData; }
|
||||
void setVertexDataPointer(J3DVertexData* pVtxData) { mVertexData = pVtxData; }
|
||||
void* getVcdVatCmd() { return mVcdVatCmd; }
|
||||
void setVcdVatCmd(void* pVatCmd) { mVcdVatCmd = (u8*)pVatCmd; }
|
||||
void show() { offFlag(J3DShpFlag_Visible); }
|
||||
void hide() { onFlag(J3DShpFlag_Visible); }
|
||||
void setCurrentViewNoPtr(u32* pViewNoPtr) { mCurrentViewNo = pViewNoPtr; }
|
||||
void setCurrentMtx(J3DCurrentMtx& mtx) { mCurrentMtx = mtx; }
|
||||
void setScaleFlagArray(u8* pScaleFlagArray) { mScaleFlagArray = pScaleFlagArray; }
|
||||
void setDrawMtx(Mtx** pDrawMtx) { mDrawMtx = pDrawMtx; }
|
||||
void setNrmMtx(Mtx33** pNrmMtx) { mNrmMtx = pNrmMtx; }
|
||||
void setTexMtxLoadType(u32 type) { mFlags = (mFlags & 0xFFFF0FFF) | type; }
|
||||
bool getNBTFlag() const { return mHasNBT; }
|
||||
u32 getBumpMtxOffset() const { return mBumpMtxOffset; }
|
||||
void setBumpMtxOffset(u32 offset) { mBumpMtxOffset = offset; }
|
||||
GXVtxDescList* getVtxDesc() { return mVtxDesc; }
|
||||
|
||||
J3DMaterial* getMaterial() const { return mMaterial; }
|
||||
u16 getIndex() const { return mIndex; }
|
||||
u32 getTexMtxLoadType() const { return mFlags & 0xF000; }
|
||||
u32 getMtxGroupNum() const { return mMtxGroupNum; }
|
||||
J3DShapeDraw* getShapeDraw(u16 idx) { return mShapeDraw[idx]; }
|
||||
J3DShapeMtx* getShapeMtx(u16 idx) { return mShapeMtx[idx]; }
|
||||
Vec* getMin() { return &mMin; }
|
||||
Vec* getMax() { return &mMax; }
|
||||
|
||||
static void resetVcdVatCache() { sOldVcdVatCmd = NULL; }
|
||||
|
||||
static void* sOldVcdVatCmd;
|
||||
|
||||
private:
|
||||
friend struct J3DShapeFactory;
|
||||
friend class J3DJointTree;
|
||||
|
||||
/* 0x04 */ J3DMaterial* mMaterial;
|
||||
/* 0x08 */ u16 mIndex;
|
||||
/* 0x0A */ u16 mMtxGroupNum;
|
||||
/* 0x0C */ u32 mFlags;
|
||||
/* 0x10 */ f32 mRadius;
|
||||
/* 0x14 */ Vec mMin;
|
||||
/* 0x20 */ Vec mMax;
|
||||
/* 0x2C */ u8* mVcdVatCmd;
|
||||
/* 0x30 */ GXVtxDescList* mVtxDesc;
|
||||
/* 0x34 */ bool mHasNBT;
|
||||
/* 0x38 */ J3DShapeMtx** mShapeMtx;
|
||||
/* 0x3C */ J3DShapeDraw** mShapeDraw;
|
||||
/* 0x40 */ J3DCurrentMtx mCurrentMtx;
|
||||
/* 0x48 */ bool mHasPNMTXIdx;
|
||||
/* 0x4C */ J3DVertexData* mVertexData;
|
||||
/* 0x50 */ J3DDrawMtxData* mDrawMtxData;
|
||||
/* 0x54 */ u8* mScaleFlagArray;
|
||||
/* 0x58 */ Mtx** mDrawMtx;
|
||||
/* 0x5C */ Mtx33** mNrmMtx;
|
||||
/* 0x60 */ u32* mCurrentViewNo;
|
||||
/* 0x64 */ u32 mBumpMtxOffset;
|
||||
};
|
||||
|
||||
typedef void (J3DShapeMtx::*J3DShapeMtx_LoadFunc)(int, u16) const;
|
||||
|
||||
/**
|
||||
@@ -197,15 +81,16 @@ public:
|
||||
static u16 sMtxLoadCache[10];
|
||||
static u32 sCurrentPipeline;
|
||||
static u8* sCurrentScaleFlag;
|
||||
static u8 sNBTFlag;
|
||||
static u8 sLODFlag;
|
||||
static bool sNBTFlag;
|
||||
static bool sLODFlag;
|
||||
static u32 sTexMtxLoadType;
|
||||
|
||||
static void setCurrentPipeline(u32 pipeline) {
|
||||
J3D_ASSERT(91, pipeline < 4, "Error : range over.");
|
||||
J3D_ASSERT_RANGE(91, pipeline < 4);
|
||||
sCurrentPipeline = pipeline;
|
||||
}
|
||||
static void setLODFlag(u8 flag) { sLODFlag = flag; }
|
||||
|
||||
static void setLODFlag(bool flag) { sLODFlag = flag; }
|
||||
static u32 getLODFlag() { return sLODFlag; }
|
||||
static void resetMtxLoadCache();
|
||||
|
||||
@@ -213,4 +98,133 @@ protected:
|
||||
/* 0x04 */ u16 mUseMtxIndex;
|
||||
};
|
||||
|
||||
class J3DMaterial;
|
||||
class J3DVertexData;
|
||||
class J3DDrawMtxData;
|
||||
|
||||
enum J3DShpFlag {
|
||||
J3DShpFlag_Visible = 0x0001,
|
||||
J3DShpFlag_SkinPosCpu = 0x0004,
|
||||
J3DShpFlag_SkinNrmCpu = 0x0008,
|
||||
J3DShpFlag_Hidden = 0x0010,
|
||||
J3DShpFlag_EnableLod = 0x0100,
|
||||
J3DShpFlag_NoMtx = 0x0200,
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
*
|
||||
*/
|
||||
class J3DShape {
|
||||
public:
|
||||
J3DShape() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
static const int kVcdVatDLSize = 0xC0;
|
||||
|
||||
/* 80314B48 */ void initialize();
|
||||
/* 80314BB8 */ void addTexMtxIndexInDL(_GXAttr, u32);
|
||||
/* 80314CBC */ void addTexMtxIndexInVcd(_GXAttr);
|
||||
/* 80314DA8 */ void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
|
||||
/* 80314E28 */ u16 countBumpMtxNum() const;
|
||||
/* 80314EEC */ void loadVtxArray() const;
|
||||
/* 80314F5C */ bool isSameVcdVatCmd(J3DShape*);
|
||||
/* 80314F98 */ void makeVtxArrayCmd();
|
||||
/* 80315260 */ void makeVcdVatCmd();
|
||||
/* 80315300 */ void loadPreDrawSetting() const;
|
||||
/* 80315398 */ void setArrayAndBindPipeline() const;
|
||||
|
||||
/* 803155E0 */ virtual void draw() const;
|
||||
/* 8031544C */ virtual void drawFast() const;
|
||||
/* 80315628 */ virtual void simpleDraw() const;
|
||||
/* 803156AC */ virtual void simpleDrawCache() const;
|
||||
|
||||
void loadCurrentMtx() const;
|
||||
|
||||
void onFlag(u32 flag) { mFlags |= flag; }
|
||||
void offFlag(u32 flag) { mFlags &= ~flag; }
|
||||
bool checkFlag(u32 flag) const { return (mFlags & flag) != 0; }
|
||||
|
||||
void setMaterial(J3DMaterial* pMaterial) {
|
||||
J3D_ASSERT_NULLPTR(509, pMaterial != NULL);
|
||||
mMaterial = pMaterial;
|
||||
}
|
||||
|
||||
void setDrawMtxDataPointer(J3DDrawMtxData* pMtxData) {
|
||||
J3D_ASSERT_NULLPTR(554, pMtxData != NULL);
|
||||
mDrawMtxData = pMtxData;
|
||||
}
|
||||
|
||||
void setVertexDataPointer(J3DVertexData* pVtxData) {
|
||||
J3D_ASSERT_NULLPTR(657, pVtxData != NULL);
|
||||
mVertexData = pVtxData;
|
||||
}
|
||||
|
||||
void* getVcdVatCmd() { return mVcdVatCmd; }
|
||||
void setVcdVatCmd(void* pVatCmd) { mVcdVatCmd = (u8*)pVatCmd; }
|
||||
void show() { offFlag(J3DShpFlag_Visible); }
|
||||
void hide() { onFlag(J3DShpFlag_Visible); }
|
||||
|
||||
void setCurrentViewNoPtr(u32* pViewNoPtr) {
|
||||
J3D_ASSERT_NULLPTR(584, pViewNoPtr != NULL);
|
||||
mCurrentViewNo = pViewNoPtr;
|
||||
}
|
||||
|
||||
void setCurrentMtx(J3DCurrentMtx& mtx) { mCurrentMtx = mtx; }
|
||||
|
||||
void setScaleFlagArray(u8* pScaleFlagArray) {
|
||||
J3D_ASSERT_NULLPTR(595, pScaleFlagArray != NULL);
|
||||
mScaleFlagArray = pScaleFlagArray;
|
||||
}
|
||||
|
||||
void setDrawMtx(Mtx** pDrawMtx) { mDrawMtx = pDrawMtx; }
|
||||
void setNrmMtx(Mtx33** pNrmMtx) { mNrmMtx = pNrmMtx; }
|
||||
void setTexMtxLoadType(u32 type) { mFlags = (mFlags & 0xFFFF0FFF) | type; }
|
||||
bool getNBTFlag() const { return mHasNBT; }
|
||||
u32 getBumpMtxOffset() const { return mBumpMtxOffset; }
|
||||
void setBumpMtxOffset(u32 offset) { mBumpMtxOffset = offset; }
|
||||
GXVtxDescList* getVtxDesc() { return mVtxDesc; }
|
||||
|
||||
J3DMaterial* getMaterial() const { return mMaterial; }
|
||||
u16 getIndex() const { return mIndex; }
|
||||
u32 getTexMtxLoadType() const { return mFlags & 0xF000; }
|
||||
u32 getMtxGroupNum() const { return mMtxGroupNum; }
|
||||
J3DShapeDraw* getShapeDraw(u16 idx) { return mShapeDraw[idx]; }
|
||||
J3DShapeMtx* getShapeMtx(u16 idx) { return mShapeMtx[idx]; }
|
||||
Vec* getMin() { return &mMin; }
|
||||
Vec* getMax() { return &mMax; }
|
||||
|
||||
static void resetVcdVatCache() { sOldVcdVatCmd = NULL; }
|
||||
|
||||
static void* sOldVcdVatCmd;
|
||||
static bool sEnvelopeFlag;
|
||||
|
||||
private:
|
||||
friend struct J3DShapeFactory;
|
||||
friend class J3DJointTree;
|
||||
|
||||
/* 0x04 */ J3DMaterial* mMaterial;
|
||||
/* 0x08 */ u16 mIndex;
|
||||
/* 0x0A */ u16 mMtxGroupNum;
|
||||
/* 0x0C */ u32 mFlags;
|
||||
/* 0x10 */ f32 mRadius;
|
||||
/* 0x14 */ Vec mMin;
|
||||
/* 0x20 */ Vec mMax;
|
||||
/* 0x2C */ u8* mVcdVatCmd;
|
||||
/* 0x30 */ GXVtxDescList* mVtxDesc;
|
||||
/* 0x34 */ bool mHasNBT;
|
||||
/* 0x38 */ J3DShapeMtx** mShapeMtx;
|
||||
/* 0x3C */ J3DShapeDraw** mShapeDraw;
|
||||
/* 0x40 */ J3DCurrentMtx mCurrentMtx;
|
||||
/* 0x48 */ bool mHasPNMTXIdx;
|
||||
/* 0x4C */ J3DVertexData* mVertexData;
|
||||
/* 0x50 */ J3DDrawMtxData* mDrawMtxData;
|
||||
/* 0x54 */ u8* mScaleFlagArray;
|
||||
/* 0x58 */ Mtx** mDrawMtx;
|
||||
/* 0x5C */ Mtx33** mNrmMtx;
|
||||
/* 0x60 */ u32* mCurrentViewNo;
|
||||
/* 0x64 */ u32 mBumpMtxOffset;
|
||||
};
|
||||
|
||||
#endif /* J3DSHAPE_H */
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define J3DSHAPEMTX_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DShape.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
#include "dolphin/mtx.h"
|
||||
|
||||
class J3DTexMtx;
|
||||
@@ -14,15 +15,21 @@ class J3DTexGenBlock;
|
||||
class J3DTexMtxObj {
|
||||
public:
|
||||
Mtx& getMtx(u16 idx) {
|
||||
J3D_ASSERT(0x113, idx <= mTexMtxNum, "Error : range over");
|
||||
J3D_ASSERT_RANGE(275, idx < mTexMtxNum);
|
||||
return mpTexMtx[idx];
|
||||
}
|
||||
|
||||
void setMtx(u16 idx, const Mtx mtx) {
|
||||
J3D_ASSERT_RANGE(288, idx < mTexMtxNum);
|
||||
MTXCopy(mtx, mpTexMtx[idx]);
|
||||
}
|
||||
|
||||
Mtx44& getEffectMtx(u16 idx) {
|
||||
J3D_ASSERT(0x125, idx <= mTexMtxNum, "Error : range over");
|
||||
J3D_ASSERT_RANGE(293, idx < mTexMtxNum);
|
||||
return mpEffectMtx[idx];
|
||||
}
|
||||
|
||||
u16 getNumTexMtx() const { return mTexMtxNum; }
|
||||
void setMtx(u16 idx, Mtx const* mtx) { MTXCopy(*mtx, mpTexMtx[idx]); }
|
||||
|
||||
/* 0x00 */ Mtx* mpTexMtx;
|
||||
/* 0x04 */ Mtx44* mpEffectMtx;
|
||||
@@ -37,7 +44,7 @@ class J3DDifferedTexMtx {
|
||||
public:
|
||||
/* 8031322C */ static void loadExecute(f32 const (*)[4]);
|
||||
|
||||
static inline void load(Mtx m) {
|
||||
static inline void load(const Mtx m) {
|
||||
if (sTexGenBlock != NULL)
|
||||
loadExecute(m);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ struct J3DFogInfo {
|
||||
struct J3DNBTScaleInfo {
|
||||
/* 8032587C */ J3DNBTScaleInfo& operator=(J3DNBTScaleInfo const&);
|
||||
|
||||
/* 0x0 */ bool mbHasScale;
|
||||
/* 0x0 */ u8 mbHasScale;
|
||||
/* 0x4 */ Vec mScale;
|
||||
}; // Size: 0x10
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
#include <dolphin/mtx.h>
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
|
||||
// Perhaps move to a new J3DEnum.h?
|
||||
enum J3DError {
|
||||
@@ -11,9 +11,11 @@ enum J3DError {
|
||||
kJ3DError_Alloc = 4,
|
||||
};
|
||||
|
||||
enum J3DSysDrawBuffer {
|
||||
/* 0x0 */ J3DSys_OPA_BUFFER_e,
|
||||
/* 0x1 */ J3DSys_XLU_BUFFER_e
|
||||
enum J3DSysDrawBuf {
|
||||
/* 0x0 */ J3DSysDrawBuf_Opa,
|
||||
/* 0x1 */ J3DSysDrawBuf_Xlu,
|
||||
|
||||
/* 0x2 */ J3DSysDrawBuf_MAX
|
||||
};
|
||||
|
||||
class J3DMtxCalc;
|
||||
@@ -53,25 +55,25 @@ struct J3DSys {
|
||||
/* 0x03C */ J3DMatPacket* mMatPacket;
|
||||
/* 0x040 */ J3DShapePacket* mShapePacket;
|
||||
/* 0x044 */ J3DShape* mShape;
|
||||
/* 0x048 */ J3DDrawBuffer* mDrawBuffer[2];
|
||||
/* 0x048 */ J3DDrawBuffer* mDrawBuffer[J3DSysDrawBuf_MAX];
|
||||
/* 0x050 */ u32 mDrawMode;
|
||||
/* 0x054 */ u32 mMaterialMode;
|
||||
/* 0x058 */ J3DTexture* mTexture;
|
||||
/* 0x05C */ u8 field_0x5c[0x04];
|
||||
/* 0x05C */ u8 unk_0x5c[0x60 - 0x5C];
|
||||
/* 0x060 */ u32 mTexCacheRegionNum;
|
||||
/* 0x064 */ GXTexRegion mTexCacheRegion[8];
|
||||
/* 0x0E4 */ u8 field_0xe4[0x20];
|
||||
/* 0x0E4 */ u8 unk_0xe4[0x104 - 0xE4];
|
||||
/* 0x104 */ Mtx* mModelDrawMtx;
|
||||
/* 0x108 */ Mtx33* mModelNrmMtx;
|
||||
/* 0x10C */ void* mVtxPos;
|
||||
/* 0x110 */ void* mVtxNrm;
|
||||
/* 0x114 */ _GXColor* mVtxCol;
|
||||
/* 0x114 */ GXColor* mVtxCol;
|
||||
/* 0x118 */ Vec* mNBTScale;
|
||||
|
||||
/* 8030FDE8 */ J3DSys();
|
||||
/* 8030FEC0 */ void loadPosMtxIndx(int, u16) const;
|
||||
/* 8030FEE4 */ void loadNrmMtxIndx(int, u16) const;
|
||||
/* 8030FF0C */ void setTexCacheRegion(_GXTexCacheSize);
|
||||
/* 8030FF0C */ void setTexCacheRegion(GXTexCacheSize);
|
||||
/* 803100BC */ void drawInit();
|
||||
/* 8031073C */ void reinitGX();
|
||||
/* 8031079C */ void reinitGenMode();
|
||||
@@ -82,16 +84,15 @@ struct J3DSys {
|
||||
/* 80310D44 */ void reinitIndStages();
|
||||
/* 80310E3C */ void reinitPixelProc();
|
||||
|
||||
enum DrawMode {
|
||||
/* 0x3 */ OPA_TEX_EDGE = 3,
|
||||
/* 0x4 */ XLU,
|
||||
enum J3DSysDrawMode {
|
||||
J3DSysDrawMode_OpaTexEdge = 3,
|
||||
J3DSysDrawMode_Xlu
|
||||
};
|
||||
|
||||
MtxP getViewMtx() { return mViewMtx; }
|
||||
|
||||
void setDrawModeOpaTexEdge() { mDrawMode = OPA_TEX_EDGE; }
|
||||
|
||||
void setDrawModeXlu() { mDrawMode = XLU; }
|
||||
void setDrawModeOpaTexEdge() { mDrawMode = J3DSysDrawMode_OpaTexEdge; }
|
||||
void setDrawModeXlu() { mDrawMode = J3DSysDrawMode_Xlu; }
|
||||
|
||||
void* getVtxPos() { return mVtxPos; }
|
||||
void setVtxPos(void* pVtxPos) { mVtxPos = pVtxPos; }
|
||||
@@ -99,15 +100,35 @@ struct J3DSys {
|
||||
void* getVtxNrm() { return mVtxNrm; }
|
||||
void setVtxNrm(void* pVtxNrm) { mVtxNrm = pVtxNrm; }
|
||||
|
||||
void* getVtxCol() const { return mVtxCol; }
|
||||
void setVtxCol(_GXColor* pVtxCol) { mVtxCol = pVtxCol; }
|
||||
void* getVtxCol() { return mVtxCol; }
|
||||
void setVtxCol(GXColor* pVtxCol) { mVtxCol = pVtxCol; }
|
||||
|
||||
void setDrawBuffer(J3DDrawBuffer* buffer, int type) {
|
||||
J3D_ASSERT_RANGE(114, type >= 0 && type < J3DSysDrawBuf_MAX);
|
||||
J3D_ASSERT_NULLPTR(115, buffer);
|
||||
mDrawBuffer[type] = buffer;
|
||||
}
|
||||
|
||||
J3DDrawBuffer* getDrawBuffer(int type) {
|
||||
J3D_ASSERT_RANGE(121, type >= 0 && type < J3DSysDrawBuf_MAX);
|
||||
return mDrawBuffer[type];
|
||||
}
|
||||
|
||||
void setMatPacket(J3DMatPacket* pPacket) {
|
||||
J3D_ASSERT_NULLPTR(162, pPacket != NULL);
|
||||
mMatPacket = pPacket;
|
||||
}
|
||||
|
||||
void setShapePacket(J3DShapePacket* pPacket) {
|
||||
J3D_ASSERT_NULLPTR(172, pPacket != NULL);
|
||||
mShapePacket = pPacket;
|
||||
}
|
||||
|
||||
void setModel(J3DModel* pModel) {
|
||||
J3D_ASSERT(200, pModel, "Error : null pointer.");
|
||||
J3D_ASSERT_NULLPTR(200, pModel != NULL);
|
||||
mModel = pModel;
|
||||
}
|
||||
void setShapePacket(J3DShapePacket* pPacket) { mShapePacket = pPacket; }
|
||||
void setMatPacket(J3DMatPacket* pPacket) { mMatPacket = pPacket; }
|
||||
|
||||
J3DMatPacket* getMatPacket() { return mMatPacket; }
|
||||
void setMaterialMode(u32 mode) { mMaterialMode = mode; }
|
||||
|
||||
@@ -124,34 +145,20 @@ struct J3DSys {
|
||||
|
||||
void offFlag(u32 flag) { mFlags &= ~flag; }
|
||||
|
||||
bool checkFlag(u32 flag) { return mFlags & flag; }
|
||||
bool checkFlag(u32 flag) { return mFlags & flag ? true : false; }
|
||||
|
||||
void setModelDrawMtx(Mtx* pMtxArr) {
|
||||
J3D_ASSERT_NULLPTR(230, pMtxArr);
|
||||
mModelDrawMtx = pMtxArr;
|
||||
GXSetArray(GX_POS_MTX_ARRAY, mModelDrawMtx, sizeof(*mModelDrawMtx));
|
||||
}
|
||||
|
||||
void setModelNrmMtx(Mtx33* pMtxArr) {
|
||||
JUT_ASSERT_MSG(241, pMtxArr, "Error : null pointer.");
|
||||
J3D_ASSERT_NULLPTR(241, pMtxArr);
|
||||
mModelNrmMtx = pMtxArr;
|
||||
GXSetArray(GX_NRM_MTX_ARRAY, mModelNrmMtx, sizeof(*mModelNrmMtx));
|
||||
}
|
||||
|
||||
// Type 0: Opa Buffer
|
||||
// Type 1: Xlu Buffer
|
||||
void setDrawBuffer(J3DDrawBuffer* buffer, int type) {
|
||||
J3D_ASSERT(114, type >= 0 && type < 2, "Error : range over.");
|
||||
J3D_ASSERT(115, buffer, "Error : null pointer.");
|
||||
mDrawBuffer[type] = buffer;
|
||||
}
|
||||
|
||||
// Type 0: Opa Buffer
|
||||
// Type 1: Xlu Buffer
|
||||
J3DDrawBuffer* getDrawBuffer(int type) {
|
||||
J3D_ASSERT(121, type >= 0 && type < 2, "Error : range over.");
|
||||
return mDrawBuffer[type];
|
||||
}
|
||||
|
||||
Mtx& getModelDrawMtx(u16 no) { return mModelDrawMtx[no]; }
|
||||
J3DShapePacket* getShapePacket() { return mShapePacket; }
|
||||
|
||||
|
||||
@@ -153,6 +153,16 @@ struct J3DTevStage {
|
||||
return *this;
|
||||
}
|
||||
|
||||
J3DTevStage& operator=(J3DTevStage& other) {
|
||||
mTevColorOp = other.mTevColorOp;
|
||||
mTevColorAB = other.mTevColorAB;
|
||||
mTevColorCD = other.mTevColorCD;
|
||||
mTevAlphaOp = other.mTevAlphaOp;
|
||||
mTevAlphaAB = other.mTevAlphaAB;
|
||||
mTevSwapModeInfo = other.mTevSwapModeInfo;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* 0x0 */ u8 field_0x0;
|
||||
/* 0x1 */ u8 mTevColorOp;
|
||||
/* 0x2 */ u8 mTevColorAB;
|
||||
@@ -214,6 +224,16 @@ struct J3DIndTevStage {
|
||||
J3DGDWriteBPCmd(mInfo | (param_1 + 0x10) * 0x1000000);
|
||||
}
|
||||
|
||||
J3DIndTevStage& operator=(const J3DIndTevStage& other) {
|
||||
mInfo = other.mInfo;
|
||||
return *this;
|
||||
}
|
||||
|
||||
J3DIndTevStage& operator=(J3DIndTevStage& other) {
|
||||
mInfo = other.mInfo;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* 0x0 */ u32 mInfo;
|
||||
};
|
||||
|
||||
@@ -264,6 +284,11 @@ struct J3DTevSwapModeTable {
|
||||
return *this;
|
||||
}
|
||||
|
||||
J3DTevSwapModeTable& operator=(J3DTevSwapModeTable& other) {
|
||||
mIdx = other.mIdx;
|
||||
return *this;
|
||||
}
|
||||
|
||||
u8 calcTevSwapTableID(u8 param_0, u8 param_1, u8 param_2, u8 param_3) {
|
||||
return 0x40 * param_0 + 0x10 * param_1 + 4 * param_2 + param_3;
|
||||
}
|
||||
@@ -281,6 +306,7 @@ extern const GXColor j3dDefaultAmbInfo;
|
||||
extern const GXColorS10 j3dDefaultTevColor;
|
||||
extern const GXColor j3dDefaultTevKColor;
|
||||
extern u8 j3dAlphaCmpTable[768];
|
||||
extern const u8 j3dDefaultNumChans;
|
||||
|
||||
struct J3DNBTScale;
|
||||
struct J3DTexCoord;
|
||||
@@ -290,5 +316,9 @@ void loadTexNo(u32 param_0, u16 const& param_1);
|
||||
void patchTexNo_PtrToIdx(u32 texID, u16 const& idx);
|
||||
bool isTexNoReg(void* param_0);
|
||||
u16 getTexNoReg(void* param_0);
|
||||
void makeTexCoordTable();
|
||||
void makeAlphaCmpTable();
|
||||
void makeZModeTable();
|
||||
void makeTevSwapTable();
|
||||
|
||||
#endif /* J3DTEVS_H */
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#define J3DTEXTURE_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DStruct.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
#include "JSystem/JUtility/JUTTexture.h"
|
||||
#include "dolphin/types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-j3d
|
||||
@@ -13,25 +13,28 @@
|
||||
class J3DTexture {
|
||||
private:
|
||||
/* 0x0 */ u16 mNum;
|
||||
/* 0x2 */ u16 field_0x2;
|
||||
/* 0x2 */ u16 unk_0x2;
|
||||
/* 0x4 */ ResTIMG* mpRes;
|
||||
|
||||
public:
|
||||
J3DTexture(u16 num, ResTIMG* res) : mNum(num), field_0x2(0), mpRes(res) {}
|
||||
/* 8031204C */ void loadGX(u16, _GXTexMapID) const;
|
||||
J3DTexture(u16 num, ResTIMG* res) : mNum(num), unk_0x2(0), mpRes(res) {}
|
||||
|
||||
/* 8031204C */ void loadGX(u16, GXTexMapID) const;
|
||||
/* 803121A4 */ void entryNum(u16);
|
||||
/* 8031221C */ void addResTIMG(u16, ResTIMG const*);
|
||||
/* 803366A4 */ virtual ~J3DTexture() {}
|
||||
|
||||
u16 getNum() const { return mNum; }
|
||||
ResTIMG* getResTIMG(u16 entry) const {
|
||||
J3D_ASSERT(72, entry < mNum, "Error : range over.");
|
||||
return &mpRes[entry];
|
||||
|
||||
ResTIMG* getResTIMG(u16 index) const {
|
||||
J3D_ASSERT_RANGE(72, index < mNum);
|
||||
return &mpRes[index];
|
||||
}
|
||||
void setResTIMG(u16 entry, const ResTIMG& timg) {
|
||||
mpRes[entry] = timg;
|
||||
mpRes[entry].imageOffset = ((mpRes[entry].imageOffset + (u32)&timg - (u32)(mpRes + entry)));
|
||||
mpRes[entry].paletteOffset = ((mpRes[entry].paletteOffset + (u32)&timg - (u32)(mpRes + entry)));
|
||||
|
||||
void setResTIMG(u16 index, const ResTIMG& timg) {
|
||||
mpRes[index] = timg;
|
||||
mpRes[index].imageOffset = ((mpRes[index].imageOffset + (uintptr_t)&timg - (uintptr_t)(mpRes + index)));
|
||||
mpRes[index].paletteOffset = ((mpRes[index].paletteOffset + (uintptr_t)&timg - (uintptr_t)(mpRes + index)));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,9 +49,11 @@ public:
|
||||
J3DTexMtx() {
|
||||
mTexMtxInfo = j3dDefaultTexMtxInfo;
|
||||
}
|
||||
|
||||
J3DTexMtx(const J3DTexMtxInfo& info) {
|
||||
mTexMtxInfo = info;
|
||||
}
|
||||
|
||||
/* 803238C4 */ void load(u32) const;
|
||||
/* 80323900 */ void calc(const Mtx);
|
||||
/* 80323920 */ void calcTexMtx(const Mtx);
|
||||
@@ -103,7 +108,7 @@ struct J3DTexCoord : public J3DTexCoordInfo {
|
||||
void setTexMtxReg(u16 reg) { mTexMtxReg = reg; }
|
||||
J3DTexCoord& operator=(const J3DTexCoord& other) {
|
||||
// Fake match (__memcpy or = doesn't match)
|
||||
*(u32*)this = *(u32*)&other;
|
||||
*(uintptr_t*)this = *(uintptr_t*)&other;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#ifndef J3DTRANSFORM_H
|
||||
#define J3DTRANSFORM_H
|
||||
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "dolphin/mtx.h"
|
||||
#include <dolphin/mtx.h>
|
||||
|
||||
struct J3DTextureSRTInfo;
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ struct J3DVtxColorCalc {
|
||||
class J3DVertexData {
|
||||
public:
|
||||
J3DVertexData();
|
||||
~J3DVertexData() {}
|
||||
|
||||
void* getVtxPosArray() const { return mVtxPosArray; }
|
||||
void* getVtxNrmArray() const { return mVtxNrmArray; }
|
||||
@@ -38,10 +39,10 @@ public:
|
||||
u32 getNrmNum() const { return mNrmNum; }
|
||||
u32 getVtxNum() const { return mVtxNum; }
|
||||
GXVtxAttrFmtList* getVtxAttrFmtList() const { return mVtxAttrFmtList; }
|
||||
u8 getVtxPosFrac() { return mVtxPosFrac; }
|
||||
u8 getVtxNrmFrac() { return mVtxNrmFrac; }
|
||||
int getVtxPosType() { return mVtxPosType; }
|
||||
int getVtxNrmType() { return mVtxNrmType; }
|
||||
u8 getVtxPosFrac() const { return mVtxPosFrac; }
|
||||
u8 getVtxNrmFrac() const { return mVtxNrmFrac; }
|
||||
int getVtxPosType() const { return mVtxPosType; }
|
||||
int getVtxNrmType() const { return mVtxNrmType; }
|
||||
|
||||
void setVtxPosFrac(u8 frac) { mVtxPosFrac = frac; }
|
||||
void setVtxPosType(GXCompType type) { mVtxPosType = type; }
|
||||
@@ -148,8 +149,4 @@ private:
|
||||
/* 0x34 */ GXColor* mCurrentVtxCol;
|
||||
}; // Size: 0x38
|
||||
|
||||
struct VertexNormal {
|
||||
Vec data;
|
||||
};
|
||||
|
||||
#endif /* J3DVERTEX_H */
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define JAISEQDATAMGR_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISound.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
@@ -28,10 +29,10 @@ struct JAISeqData {
|
||||
*/
|
||||
struct JAISeqDataRegion {
|
||||
bool intersects(JAISeqData& seqData) const {
|
||||
if ((u32)addr + size < (u32)seqData.field_0x0) {
|
||||
if ((uintptr_t)addr + size < (uintptr_t)seqData.field_0x0) {
|
||||
return false;
|
||||
}
|
||||
if ((u32)seqData.field_0x0 + seqData.field_0x4 < (u32)addr) {
|
||||
if ((uintptr_t)seqData.field_0x0 + seqData.field_0x4 < (uintptr_t)addr) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
if (!this->field_0x4.test(i)) {
|
||||
continue;
|
||||
}
|
||||
if ((u32)this->mHeaps[i].getBase() != param_0) {
|
||||
if ((uintptr_t)this->mHeaps[i].getBase() != param_0) {
|
||||
continue;
|
||||
}
|
||||
this->field_0x4.reset(i);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "JSystem/JGadget/std-memory.h"
|
||||
#include <algorithm.h>
|
||||
#include <msl_memory.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace JGadget {
|
||||
namespace vector {
|
||||
@@ -105,7 +106,7 @@ struct TVector {
|
||||
}
|
||||
|
||||
T* insert(T* pos, const T& val) {
|
||||
u32 diff = (int)((u32)pos - (u32)begin()) / 4;
|
||||
u32 diff = (int)((uintptr_t)pos - (uintptr_t)begin()) / 4;
|
||||
insert(pos, 1, val);
|
||||
return pBegin_ + diff;
|
||||
}
|
||||
@@ -118,7 +119,7 @@ struct TVector {
|
||||
if (pBegin_ == 0) {
|
||||
return 0;
|
||||
}
|
||||
return (int)((u32)pEnd_ - (u32)pBegin_) / 4;
|
||||
return (int)((uintptr_t)pEnd_ - (uintptr_t)pBegin_) / 4;
|
||||
}
|
||||
|
||||
u32 capacity() { return mCapacity; }
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <dolphin.h>
|
||||
#include "JSystem/JSupport/JSUMemoryStream.h"
|
||||
#include "JSystem/JHostIO/JORReflexible.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define MCTX_MSG_RESET 0
|
||||
#define MCTX_MSG_GET_ROOT_OBJ 2
|
||||
@@ -29,7 +30,7 @@
|
||||
#define DEFINE_GEN_CHECKBOX(T, kind) \
|
||||
void genCheckBox(const char* label, T* pSrc, T mask, u32 style, JOREventListener* pListener, \
|
||||
u16 posX, u16 posY, u16 width, u16 height) { \
|
||||
genCheckBoxSub(kind, label, (u32)pSrc, style, *pSrc, mask, pListener, posX, posY, width, \
|
||||
genCheckBoxSub(kind, label, (uintptr_t)pSrc, style, *pSrc, mask, pListener, posX, posY, width, \
|
||||
height); \
|
||||
}
|
||||
|
||||
@@ -43,7 +44,7 @@
|
||||
#define DEFINE_GEN_SLIDER(T, kind) \
|
||||
void genSlider(const char* label, T* pSrc, T rangeMin, T rangeMax, u32 style, \
|
||||
JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height) { \
|
||||
genSliderSub(kind, label, (u32)pSrc, style, *pSrc, rangeMin, rangeMax, pListener, posX, \
|
||||
genSliderSub(kind, label, (uintptr_t)pSrc, style, *pSrc, rangeMin, rangeMax, pListener, posX, \
|
||||
posY, width, height); \
|
||||
}
|
||||
|
||||
@@ -57,7 +58,7 @@
|
||||
#define DEFINE_START_COMBO_BOX(T, kind) \
|
||||
void startComboBox(const char* label, T* pSrc, u32 style, \
|
||||
JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height) { \
|
||||
startSelectorSub('CMBX', kind, label, (u32)pSrc, style, *pSrc, pListener, posX, \
|
||||
startSelectorSub('CMBX', kind, label, (uintptr_t)pSrc, style, *pSrc, pListener, posX, \
|
||||
posY, width, height); \
|
||||
}
|
||||
|
||||
@@ -70,7 +71,7 @@
|
||||
|
||||
#define DEFINE_UPDATE_SLIDER(T) \
|
||||
void updateSlider(u32 mode, T* pSrc, T rangeMin, T rangeMax, u32 param_5) { \
|
||||
updateSliderSub(mode, (u32) pSrc, *pSrc, rangeMin, rangeMax, param_5); \
|
||||
updateSliderSub(mode, (uintptr_t)pSrc, *pSrc, rangeMin, rangeMax, param_5); \
|
||||
}
|
||||
|
||||
#define DEFINE_UPDATE_SLIDER_ID(T) \
|
||||
@@ -252,7 +253,7 @@ public:
|
||||
void updateEditBoxID(u32 mode, u32 id, const char* string, u32 param_3, u16 length);
|
||||
|
||||
void updateCheckBox(u32 mode, u8* pSrc, u8 mask, u32 param_4) {
|
||||
updateCheckBoxSub(mode, (u32) pSrc, *pSrc, mask, param_4);
|
||||
updateCheckBoxSub(mode, (uintptr_t)pSrc, *pSrc, mask, param_4);
|
||||
}
|
||||
|
||||
void updateCheckBoxID(u32 mode, u32 id, u8 value, u8 mask, u32 param_4) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define JKREXPHEAP_H
|
||||
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jkernel
|
||||
@@ -34,7 +35,7 @@ public:
|
||||
CMemBlock* getNextBlock() const { return mNext; }
|
||||
u32 getSize() const { return size; }
|
||||
u8 getGroupId() const { return mGroupId; }
|
||||
static CMemBlock* getBlock(void* data) { return (CMemBlock*)((u32)data + -0x10); }
|
||||
static CMemBlock* getBlock(void* data) { return (CMemBlock*)((uintptr_t)data + -0x10); }
|
||||
|
||||
private:
|
||||
/* 0x0 */ u16 mMagic;
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
#define JMATRIGONOMETRIC_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "utility.h"
|
||||
#include <utility.h>
|
||||
|
||||
namespace JMath {
|
||||
template<typename T>
|
||||
struct TAngleConstant_;
|
||||
|
||||
@@ -19,7 +20,6 @@ struct TAngleConstant_<f32> {
|
||||
static f32 RADIAN_TO_DEGREE_FACTOR() { return 180.0f / RADIAN_DEG180(); }
|
||||
};
|
||||
|
||||
namespace JMath {
|
||||
/**
|
||||
* @ingroup jsystem-jmath
|
||||
*
|
||||
@@ -73,30 +73,31 @@ struct TAtanTable {
|
||||
* @ingroup jsystem-jmath
|
||||
*
|
||||
*/
|
||||
template<int N, typename T>
|
||||
struct TAsinAcosTable {
|
||||
f32 table[1025];
|
||||
T table[1025];
|
||||
u8 pad[0x1C];
|
||||
|
||||
f32 acos_(f32 x) {
|
||||
T acos_(T x) const {
|
||||
if (x >= 1.0f) {
|
||||
return 0.0f;
|
||||
} else if (x <= -1.0f) {
|
||||
return TAngleConstant_<f32>::RADIAN_DEG180();
|
||||
return TAngleConstant_<T>::RADIAN_DEG180();
|
||||
} else if (x < 0.0f) {
|
||||
return table[(u32)(-x * 1023.5f)] + TAngleConstant_<f32>::RADIAN_DEG090();
|
||||
return table[(u32)(-x * 1023.5f)] + TAngleConstant_<T>::RADIAN_DEG090();
|
||||
} else {
|
||||
return TAngleConstant_<f32>::RADIAN_DEG090() - table[(u32)(x * 1023.5f)];
|
||||
return TAngleConstant_<T>::RADIAN_DEG090() - table[(u32)(x * 1023.5f)];
|
||||
}
|
||||
}
|
||||
|
||||
f32 acosDegree(f32 x) {
|
||||
return acos_(x) * TAngleConstant_<f32>::RADIAN_TO_DEGREE_FACTOR();
|
||||
T acosDegree(T x) const {
|
||||
return acos_(x) * TAngleConstant_<T>::RADIAN_TO_DEGREE_FACTOR();
|
||||
}
|
||||
};
|
||||
|
||||
extern TSinCosTable<13, f32> sincosTable_;
|
||||
extern TAtanTable atanTable_;
|
||||
extern TAsinAcosTable asinAcosTable_;
|
||||
extern TAsinAcosTable<1024, f32> asinAcosTable_;
|
||||
|
||||
inline f32 acosDegree(f32 x) {
|
||||
return asinAcosTable_.acosDegree(x);
|
||||
|
||||
@@ -80,6 +80,11 @@ inline f32 JMAHermiteInterpolation(register f32 p1, register f32 p2, register f3
|
||||
|
||||
namespace JMath {
|
||||
|
||||
template <typename T>
|
||||
inline T fastSqrt(T value) {
|
||||
return JMAFastSqrt(value);
|
||||
}
|
||||
|
||||
inline f32 fastReciprocal(f32 value) {
|
||||
return JMAFastReciprocal(value);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define JPAEMITTER_H
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
#include <stdint.h>
|
||||
#include "JSystem/JParticle/JPAResource.h"
|
||||
#include "JSystem/JParticle/JPAList.h"
|
||||
#include "JSystem/JParticle/JPARandom.h"
|
||||
@@ -197,8 +198,8 @@ public:
|
||||
void stopDrawParticle() { setStatus(JPAEmtrStts_StopDraw); }
|
||||
void playDrawParticle() { clearStatus(JPAEmtrStts_StopDraw); }
|
||||
|
||||
u32 getUserWork() { return mpUserWork; }
|
||||
void setUserWork(u32 userWork) { mpUserWork = userWork; }
|
||||
uintptr_t getUserWork() { return mpUserWork; }
|
||||
void setUserWork(uintptr_t userWork) { mpUserWork = userWork; }
|
||||
u32 getParticleNumber() const {
|
||||
return mAlivePtclBase.getNum() + mAlivePtclChld.getNum();
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ struct TAdaptor_actor : public TAdaptor {
|
||||
};
|
||||
|
||||
TAdaptor_actor()
|
||||
: TAdaptor(mValue, ARRAY_SIZE(mValue))
|
||||
: TAdaptor(mValue, ARRAY_SIZEU(mValue))
|
||||
, mValue()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2,17 +2,18 @@
|
||||
#define JSUPPORT_H
|
||||
|
||||
#include <dolphin.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jsupport
|
||||
*
|
||||
*/
|
||||
template <typename T>
|
||||
T* JSUConvertOffsetToPtr(const void* ptr, u32 offset) {
|
||||
T* JSUConvertOffsetToPtr(const void* ptr, uintptr_t offset) {
|
||||
if (offset == 0) {
|
||||
return NULL;
|
||||
} else {
|
||||
return (T*)((s32)ptr + (s32)offset);
|
||||
return (T*)((intptr_t)ptr + (intptr_t)offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +26,7 @@ T* JSUConvertOffsetToPtr(const void* ptr, const void* offset) {
|
||||
if (offset == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
return (T*)((s32)ptr + (s32)offset);
|
||||
return (T*)((intptr_t)ptr + (intptr_t)offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#define JUT_ASSERT_MSG_F(LINE, COND, MSG, ...) \
|
||||
(COND) ? (void)0 : (JUTAssertion::showAssert_f(JUTAssertion::getSDevice(), __FILE__, LINE, MSG, __VA_ARGS__), OSPanic(__FILE__, LINE, "Halt"));
|
||||
|
||||
#define J3D_ASSERT(LINE, COND, MSG) JUT_ASSERT_MSG(LINE, (COND) != 0, MSG)
|
||||
#define J3D_PANIC(LINE, COND, MSG) ((COND) != 0 || (OSPanic(__FILE__, LINE, MSG), 0));
|
||||
|
||||
#define JUT_PANIC(LINE, TEXT) \
|
||||
@@ -36,7 +35,6 @@
|
||||
#define JUT_ASSERT(...) (void)0;
|
||||
#define JUT_ASSERT_MSG(...) (void)0;
|
||||
#define JUT_ASSERT_MSG_F(...) (void)0;
|
||||
#define J3D_ASSERT(...) (void)0;
|
||||
#define J3D_PANIC(...) (void)0;
|
||||
#define JUT_PANIC(...)
|
||||
#define JUT_WARN(...)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define JUTTEXTURE_H
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
#include <stdint.h>
|
||||
|
||||
class JUTPalette;
|
||||
|
||||
@@ -24,7 +25,7 @@ struct ResTIMG {
|
||||
/* 0x08 */ u8 indexTexture;
|
||||
/* 0x09 */ u8 colorFormat;
|
||||
/* 0x0A */ u16 numColors;
|
||||
/* 0x0C */ u32 paletteOffset;
|
||||
/* 0x0C */ uintptr_t paletteOffset;
|
||||
/* 0x10 */ u8 mipmapEnabled;
|
||||
/* 0x11 */ u8 doEdgeLOD;
|
||||
/* 0x12 */ u8 biasClamp;
|
||||
@@ -36,7 +37,7 @@ struct ResTIMG {
|
||||
/* 0x18 */ u8 mipmapCount;
|
||||
/* 0x19 */ u8 unknown;
|
||||
/* 0x1A */ s16 LODBias;
|
||||
/* 0x1C */ u32 imageOffset;
|
||||
/* 0x1C */ uintptr_t imageOffset;
|
||||
}; // Size: 0x20
|
||||
|
||||
/**
|
||||
|
||||
@@ -4332,7 +4332,7 @@ public:
|
||||
/* 0x032C0 */ s16 field_0x32c0[2];
|
||||
/* 0x032C4 */ u16 field_0x32c4[2];
|
||||
/* 0x032C8 */ u32 field_0x32c8;
|
||||
/* 0x032CC */ u32 field_0x32cc;
|
||||
/* 0x032CC */ uintptr_t field_0x32cc;
|
||||
/* 0x032D0 */ u32 field_0x32d0;
|
||||
/* 0x032D4 */ u32 field_0x32d4;
|
||||
/* 0x032D8 */ firePointEff_c field_0x32d8[4];
|
||||
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
class dDlst_shadowRealPoly_c : public dDlst_shadowPoly_c {
|
||||
public:
|
||||
/* 800569A0 */ virtual dDlst_shadowTri_c* getTri() { return mShadowTri; }
|
||||
/* 800569A8 */ virtual s32 getTriMax() { return ARRAY_SIZE(mShadowTri); }
|
||||
/* 800569A8 */ virtual s32 getTriMax() { return ARRAY_SIZEU(mShadowTri); }
|
||||
|
||||
/* 0x8 */ dDlst_shadowTri_c mShadowTri[256];
|
||||
};
|
||||
@@ -346,8 +346,8 @@ public:
|
||||
J3DDrawBuffer* getOpaListBG() { return mDrawBuffers[DB_OPA_LIST_BG]; }
|
||||
J3DDrawBuffer* getOpaListDark() { return mDrawBuffers[DB_OPA_LIST_DARK]; }
|
||||
J3DDrawBuffer* getXluListBG() { return mDrawBuffers[DB_XLU_LIST_BG]; }
|
||||
void setXluDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, J3DSys_XLU_BUFFER_e); }
|
||||
void setOpaDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, J3DSys_OPA_BUFFER_e); }
|
||||
void setXluDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, J3DSysDrawBuf_Xlu); }
|
||||
void setOpaDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, J3DSysDrawBuf_Opa); }
|
||||
void setXluListSky() { setXluDrawList(mDrawBuffers[DB_XLU_LIST_SKY]); }
|
||||
void setOpaListSky() { setOpaDrawList(mDrawBuffers[DB_OPA_LIST_SKY]); }
|
||||
void setXluListDark() { setXluDrawList(mDrawBuffers[DB_XLU_LIST_DARK]); }
|
||||
|
||||
+12
-12
@@ -81,50 +81,50 @@ public:
|
||||
static int syncAllRes(dRes_info_c* i_resInfo, int i_infoNum);
|
||||
|
||||
int setObjectRes(const char* i_arcName, u8 i_mountDirection, JKRHeap* i_heap) {
|
||||
return setRes(i_arcName, mObjectInfo, ARRAY_SIZE(mObjectInfo), "/res/Object/", i_mountDirection,
|
||||
return setRes(i_arcName, mObjectInfo, ARRAY_SIZEU(mObjectInfo), "/res/Object/", i_mountDirection,
|
||||
i_heap);
|
||||
}
|
||||
|
||||
void* getObjectRes(const char* i_arcName, const char* resName) {
|
||||
return getRes(i_arcName, resName, mObjectInfo, ARRAY_SIZE(mObjectInfo));
|
||||
return getRes(i_arcName, resName, mObjectInfo, ARRAY_SIZEU(mObjectInfo));
|
||||
}
|
||||
|
||||
void* getObjectRes(const char* i_arcName, s32 i_index) {
|
||||
return getRes(i_arcName, i_index, mObjectInfo, ARRAY_SIZE(mObjectInfo));
|
||||
return getRes(i_arcName, i_index, mObjectInfo, ARRAY_SIZEU(mObjectInfo));
|
||||
}
|
||||
|
||||
void* getObjectIDRes(const char* i_arcName, u16 i_resID) {
|
||||
return getIDRes(i_arcName, i_resID, mObjectInfo, ARRAY_SIZE(mObjectInfo));
|
||||
return getIDRes(i_arcName, i_resID, mObjectInfo, ARRAY_SIZEU(mObjectInfo));
|
||||
}
|
||||
|
||||
int syncObjectRes(const char* i_arcName) {
|
||||
return syncRes(i_arcName, mObjectInfo, ARRAY_SIZE(mObjectInfo));
|
||||
return syncRes(i_arcName, mObjectInfo, ARRAY_SIZEU(mObjectInfo));
|
||||
}
|
||||
|
||||
int syncStageRes(const char* i_arcName) {
|
||||
return syncRes(i_arcName, mStageInfo, ARRAY_SIZE(mStageInfo));
|
||||
return syncRes(i_arcName, mStageInfo, ARRAY_SIZEU(mStageInfo));
|
||||
}
|
||||
|
||||
int syncAllObjectRes() { return syncAllRes(mObjectInfo, ARRAY_SIZE(mObjectInfo)); }
|
||||
int syncAllObjectRes() { return syncAllRes(mObjectInfo, ARRAY_SIZEU(mObjectInfo)); }
|
||||
|
||||
int deleteObjectRes(const char* i_arcName) {
|
||||
return deleteRes(i_arcName, mObjectInfo, ARRAY_SIZE(mObjectInfo));
|
||||
return deleteRes(i_arcName, mObjectInfo, ARRAY_SIZEU(mObjectInfo));
|
||||
}
|
||||
|
||||
int deleteStageRes(const char* i_arcName) {
|
||||
return deleteRes(i_arcName, mStageInfo, ARRAY_SIZE(mStageInfo));
|
||||
return deleteRes(i_arcName, mStageInfo, ARRAY_SIZEU(mStageInfo));
|
||||
}
|
||||
|
||||
void* getStageRes(const char* i_arcName, const char* i_resName) {
|
||||
return getRes(i_arcName, i_resName, mStageInfo, ARRAY_SIZE(mStageInfo));
|
||||
return getRes(i_arcName, i_resName, mStageInfo, ARRAY_SIZEU(mStageInfo));
|
||||
}
|
||||
|
||||
dRes_info_c* getObjectResInfo(const char* i_arcName) {
|
||||
return getResInfo(i_arcName, mObjectInfo, ARRAY_SIZE(mObjectInfo));
|
||||
return getResInfo(i_arcName, mObjectInfo, ARRAY_SIZEU(mObjectInfo));
|
||||
}
|
||||
|
||||
dRes_info_c* getStageResInfo(const char* i_arcName) {
|
||||
return getResInfo(i_arcName, mStageInfo, ARRAY_SIZE(mStageInfo));
|
||||
return getResInfo(i_arcName, mStageInfo, ARRAY_SIZEU(mStageInfo));
|
||||
}
|
||||
|
||||
/* 0x0000 */ dRes_info_c mObjectInfo[128];
|
||||
|
||||
+2
-1
@@ -23,7 +23,8 @@
|
||||
|
||||
#define ALIGN_DECL(ALIGNMENT) __attribute__((aligned(ALIGNMENT)))
|
||||
|
||||
#define ARRAY_SIZE(o) (sizeof((o)) / sizeof(*(o)))
|
||||
#define ARRAY_SIZE(o) (s32)(sizeof((o)) / sizeof(*(o)))
|
||||
#define ARRAY_SIZEU(o) (sizeof((o)) / sizeof(*(o)))
|
||||
|
||||
// Align X to the previous N bytes (N must be power of two)
|
||||
#define ALIGN_PREV(X, N) ((X) & ~((N)-1))
|
||||
|
||||
Reference in New Issue
Block a user