mirror of
https://github.com/zeldaret/tww.git
synced 2026-08-14 04:23:01 -04:00
J3DMaterialFactory_v21 90%
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "dolphin/gx/GXEnum.h"
|
||||
#include "dolphin/gx/GXStruct.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMatBlock.h"
|
||||
|
||||
class J3DMaterial;
|
||||
struct J3DMaterialBlock_v21;
|
||||
@@ -26,6 +27,37 @@ class J3DDisplayListInit;
|
||||
class J3DPatchingInfo;
|
||||
class J3DCurrentMtxInfo;
|
||||
|
||||
struct J3DMaterialInitData_v21 {
|
||||
/* 0x000 */ u8 mMaterialMode;
|
||||
/* 0x001 */ u8 mCullModeIdx;
|
||||
/* 0x002 */ u8 mColorChanNumIdx;
|
||||
/* 0x003 */ u8 mTexGenNumIdx;
|
||||
/* 0x004 */ u8 mTevStageNumIdx;
|
||||
/* 0x005 */ u8 mZCompLocIdx;
|
||||
/* 0x006 */ u8 mZModeIdx;
|
||||
/* 0x007 */ u8 mDitherIdx;
|
||||
/* 0x008 */ u16 mMatColorIdx[2];
|
||||
/* 0x00C */ u16 mColorChanIdx[4];
|
||||
/* 0x014 */ u16 mTexCoordIdx[8];
|
||||
/* 0x024 */ u8 field_0x024[16];
|
||||
/* 0x034 */ u16 mTexMtxIdx[8];
|
||||
/* 0x044 */ u8 field_0x044[44];
|
||||
/* 0xXXX */ u16 mTexNoIdx[8];
|
||||
/* 0xXXX */ u16 mTevKColorIdx[4];
|
||||
/* 0xXXX */ u8 mTevKColorSel[16];
|
||||
/* 0xXXX */ u8 mTevKAlphaSel[16];
|
||||
/* 0xXXX */ u16 mTevOrderIdx[16];
|
||||
/* 0xXXX */ u16 mTevColorIdx[4];
|
||||
/* 0xXXX */ u16 mTevStageIdx[16];
|
||||
/* 0xXXX */ u16 mTevSwapModeIdx[16];
|
||||
/* 0xXXX */ u16 mTevSwapModeTableIdx[4];
|
||||
/* 0xXXX */ u8 field_0x12c[24];
|
||||
/* 0xXXX */ u16 mFogIdx;
|
||||
/* 0xXXX */ u16 mAlphaCompIdx;
|
||||
/* 0xXXX */ u16 mBlendIdx;
|
||||
/* 0xXXX */ u16 mNBTScaleIdx;
|
||||
};
|
||||
|
||||
class J3DMaterialFactory_v21 {
|
||||
public:
|
||||
J3DMaterialFactory_v21(const J3DMaterialBlock_v21&);
|
||||
@@ -33,60 +65,61 @@ public:
|
||||
u32 countTexGens(int) const;
|
||||
u32 countStages(int) const;
|
||||
J3DMaterial* create(J3DMaterial*, int, unsigned long) const;
|
||||
void newMatColor(int, int) const;
|
||||
void newColorChanNum(int) const;
|
||||
void newColorChan(int, int) const;
|
||||
void newTexGenNum(int) const;
|
||||
void newTexCoord(int, int) const;
|
||||
void newTexMtx(int, int) const;
|
||||
void newCullMode(int) const;
|
||||
void newTexNo(int, int) const;
|
||||
void newTevOrder(int, int) const;
|
||||
void newTevColor(int, int) const;
|
||||
void newTevKColor(int, int) const;
|
||||
void newTevStageNum(int) const;
|
||||
void newTevStage(int, int) const;
|
||||
void newTevSwapModeTable(int, int) const;
|
||||
void newFog(int) const;
|
||||
void newAlphaComp(int) const;
|
||||
void newBlend(int) const;
|
||||
void newZMode(int) const;
|
||||
void newZCompLoc(int) const;
|
||||
void newDither(int) const;
|
||||
void newNBTScale(int) const;
|
||||
J3DGXColor newMatColor(int, int) const;
|
||||
u8 newColorChanNum(int) const;
|
||||
J3DColorChan newColorChan(int, int) const;
|
||||
u32 newTexGenNum(int) const;
|
||||
J3DTexCoord newTexCoord(int, int) const;
|
||||
J3DTexMtx* newTexMtx(int, int) const;
|
||||
u8 newCullMode(int) const;
|
||||
u16 newTexNo(int, int) const;
|
||||
J3DTevOrder newTevOrder(int, int) const;
|
||||
J3DGXColorS10 newTevColor(int, int) const;
|
||||
J3DGXColor newTevKColor(int, int) const;
|
||||
u8 newTevStageNum(int) const;
|
||||
J3DTevStage newTevStage(int, int) const;
|
||||
J3DTevSwapModeTable newTevSwapModeTable(int, int) const;
|
||||
J3DFog* newFog(int) const;
|
||||
J3DAlphaComp newAlphaComp(int) const;
|
||||
J3DBlend newBlend(int) const;
|
||||
J3DZMode newZMode(int) const;
|
||||
u8 newZCompLoc(int) const;
|
||||
u8 newDither(int) const;
|
||||
J3DNBTScale newNBTScale(int) const;
|
||||
|
||||
u16 getMaterialID(int idx) const { return mpMaterialID[idx]; }
|
||||
void getMaterialMode(int) const {}
|
||||
u8 getMaterialMode(int idx) const { return mpMaterialInitData[getMaterialID(idx)].mMaterialMode; }
|
||||
|
||||
/* 0x00 */ u16 mMaterialNum;
|
||||
/* 0x04 */ J3DMaterialInitData_v21* field_0x04;
|
||||
/* 0x04 */ J3DMaterialInitData_v21* mpMaterialInitData;
|
||||
/* 0x08 */ u16* mpMaterialID;
|
||||
/* 0x0C */ GXColor* field_0x0c;
|
||||
/* 0x10 */ u8* field_0x10;
|
||||
/* 0x14 */ J3DColorChanInfo* field_0x14;
|
||||
/* 0x18 */ u8* field_0x18;
|
||||
/* 0x1C */ J3DTexCoordInfo* field_0x1c;
|
||||
/* 0x20 */ J3DTexCoord2Info* field_0x20;
|
||||
/* 0x24 */ J3DTexMtxInfo* field_0x24;
|
||||
/* 0x0C */ GXColor* mpMatColor;
|
||||
/* 0x10 */ u8* mpColorChanNum;
|
||||
/* 0x14 */ J3DColorChanInfo* mpColorChanInfo;
|
||||
/* 0x18 */ u8* mpTexGenNum;
|
||||
/* 0x1C */ J3DTexCoordInfo* mpTexCoordInfo;
|
||||
/* 0x20 */ J3DTexCoord2Info* mpTexCoord2Info;
|
||||
/* 0x24 */ J3DTexMtxInfo* mpTexMtxInfo;
|
||||
/* 0x28 */ J3DTexMtxInfo* field_0x28;
|
||||
/* 0x2C */ u16* field_0x2c;
|
||||
/* 0x30 */ GXCullMode* field_0x30;
|
||||
/* 0x34 */ J3DTevOrderInfo* field_0x34;
|
||||
/* 0x38 */ GXColorS10* field_0x38;
|
||||
/* 0x3C */ GXColor* field_0x3c;
|
||||
/* 0x40 */ u8* field_0x40;
|
||||
/* 0x44 */ J3DTevStageInfo* field_0x44;
|
||||
/* 0x48 */ J3DTevSwapModeTableInfo* field_0x48;
|
||||
/* 0x4C */ J3DFogInfo* field_0x4c;
|
||||
/* 0x50 */ J3DAlphaCompInfo* field_0x50;
|
||||
/* 0x54 */ J3DBlendInfo* field_0x54;
|
||||
/* 0x58 */ J3DZModeInfo* field_0x58;
|
||||
/* 0x5C */ u8* field_0x5c;
|
||||
/* 0x60 */ u8* field_0x60;
|
||||
/* 0x64 */ J3DNBTScaleInfo* field_0x64;
|
||||
/* 0x68 */ u16 field_0x68;
|
||||
/* 0x69 */ u8 field_0x69;
|
||||
/* 0x6A */ u8 field_0x6a;
|
||||
/* 0x2C */ u16* mpTexNo;
|
||||
/* 0x30 */ GXCullMode* mpCullMode;
|
||||
/* 0x34 */ J3DTevOrderInfo* mpTevOrderInfo;
|
||||
/* 0x38 */ GXColorS10* mpTevColor;
|
||||
/* 0x3C */ GXColor* mpTevKColor;
|
||||
/* 0x40 */ u8* mpTevStageNum;
|
||||
/* 0x44 */ J3DTevStageInfo* mpTevStageInfo;
|
||||
/* 0x48 */ J3DTevSwapModeInfo* mpTevSwapModeInfo;
|
||||
/* 0x4C */ J3DTevSwapModeTableInfo* mpTevSwapModeTableInfo;
|
||||
/* 0x50 */ J3DFogInfo* mpFogInfo;
|
||||
/* 0x54 */ J3DAlphaCompInfo* mpAlphaCompInfo;
|
||||
/* 0x58 */ J3DBlendInfo* mpBlendInfo;
|
||||
/* 0x5C */ J3DZModeInfo* mpZModeInfo;
|
||||
/* 0x60 */ u8* mpZCompLoc;
|
||||
/* 0x64 */ u8* mpDither;
|
||||
/* 0x68 */ J3DNBTScaleInfo* mpNBTScaleInfo;
|
||||
/* 0x6C */ u16 field_0x68;
|
||||
/* 0x6E */ u8 field_0x69;
|
||||
/* 0x6F */ u8 field_0x6a;
|
||||
};
|
||||
|
||||
#endif /* J3DMATERIALFACTORY_V21_H */
|
||||
|
||||
@@ -76,10 +76,33 @@ struct J3DMaterialBlock : public JUTDataBlockHeader {
|
||||
|
||||
struct J3DMaterialBlock_v21 : public JUTDataBlockHeader {
|
||||
/* 0x08 */ u16 mMaterialNum;
|
||||
/* 0x0C */ void* field_0x0c;
|
||||
/* 0x10 */ void* field_0x10;
|
||||
/* 0x0C */ void* mpMaterialInitData;
|
||||
/* 0x10 */ void* mpMaterialID;
|
||||
/* 0x14 */ void* mpNameTable;
|
||||
/* more */
|
||||
/* 0x18 */ void* mpCullMode;
|
||||
/* 0x1C */ void* mpMatColor;
|
||||
/* 0x20 */ void* mpColorChanNum;
|
||||
/* 0x24 */ void* mpColorChanInfo;
|
||||
/* 0x28 */ void* mpTexGenNum;
|
||||
/* 0x2C */ void* mpTexCoordInfo;
|
||||
/* 0x30 */ void* mpTexCoord2Info;
|
||||
/* 0x34 */ void* mpTexMtxInfo;
|
||||
/* 0x38 */ void* field_0x44;
|
||||
/* 0x3C */ void* mpTexNo;
|
||||
/* 0x40 */ void* mpTevOrderInfo;
|
||||
/* 0x44 */ void* mpTevColor;
|
||||
/* 0x48 */ void* mpTevKColor;
|
||||
/* 0x4C */ void* mpTevStageNum;
|
||||
/* 0x50 */ void* mpTevStageInfo;
|
||||
/* 0x54 */ void* mpTevSwapModeInfo;
|
||||
/* 0x58 */ void* mpTevSwapModeTableInfo;
|
||||
/* 0x68 */ void* mpFogInfo;
|
||||
/* 0x6C */ void* mpAlphaCompInfo;
|
||||
/* 0x70 */ void* mpBlendInfo;
|
||||
/* 0x74 */ void* mpZModeInfo;
|
||||
/* 0x78 */ void* mpZCompLoc;
|
||||
/* 0x7C */ void* mpDither;
|
||||
/* 0x80 */ void* mpNBTScaleInfo;
|
||||
};
|
||||
|
||||
struct J3DMaterialDLBlock : public JUTDataBlockHeader {
|
||||
|
||||
@@ -660,7 +660,6 @@ J3DBlend J3DMaterialFactory::newBlend(int idx) const {
|
||||
|
||||
/* 802F9444-802F94A4 .text newZMode__18J3DMaterialFactoryCFi */
|
||||
J3DZMode J3DMaterialFactory::newZMode(int idx) const {
|
||||
/* Nonmatching - J3DZModeInfo array seems to be 0x04-sized */
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mZModeIdx;
|
||||
if (no != 0xFF)
|
||||
return J3DZMode(mpZModeInfo[no]);
|
||||
|
||||
@@ -4,134 +4,368 @@
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMatBlock.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
|
||||
/* 802F9A88-802F9C68 .text __ct__22J3DMaterialFactory_v21FRC20J3DMaterialBlock_v21 */
|
||||
J3DMaterialFactory_v21::J3DMaterialFactory_v21(const J3DMaterialBlock_v21&) {
|
||||
/* Nonmatching */
|
||||
J3DMaterialFactory_v21::J3DMaterialFactory_v21(const J3DMaterialBlock_v21& block) {
|
||||
mMaterialNum = block.mMaterialNum;
|
||||
mpMaterialInitData = JSUConvertOffsetToPtr<J3DMaterialInitData_v21>(&block, block.mpMaterialInitData);
|
||||
mpMaterialID = JSUConvertOffsetToPtr<u16>(&block, block.mpMaterialID);
|
||||
|
||||
mpCullMode = JSUConvertOffsetToPtr<GXCullMode>(&block, block.mpCullMode);
|
||||
mpMatColor = JSUConvertOffsetToPtr<GXColor>(&block, block.mpMatColor);
|
||||
mpColorChanNum = JSUConvertOffsetToPtr<u8>(&block, block.mpColorChanNum);
|
||||
mpColorChanInfo = JSUConvertOffsetToPtr<J3DColorChanInfo>(&block, block.mpColorChanInfo);
|
||||
mpTexGenNum = JSUConvertOffsetToPtr<u8>(&block, block.mpTexGenNum);
|
||||
mpTexCoordInfo = JSUConvertOffsetToPtr<J3DTexCoordInfo>(&block, block.mpTexCoordInfo);
|
||||
mpTexCoord2Info = JSUConvertOffsetToPtr<J3DTexCoord2Info>(&block, block.mpTexCoord2Info);
|
||||
mpTexMtxInfo = JSUConvertOffsetToPtr<J3DTexMtxInfo>(&block, block.mpTexMtxInfo);
|
||||
field_0x28 = JSUConvertOffsetToPtr<J3DTexMtxInfo>(&block, block.field_0x44);
|
||||
mpTexNo = JSUConvertOffsetToPtr<u16>(&block, block.mpTexNo);
|
||||
mpTevOrderInfo = JSUConvertOffsetToPtr<J3DTevOrderInfo>(&block, block.mpTevOrderInfo);
|
||||
mpTevColor = JSUConvertOffsetToPtr<GXColorS10>(&block, block.mpTevColor);
|
||||
mpTevKColor = JSUConvertOffsetToPtr<GXColor>(&block, block.mpTevKColor);
|
||||
mpTevStageNum = JSUConvertOffsetToPtr<u8>(&block, block.mpTevStageNum);
|
||||
mpTevStageInfo = JSUConvertOffsetToPtr<J3DTevStageInfo>(&block, block.mpTevStageInfo);
|
||||
mpTevSwapModeInfo = JSUConvertOffsetToPtr<J3DTevSwapModeInfo>(&block, block.mpTevSwapModeInfo);
|
||||
mpTevSwapModeTableInfo = JSUConvertOffsetToPtr<J3DTevSwapModeTableInfo>(&block, block.mpTevSwapModeTableInfo);
|
||||
mpFogInfo = JSUConvertOffsetToPtr<J3DFogInfo>(&block, block.mpFogInfo);
|
||||
mpAlphaCompInfo = JSUConvertOffsetToPtr<J3DAlphaCompInfo>(&block, block.mpAlphaCompInfo);
|
||||
mpBlendInfo = JSUConvertOffsetToPtr<J3DBlendInfo>(&block, block.mpBlendInfo);
|
||||
mpZModeInfo = JSUConvertOffsetToPtr<J3DZModeInfo>(&block, block.mpZModeInfo);
|
||||
mpZCompLoc = JSUConvertOffsetToPtr<u8>(&block, block.mpZCompLoc);
|
||||
mpDither = JSUConvertOffsetToPtr<u8>(&block, block.mpDither);
|
||||
mpNBTScaleInfo = JSUConvertOffsetToPtr<J3DNBTScaleInfo>(&block, block.mpNBTScaleInfo);
|
||||
}
|
||||
|
||||
/* 802F9C68-802F9C8C .text countUniqueMaterials__22J3DMaterialFactory_v21Fv */
|
||||
u16 J3DMaterialFactory_v21::countUniqueMaterials() {
|
||||
/* Nonmatching */
|
||||
u16 num = 0;
|
||||
for (; num < mMaterialNum; num++)
|
||||
;
|
||||
return num;
|
||||
}
|
||||
|
||||
/* 802F9C8C-802F9CC4 .text countTexGens__22J3DMaterialFactory_v21CFi */
|
||||
u32 J3DMaterialFactory_v21::countTexGens(int) const {
|
||||
/* Nonmatching */
|
||||
u32 J3DMaterialFactory_v21::countTexGens(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mTexGenNumIdx;
|
||||
if (no != 0xFF)
|
||||
return mpTexGenNum[no];
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 802F9CC4-802F9D4C .text countStages__22J3DMaterialFactory_v21CFi */
|
||||
u32 J3DMaterialFactory_v21::countStages(int) const {
|
||||
/* Nonmatching */
|
||||
u32 J3DMaterialFactory_v21::countStages(int idx) const {
|
||||
J3DMaterialInitData_v21* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
|
||||
u32 texGenNum = 0;
|
||||
u32 tevStageNum = 0;
|
||||
|
||||
u8 no = initData->mTevStageNumIdx;
|
||||
if (no != 0xFF)
|
||||
tevStageNum = mpTevStageNum[no];
|
||||
|
||||
for (s32 i = 0; i < 8; i++)
|
||||
if (initData->mTexNoIdx[i] != 0xFFFF)
|
||||
texGenNum++;
|
||||
|
||||
if (tevStageNum != texGenNum && texGenNum != 0) {
|
||||
return tevStageNum > texGenNum ? tevStageNum : texGenNum;
|
||||
} else {
|
||||
return tevStageNum;
|
||||
}
|
||||
}
|
||||
|
||||
static inline u32 getMdlDataFlag_TevStageNum(u32 flag) { return (flag >> 16) & 0x1F; }
|
||||
static inline u32 getMdlDataFlag_TexGenFlag(u32 flag) { return flag & 0x0C000000; }
|
||||
static inline u32 getMdlDataFlag_PEFlag(u32 flag) { return flag & 0x30000000; }
|
||||
static inline u32 getMdlDataFlag_ColorFlag(u32 flag) { return flag & 0xC0000000; }
|
||||
|
||||
/* 802F9D4C-802FA4C0 .text create__22J3DMaterialFactory_v21CFP11J3DMaterialiUl */
|
||||
J3DMaterial* J3DMaterialFactory_v21::create(J3DMaterial*, int, unsigned long) const {
|
||||
/* Nonmatching */
|
||||
J3DMaterial* J3DMaterialFactory_v21::create(J3DMaterial* mat, int idx, u32 flag) const {
|
||||
/* Nonmatching - regalloc */
|
||||
|
||||
u32 stageNum = countStages(idx);
|
||||
u32 tevStageNum = (u32)getMdlDataFlag_TevStageNum(flag);
|
||||
|
||||
if (stageNum > tevStageNum)
|
||||
tevStageNum = stageNum;
|
||||
u32 texNum = tevStageNum > 8 ? 8 : tevStageNum;
|
||||
|
||||
u32 texGenNum = countTexGens(idx);
|
||||
u32 texGenFlag = texGenNum > 4 ? 0 : getMdlDataFlag_TexGenFlag(flag);
|
||||
u32 colorFlag = getMdlDataFlag_ColorFlag(flag);
|
||||
u32 peFlag = getMdlDataFlag_PEFlag(flag);
|
||||
bool indFlag = (flag & 0x01000000);
|
||||
|
||||
if (mat == NULL)
|
||||
mat = new J3DMaterial();
|
||||
|
||||
mat->mColorBlock = J3DMaterial::createColorBlock(colorFlag);
|
||||
mat->mTexGenBlock = J3DMaterial::createTexGenBlock(texGenFlag);
|
||||
mat->mTevBlock = J3DMaterial::createTevBlock((u16)tevStageNum);
|
||||
mat->mIndBlock = J3DMaterial::createIndBlock(indFlag);
|
||||
mat->mPEBlock = J3DMaterial::createPEBlock(peFlag, getMaterialMode(idx));
|
||||
mat->mIndex = idx;
|
||||
mat->mMaterialMode = getMaterialMode(idx);
|
||||
mat->mColorBlock->setColorChanNum(newColorChanNum(idx));
|
||||
mat->mColorBlock->setCullMode(newCullMode(idx));
|
||||
mat->mTexGenBlock->setTexGenNum(newTexGenNum(idx));
|
||||
mat->mTexGenBlock->setNBTScale(newNBTScale(idx));
|
||||
mat->mPEBlock->setFog(newFog(idx));
|
||||
mat->mPEBlock->setAlphaComp(newAlphaComp(idx));
|
||||
mat->mPEBlock->setBlend(newBlend(idx));
|
||||
mat->mPEBlock->setZMode(newZMode(idx));
|
||||
mat->mPEBlock->setZCompLoc(newZCompLoc(idx));
|
||||
mat->mPEBlock->setDither(newDither(idx));
|
||||
mat->mTevBlock->setTevStageNum(newTevStageNum(idx));
|
||||
|
||||
for (u8 i = 0; i < texNum; i++)
|
||||
mat->mTevBlock->setTexNo(i, newTexNo(idx, i));
|
||||
for (u8 i = 0; i < tevStageNum; i++)
|
||||
mat->mTevBlock->setTevOrder(i, newTevOrder(idx, i));
|
||||
for (u8 i = 0; i < tevStageNum; i++) {
|
||||
J3DMaterialInitData_v21* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
mat->mTevBlock->setTevStage(i, newTevStage(idx, i));
|
||||
if (initData->mTevSwapModeIdx[i] != 0xFFFF) {
|
||||
mat->mTevBlock->getTevStage(i)->setTexSel(mpTevSwapModeInfo[initData->mTevSwapModeIdx[i]].mTexSel);
|
||||
mat->mTevBlock->getTevStage(i)->setRasSel(mpTevSwapModeInfo[initData->mTevSwapModeIdx[i]].mRasSel);
|
||||
}
|
||||
}
|
||||
for (u8 i = 0; i < 4; i++)
|
||||
mat->mTevBlock->setTevKColor(i, newTevKColor(idx, i));
|
||||
for (u8 i = 0; i < 4; i++)
|
||||
mat->mTevBlock->setTevColor(i, newTevColor(idx, i));
|
||||
for (u8 i = 0; i < 4; i++)
|
||||
mat->mTevBlock->setTevSwapModeTable(i, newTevSwapModeTable(idx, i));
|
||||
for (u8 i = 0; i < 2; i++)
|
||||
mat->mColorBlock->setMatColor(i, newMatColor(idx, i));
|
||||
for (u8 i = 0; i < 4; i++) {
|
||||
J3DColorChan colorChan = newColorChan(idx, i);
|
||||
mat->mColorBlock->setColorChan(i, colorChan);
|
||||
}
|
||||
for (u8 i = 0; i < texGenNum; i++) {
|
||||
J3DTexCoord texCoord = newTexCoord(idx, i);
|
||||
mat->mTexGenBlock->setTexCoord(i, &texCoord);
|
||||
}
|
||||
for (u8 i = 0; i < 8; i++) {
|
||||
mat->mTexGenBlock->setTexMtx(i, newTexMtx(idx, i));
|
||||
}
|
||||
J3DMaterialInitData_v21* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
for (u8 i = 0; i < tevStageNum; i++) {
|
||||
if (initData->mTevKColorSel[i] != 0xff) {
|
||||
mat->mTevBlock->setTevKColorSel(i, initData->mTevKColorSel[i]);
|
||||
} else {
|
||||
mat->mTevBlock->setTevKColorSel(i, 0xc);
|
||||
}
|
||||
}
|
||||
for (u8 i = 0; i < tevStageNum; i++) {
|
||||
if (initData->mTevKAlphaSel[i] != 0xff) {
|
||||
mat->mTevBlock->setTevKAlphaSel(i, initData->mTevKAlphaSel[i]);
|
||||
} else {
|
||||
mat->mTevBlock->setTevKAlphaSel(i, 0x1c);
|
||||
}
|
||||
}
|
||||
return mat;
|
||||
}
|
||||
|
||||
/* 802FA4C0-802FA550 .text newMatColor__22J3DMaterialFactory_v21CFii */
|
||||
void J3DMaterialFactory_v21::newMatColor(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DGXColor J3DMaterialFactory_v21::newMatColor(int idx, int stage) const {
|
||||
GXColor _ret = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
J3DGXColor ret(_ret);
|
||||
J3DMaterialInitData_v21* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mMatColorIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return mpMatColor[no];
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802FA550-802FA588 .text newColorChanNum__22J3DMaterialFactory_v21CFi */
|
||||
void J3DMaterialFactory_v21::newColorChanNum(int) const {
|
||||
/* Nonmatching */
|
||||
u8 J3DMaterialFactory_v21::newColorChanNum(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mColorChanNumIdx;
|
||||
if (no != 0xFF)
|
||||
return mpColorChanNum[no];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 802FA588-802FA72C .text newColorChan__22J3DMaterialFactory_v21CFii */
|
||||
void J3DMaterialFactory_v21::newColorChan(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DColorChan J3DMaterialFactory_v21::newColorChan(int idx, int stage) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mColorChanIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return J3DColorChan(mpColorChanInfo[no]);
|
||||
else
|
||||
return J3DColorChan();
|
||||
}
|
||||
|
||||
/* 802FA72C-802FA764 .text newTexGenNum__22J3DMaterialFactory_v21CFi */
|
||||
void J3DMaterialFactory_v21::newTexGenNum(int) const {
|
||||
/* Nonmatching */
|
||||
u32 J3DMaterialFactory_v21::newTexGenNum(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mTexGenNumIdx;
|
||||
if (no != 0xFF)
|
||||
return mpTexGenNum[no];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 802FA764-802FA7D8 .text newTexCoord__22J3DMaterialFactory_v21CFii */
|
||||
void J3DMaterialFactory_v21::newTexCoord(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DTexCoord J3DMaterialFactory_v21::newTexCoord(int idx, int stage) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTexCoordIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return J3DTexCoord(mpTexCoordInfo[no]);
|
||||
else
|
||||
return J3DTexCoord();
|
||||
}
|
||||
|
||||
/* 802FA7D8-802FA8E8 .text newTexMtx__22J3DMaterialFactory_v21CFii */
|
||||
void J3DMaterialFactory_v21::newTexMtx(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DTexMtx* J3DMaterialFactory_v21::newTexMtx(int idx, int stage) const {
|
||||
J3DTexMtx* ret = NULL;
|
||||
J3DMaterialInitData_v21* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
if (initData->mTexMtxIdx[stage] != 0xFFFF)
|
||||
ret = new J3DTexMtx(mpTexMtxInfo[initData->mTexMtxIdx[stage]]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802FA8E8-802FA928 .text newCullMode__22J3DMaterialFactory_v21CFi */
|
||||
void J3DMaterialFactory_v21::newCullMode(int) const {
|
||||
/* Nonmatching */
|
||||
u8 J3DMaterialFactory_v21::newCullMode(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mCullModeIdx;
|
||||
if (no != 0xFF)
|
||||
return mpCullMode[no];
|
||||
else
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
/* 802FA928-802FA970 .text newTexNo__22J3DMaterialFactory_v21CFii */
|
||||
void J3DMaterialFactory_v21::newTexNo(int, int) const {
|
||||
/* Nonmatching */
|
||||
u16 J3DMaterialFactory_v21::newTexNo(int idx, int stage) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTexNoIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return mpTexNo[no];
|
||||
else
|
||||
return 0xFFFF;
|
||||
}
|
||||
|
||||
/* 802FA970-802FA9E4 .text newTevOrder__22J3DMaterialFactory_v21CFii */
|
||||
void J3DMaterialFactory_v21::newTevOrder(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DTevOrder J3DMaterialFactory_v21::newTevOrder(int idx, int stage) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTevOrderIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return J3DTevOrder(mpTevOrderInfo[no]);
|
||||
else
|
||||
return J3DTevOrder();
|
||||
}
|
||||
|
||||
/* 802FA9E4-802FAA7C .text newTevColor__22J3DMaterialFactory_v21CFii */
|
||||
void J3DMaterialFactory_v21::newTevColor(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DGXColorS10 J3DMaterialFactory_v21::newTevColor(int idx, int stage) const {
|
||||
GXColorS10 _ret = { 0x00, 0x00, 0x00, 0x00 };
|
||||
J3DGXColorS10 ret(_ret);
|
||||
J3DMaterialInitData_v21* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTevColorIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return mpTevColor[no];
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802FAA7C-802FAB0C .text newTevKColor__22J3DMaterialFactory_v21CFii */
|
||||
void J3DMaterialFactory_v21::newTevKColor(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DGXColor J3DMaterialFactory_v21::newTevKColor(int idx, int stage) const {
|
||||
GXColor _ret = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
J3DGXColor ret(_ret);
|
||||
J3DMaterialInitData_v21* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTevKColorIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return mpTevKColor[no];
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802FAB0C-802FAB44 .text newTevStageNum__22J3DMaterialFactory_v21CFi */
|
||||
void J3DMaterialFactory_v21::newTevStageNum(int) const {
|
||||
/* Nonmatching */
|
||||
u8 J3DMaterialFactory_v21::newTevStageNum(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mTevStageNumIdx;
|
||||
if (no != 0xFF)
|
||||
return mpTevStageNum[no];
|
||||
else
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
/* 802FAB44-802FABA4 .text newTevStage__22J3DMaterialFactory_v21CFii */
|
||||
void J3DMaterialFactory_v21::newTevStage(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DTevStage J3DMaterialFactory_v21::newTevStage(int idx, int stage) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTevStageIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return J3DTevStage(mpTevStageInfo[no]);
|
||||
else
|
||||
return J3DTevStage();
|
||||
}
|
||||
|
||||
/* 802FABA4-802FAC40 .text newTevSwapModeTable__22J3DMaterialFactory_v21CFii */
|
||||
void J3DMaterialFactory_v21::newTevSwapModeTable(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DTevSwapModeTable J3DMaterialFactory_v21::newTevSwapModeTable(int idx, int stage) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTevSwapModeTableIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return J3DTevSwapModeTable(mpTevSwapModeTableInfo[no]);
|
||||
else
|
||||
return J3DTevSwapModeTable(j3dDefaultTevSwapModeTable);
|
||||
}
|
||||
|
||||
/* 802FAC40-802FADC4 .text newFog__22J3DMaterialFactory_v21CFi */
|
||||
void J3DMaterialFactory_v21::newFog(int) const {
|
||||
/* Nonmatching */
|
||||
J3DFog* J3DMaterialFactory_v21::newFog(int idx) const {
|
||||
J3DMaterialInitData_v21* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
if (initData->mFogIdx != 0xFFFF)
|
||||
return new J3DFog(mpFogInfo[initData->mFogIdx]);
|
||||
else
|
||||
return new J3DFog();
|
||||
}
|
||||
|
||||
/* 802FADC4-802FAE44 .text newAlphaComp__22J3DMaterialFactory_v21CFi */
|
||||
void J3DMaterialFactory_v21::newAlphaComp(int) const {
|
||||
/* Nonmatching */
|
||||
J3DAlphaComp J3DMaterialFactory_v21::newAlphaComp(int idx) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mAlphaCompIdx;
|
||||
if (no != 0xFFFF)
|
||||
return J3DAlphaComp(mpAlphaCompInfo[no]);
|
||||
else
|
||||
return J3DAlphaComp(0xFFFF);
|
||||
}
|
||||
|
||||
/* 802FAE44-802FAEC0 .text newBlend__22J3DMaterialFactory_v21CFi */
|
||||
void J3DMaterialFactory_v21::newBlend(int) const {
|
||||
/* Nonmatching */
|
||||
J3DBlend J3DMaterialFactory_v21::newBlend(int idx) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mBlendIdx;
|
||||
if (no != 0xFFFF)
|
||||
return J3DBlend(mpBlendInfo[no]);
|
||||
else
|
||||
return J3DBlend();
|
||||
}
|
||||
|
||||
/* 802FAEC0-802FAF20 .text newZMode__22J3DMaterialFactory_v21CFi */
|
||||
void J3DMaterialFactory_v21::newZMode(int) const {
|
||||
/* Nonmatching */
|
||||
J3DZMode J3DMaterialFactory_v21::newZMode(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mZModeIdx;
|
||||
if (no != 0xFF)
|
||||
return J3DZMode(mpZModeInfo[no]);
|
||||
else
|
||||
return J3DZMode();
|
||||
}
|
||||
|
||||
/* 802FAF20-802FAF58 .text newZCompLoc__22J3DMaterialFactory_v21CFi */
|
||||
void J3DMaterialFactory_v21::newZCompLoc(int) const {
|
||||
/* Nonmatching */
|
||||
u8 J3DMaterialFactory_v21::newZCompLoc(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mZCompLocIdx;
|
||||
if (no != 0xFF)
|
||||
return mpZCompLoc[no];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 802FAF58-802FAF90 .text newDither__22J3DMaterialFactory_v21CFi */
|
||||
void J3DMaterialFactory_v21::newDither(int) const {
|
||||
/* Nonmatching */
|
||||
u8 J3DMaterialFactory_v21::newDither(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mDitherIdx;
|
||||
if (no != 0xFF)
|
||||
return mpDither[no];
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 802FAF90-802FB034 .text newNBTScale__22J3DMaterialFactory_v21CFi */
|
||||
void J3DMaterialFactory_v21::newNBTScale(int) const {
|
||||
/* Nonmatching */
|
||||
J3DNBTScale J3DMaterialFactory_v21::newNBTScale(int idx) const {
|
||||
J3DNBTScale ret;
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mNBTScaleIdx;
|
||||
if (no != 0xFFFF)
|
||||
return J3DNBTScale(mpNBTScaleInfo[no]);
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user