mirror of
https://github.com/zeldaret/tww.git
synced 2026-09-05 10:27:35 -04:00
Various J3D inline fixes
This commit is contained in:
@@ -138,7 +138,7 @@ inline void J3DGDSetZCompLoc(u32 compLocEnable) {
|
||||
}
|
||||
|
||||
inline void J3DGDSetTevKonstantSel_SwapModeTable(GXTevStageID stage, GXTevKColorSel colorSel1, GXTevKAlphaSel alphaSel1, GXTevKColorSel colorSel2, GXTevKAlphaSel alphaSel2, GXTevColorChan chan1, GXTevColorChan chan2) {
|
||||
J3DGDWriteBPCmd((stage / 2 + 0xF6) << 24 | (chan1 | chan2 << 2 | colorSel1 << 4 | alphaSel1 << 9 | colorSel2 << 14 | alphaSel2 << 19) & 0x00FFFFFF);
|
||||
J3DGDWriteBPCmd((stage / 2 + 0xF6) << 24 | ((chan1 | chan2 << 2 | colorSel1 << 4 | alphaSel1 << 9 | colorSel2 << 14 | alphaSel2 << 19) & 0x00FFFFFF));
|
||||
}
|
||||
|
||||
#endif /* J3DGD_H */
|
||||
|
||||
@@ -619,6 +619,15 @@ struct J3DZMode {
|
||||
J3DZMode() { mZModeID = j3dDefaultZModeID; }
|
||||
explicit J3DZMode(const J3DZModeInfo& info) { setZModeInfo(info); }
|
||||
|
||||
J3DZMode& operator=(u16 zModeID) {
|
||||
mZModeID = zModeID;
|
||||
return *this;
|
||||
}
|
||||
J3DZMode& operator=(const J3DZMode& other) {
|
||||
mZModeID = other.mZModeID;
|
||||
return *this;
|
||||
}
|
||||
|
||||
u8 getCompareEnable() const { return j3dZModeTable[mZModeID * 3 + 0]; }
|
||||
u8 getFunc() const { return j3dZModeTable[mZModeID * 3 + 1]; }
|
||||
u8 getUpdateEnable() const { return j3dZModeTable[mZModeID * 3 + 2]; }
|
||||
@@ -639,13 +648,22 @@ struct J3DZMode {
|
||||
mZModeID = calcZModeID(j3dZModeTable[mZModeID * 3], j3dZModeTable[mZModeID * 3 + 1], i_enable);
|
||||
}
|
||||
|
||||
// void operator==(J3DZMode&) {}
|
||||
|
||||
private:
|
||||
/* 0x0 */ u16 mZModeID;
|
||||
};
|
||||
|
||||
struct J3DBlend : public J3DBlendInfo {
|
||||
J3DBlend() { *(J3DBlendInfo*)this = j3dDefaultBlendInfo; }
|
||||
explicit J3DBlend(const J3DBlendInfo& info) { *(J3DBlendInfo*)this = info; }
|
||||
void setBlendInfo(const J3DBlendInfo& info) { *(J3DBlendInfo*)this = info; }
|
||||
J3DBlend() {
|
||||
J3DBlendInfo::operator=(j3dDefaultBlendInfo);
|
||||
}
|
||||
explicit J3DBlend(const J3DBlendInfo& info) {
|
||||
J3DBlendInfo::operator=(info);
|
||||
}
|
||||
void setBlendInfo(const J3DBlendInfo& info) {
|
||||
J3DBlendInfo::operator=(info);
|
||||
}
|
||||
|
||||
GXBlendMode getType() const { return (GXBlendMode)mBlendMode; }
|
||||
void setType(u8 i_type) { mBlendMode = i_type; }
|
||||
@@ -655,8 +673,8 @@ struct J3DBlend : public J3DBlendInfo {
|
||||
void setDstFactor(u8 i_dst) { mDstFactor = i_dst; }
|
||||
GXLogicOp getOp() const { return (GXLogicOp)mLogicOp; }
|
||||
|
||||
void load(u8 ditherEnable) {
|
||||
J3DGDSetBlendMode(getType(), getSrcFactor(), getDstFactor(), getOp(), ditherEnable);
|
||||
void load(u8 ditherEnable) const {
|
||||
J3DGDSetBlendMode((GXBlendMode)mBlendMode, (GXBlendFactor)mSrcFactor, (GXBlendFactor)mDstFactor, (GXLogicOp)mLogicOp, ditherEnable);
|
||||
}
|
||||
|
||||
// void operator=(const J3DBlend&) {}
|
||||
@@ -698,7 +716,21 @@ struct J3DAlphaComp {
|
||||
mRef1 = info.mRef1;
|
||||
}
|
||||
|
||||
GXCompare getComp0() const { return GXCompare(j3dAlphaCmpTable[mAlphaCmpID * 3]); }
|
||||
J3DAlphaComp& operator=(u16 id) { mAlphaCmpID = id; return *this; }
|
||||
J3DAlphaComp& operator=(const J3DAlphaComp& rhs) {
|
||||
mAlphaCmpID = rhs.mAlphaCmpID;
|
||||
mRef0 = rhs.mRef0;
|
||||
mRef1 = rhs.mRef1;
|
||||
return *this;
|
||||
}
|
||||
J3DAlphaComp& operator=(J3DAlphaComp& rhs) {
|
||||
mAlphaCmpID = rhs.mAlphaCmpID;
|
||||
mRef0 = rhs.mRef0;
|
||||
mRef1 = rhs.mRef1;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GXCompare getComp0() const { return GXCompare(j3dAlphaCmpTable[mAlphaCmpID * 3 + 0]); }
|
||||
GXAlphaOp getOp() const { return GXAlphaOp(j3dAlphaCmpTable[mAlphaCmpID * 3 + 1]); }
|
||||
GXCompare getComp1() const { return GXCompare(j3dAlphaCmpTable[mAlphaCmpID * 3 + 2]); }
|
||||
u8 getRef0() const { return mRef0; }
|
||||
@@ -710,10 +742,17 @@ struct J3DAlphaComp {
|
||||
mRef1 = info.mRef1;
|
||||
}
|
||||
|
||||
void load() {
|
||||
J3DGDSetAlphaCompare(getComp0(), getRef0(), getOp(), getComp1(), getRef1());
|
||||
void load() const {
|
||||
J3DGDSetAlphaCompare(getComp0(), mRef0, getOp(), getComp1(), mRef1);
|
||||
}
|
||||
|
||||
// void operator!=(unsigned short) {}
|
||||
// void operator=(J3DAlphaComp&) {}
|
||||
// void operator=(const J3DAlphaComp&) {}
|
||||
// void operator=(unsigned short) {}
|
||||
// void operator==(J3DAlphaComp&) {}
|
||||
|
||||
private:
|
||||
/* 0x00 */ u16 mAlphaCmpID;
|
||||
/* 0x02 */ u8 mRef0;
|
||||
/* 0x03 */ u8 mRef1;
|
||||
@@ -866,8 +905,12 @@ public:
|
||||
};
|
||||
|
||||
struct J3DIndTexCoordScale : public J3DIndTexCoordScaleInfo {
|
||||
J3DIndTexCoordScale() { *(J3DIndTexCoordScaleInfo*)this = j3dDefaultIndTexCoordScaleInfo; }
|
||||
explicit J3DIndTexCoordScale(const J3DIndTexCoordScaleInfo& info) {*(J3DIndTexCoordScaleInfo*)this = info; }
|
||||
J3DIndTexCoordScale() {
|
||||
J3DIndTexCoordScaleInfo::operator=(j3dDefaultIndTexCoordScaleInfo);
|
||||
}
|
||||
explicit J3DIndTexCoordScale(const J3DIndTexCoordScaleInfo& info) {
|
||||
J3DIndTexCoordScaleInfo::operator=(info);
|
||||
}
|
||||
~J3DIndTexCoordScale() {}
|
||||
|
||||
u8 getScaleS() { return mScaleS; }
|
||||
@@ -875,8 +918,12 @@ struct J3DIndTexCoordScale : public J3DIndTexCoordScaleInfo {
|
||||
};
|
||||
|
||||
struct J3DIndTexMtx : public J3DIndTexMtxInfo {
|
||||
J3DIndTexMtx() {*(J3DIndTexMtxInfo*)this = j3dDefaultIndTexMtxInfo; }
|
||||
explicit J3DIndTexMtx(const J3DIndTexMtxInfo& info) { *(J3DIndTexMtxInfo*)this = info; }
|
||||
J3DIndTexMtx() {
|
||||
J3DIndTexMtxInfo::operator=(j3dDefaultIndTexMtxInfo);
|
||||
}
|
||||
explicit J3DIndTexMtx(const J3DIndTexMtxInfo& info) {
|
||||
J3DIndTexMtxInfo::operator=(info);
|
||||
}
|
||||
~J3DIndTexMtx() {}
|
||||
|
||||
void load(u32 id) const {
|
||||
@@ -897,8 +944,16 @@ struct J3DIndTexMtx : public J3DIndTexMtxInfo {
|
||||
}; // Size: 0x1C
|
||||
|
||||
struct J3DIndTexOrder : public J3DIndTexOrderInfo {
|
||||
J3DIndTexOrder() { *(J3DIndTexOrderInfo*)this = j3dDefaultIndTexOrderNull; }
|
||||
explicit J3DIndTexOrder(const J3DIndTexOrderInfo& info) { *(J3DIndTexOrderInfo*)this = info; }
|
||||
J3DIndTexOrder() {
|
||||
J3DIndTexOrderInfo::operator=(j3dDefaultIndTexOrderNull);
|
||||
}
|
||||
explicit J3DIndTexOrder(const J3DIndTexOrderInfo& info) {
|
||||
J3DIndTexOrderInfo::operator=(info);
|
||||
}
|
||||
J3DIndTexOrder& operator=(const J3DIndTexOrder& other) {
|
||||
J3DIndTexOrderInfo::operator=(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
u8 getCoord() { return mCoord; }
|
||||
u8 getMap() { return mMap; }
|
||||
|
||||
@@ -106,6 +106,7 @@ struct J3DIndTexMtxInfo {
|
||||
}
|
||||
mScaleExp = other.mScaleExp;
|
||||
}
|
||||
|
||||
/* 0x00 */ Mtx23 mOffsetMtx;
|
||||
/* 0x18 */ s8 mScaleExp;
|
||||
}; // Size: 0x1C
|
||||
@@ -203,6 +204,12 @@ struct J3DIndTevStageInfo {
|
||||
};
|
||||
|
||||
struct J3DTexCoordInfo {
|
||||
void operator=(const J3DTexCoordInfo& other) {
|
||||
mTexGenType = other.mTexGenType;
|
||||
mTexGenSrc = other.mTexGenSrc;
|
||||
mTexGenMtx = other.mTexGenMtx;
|
||||
}
|
||||
|
||||
/* 0x0 */ u8 mTexGenType ALIGN_DECL(4);
|
||||
/* 0x1 */ u8 mTexGenSrc;
|
||||
/* 0x2 */ u8 mTexGenMtx;
|
||||
|
||||
@@ -51,26 +51,26 @@ struct J3DTevStage {
|
||||
}
|
||||
|
||||
void setTevColorOp(u8 param_1, u8 param_2, u8 param_3, u8 param_4, u8 param_5) {
|
||||
mTevColorOp = mTevColorOp & ~(0x01 << 2) | param_1 << 2;
|
||||
mTevColorOp = (mTevColorOp & ~(0x01 << 2)) | param_1 << 2;
|
||||
if (param_1 <= 1) {
|
||||
mTevColorOp = mTevColorOp & ~(0x03 << 4) | param_3 << 4;
|
||||
mTevColorOp = mTevColorOp & ~0x03 | param_2;
|
||||
mTevColorOp = (mTevColorOp & ~(0x03 << 4)) | param_3 << 4;
|
||||
mTevColorOp = (mTevColorOp & ~0x03) | param_2;
|
||||
} else {
|
||||
mTevColorOp = mTevColorOp & ~(0x03 << 4) | (param_1 >> 1 & 3) << 4;
|
||||
mTevColorOp = mTevColorOp & ~0x03 | 3;
|
||||
mTevColorOp = (mTevColorOp & ~(0x03 << 4)) | (param_1 >> 1 & 3) << 4;
|
||||
mTevColorOp = (mTevColorOp & ~0x03) | 3;
|
||||
}
|
||||
mTevColorOp = mTevColorOp & ~(0x01 << 3) | param_4 << 3;
|
||||
mTevColorOp = mTevColorOp & ~(0x03 << 6) | param_5 << 6;
|
||||
mTevColorOp = (mTevColorOp & ~(0x01 << 3)) | param_4 << 3;
|
||||
mTevColorOp = (mTevColorOp & ~(0x03 << 6)) | param_5 << 6;
|
||||
}
|
||||
void setTevColorAB(u8 a, u8 b) { mTevColorAB = a << 4 | b; }
|
||||
void setTevColorCD(u8 c, u8 d) { mTevColorCD = c << 4 | d; }
|
||||
void setAlphaA(u8 a) { mTevAlphaAB = mTevAlphaAB & ~(0x07 << 5) | a << 5; }
|
||||
void setAlphaB(u8 b) { mTevAlphaAB = mTevAlphaAB & ~(0x07 << 2) | b << 2; }
|
||||
void setAlphaA(u8 a) { mTevAlphaAB = (mTevAlphaAB & ~(0x07 << 5)) | a << 5; }
|
||||
void setAlphaB(u8 b) { mTevAlphaAB = (mTevAlphaAB & ~(0x07 << 2)) | b << 2; }
|
||||
void setAlphaC(u8 c) {
|
||||
mTevAlphaAB = mTevAlphaAB & ~0x03 | c >> 1;
|
||||
mTevSwapModeInfo = mTevSwapModeInfo & ~(0x01 << 7) | c << 7;
|
||||
mTevAlphaAB = (mTevAlphaAB & ~0x03) | c >> 1;
|
||||
mTevSwapModeInfo = (mTevSwapModeInfo & ~(0x01 << 7)) | c << 7;
|
||||
}
|
||||
void setAlphaD(u8 d) { mTevSwapModeInfo = mTevSwapModeInfo & ~(0x07 << 4) | d << 4; }
|
||||
void setAlphaD(u8 d) { mTevSwapModeInfo = (mTevSwapModeInfo & ~(0x07 << 4)) | d << 4; }
|
||||
void setAlphaABCD(u8 a, u8 b, u8 c, u8 d) {
|
||||
setAlphaA(a);
|
||||
setAlphaB(b);
|
||||
@@ -78,16 +78,16 @@ struct J3DTevStage {
|
||||
setAlphaD(d);
|
||||
}
|
||||
void setTevAlphaOp(u8 param_1, u8 param_2, u8 param_3, u8 param_4, u8 param_5) {
|
||||
mTevAlphaOp = mTevAlphaOp & ~(0x01 << 2) | param_1 << 2;
|
||||
mTevAlphaOp = (mTevAlphaOp & ~(0x01 << 2)) | param_1 << 2;
|
||||
if (param_1 <= 1) {
|
||||
mTevAlphaOp = mTevAlphaOp & ~0x03 | param_2;
|
||||
mTevAlphaOp = mTevAlphaOp & ~(0x03 << 4) | param_3 << 4;
|
||||
mTevAlphaOp = (mTevAlphaOp & ~0x03) | param_2;
|
||||
mTevAlphaOp = (mTevAlphaOp & ~(0x03 << 4)) | param_3 << 4;
|
||||
} else {
|
||||
mTevAlphaOp = mTevAlphaOp & ~(0x03 << 4) | (param_1 >> 1 & 3) << 4;
|
||||
mTevAlphaOp = mTevAlphaOp & ~0x03 | 3;
|
||||
mTevAlphaOp = (mTevAlphaOp & ~(0x03 << 4)) | (param_1 >> 1 & 3) << 4;
|
||||
mTevAlphaOp = (mTevAlphaOp & ~0x03) | 3;
|
||||
}
|
||||
mTevAlphaOp = mTevAlphaOp & ~(0x01 << 3) | param_4 << 3;
|
||||
mTevAlphaOp = mTevAlphaOp & ~(0x03 << 6) | param_5 << 6;
|
||||
mTevAlphaOp = (mTevAlphaOp & ~(0x01 << 3)) | param_4 << 3;
|
||||
mTevAlphaOp = (mTevAlphaOp & ~(0x03 << 6)) | param_5 << 6;
|
||||
}
|
||||
void setTevStageInfo(const J3DTevStageInfo& info) {
|
||||
setTevColorOp(info.field_0x5, info.field_0x6, info.field_0x7, info.field_0x8, info.field_0x9);
|
||||
@@ -97,18 +97,48 @@ struct J3DTevStage {
|
||||
setTevAlphaOp(info.field_0xe, info.field_0xf, info.field_0x10, info.field_0x11, info.field_0x12);
|
||||
}
|
||||
|
||||
void setTexSel(u8 param_0) { mTevSwapModeInfo = mTevSwapModeInfo & ~0x0C | param_0 << 2; }
|
||||
void setRasSel(u8 param_0) { mTevSwapModeInfo = mTevSwapModeInfo & ~0x03 | param_0; }
|
||||
void setTexSel(u8 param_0) { mTevSwapModeInfo = (mTevSwapModeInfo & ~0x0C) | param_0 << 2; }
|
||||
void setRasSel(u8 param_0) { mTevSwapModeInfo = (mTevSwapModeInfo & ~0x03) | param_0; }
|
||||
void setTevSwapModeInfo(const J3DTevSwapModeInfo& info) {
|
||||
setTexSel(info.mTexSel);
|
||||
setRasSel(info.mRasSel);
|
||||
}
|
||||
|
||||
void setStageNo(u32 i) {
|
||||
mTevColorReg = GX_BP_REG_TEVCOLORCOMBINER0 + i * 2;
|
||||
mTevAlphaReg = GX_BP_REG_TEVALPHACOMBINER0 + i * 2;
|
||||
}
|
||||
|
||||
void load(u32) const {
|
||||
J3DGDWriteBPCmd(*(u32*)&mTevColorReg);
|
||||
J3DGDWriteBPCmd(*(u32*)&mTevAlphaReg);
|
||||
}
|
||||
|
||||
void getABias() const {}
|
||||
void getAClamp() const {}
|
||||
void getAOp() const {}
|
||||
void getAReg() const {}
|
||||
void getAScale() const {}
|
||||
void getAlphaA() const {}
|
||||
void getAlphaB() const {}
|
||||
void getAlphaC() const {}
|
||||
void getAlphaD() const {}
|
||||
void getCBias() const {}
|
||||
void getCClamp() const {}
|
||||
void getCOp() const {}
|
||||
void getCReg() const {}
|
||||
void getCScale() const {}
|
||||
void getColorA() const {}
|
||||
void getColorB() const {}
|
||||
void getColorC() const {}
|
||||
void getColorD() const {}
|
||||
void getRasSel() const {}
|
||||
void getTexSel() const {}
|
||||
|
||||
// void operator=(J3DTevStage&) {}
|
||||
// void operator==(J3DTevStage&) {}
|
||||
|
||||
private:
|
||||
/* 0x0 */ u8 mTevColorReg;
|
||||
/* 0x1 */ u8 mTevColorOp;
|
||||
/* 0x2 */ u8 mTevColorAB;
|
||||
@@ -130,15 +160,15 @@ struct J3DIndTevStage {
|
||||
setIndTevStageInfo(info);
|
||||
}
|
||||
|
||||
void setIndStage(u8 stage) { mInfo = mInfo & ~0x03 | stage; }
|
||||
void setIndFormat(u8 format) { mInfo = mInfo & ~0x0C | format << 2; }
|
||||
void setBiasSel(u8 sel) { mInfo = mInfo & ~0x70 | sel << 4; }
|
||||
void setAlphaSel(u8 sel) { mInfo = mInfo & ~0x0180 | sel << 7; }
|
||||
void setMtxSel(u8 sel) { mInfo = mInfo & ~0x1E00 | sel << 9; }
|
||||
void setWrapS(u8 wrap) { mInfo = mInfo & ~0xE000 | wrap << 13; }
|
||||
void setWrapT(u8 wrap) { mInfo = mInfo & ~0x070000 | wrap << 16; }
|
||||
void setLod(u8 lod) { mInfo = mInfo & ~0x080000 | lod << 19; }
|
||||
void setPrev(u8 prev) { mInfo = mInfo & ~0x100000 | prev << 20; }
|
||||
void setIndStage(u8 stage) { mInfo = (mInfo & ~0x03) | stage; }
|
||||
void setIndFormat(u8 format) { mInfo = (mInfo & ~0x0C) | format << 2; }
|
||||
void setBiasSel(u8 sel) { mInfo = (mInfo & ~0x70) | sel << 4; }
|
||||
void setAlphaSel(u8 sel) { mInfo = (mInfo & ~0x0180) | sel << 7; }
|
||||
void setMtxSel(u8 sel) { mInfo = (mInfo & ~0x1E00) | sel << 9; }
|
||||
void setWrapS(u8 wrap) { mInfo = (mInfo & ~0xE000) | wrap << 13; }
|
||||
void setWrapT(u8 wrap) { mInfo = (mInfo & ~0x070000) | wrap << 16; }
|
||||
void setLod(u8 lod) { mInfo = (mInfo & ~0x080000) | lod << 19; }
|
||||
void setPrev(u8 prev) { mInfo = (mInfo & ~0x100000) | prev << 20; }
|
||||
|
||||
void setIndTevStageInfo(const J3DIndTevStageInfo& info) {
|
||||
setIndStage(info.mIndStage);
|
||||
@@ -152,16 +182,40 @@ struct J3DIndTevStage {
|
||||
setAlphaSel(info.mAlphaSel);
|
||||
}
|
||||
|
||||
void load(u32 param_1) {
|
||||
void load(u32 param_1) const {
|
||||
J3DGDWriteBPCmd(mInfo | (param_1 + 16) << 24);
|
||||
}
|
||||
|
||||
void getAlphaSel() const {}
|
||||
void getBiasSel() const {}
|
||||
void getIndFormat() const {}
|
||||
void getIndStage() const {}
|
||||
void getLod() const {}
|
||||
void getMtxSel() const {}
|
||||
void getPrev() const {}
|
||||
void getWrapS() const {}
|
||||
void getWrapT() const {}
|
||||
|
||||
J3DIndTevStage& operator=(J3DIndTevStage& other) {
|
||||
mInfo = other.mInfo;
|
||||
return *this;
|
||||
}
|
||||
J3DIndTevStage& operator=(const J3DIndTevStage& other) {
|
||||
mInfo = other.mInfo;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x0 */ u32 mInfo;
|
||||
};
|
||||
|
||||
struct J3DTevOrder : public J3DTevOrderInfo {
|
||||
J3DTevOrder() { *(J3DTevOrderInfo*)this = j3dDefaultTevOrderInfoNull; }
|
||||
explicit J3DTevOrder(const J3DTevOrderInfo& info) { *(J3DTevOrderInfo*)this = info; }
|
||||
J3DTevOrder() {
|
||||
J3DTevOrderInfo::operator=(j3dDefaultTevOrderInfoNull);
|
||||
}
|
||||
explicit J3DTevOrder(const J3DTevOrderInfo& info) {
|
||||
J3DTevOrderInfo::operator=(info);
|
||||
}
|
||||
|
||||
J3DTevOrderInfo& getTevOrderInfo() { return *this; }
|
||||
u8 getTexMap() { return mTexMap; }
|
||||
@@ -175,11 +229,12 @@ struct J3DTevSwapModeTable {
|
||||
J3DTevSwapModeTable() { mIdx = j3dDefaultTevSwapTableID; }
|
||||
explicit J3DTevSwapModeTable(const J3DTevSwapModeTableInfo& info) { mIdx = calcTevSwapTableID(info.field_0x0, info.field_0x1, info.field_0x2, info.field_0x3); }
|
||||
|
||||
u8 getR() { return j3dTevSwapTableTable[mIdx * 4]; }
|
||||
u8 getG() { return j3dTevSwapTableTable[mIdx * 4 + 1]; }
|
||||
u8 getB() { return j3dTevSwapTableTable[mIdx * 4 + 2]; }
|
||||
u8 getA() { return j3dTevSwapTableTable[mIdx * 4 + 3]; }
|
||||
u8 getR() const { return j3dTevSwapTableTable[mIdx * 4]; }
|
||||
u8 getG() const { return j3dTevSwapTableTable[mIdx * 4 + 1]; }
|
||||
u8 getB() const { return j3dTevSwapTableTable[mIdx * 4 + 2]; }
|
||||
u8 getA() const { return j3dTevSwapTableTable[mIdx * 4 + 3]; }
|
||||
|
||||
private:
|
||||
/* 0x0 */ u8 mIdx;
|
||||
}; // Size: 0x1
|
||||
|
||||
@@ -199,8 +254,12 @@ public:
|
||||
}; // Size = 0x74
|
||||
|
||||
struct J3DNBTScale : public J3DNBTScaleInfo {
|
||||
J3DNBTScale() { *(J3DNBTScaleInfo*)this = j3dDefaultNBTScaleInfo; }
|
||||
explicit J3DNBTScale(const J3DNBTScaleInfo& info) { *(J3DNBTScaleInfo*)this = info; }
|
||||
J3DNBTScale() {
|
||||
J3DNBTScaleInfo::operator=(j3dDefaultNBTScaleInfo);
|
||||
}
|
||||
explicit J3DNBTScale(const J3DNBTScaleInfo& info) {
|
||||
J3DNBTScaleInfo::operator=(info);
|
||||
}
|
||||
Vec* getScale() { return &mScale; }
|
||||
};
|
||||
|
||||
|
||||
@@ -51,40 +51,46 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class J3DTexMtx {
|
||||
class J3DTexMtx : public J3DTexMtxInfo {
|
||||
public:
|
||||
J3DTexMtx() { mTexMtxInfo = j3dDefaultTexMtxInfo; }
|
||||
J3DTexMtx() { J3DTexMtxInfo::operator=(j3dDefaultTexMtxInfo); }
|
||||
J3DTexMtx(const J3DTexMtxInfo& info) {
|
||||
mTexMtxInfo = info;
|
||||
J3DTexMtxInfo::operator=(info);
|
||||
}
|
||||
~J3DTexMtx() {}
|
||||
void load(u32 texMtxID) const {
|
||||
GDOverflowCheck(53);
|
||||
J3DGDLoadTexMtxImm((Mtx&)mMtx, GX_TEXMTX0 + texMtxID * 3, (GXTexMtxType)mTexMtxInfo.mProjection);
|
||||
J3DGDLoadTexMtxImm((Mtx&)mMtx, GX_TEXMTX0 + texMtxID * 3, (GXTexMtxType)mProjection);
|
||||
};
|
||||
void calc();
|
||||
|
||||
J3DTexMtxInfo& getTexMtxInfo() { return mTexMtxInfo; }
|
||||
J3DTextureSRTInfo& getTextureSRT() { return mTexMtxInfo.mSRT;}
|
||||
J3DTexMtxInfo& getTexMtxInfo() { return *this; }
|
||||
J3DTextureSRTInfo& getTextureSRT() { return mSRT;}
|
||||
Mtx& getMtx() { return mMtx; }
|
||||
void setEffectMtx(Mtx effectMtx) { mTexMtxInfo.setEffectMtx(effectMtx); }
|
||||
void setEffectMtx(Mtx effectMtx) { J3DTexMtxInfo::setEffectMtx(effectMtx); }
|
||||
Mtx& getViewMtx() { return mViewMtx; }
|
||||
void setViewMtx(const Mtx viewMtx) { MTXCopy(viewMtx, mViewMtx); }
|
||||
void setViewMtx(Mtx viewMtx) { MTXCopy(viewMtx, mViewMtx); }
|
||||
|
||||
public:
|
||||
/* 0x00 */ J3DTexMtxInfo mTexMtxInfo;
|
||||
private:
|
||||
/* 0x64 */ Mtx mMtx;
|
||||
/* 0x94 */ Mtx mViewMtx;
|
||||
}; // Size: 0xC4
|
||||
|
||||
struct J3DTexCoord : public J3DTexCoordInfo {
|
||||
J3DTexCoord() { *(J3DTexCoordInfo*)this = j3dDefaultTexCoordInfo[0]; }
|
||||
J3DTexCoord(const J3DTexCoordInfo& info) { *(J3DTexCoordInfo*)this = info; }
|
||||
J3DTexCoord() {
|
||||
J3DTexCoordInfo::operator=(j3dDefaultTexCoordInfo[0]);
|
||||
}
|
||||
J3DTexCoord(const J3DTexCoordInfo& info) {
|
||||
J3DTexCoordInfo::operator=(info);
|
||||
}
|
||||
|
||||
u8 getTexGenType() const { return mTexGenType; }
|
||||
u8 getTexGenSrc() const { return mTexGenSrc; }
|
||||
u8 getTexGenMtx() const { return mTexGenMtx; }
|
||||
void setTexGenMtx(u8 v) { mTexGenMtx = v; }
|
||||
|
||||
// void operator=(const J3DTexCoord&) {}
|
||||
// void operator==(J3DTexCoord&) {}
|
||||
}; // Size: 0x4
|
||||
|
||||
#endif /* J3DTEXTURE_H */
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef GDGEOMETRY_H
|
||||
#define GDGEOMETRY_H
|
||||
|
||||
#include "dolphin/gx/GX.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -505,8 +506,6 @@ extern "C" {
|
||||
(u32)(p5) << 24 \
|
||||
)
|
||||
|
||||
typedef struct _GXVtxDescList GXVtxDescList;
|
||||
|
||||
void GDSetVtxDescv(GXVtxDescList*);
|
||||
void GDSetArray(GXAttr attr, void* data, u8 stride);
|
||||
void GDSetArrayRaw(GXAttr attr, u32 data, u8 stride);
|
||||
|
||||
@@ -118,8 +118,7 @@ void J3DTevBlockPatched::initialize() {
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mTexNo); i++)
|
||||
mTexNo[i] = 0xFFFF;
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mTevStage); i++) {
|
||||
mTevStage[i].mTevColorReg = 0xC0 + i * 2;
|
||||
mTevStage[i].mTevAlphaReg = 0xC1 + i * 2;
|
||||
mTevStage[i].setStageNo(i);
|
||||
}
|
||||
for (u32 i = 0; i < 3; i++)
|
||||
mTevColor[i] = j3dDefaultTevColor;
|
||||
@@ -135,8 +134,7 @@ void J3DTevBlockPatched::initialize() {
|
||||
/* 802DFABC-802DFAE4 .text initialize__12J3DTevBlock1Fv */
|
||||
void J3DTevBlock1::initialize() {
|
||||
mTexNo[0] = 0xFFFF;
|
||||
mTevStage[0].mTevColorReg = 0xC0;
|
||||
mTevStage[0].mTevAlphaReg = 0xC1;
|
||||
mTevStage[0].setStageNo(0);
|
||||
mTexNoOffset = 0;
|
||||
}
|
||||
|
||||
@@ -146,10 +144,8 @@ void J3DTevBlock2::initialize() {
|
||||
mTexNo[1] = 0xFFFF;
|
||||
mTevStageNum = 1;
|
||||
|
||||
mTevStage[0].mTevColorReg = 0xC0;
|
||||
mTevStage[0].mTevAlphaReg = 0xC1;
|
||||
mTevStage[1].mTevColorReg = 0xC2;
|
||||
mTevStage[1].mTevAlphaReg = 0xC3;
|
||||
mTevStage[0].setStageNo(0);
|
||||
mTevStage[1].setStageNo(1);
|
||||
mTevKColorSel[0] = GX_TEV_KCSEL_K0;
|
||||
mTevKColorSel[1] = GX_TEV_KCSEL_K0;
|
||||
mTevKAlphaSel[0] = GX_TEV_KASEL_K0_A;
|
||||
@@ -171,14 +167,10 @@ void J3DTevBlock4::initialize() {
|
||||
mTexNo[3] = 0xFFFF;
|
||||
mTevStageNum = 1;
|
||||
|
||||
mTevStage[0].mTevColorReg = 0xC0;
|
||||
mTevStage[0].mTevAlphaReg = 0xC1;
|
||||
mTevStage[1].mTevColorReg = 0xC2;
|
||||
mTevStage[1].mTevAlphaReg = 0xC3;
|
||||
mTevStage[2].mTevColorReg = 0xC4;
|
||||
mTevStage[2].mTevAlphaReg = 0xC5;
|
||||
mTevStage[3].mTevColorReg = 0xC6;
|
||||
mTevStage[3].mTevAlphaReg = 0xC7;
|
||||
mTevStage[0].setStageNo(0);
|
||||
mTevStage[1].setStageNo(1);
|
||||
mTevStage[2].setStageNo(2);
|
||||
mTevStage[3].setStageNo(3);
|
||||
mTevKColorSel[0] = GX_TEV_KCSEL_K0;
|
||||
mTevKColorSel[1] = GX_TEV_KCSEL_K0;
|
||||
mTevKColorSel[2] = GX_TEV_KCSEL_K0;
|
||||
@@ -210,8 +202,7 @@ void J3DTevBlock16::initialize() {
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mTevKColorSel); i++)
|
||||
mTevKAlphaSel[i] = GX_TEV_KASEL_K0_A;
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mTevStage); i++) {
|
||||
mTevStage[i].mTevColorReg = 0xC0 + i * 2;
|
||||
mTevStage[i].mTevAlphaReg = 0xC1 + i * 2;
|
||||
mTevStage[i].setStageNo(i);
|
||||
}
|
||||
mTexNoOffset = 0;
|
||||
mTevRegOffset = 0;
|
||||
@@ -224,8 +215,8 @@ void J3DIndBlockFull::initialize() {
|
||||
|
||||
/* 802DFDFC-802DFE20 .text initialize__16J3DPEBlockFogOffFv */
|
||||
void J3DPEBlockFogOff::initialize() {
|
||||
mAlphaComp.mAlphaCmpID = 0xFFFF;
|
||||
mZMode.mZModeID = 0xFFFF;
|
||||
mAlphaComp = 0xFFFF;
|
||||
mZMode = 0xFFFF;
|
||||
mZCompLoc = 0xFF;
|
||||
mDither = 1;
|
||||
}
|
||||
@@ -233,8 +224,8 @@ void J3DPEBlockFogOff::initialize() {
|
||||
/* 802DFE20-802DFE50 .text initialize__14J3DPEBlockFullFv */
|
||||
void J3DPEBlockFull::initialize() {
|
||||
mFog = NULL;
|
||||
mAlphaComp.mAlphaCmpID = 0xFFFF;
|
||||
mZMode.mZModeID = 0xFFFF;
|
||||
mAlphaComp = 0xFFFF;
|
||||
mZMode = 0xFFFF;
|
||||
mZCompLoc = 0xFF;
|
||||
mDither = 1;
|
||||
mFogOffset = 0;
|
||||
@@ -577,8 +568,8 @@ void J3DTexGenBlockPatched::diffTexGen() {
|
||||
J3DGDWriteXFCmdHdr(0x1040, num);
|
||||
}
|
||||
for (u32 i = 0; i < num; ++i) {
|
||||
J3DGDSetTexCoordGen((GXTexGenType)mTexCoord[i].mTexGenType,
|
||||
(GXTexGenSrc)mTexCoord[i].mTexGenSrc);
|
||||
J3DGDSetTexCoordGen((GXTexGenType)mTexCoord[i].getTexGenType(),
|
||||
(GXTexGenSrc)mTexCoord[i].getTexGenSrc());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1803,13 +1794,13 @@ void J3DTexGenBlockPatched::calc(const Mtx modelMtx) {
|
||||
viewMtx[2][3] = 0.0f;
|
||||
mTexMtx[i]->setViewMtx(viewMtx);
|
||||
} else if (mode == J3DTexMtxMode_Projmap || mode == J3DTexMtxMode_ProjmapBasic) {
|
||||
mTexMtx[i]->setViewMtx(modelMtx);
|
||||
mTexMtx[i]->setViewMtx(const_cast<MtxP>(modelMtx));
|
||||
} else if (mode == J3DTexMtxMode_ViewProjmap || mode == J3DTexMtxMode_ViewProjmapBasic) {
|
||||
Mtx viewMtx;
|
||||
MTXConcat(j3dSys.getViewMtx(), modelMtx, viewMtx);
|
||||
mTexMtx[i]->setViewMtx(viewMtx);
|
||||
} else if (mode == J3DTexMtxMode_EnvmapOldEffectMtx || mode == J3DTexMtxMode_EnvmapEffectMtx || mode == J3DTexMtxMode_Unknown5) {
|
||||
mTexMtx[i]->setViewMtx(modelMtx);
|
||||
mTexMtx[i]->setViewMtx(const_cast<MtxP>(modelMtx));
|
||||
mTexMtx[i]->getViewMtx()[0][3] = 0.0f;
|
||||
mTexMtx[i]->getViewMtx()[1][3] = 0.0f;
|
||||
mTexMtx[i]->getViewMtx()[2][3] = 0.0f;
|
||||
@@ -1831,11 +1822,11 @@ void J3DTexGenBlockPatched::calc(const Mtx modelMtx) {
|
||||
viewMtx[2][3] = 0.0f;
|
||||
mTexMtx[i]->setViewMtx(viewMtx);
|
||||
} else if (mode == J3DTexMtxMode_Projmap || mode == J3DTexMtxMode_ProjmapBasic) {
|
||||
mTexMtx[i]->setViewMtx(j3dDefaultMtx);
|
||||
mTexMtx[i]->setViewMtx(const_cast<MtxP>(j3dDefaultMtx));
|
||||
} else if (mode == J3DTexMtxMode_ViewProjmap || mode == J3DTexMtxMode_ViewProjmapBasic) {
|
||||
mTexMtx[i]->setViewMtx(j3dSys.getViewMtx());
|
||||
} else if (mode == J3DTexMtxMode_EnvmapOldEffectMtx || mode == J3DTexMtxMode_EnvmapEffectMtx || mode == J3DTexMtxMode_Unknown5) {
|
||||
mTexMtx[i]->setViewMtx(j3dDefaultMtx);
|
||||
mTexMtx[i]->setViewMtx(const_cast<MtxP>(j3dDefaultMtx));
|
||||
}
|
||||
|
||||
mTexMtx[i]->calc();
|
||||
|
||||
@@ -52,70 +52,70 @@ void J3DTexMtx::calc() {
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
};
|
||||
|
||||
u32 mode = mTexMtxInfo.mInfo & 0x7f;
|
||||
u32 extra = (mTexMtxInfo.mInfo >> 7) & 1;
|
||||
u32 mode = mInfo & 0x7f;
|
||||
u32 extra = (mInfo >> 7) & 1;
|
||||
|
||||
if (mode == J3DTexMtxMode_Projmap || mode == J3DTexMtxMode_ViewProjmap || mode == J3DTexMtxMode_EnvmapEffectMtx) {
|
||||
if (extra == 0) {
|
||||
J3DGetTextureMtx(mTexMtxInfo.mSRT, mTexMtxInfo.mCenter, mtx2);
|
||||
J3DGetTextureMtx(mSRT, mCenter, mtx2);
|
||||
} else if (extra == 1) {
|
||||
J3DGetTextureMtxMaya(mTexMtxInfo.mSRT, mtx2);
|
||||
J3DGetTextureMtxMaya(mSRT, mtx2);
|
||||
}
|
||||
MTXConcat(mtx2, qMtx, mtx2);
|
||||
J3DMtxProjConcat(mtx2, mTexMtxInfo.mEffectMtx, mtx1);
|
||||
J3DMtxProjConcat(mtx2, mEffectMtx, mtx1);
|
||||
MTXConcat(mtx1, mViewMtx, mMtx);
|
||||
} else if (mode == J3DTexMtxMode_Envmap) {
|
||||
if (extra == 0) {
|
||||
J3DGetTextureMtx(mTexMtxInfo.mSRT, mTexMtxInfo.mCenter, mtx1);
|
||||
J3DGetTextureMtx(mSRT, mCenter, mtx1);
|
||||
} else if (extra == 1) {
|
||||
J3DGetTextureMtxMaya(mTexMtxInfo.mSRT, mtx1);
|
||||
J3DGetTextureMtxMaya(mSRT, mtx1);
|
||||
}
|
||||
MTXConcat(mtx1, qMtx, mtx1);
|
||||
MTXConcat(mtx1, mViewMtx, mMtx);
|
||||
} else if (mode == J3DTexMtxMode_EnvmapOldEffectMtx) {
|
||||
if (extra == 0) {
|
||||
J3DGetTextureMtxOld(mTexMtxInfo.mSRT, mTexMtxInfo.mCenter, mtx2);
|
||||
J3DGetTextureMtxOld(mSRT, mCenter, mtx2);
|
||||
} else if (extra == 1) {
|
||||
J3DGetTextureMtxMayaOld(mTexMtxInfo.mSRT, mtx2);
|
||||
J3DGetTextureMtxMayaOld(mSRT, mtx2);
|
||||
}
|
||||
MTXConcat(mtx2, qMtx2, mtx2);
|
||||
J3DMtxProjConcat(mtx2, mTexMtxInfo.mEffectMtx, mtx1);
|
||||
J3DMtxProjConcat(mtx2, mEffectMtx, mtx1);
|
||||
MTXConcat(mtx1, mViewMtx, mMtx);
|
||||
} else if (mode == J3DTexMtxMode_EnvmapOld) {
|
||||
if (extra == 0) {
|
||||
J3DGetTextureMtxOld(mTexMtxInfo.mSRT, mTexMtxInfo.mCenter, mtx1);
|
||||
J3DGetTextureMtxOld(mSRT, mCenter, mtx1);
|
||||
} else if (extra == 1) {
|
||||
J3DGetTextureMtxMayaOld(mTexMtxInfo.mSRT, mtx1);
|
||||
J3DGetTextureMtxMayaOld(mSRT, mtx1);
|
||||
}
|
||||
MTXConcat(mtx1, qMtx2, mtx1);
|
||||
MTXConcat(mtx1, mViewMtx, mMtx);
|
||||
} else if (mode == J3DTexMtxMode_EnvmapBasic) {
|
||||
if (extra == 0) {
|
||||
J3DGetTextureMtxOld(mTexMtxInfo.mSRT, mTexMtxInfo.mCenter, mtx1);
|
||||
J3DGetTextureMtxOld(mSRT, mCenter, mtx1);
|
||||
} else if (extra == 1) {
|
||||
J3DGetTextureMtxMayaOld(mTexMtxInfo.mSRT, mtx1);
|
||||
J3DGetTextureMtxMayaOld(mSRT, mtx1);
|
||||
}
|
||||
MTXConcat(mtx1, mViewMtx, mMtx);
|
||||
} else if (mode == J3DTexMtxMode_ProjmapBasic || mode == J3DTexMtxMode_ViewProjmapBasic || mode == J3DTexMtxMode_Unknown5) {
|
||||
if (extra == 0) {
|
||||
J3DGetTextureMtxOld(mTexMtxInfo.mSRT, mTexMtxInfo.mCenter, mtx2);
|
||||
J3DGetTextureMtxOld(mSRT, mCenter, mtx2);
|
||||
} else if (extra == 1) {
|
||||
J3DGetTextureMtxMayaOld(mTexMtxInfo.mSRT, mtx2);
|
||||
J3DGetTextureMtxMayaOld(mSRT, mtx2);
|
||||
}
|
||||
J3DMtxProjConcat(mtx2, mTexMtxInfo.mEffectMtx, mtx1);
|
||||
J3DMtxProjConcat(mtx2, mEffectMtx, mtx1);
|
||||
MTXConcat(mtx1, mViewMtx, mMtx);
|
||||
} else if (mode == J3DTexMtxMode_Unknown4) {
|
||||
if (extra == 0) {
|
||||
J3DGetTextureMtxOld(mTexMtxInfo.mSRT, mTexMtxInfo.mCenter, mtx2);
|
||||
J3DGetTextureMtxOld(mSRT, mCenter, mtx2);
|
||||
} else if (extra == 1) {
|
||||
J3DGetTextureMtxMayaOld(mTexMtxInfo.mSRT, mtx2);
|
||||
J3DGetTextureMtxMayaOld(mSRT, mtx2);
|
||||
}
|
||||
J3DMtxProjConcat(mtx2, mTexMtxInfo.mEffectMtx, mMtx);
|
||||
J3DMtxProjConcat(mtx2, mEffectMtx, mMtx);
|
||||
} else {
|
||||
if (extra == 0) {
|
||||
J3DGetTextureMtxOld(mTexMtxInfo.mSRT, mTexMtxInfo.mCenter, mMtx);
|
||||
J3DGetTextureMtxOld(mSRT, mCenter, mMtx);
|
||||
} else if (extra == 1) {
|
||||
J3DGetTextureMtxMayaOld(mTexMtxInfo.mSRT, mMtx);
|
||||
J3DGetTextureMtxMayaOld(mSRT, mMtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ bool cCcD_DivideInfo::Chk(const cCcD_DivideInfo& other) const {
|
||||
|
||||
/* 80241428-80241558 .text SetArea__15cCcD_DivideAreaFRC8cM3dGAab */
|
||||
void cCcD_DivideArea::SetArea(const cM3dGAab& aabb) {
|
||||
*(cM3dGAab*)this = aabb;
|
||||
Set(aabb.GetMinP(), aabb.GetMaxP());
|
||||
mScaledXDiff = (GetMaxX() - GetMinX()) * 0.09090909f;
|
||||
mXDiffIsZero = cM3d_IsZero(mScaledXDiff);
|
||||
if (!mXDiffIsZero)
|
||||
|
||||
@@ -278,7 +278,7 @@ BOOL daShip_c::draw() {
|
||||
mDoMtx_stack_c::concat(MStack_50);
|
||||
mDoMtx_stack_c::revConcat(m02A8);
|
||||
m02A0->setEffectMtx(mDoMtx_stack_c::get());
|
||||
m02A4->mTexMtxInfo.mSRT.mTranslationX = m03D4;
|
||||
m02A4->mSRT.mTranslationX = m03D4;
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user