some J3D/misc cleanup (#2628)

* some j3d cleanup

* begin using uintptr_t

* j3dgraphbase cleanup

* j3dgraphanimator cleanup
This commit is contained in:
TakaRikka
2025-09-04 07:56:59 -07:00
committed by GitHub
parent ee8b843996
commit b45a089e15
290 changed files with 4221 additions and 3605 deletions
+27 -23
View File
@@ -1,15 +1,8 @@
//
// Generated By: dol2asm
// Translation Unit: J3DCluster
//
#include "JSystem/J3DGraphAnimator/J3DCluster.h"
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
#include "JSystem/JMath/JMATrigonometric.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "dolphin/base/PPCArch.h"
#include "dolphin/os.h"
/* 8032E1F8-8032E230 328B38 0038+00 0/0 1/1 0/0 .text __ct__13J3DDeformDataFv */
J3DDeformData::J3DDeformData() {
@@ -37,7 +30,7 @@ void J3DDeformData::offAllFlag(u32 i_flag) {
/* 8032E274-8032E298 328BB4 0024+00 0/0 1/1 0/0 .text deform__13J3DDeformDataFP8J3DModel
*/
void J3DDeformData::deform(J3DModel* model) {
J3D_ASSERT(110, model, "Error : null pointer");
J3D_ASSERT_NULLPTR(110, model);
deform(model->getVertexBuffer());
}
@@ -45,7 +38,7 @@ void J3DDeformData::deform(J3DModel* model) {
/* 8032E298-8032E364 328BD8 00CC+00 1/1 0/0 0/0 .text deform__13J3DDeformDataFP15J3DVertexBuffer
*/
void J3DDeformData::deform(J3DVertexBuffer* buffer) {
J3D_ASSERT(141, buffer, "Error : null pointer");
J3D_ASSERT_NULLPTR(141, buffer);
buffer->swapVtxPosArrayPointer();
buffer->swapVtxNrmArrayPointer();
@@ -83,7 +76,7 @@ J3DDeformer::J3DDeformer(J3DDeformData* data) {
/* 8032E3BC-8032E4A4 328CFC 00E8+00 1/1 0/0 0/0 .text deform__11J3DDeformerFP15J3DVertexBufferUs
*/
void J3DDeformer::deform(J3DVertexBuffer* buffer, u16 param_1) {
J3D_ASSERT(222, buffer, "Error : null pointer");
J3D_ASSERT_NULLPTR(222, buffer);
u16 var_r31 = 0;
if (mAnmCluster != NULL) {
@@ -246,19 +239,29 @@ void J3DDeformer::deform_VtxNrmF32(J3DVertexBuffer* i_buffer, J3DCluster* i_clus
/* 8032EAB4-8032EBCC 3293F4 0118+00 1/1 0/0 0/0 .text deform__11J3DDeformerFP15J3DVertexBufferUsPf
*/
void J3DDeformer::deform(J3DVertexBuffer* i_buffer, u16 param_1, f32* i_weights) {
if (checkFlag(2) && i_buffer->getVertexData()->getVtxPosType() == 4) {
J3DCluster* cluster = mDeformData->getClusterPointer(param_1);
u16 offset = 0;
for (u16 i = 0; i < param_1; i++) {
offset += mDeformData->getClusterPointer(i)->mKeyNum + 1;
}
J3DClusterKey* clusterKey = mDeformData->getClusterKeyPointer(offset);
normalizeWeight(cluster->mKeyNum, i_weights);
deform_VtxPosF32(i_buffer, cluster, clusterKey, i_weights);
if (checkFlag(1) && cluster->mFlags != 0 && i_buffer->getVertexData()->getVtxNrmType() == 4)
{
deform_VtxNrmF32(i_buffer, cluster, clusterKey, i_weights);
J3D_ASSERT_NULLPTR(505, i_buffer != NULL);
if (checkFlag(2)) {
JUT_ASSERT_MSG(512, i_buffer->getVertexData()->getVtxPosType() == 4, "Error : Invalid Verex Format");
if (i_buffer->getVertexData()->getVtxPosType() == 4) {
J3DCluster* cluster = mDeformData->getClusterPointer(param_1);
u16 offset = 0;
J3DClusterKey* clusterKey = NULL;
for (u16 i = 0; i < param_1; i++) {
offset += mDeformData->getClusterPointer(i)->mKeyNum + 1;
}
clusterKey = mDeformData->getClusterKeyPointer(offset);
int var_r23 = cluster->mKeyNum;
normalizeWeight(var_r23, i_weights);
deform_VtxPosF32(i_buffer, cluster, clusterKey, i_weights);
if (checkFlag(1) && cluster->mFlags != 0 && i_buffer->getVertexData()->getVtxNrmType() == 4)
{
deform_VtxNrmF32(i_buffer, cluster, clusterKey, i_weights);
}
}
}
}
@@ -270,6 +273,7 @@ void J3DDeformer::normalizeWeight(int i_keyNum, f32* i_weights) {
for (u16 i = 0; i < i_keyNum; i++) {
totalWeight += i_weights[i];
}
f32 scale = 1.0f / totalWeight;
for (u16 i = 0; i < i_keyNum; i++) {
i_weights[i] *= scale;