some various J2D/J3D work (#2043)

* most of J2DPicture done

* fix GXSetTexCoordGen

* some j3d work
This commit is contained in:
TakaRikka
2024-01-22 17:23:54 +02:00
committed by GitHub
parent 5a735a4956
commit 697cd08979
27 changed files with 1096 additions and 377 deletions
@@ -786,11 +786,11 @@ asm void J3DAnmTexPattern::getTexNo(u16 param_0, u16* param_1) const {
* searchUpdateMaterialID__16J3DAnmTexPatternFP16J3DMaterialTable */
void J3DAnmTexPattern::searchUpdateMaterialID(J3DMaterialTable* param_0) {
for (u16 i = 0; i < mUpdateMaterialNum; i++) {
s32 r3 = param_0->getMaterialName()->getIndex(field_0x1c.getName(i));
s32 r3 = param_0->getMaterialName()->getIndex(mUpdateMaterialName.getName(i));
if (r3 != -1) {
field_0x18[i] = r3;
mUpdateMaterialID[i] = r3;
} else {
field_0x18[i] = -1;
mUpdateMaterialID[i] = -1;
}
}
}
+81 -81
View File
@@ -4,38 +4,24 @@
//
#include "JSystem/J3DGraphAnimator/J3DCluster.h"
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
#include "JSystem/J3DGraphAnimator/J3DSkinDeform.h"
#include "JSystem/JMath/JMath.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "dol2asm.h"
#include "dolphin/os.h"
//
// Types:
//
struct JMath {
static f32 asinAcosTable_[1032];
};
struct J3DVertexBuffer {};
struct J3DModel {};
struct J3DAnmCluster {};
struct J3DDeformData {
/* 8032E1F8 */ J3DDeformData();
/* 8032E230 */ void offAllFlag(u32);
/* 8032E298 */ void deform(J3DVertexBuffer*);
/* 8032E274 */ void deform(J3DModel*);
/* 8032E364 */ void setAnm(J3DAnmCluster*);
};
struct J3DDeformer {
/* 8032E39C */ J3DDeformer(J3DDeformData*);
/* 8032EAB4 */ void deform(J3DVertexBuffer*, u16, f32*);
/* 8032E3BC */ void deform(J3DVertexBuffer*, u16);
/* 8032E4A4 */ void deform_VtxPosF32(J3DVertexBuffer*, J3DCluster*, J3DClusterKey*, f32*);
/* 8032E60C */ void deform_VtxNrmF32(J3DVertexBuffer*, J3DCluster*, J3DClusterKey*, f32*);
/* 8032EBCC */ void normalizeWeight(int, f32*);
};
#ifdef DEBUG
#define J3D_ASSERT(COND) \
if ((COND) == 0) { \
JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, __LINE__, \
"Error : null pointer"); \
OSPanic(__FILE__, __LINE__, "Halt"); \
}
#else
#define J3D_ASSERT(COND)
#endif
//
// Forward References:
@@ -58,8 +44,6 @@ extern "C" void normalizeWeight__11J3DDeformerFiPf();
//
extern "C" void PPCSync();
extern "C" void DCStoreRangeNoSync();
extern "C" void PSVECNormalize();
extern "C" void __cvt_fp2unsigned();
extern "C" void _savegpr_21();
extern "C" void _savegpr_26();
@@ -76,77 +60,93 @@ extern "C" f32 asinAcosTable___5JMath[1032];
//
/* 8032E1F8-8032E230 328B38 0038+00 0/0 1/1 0/0 .text __ct__13J3DDeformDataFv */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm J3DDeformData::J3DDeformData() {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/__ct__13J3DDeformDataFv.s"
J3DDeformData::J3DDeformData() {
mClusterNum = 0;
mClusterKeyNum = 0;
mClusterVertexNum = 0;
mClusterPointer = NULL;
mClusterKeyPointer = NULL;
mClusterVertex = NULL;
mVtxPosNum = 0;
mVtxNrmNum = 0;
mVtxPos = NULL;
mVtxNrm = NULL;
mClusterName = NULL;
mClusterKeyName = NULL;
}
#pragma pop
/* 8032E230-8032E274 328B70 0044+00 0/0 1/1 0/0 .text offAllFlag__13J3DDeformDataFUl */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void J3DDeformData::offAllFlag(u32 param_0) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/offAllFlag__13J3DDeformDataFUl.s"
void J3DDeformData::offAllFlag(u32 i_flag) {
for (u16 i = 0; i < mClusterNum; i++) {
mClusterPointer[i].getDeformer()->offFlag(i_flag);
}
}
#pragma pop
/* 8032E274-8032E298 328BB4 0024+00 0/0 1/1 0/0 .text deform__13J3DDeformDataFP8J3DModel
*/
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void J3DDeformData::deform(J3DModel* param_0) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/deform__13J3DDeformDataFP8J3DModel.s"
void J3DDeformData::deform(J3DModel* model) {
J3D_ASSERT(model != NULL);
deform(model->getVertexBuffer());
}
#pragma pop
/* 8032E298-8032E364 328BD8 00CC+00 1/1 0/0 0/0 .text deform__13J3DDeformDataFP15J3DVertexBuffer
*/
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void J3DDeformData::deform(J3DVertexBuffer* param_0) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/deform__13J3DDeformDataFP15J3DVertexBuffer.s"
void J3DDeformData::deform(J3DVertexBuffer* buffer) {
J3D_ASSERT(buffer != NULL);
buffer->swapVtxPosArrayPointer();
buffer->swapVtxNrmArrayPointer();
for (u16 i = 0; i < mClusterNum; i++) {
mClusterPointer[i].getDeformer()->deform(buffer, i);
}
DCStoreRangeNoSync(buffer->getVtxPosArrayPointer(0),
buffer->getVertexData()->getVtxNum() * sizeof(Vec));
DCStoreRangeNoSync(buffer->getVtxNrmArrayPointer(0),
buffer->getVertexData()->getNrmNum() * sizeof(Vec));
PPCSync();
buffer->setCurrentVtxPos(buffer->getVtxPosArrayPointer(0));
buffer->setCurrentVtxNrm(buffer->getVtxNrmArrayPointer(0));
}
#pragma pop
/* 8032E364-8032E39C 328CA4 0038+00 0/0 1/1 0/0 .text setAnm__13J3DDeformDataFP13J3DAnmCluster */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void J3DDeformData::setAnm(J3DAnmCluster* param_0) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/setAnm__13J3DDeformDataFP13J3DAnmCluster.s"
void J3DDeformData::setAnm(J3DAnmCluster* anm) {
for (u16 i = 0; i < mClusterNum; i++) {
mClusterPointer[i].getDeformer()->setAnmCluster(anm);
}
}
#pragma pop
/* 8032E39C-8032E3BC 328CDC 0020+00 0/0 1/1 0/0 .text __ct__11J3DDeformerFP13J3DDeformData */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm J3DDeformer::J3DDeformer(J3DDeformData* param_0) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/__ct__11J3DDeformerFP13J3DDeformData.s"
J3DDeformer::J3DDeformer(J3DDeformData* data) {
mDeformData = data;
mAnmCluster = NULL;
field_0x8 = NULL;
field_0xc = NULL;
mFlags = 3;
}
#pragma pop
/* 8032E3BC-8032E4A4 328CFC 00E8+00 1/1 0/0 0/0 .text deform__11J3DDeformerFP15J3DVertexBufferUs
*/
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void J3DDeformer::deform(J3DVertexBuffer* param_0, u16 param_1) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/deform__11J3DDeformerFP15J3DVertexBufferUs.s"
void J3DDeformer::deform(J3DVertexBuffer* buffer, u16 param_1) {
J3D_ASSERT(buffer != 0);
u16 var_r31 = 0;
if (mAnmCluster != NULL) {
for (u16 i = 0; i < param_1; i++) {
var_r31 += mDeformData->getClusterPointer(i)->mKeyNum;
}
u16 num = mDeformData->getClusterPointer(param_1)->mKeyNum;
for (u16 i = 0; i < num; i++) {
field_0x8[i] = mAnmCluster->getWeight(var_r31++);
}
deform(buffer, param_1, field_0x8);
}
}
#pragma pop
/* ############################################################################################## */
/* 80456470-80456474 004A70 0004+00 2/2 0/0 0/0 .sdata2 @830 */
+6 -27
View File
@@ -1,34 +1,12 @@
//
// Generated By: dol2asm
// Translation Unit: J3DJoint
//
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
#include "JSystem/J3DGraphBase/J3DDrawBuffer.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "JSystem/JMath/JMath.h"
#include "dol2asm.h"
#include "dolphin/types.h"
#include "m_Do/m_Do_mtx.h"
//
// Types:
//
//
// Forward References:
//
//
// External References:
//
//
// Declarations:
//
/* 8032EC28-8032ECAC 329568 0084+00 0/0 1/1 0/0 .text
* init__25J3DMtxCalcJ3DSysInitBasicFRC3VecRA3_A4_Cf */
void J3DMtxCalcJ3DSysInitBasic::init(Vec const& scale, Mtx const& mtx) {
@@ -181,7 +159,7 @@ void J3DJoint::appendChild(J3DJoint* pChild) {
#pragma push
#pragma force_active on
/* dead data */
SECTION_DEAD static u32 const pad_803A2080[2] = {0,0};
SECTION_DEAD static u32 const pad_803A2080[2] = {0, 0};
#pragma pop
/* 8032F170-8032F254 329AB0 00E4+00 0/0 1/1 0/0 .text __ct__8J3DJointFv */
@@ -210,12 +188,13 @@ void J3DJoint::entryIn() {
MtxP anmMtx = j3dSys.getModel()->i_getAnmMtx(mJntNo);
j3dSys.getDrawBuffer(0)->setZMtx(anmMtx);
j3dSys.getDrawBuffer(1)->setZMtx(anmMtx);
for (J3DMaterial* mesh = mMesh; mesh != NULL; ) {
for (J3DMaterial* mesh = mMesh; mesh != NULL;) {
if (mesh->getShape()->checkFlag(1)) {
mesh = mesh->getNext();
} else {
J3DMatPacket* matPacket = j3dSys.getModel()->getMatPacket(mesh->getIndex());
J3DShapePacket* shapePacket = j3dSys.getModel()->getShapePacket(mesh->getShape()->getIndex());
J3DShapePacket* shapePacket =
j3dSys.getModel()->getShapePacket(mesh->getShape()->getIndex());
if (!matPacket->isLocked()) {
if (mesh->getMaterialAnm()) {
J3DMaterialAnm* piVar8 = mesh->getMaterialAnm();
@@ -276,7 +255,7 @@ void J3DJoint::recursiveCalc() {
child->recursiveCalc();
}
mDoMtx_copy(prevCurrentMtx, J3DSys::mCurrentMtx);
J3DSys::mCurrentS.x = currentX;
J3DSys::mCurrentS.y = currentY;
J3DSys::mCurrentS.z = currentZ;
@@ -1,13 +1,7 @@
//
// Generated By: dol2asm
// Translation Unit: J3DJointTree
//
#include "JSystem/J3DGraphAnimator/J3DJointTree.h"
#include "JSystem/J3DGraphAnimator/J3DMaterialAttach.h"
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "dolphin/types.h"
/* 80325A18-80325A9C 320358 0084+00 0/0 1/1 0/0 .text __ct__12J3DJointTreeFv */
J3DJointTree::J3DJointTree()
@@ -111,6 +111,29 @@ int J3DMaterialTable::removeMatColorAnimator(J3DAnmColor* pAnmColor) {
/* 8032F6F8-8032F7B4 32A038 00BC+00 0/0 5/5 10/10 .text
* removeTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern */
// regalloc
#ifdef NONMATCHING
int J3DMaterialTable::removeTexNoAnimator(J3DAnmTexPattern* anm) {
int ret = 0;
u16 materialNum = anm->getUpdateMaterialNum();
J3DAnmTexPatternFullTable* anm_table = anm->getAnmTable();
for (u16 i = 0; i < materialNum; i++) {
if (anm->isValidUpdateMaterialID(i)) {
u16 materialID = anm->getUpdateMaterialID(i);
J3DMaterialAnm* pMatAnm = getMaterialNodePointer(materialID)->getMaterialAnm();
u8 texNo = anm_table[i].mTexNo;
if (pMatAnm == NULL)
ret = 1;
else
pMatAnm->setTexNoAnm(texNo, NULL);
}
}
return ret;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@@ -119,6 +142,7 @@ asm int J3DMaterialTable::removeTexNoAnimator(J3DAnmTexPattern* param_0) {
#include "asm/JSystem/J3DGraphAnimator/J3DMaterialAttach/removeTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern.s"
}
#pragma pop
#endif
/* 8032F7B4-8032F880 32A0F4 00CC+00 0/0 4/4 26/26 .text
* removeTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */