J3DModelData 99%

just one regswap
This commit is contained in:
Jasper St. Pierre
2023-09-24 00:30:34 -07:00
parent 2f918f337e
commit 2d719328f6
11 changed files with 202 additions and 133 deletions
+135 -20
View File
@@ -4,64 +4,179 @@
//
#include "JSystem/J3DGraphAnimator/J3DModelData.h"
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
#include "JSystem/JUtility/JUTNameTab.h"
#include "dolphin/types.h"
/* 802ECF30-802ECF70 .text clear__12J3DJointTreeFv */
void J3DJointTree::clear() {
/* Nonmatching */
mHierarchy = NULL;
mFlags = 0;
mModelDataType = 0;
mRootNode = NULL;
mBasicMtxCalc = NULL;
mJointNum = NULL;
mJointNodePointer = NULL;
field_0x40 = NULL;
mWEvlpMtxNum = 0;
mWEvlpMixMtxNum = NULL;
mWEvlpMixIndex = NULL;
mWEvlpMixWeight = NULL;
mInvJointMtx = NULL;
mJointName = NULL;
}
/* 802ECF70-802ED108 .text makeHierarchy__12J3DJointTreeFP7J3DNodePPC17J3DModelHierarchyP16J3DMaterialTablePP8J3DShape */
void J3DJointTree::makeHierarchy(J3DNode*, const J3DModelHierarchy**, J3DMaterialTable*, J3DShape**) {
/* Nonmatching */
void J3DJointTree::makeHierarchy(J3DNode* pRootNode, const J3DModelHierarchy** pHierarchy, J3DMaterialTable* pMaterialTable, J3DShape** pShapeTable) {
enum {
kTypeEnd = 0x00,
kTypeBeginChild = 0x01,
kTypeEndChild = 0x02,
kTypeJoint = 0x10,
kTypeMaterial = 0x11,
kTypeShape = 0x12,
};
J3DNode * pCurNode = pRootNode;
while (true) {
J3DNode * pNewNode = NULL;
J3DMaterial * pNewMaterial = NULL;
J3DShape * pNewShape = NULL;
const J3DModelHierarchy * inf = *pHierarchy;
switch (inf->mType) {
case kTypeBeginChild:
*pHierarchy = inf + 1;
makeHierarchy(pCurNode, pHierarchy, pMaterialTable, pShapeTable);
break;
case kTypeEndChild:
*pHierarchy = inf + 1;
return;
case kTypeEnd:
return;
case kTypeJoint:
{
J3DJoint ** pJoints = mJointNodePointer;
*pHierarchy = inf + 1;
pNewNode = pJoints[inf->mValue];
}
break;
case kTypeMaterial:
*pHierarchy = inf + 1;
pNewMaterial = pMaterialTable->mMaterialNodePointer[inf->mValue];
break;
case kTypeShape:
*pHierarchy = inf + 1;
pNewShape = pShapeTable[inf->mValue];
break;
}
if (pNewNode != NULL) {
pCurNode = pNewNode;
if (pRootNode == NULL)
mRootNode = (J3DJoint*)pNewNode;
else
pRootNode->appendChild(pNewNode);
} else if (pNewMaterial != NULL && pRootNode->getType() == 'NJNT') {
((J3DJoint*)pRootNode)->addMesh(pNewMaterial);
pNewMaterial->mJoint = ((J3DJoint*)pRootNode);
} else if (pNewShape != NULL && pNewNode->getType() == 'NJNT') {
pNewMaterial = ((J3DJoint*)pRootNode)->getMesh();
pNewMaterial->mShape = pNewShape;
pNewShape->mMaterial = pNewMaterial;
}
}
}
/* 802ED108-802ED130 .text clear__12J3DModelDataFv */
void J3DModelData::clear() {
/* Nonmatching */
mpRawData = NULL;
mFlags = 0;
mbHasBumpArray = 0;
mbHasBillboard = 0;
mShapeTable.clear();
mName = NULL;
mVertexData.clear();
}
/* 802ED130-802ED1A8 .text __ct__12J3DModelDataFv */
J3DModelData::J3DModelData() {
/* Nonmatching */
clear();
}
/* 802ED1A8-802ED238 .text __dt__12J3DModelDataFv */
J3DModelData::~J3DModelData() {
/* Nonmatching */
}
/* 802ED238-802ED2A4 .text initShapeNodes__12J3DModelDataFv */
void J3DModelData::initShapeNodes() {
/* Nonmatching */
for (u16 i = 0; i < getShapeNum(); i++) {
J3DShape *pShape = getShapeNodePointer(i);
pShape->setDrawMtxDataPointer(getDrawMtxData());
pShape->setVertexDataPointer(&getVertexData());
pShape->makeVcdVatCmd();
}
}
/* 802ED2A4-802ED340 .text sortVcdVatCmd__12J3DModelDataFv */
void J3DModelData::sortVcdVatCmd() {
/* Nonmatching */
for (u16 i = 0; i < getShapeNum(); i++)
for (u16 j = 0; j < i; j++)
if (getShapeNodePointer(i)->isSameVcdVatCmd(getShapeNodePointer(j)))
getShapeNodePointer(i)->setVcdVatCmd(getShapeNodePointer(j)->getVcdVatCmd());
}
/* 802ED340-802ED3E8 .text indexToPtr__12J3DModelDataFv */
void J3DModelData::indexToPtr() {
/* Nonmatching */
j3dSys.setTexture(getTexture());
GDLObj dlObj;
for (u16 i = 0; i < getMaterialNum(); i++) {
J3DDisplayListObj *pDLObj = getMaterialNodePointer(i)->getSharedDisplayListObj();
GDInitGDLObj(&dlObj, pDLObj->getDisplayList(0), pDLObj->getDisplayListSize());
GDSetCurrent(&dlObj);
getMaterialNodePointer(i)->getTevBlock()->indexToPtr();
}
GDSetCurrent(NULL);
}
/* 802ED3E8-802ED434 .text isDeformablePositionFormat__12J3DModelDataCFv */
void J3DModelData::isDeformablePositionFormat() const {
/* Nonmatching */
bool J3DModelData::isDeformablePositionFormat() const {
GXVtxAttrFmtList *vtxAttr = getVtxAttrFmtList();
for (; vtxAttr->mAttrib != GX_VA_NULL; vtxAttr++) {
switch (vtxAttr->mAttrib) {
case GX_VA_POS:
if (vtxAttr->mCompType == GX_F32 && vtxAttr->mCompCnt == GX_POS_XYZ)
return true;
break;
}
}
return false;
}
/* 802ED434-802ED4F4 .text setMaterialTable__12J3DModelDataFP16J3DMaterialTable19J3DMaterialCopyFlag */
void J3DModelData::setMaterialTable(J3DMaterialTable*, J3DMaterialCopyFlag) {
/* Nonmatching */
void J3DModelData::setMaterialTable(J3DMaterialTable* pMaterialTable, J3DMaterialCopyFlag flag) {
if (flag & J3DMatCopyFlag_Material) {
for (u16 i = 0; i < pMaterialTable->getMaterialNum(); i++) {
JUTNameTab *pMaterialName = getMaterialName();
const char *pName = pMaterialTable->getMaterialName()->getName(i);
s32 nameIndex = pMaterialName->getIndex(pName);
if (nameIndex != -1)
getMaterialNodePointer(nameIndex)->copy(pMaterialTable->getMaterialNodePointer(i));
}
}
if ((flag & J3DMatCopyFlag_Texture) && pMaterialTable->getTexture()->getNum() != 0) {
setTexture(pMaterialTable->getTexture());
setTextureName(pMaterialTable->getTextureName());
}
}
/* 802ED4F4-802ED500 .text getType__7J3DNodeCFv */
void J3DNode::getType() const {
/* Nonmatching */
}
/* 802ED500-802ED564 .text __dt__12J3DJointTreeFv */
J3DJointTree::~J3DJointTree() {
/* Nonmatching */
u32 J3DNode::getType() const {
return 'NNON';
}
+22 -76
View File
@@ -20,6 +20,11 @@ extern void J3DCalcBBoardMtx(Mtx);
u32 J3DShapeMtx::sCurrentPipeline;
/* 802DD048-802DD054 .text getType__11J3DShapeMtxCFv */
u32 J3DShapeMtx::getType() const {
return 'SMTX';
}
/* 802DB9D8-802DBA1C .text loadMtxIndx_PNGP__11J3DShapeMtxCFiUs */
void J3DShapeMtx::loadMtxIndx_PNGP(int mtxNo, u16 index) const {
J3DFifoLoadIndx(GX_CMD_LOAD_INDX_A, index, 0xB000 | ((u16)(mtxNo * 0x0C)));
@@ -282,6 +287,16 @@ void J3DShapeMtxBBoardConcatView::load() const {
}
}
/* 802DCF88-802DCF94 .text getType__21J3DShapeMtxConcatViewCFv */
u32 J3DShapeMtxConcatView::getType() const {
return 'SMCV';
}
/* 802DCF94-802DCF98 .text loadNrmMtx__21J3DShapeMtxConcatViewCFiUs */
void J3DShapeMtxConcatView::loadNrmMtx(int mtxNo, u16 index) const {
/* Nonmatching */
}
/* 802DC8C0-802DC9B8 .text load__21J3DShapeMtxYBBoardImmCFv */
void J3DShapeMtxYBBoardImm::load() const {
/* Nonmatching */
@@ -292,26 +307,6 @@ void J3DShapeMtxYBBoardConcatView::load() const {
/* Nonmatching */
}
/* 802DCAEC-802DCB04 .text __ct__12J3DShapeDrawFPCUcUl */
J3DShapeDraw::J3DShapeDraw(const unsigned char*, unsigned long) {
/* Nonmatching */
}
/* 802DCB04-802DCB30 .text draw__12J3DShapeDrawCFv */
void J3DShapeDraw::draw() const {
/* Nonmatching */
}
/* 802DCB30-802DCB78 .text __dt__12J3DShapeDrawFv */
J3DShapeDraw::~J3DShapeDraw() {
/* Nonmatching */
}
/* 802DCB78-802DCBF4 .text __dt__28J3DShapeMtxYBBoardConcatViewFv */
J3DShapeMtxYBBoardConcatView::~J3DShapeMtxYBBoardConcatView() {
/* Nonmatching */
}
/* 802DCBF4-802DCC00 .text getType__21J3DShapeMtxYBBoardImmCFv */
u32 J3DShapeMtxYBBoardImm::getType() const {
return 'SMYB';
@@ -322,31 +317,11 @@ u32 J3DShapeMtx::getUseMtxIndex(u16 i) const {
return mUseMtxIndex;
}
/* 802DCC08-802DCC74 .text __dt__21J3DShapeMtxYBBoardImmFv */
J3DShapeMtxYBBoardImm::~J3DShapeMtxYBBoardImm() {
/* Nonmatching */
}
/* 802DCC74-802DCCF0 .text __dt__27J3DShapeMtxBBoardConcatViewFv */
J3DShapeMtxBBoardConcatView::~J3DShapeMtxBBoardConcatView() {
/* Nonmatching */
}
/* 802DCCF0-802DCCFC .text getType__20J3DShapeMtxBBoardImmCFv */
u32 J3DShapeMtxBBoardImm::getType() const {
return 'SMBB';
}
/* 802DCCFC-802DCD68 .text __dt__20J3DShapeMtxBBoardImmFv */
J3DShapeMtxBBoardImm::~J3DShapeMtxBBoardImm() {
/* Nonmatching */
}
/* 802DCD68-802DCDE4 .text __dt__26J3DShapeMtxMultiConcatViewFv */
J3DShapeMtxMultiConcatView::~J3DShapeMtxMultiConcatView() {
/* Nonmatching */
}
/* 802DCDE4-802DCDF0 .text getType__26J3DShapeMtxMultiConcatViewCFv */
u32 J3DShapeMtxMultiConcatView::getType() const {
return 'SMMI';
@@ -367,11 +342,6 @@ void J3DShapeMtxMultiConcatView::loadNrmMtx(int mtxNo, u16 index) const {
/* Nonmatching */
}
/* 802DCE0C-802DCE78 .text __dt__19J3DShapeMtxMultiImmFv */
J3DShapeMtxMultiImm::~J3DShapeMtxMultiImm() {
/* Nonmatching */
}
/* 802DCE78-802DCE84 .text getType__19J3DShapeMtxMultiImmCFv */
u32 J3DShapeMtxMultiImm::getType() const {
return 'SMMI';
@@ -387,11 +357,6 @@ u32 J3DShapeMtxMultiImm::getUseMtxIndex(u16 i) const {
return mUseMtxIndexTable[i];
}
/* 802DCE9C-802DCEF8 .text __dt__16J3DShapeMtxMultiFv */
J3DShapeMtxMulti::~J3DShapeMtxMulti() {
/* Nonmatching */
}
/* 802DCEF8-802DCF04 .text getType__16J3DShapeMtxMultiCFv */
u32 J3DShapeMtxMulti::getType() const {
return 'SMML';
@@ -407,37 +372,18 @@ u32 J3DShapeMtxMulti::getUseMtxIndex(u16 i) const {
return mUseMtxIndexTable[i];
}
/* 802DCF1C-802DCF88 .text __dt__21J3DShapeMtxConcatViewFv */
J3DShapeMtxConcatView::~J3DShapeMtxConcatView() {
/* Nonmatching */
}
/* 802DCF88-802DCF94 .text getType__21J3DShapeMtxConcatViewCFv */
u32 J3DShapeMtxConcatView::getType() const {
return 'SMCV';
}
/* 802DCF94-802DCF98 .text loadNrmMtx__21J3DShapeMtxConcatViewCFiUs */
void J3DShapeMtxConcatView::loadNrmMtx(int mtxNo, u16 index) const {
/* Nonmatching */
}
/* 802DCF98-802DCFF4 .text __dt__14J3DShapeMtxImmFv */
J3DShapeMtxImm::~J3DShapeMtxImm() {
/* Nonmatching */
}
/* 802DCFF4-802DD000 .text getType__14J3DShapeMtxImmCFv */
u32 J3DShapeMtxImm::getType() const {
return 'SMIM';
}
/* 802DD000-802DD048 .text __dt__11J3DShapeMtxFv */
J3DShapeMtx::~J3DShapeMtx() {
/* Nonmatching */
/* 802DCAEC-802DCB04 .text __ct__12J3DShapeDrawFPCUcUl */
J3DShapeDraw::J3DShapeDraw(const u8* pDL, u32 size) {
mDisplayList = (void*) pDL;
mDisplayListSize = size;
}
/* 802DD048-802DD054 .text getType__11J3DShapeMtxCFv */
u32 J3DShapeMtx::getType() const {
return 'SMTX';
/* 802DCB04-802DCB30 .text draw__12J3DShapeDrawCFv */
void J3DShapeDraw::draw() const {
GXCallDisplayList(mDisplayList, mDisplayListSize);
}