mirror of
https://github.com/zeldaret/tp
synced 2026-05-27 16:13:56 -04:00
some J3D/misc cleanup (#2628)
* some j3d cleanup * begin using uintptr_t * j3dgraphbase cleanup * j3dgraphanimator cleanup
This commit is contained in:
@@ -1,14 +1,8 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DVertex
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DVertex.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJointTree.h"
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "string.h"
|
||||
#include <dolphin/os.h>
|
||||
#include <string.h>
|
||||
#include "global.h"
|
||||
|
||||
/* 80310EF8-80310F78 30B838 0080+00 0/0 1/1 0/0 .text __ct__13J3DVertexDataFv */
|
||||
@@ -24,10 +18,10 @@ J3DVertexData::J3DVertexData() {
|
||||
mVtxNrmArray = NULL;
|
||||
mVtxNBTArray = NULL;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(mVtxColorArray); i++)
|
||||
for (int i = 0; i < 2; i++)
|
||||
mVtxColorArray[i] = NULL;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(mVtxTexCoordArray); i++)
|
||||
for (int i = 0; i < 8; i++)
|
||||
mVtxTexCoordArray[i] = NULL;
|
||||
|
||||
mVtxPosFrac = 0;
|
||||
@@ -39,6 +33,8 @@ J3DVertexData::J3DVertexData() {
|
||||
/* 80310F78-80310FD8 30B8B8 0060+00 0/0 1/1 0/0 .text
|
||||
* setVertexData__15J3DVertexBufferFP13J3DVertexData */
|
||||
void J3DVertexBuffer::setVertexData(J3DVertexData* pVtxData) {
|
||||
J3D_ASSERT_NULLPTR(175, pVtxData != NULL);
|
||||
|
||||
mVtxData = pVtxData;
|
||||
mVtxPosArray[0] = pVtxData->getVtxPosArray();
|
||||
mVtxNrmArray[0] = pVtxData->getVtxNrmArray();
|
||||
@@ -59,20 +55,11 @@ void J3DVertexBuffer::setVertexData(J3DVertexData* pVtxData) {
|
||||
void J3DVertexBuffer::init() {
|
||||
mVtxData = NULL;
|
||||
|
||||
mVtxPosArray[1] = NULL;
|
||||
mVtxPosArray[0] = NULL;
|
||||
|
||||
mVtxNrmArray[1] = NULL;
|
||||
mVtxNrmArray[0] = NULL;
|
||||
|
||||
mVtxColArray[1] = NULL;
|
||||
mVtxColArray[0] = NULL;
|
||||
|
||||
mTransformedVtxPosArray[1] = NULL;
|
||||
mTransformedVtxPosArray[0] = NULL;
|
||||
|
||||
mTransformedVtxNrmArray[1] = NULL;
|
||||
mTransformedVtxNrmArray[0] = NULL;
|
||||
mVtxPosArray[0] = mVtxPosArray[1] = NULL;
|
||||
mVtxNrmArray[0] = mVtxNrmArray[1] = NULL;
|
||||
mVtxColArray[0] = mVtxColArray[1] = NULL;
|
||||
mTransformedVtxPosArray[0] = mTransformedVtxPosArray[1] = NULL;
|
||||
mTransformedVtxNrmArray[0] = mTransformedVtxNrmArray[1] = NULL;
|
||||
|
||||
mCurrentVtxPos = NULL;
|
||||
mCurrentVtxNrm = NULL;
|
||||
@@ -96,25 +83,26 @@ void J3DVertexBuffer::setArray() const {
|
||||
s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) {
|
||||
if (flag & 1) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mVtxPosArray[i] = new (0x20) Vec[mVtxData->getVtxNum()];
|
||||
|
||||
mVtxPosArray[i] = new (0x20) char[mVtxData->getVtxNum() * 3 * 4];
|
||||
if (mVtxPosArray[i] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
memcpy(mVtxPosArray[i], mVtxData->getVtxPosArray(), mVtxData->getVtxNum() * 12);
|
||||
DCStoreRange(mVtxPosArray[i], mVtxData->getVtxNum() * 12);
|
||||
|
||||
memcpy(mVtxPosArray[i], mVtxData->getVtxPosArray(), mVtxData->getVtxNum() * 3 * 4);
|
||||
DCStoreRange(mVtxPosArray[i], mVtxData->getVtxNum() * 3 * 4);
|
||||
}
|
||||
} else {
|
||||
mVtxPosArray[0] = mVtxData->getVtxPosArray();
|
||||
|
||||
if (mVtxPosArray[1] == NULL) {
|
||||
mVtxPosArray[1] = new (0x20) Vec[mVtxData->getVtxNum()];
|
||||
mVtxPosArray[1] = new (0x20) char[mVtxData->getVtxNum() * 3 * 4];
|
||||
if (mVtxPosArray[1] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
}
|
||||
memcpy(mVtxPosArray[1], mVtxData->getVtxPosArray(), mVtxData->getVtxNum() * 12);
|
||||
DCStoreRange(mVtxPosArray[1], mVtxData->getVtxNum() * 12);
|
||||
|
||||
memcpy(mVtxPosArray[1], mVtxData->getVtxPosArray(), mVtxData->getVtxNum() * 3 * 4);
|
||||
DCStoreRange(mVtxPosArray[1], mVtxData->getVtxNum() * 3 * 4);
|
||||
}
|
||||
|
||||
return kJ3DError_Success;
|
||||
@@ -125,25 +113,26 @@ s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) {
|
||||
s32 J3DVertexBuffer::copyLocalVtxNrmArray(u32 flag) {
|
||||
if (flag & 1) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mVtxNrmArray[i] = new (0x20) VertexNormal[mVtxData->getNrmNum()];
|
||||
|
||||
mVtxNrmArray[i] = new (0x20) char[mVtxData->getNrmNum() * 3 * 4];
|
||||
if (mVtxNrmArray[i] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
memcpy(mVtxNrmArray[i], mVtxData->getVtxNrmArray(), mVtxData->getNrmNum() * 12);
|
||||
DCStoreRange(mVtxNrmArray[i], mVtxData->getNrmNum() * 12);
|
||||
|
||||
memcpy(mVtxNrmArray[i], mVtxData->getVtxNrmArray(), mVtxData->getNrmNum() * 3 * 4);
|
||||
DCStoreRange(mVtxNrmArray[i], mVtxData->getNrmNum() * 3 * 4);
|
||||
}
|
||||
} else {
|
||||
mVtxNrmArray[0] = mVtxData->getVtxNrmArray();
|
||||
|
||||
if (mVtxNrmArray[1] == NULL) {
|
||||
mVtxNrmArray[1] = new (0x20) VertexNormal[mVtxData->getNrmNum()];
|
||||
mVtxNrmArray[1] = new (0x20) char[mVtxData->getNrmNum() * 3 * 4];
|
||||
if (mVtxNrmArray[1] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
}
|
||||
memcpy(mVtxNrmArray[1], mVtxData->getVtxNrmArray(), mVtxData->getNrmNum() * 12);
|
||||
DCStoreRange(mVtxNrmArray[1], mVtxData->getNrmNum() * 12);
|
||||
|
||||
memcpy(mVtxNrmArray[1], mVtxData->getVtxNrmArray(), mVtxData->getNrmNum() * 3 * 4);
|
||||
DCStoreRange(mVtxNrmArray[1], mVtxData->getNrmNum() * 3 * 4);
|
||||
}
|
||||
|
||||
return kJ3DError_Success;
|
||||
@@ -185,6 +174,7 @@ s32 J3DVertexBuffer::copyLocalVtxArray(u32 flag) {
|
||||
delete mVtxPosArray[i];
|
||||
mVtxPosArray[i] = oldPosArray[i];
|
||||
}
|
||||
|
||||
if (oldNrmArray[i] != mVtxNrmArray[i]) {
|
||||
if (mVtxNrmArray[i] != mVtxData->getVtxNrmArray())
|
||||
delete mVtxNrmArray[i];
|
||||
@@ -208,7 +198,7 @@ s32 J3DVertexBuffer::allocTransformedVtxPosArray() {
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (i == 0 || mTransformedVtxPosArray[i] == NULL) {
|
||||
mTransformedVtxPosArray[i] = new (0x20) Vec[mVtxData->getVtxNum()];
|
||||
mTransformedVtxPosArray[i] = new (0x20) char[mVtxData->getVtxNum() * 3 * 4];
|
||||
if (mTransformedVtxPosArray[i] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -225,7 +215,7 @@ s32 J3DVertexBuffer::allocTransformedVtxNrmArray() {
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (i == 0 || mTransformedVtxNrmArray[i] == NULL) {
|
||||
mTransformedVtxNrmArray[i] = new (0x20) VertexNormal[mVtxData->getNrmNum()];
|
||||
mTransformedVtxNrmArray[i] = new (0x20) char[mVtxData->getNrmNum() * 3 * 4];
|
||||
if (mTransformedVtxNrmArray[i] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user