mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-18 04:48:21 -04:00
some J3D/misc cleanup (#2628)
* some j3d cleanup * begin using uintptr_t * j3dgraphbase cleanup * j3dgraphanimator cleanup
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
|
||||
@@ -24,7 +24,6 @@ void J3DMtxCalcJ3DSysInitMaya::init(Vec const& scale, Mtx const& mtx) {
|
||||
J3DSys::mCurrentS.z);
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804515F0-804515F4 000AF0 0004+00 3/3 1/1 0/0 .sbss mMtxBuffer__10J3DMtxCalc */
|
||||
J3DMtxBuffer* J3DMtxCalc::mMtxBuffer;
|
||||
|
||||
@@ -180,7 +179,7 @@ void J3DJoint::entryIn() {
|
||||
j3dSys.getDrawBuffer(0)->setZMtx(anmMtx);
|
||||
j3dSys.getDrawBuffer(1)->setZMtx(anmMtx);
|
||||
for (J3DMaterial* mesh = mMesh; mesh != NULL;) {
|
||||
if (mesh->getShape()->checkFlag(1)) {
|
||||
if (mesh->getShape()->checkFlag(J3DShpFlag_Visible)) {
|
||||
mesh = mesh->getNext();
|
||||
} else {
|
||||
J3DMatPacket* matPacket = j3dSys.getModel()->getMatPacket(mesh->getIndex());
|
||||
@@ -207,7 +206,6 @@ void J3DJoint::entryIn() {
|
||||
}
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804515F8-80451600 000AF8 0004+04 1/1 1/1 0/0 .sbss mCurrentMtxCalc__8J3DJoint */
|
||||
J3DMtxCalc* J3DJoint::mCurrentMtxCalc;
|
||||
|
||||
@@ -265,4 +263,4 @@ void J3DJoint::recursiveCalc() {
|
||||
if (younger != NULL) {
|
||||
younger->recursiveCalc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,15 @@
|
||||
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
|
||||
enum {
|
||||
kTypeEnd = 0x00,
|
||||
kTypeBeginChild = 0x01,
|
||||
kTypeEndChild = 0x02,
|
||||
kTypeJoint = 0x10,
|
||||
kTypeMaterial = 0x11,
|
||||
kTypeShape = 0x12,
|
||||
};
|
||||
|
||||
/* 80325A18-80325A9C 320358 0084+00 0/0 1/1 0/0 .text __ct__12J3DJointTreeFv */
|
||||
J3DJointTree::J3DJointTree()
|
||||
: mHierarchy(NULL), mFlags(0), mModelDataType(0), mRootNode(NULL), mBasicMtxCalc(NULL),
|
||||
@@ -13,52 +22,34 @@ J3DJointTree::J3DJointTree()
|
||||
/* 80325A9C-80325C00 3203DC 0164+00 1/0 2/2 0/0 .text
|
||||
* makeHierarchy__12J3DJointTreeFP8J3DJointPPC17J3DModelHierarchyP16J3DMaterialTableP13J3DShapeTable
|
||||
*/
|
||||
void J3DJointTree::makeHierarchy(J3DJoint* pJoint, J3DModelHierarchy const** pHierarchy,
|
||||
void J3DJointTree::makeHierarchy(J3DJoint* pJoint, const J3DModelHierarchy** pHierarchy,
|
||||
J3DMaterialTable* pMaterialTable, J3DShapeTable* pShapeTable) {
|
||||
enum {
|
||||
kTypeEnd = 0x00,
|
||||
kTypeBeginChild = 0x01,
|
||||
kTypeEndChild = 0x02,
|
||||
kTypeJoint = 0x10,
|
||||
kTypeMaterial = 0x11,
|
||||
kTypeShape = 0x12,
|
||||
};
|
||||
|
||||
J3DJoint * curJoint = pJoint;
|
||||
J3D_ASSERT_NULLPTR(95, pHierarchy != NULL);
|
||||
J3DJoint* curJoint = pJoint;
|
||||
|
||||
while (true) {
|
||||
J3DJoint * newJoint = NULL;
|
||||
J3DMaterial * newMaterial = NULL;
|
||||
J3DShape * newShape = NULL;
|
||||
const J3DModelHierarchy * inf = *pHierarchy;
|
||||
u16 val;
|
||||
J3DJoint* newJoint = NULL;
|
||||
J3DMaterial* newMaterial = NULL;
|
||||
J3DShape* newShape = NULL;
|
||||
|
||||
switch (inf->mType) {
|
||||
switch ((*pHierarchy)->mType) {
|
||||
case kTypeBeginChild:
|
||||
*pHierarchy = inf + 1;
|
||||
(*pHierarchy)++;
|
||||
makeHierarchy(curJoint, pHierarchy, pMaterialTable, pShapeTable);
|
||||
break;
|
||||
case kTypeEndChild:
|
||||
*pHierarchy = inf + 1;
|
||||
(*pHierarchy)++;
|
||||
return;
|
||||
case kTypeEnd:
|
||||
return;
|
||||
case kTypeJoint:
|
||||
{
|
||||
J3DJoint ** jointNodePointer = mJointNodePointer;
|
||||
*pHierarchy = inf + 1;
|
||||
newJoint = jointNodePointer[inf->mValue];
|
||||
}
|
||||
newJoint = mJointNodePointer[((*pHierarchy)++)->mValue];
|
||||
break;
|
||||
case kTypeMaterial:
|
||||
*pHierarchy = inf + 1;
|
||||
val = inf->mValue;
|
||||
newMaterial = pMaterialTable->getMaterialNodePointer(val);
|
||||
newMaterial = pMaterialTable->getMaterialNodePointer(((*pHierarchy)++)->mValue);
|
||||
break;
|
||||
case kTypeShape:
|
||||
*pHierarchy = inf + 1;
|
||||
val = inf->mValue;
|
||||
newShape = pShapeTable->getShapeNodePointer(val);
|
||||
newShape = pShapeTable->getShapeNodePointer(((*pHierarchy)++)->mValue);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -68,31 +59,29 @@ void J3DJointTree::makeHierarchy(J3DJoint* pJoint, J3DModelHierarchy const** pHi
|
||||
mRootNode = newJoint;
|
||||
else
|
||||
pJoint->appendChild(newJoint);
|
||||
} else if (newMaterial != NULL) {
|
||||
if (pJoint->getMesh() != NULL)
|
||||
newMaterial->mNext = pJoint->getMesh();
|
||||
pJoint->mMesh = newMaterial;
|
||||
newMaterial->mJoint = pJoint;
|
||||
} else if (newShape != NULL) {
|
||||
newMaterial = pJoint->getMesh();
|
||||
newMaterial->mShape = newShape;
|
||||
newShape->mMaterial = newMaterial;
|
||||
} else if (newMaterial != NULL && pJoint->getType() == 'NJNT') {
|
||||
pJoint->addMesh(newMaterial);
|
||||
newMaterial->setJoint(pJoint);
|
||||
} else if (newShape != NULL && pJoint->getType() == 'NJNT') {
|
||||
J3DMaterial* newMaterial = pJoint->getMesh();
|
||||
newMaterial->addShape(newShape);
|
||||
newShape->setMaterial(newMaterial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 80325C00-80325CAC 320540 00AC+00 0/0 2/2 0/0 .text findImportantMtxIndex__12J3DJointTreeFv */
|
||||
void J3DJointTree::findImportantMtxIndex() {
|
||||
const s32 wEvlpMtxNum = getWEvlpMtxNum();
|
||||
s32 wEvlpMtxNum = getWEvlpMtxNum();
|
||||
u32 tableIdx = 0;
|
||||
const u16 drawFullWgtMtxNum = getDrawFullWgtMtxNum();
|
||||
const u16 * wEvlpMixIndex = getWEvlpMixMtxIndex();
|
||||
const f32 * wEvlpMixWeight = getWEvlpMixWeight();
|
||||
u16 * wEvlpImportantMtxIdx = getWEvlpImportantMtxIndex();
|
||||
u16 drawFullWgtMtxNum = getDrawFullWgtMtxNum();
|
||||
u16* wEvlpMixIndex = getWEvlpMixMtxIndex();
|
||||
f32* wEvlpMixWeight = getWEvlpMixWeight();
|
||||
u16* wEvlpImportantMtxIdx = getWEvlpImportantMtxIndex();
|
||||
|
||||
// Rigid matrices are easy.
|
||||
for (u16 i = 0; i < drawFullWgtMtxNum; i++)
|
||||
wEvlpImportantMtxIdx[i] = mDrawMtxData.mDrawMtxIndex[i];
|
||||
wEvlpImportantMtxIdx[i] = getDrawMtxIndex(i);
|
||||
|
||||
// For envelope matrices, we need to find the matrix with the most contribution.
|
||||
for (s32 i = 0; i < wEvlpMtxNum; i++) {
|
||||
@@ -100,26 +89,25 @@ void J3DJointTree::findImportantMtxIndex() {
|
||||
u16 bestIdx = 0;
|
||||
f32 bestWeight = -0.1f;
|
||||
|
||||
for (s32 j = 0; j < mixNum; j++) {
|
||||
for (s32 j = 0; j < mixNum; j++, tableIdx++) {
|
||||
if (bestWeight < wEvlpMixWeight[tableIdx]) {
|
||||
bestWeight = wEvlpMixWeight[tableIdx];
|
||||
bestIdx = wEvlpMixIndex[tableIdx];
|
||||
}
|
||||
|
||||
tableIdx++;
|
||||
}
|
||||
|
||||
wEvlpImportantMtxIdx[i + mDrawMtxData.mDrawFullWgtMtxNum] = bestIdx;
|
||||
wEvlpImportantMtxIdx[i + getDrawFullWgtMtxNum()] = bestIdx;
|
||||
}
|
||||
}
|
||||
|
||||
/* 80325CAC-80325D1C 3205EC 0070+00 1/0 0/0 0/0 .text
|
||||
* calc__12J3DJointTreeFP12J3DMtxBufferRC3VecRA3_A4_Cf */
|
||||
void J3DJointTree::calc(J3DMtxBuffer* pMtxBuffer, Vec const& scale, f32 const (&mtx)[3][4]) {
|
||||
J3D_ASSERT_NULLPTR(217, pMtxBuffer != NULL);
|
||||
getBasicMtxCalc()->init(scale, mtx);
|
||||
J3DMtxCalc::setMtxBuffer(pMtxBuffer);
|
||||
J3DJoint* root = getRootNode();
|
||||
getBasicMtxCalc()->setMtxBuffer(pMtxBuffer);
|
||||
|
||||
J3DJoint* root = getRootNode();
|
||||
if (root == NULL)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,22 +1,5 @@
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "dol2asm.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern "C" void calc__14J3DMaterialAnmCFP11J3DMaterial();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
extern "C" void __dt__14J3DMaterialAnmFv();
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
void J3DMaterialAnm::initialize() {
|
||||
for (int i = 0; i < ARRAY_SIZE(mMatColorAnm); i++) {
|
||||
@@ -40,10 +23,12 @@ void J3DMaterialAnm::initialize() {
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMaterialAnm::calc(J3DMaterial* pMat) const {
|
||||
void J3DMaterialAnm::calc(J3DMaterial* pMaterial) const {
|
||||
J3D_ASSERT_NULLPTR(54, pMaterial != NULL);
|
||||
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mMatColorAnm); i++) {
|
||||
if (mMatColorAnm[i].getAnmFlag()) {
|
||||
_GXColor* color = pMat->getColorBlock()->getMatColor(i);
|
||||
GXColor* color = pMaterial->mColorBlock->getMatColor(i);
|
||||
mMatColorAnm[i].calc(color);
|
||||
}
|
||||
}
|
||||
@@ -52,77 +37,78 @@ void J3DMaterialAnm::calc(J3DMaterial* pMat) const {
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mTexNoAnm); i++) {
|
||||
if (mTexNoAnm[i].getAnmFlag()) {
|
||||
mTexNoAnm[i].calc(&tmp);
|
||||
pMat->getTevBlock()->setTexNo(i, tmp);
|
||||
pMaterial->mTevBlock->setTexNo(i, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < 3; i++) {
|
||||
if (mTevColorAnm[i].getAnmFlag()) {
|
||||
_GXColorS10* color = pMat->getTevBlock()->getTevColor(i);
|
||||
GXColorS10* color = pMaterial->mTevBlock->getTevColor(i);
|
||||
mTevColorAnm[i].calc(color);
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mTevKColorAnm); i++) {
|
||||
if (mTevKColorAnm[i].getAnmFlag()) {
|
||||
_GXColor* color = pMat->getTevBlock()->getTevKColor(i);
|
||||
GXColor* color = pMaterial->mTevBlock->getTevKColor(i);
|
||||
mTevKColorAnm[i].calc(color);
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < ARRAY_SIZE(mTexMtxAnm); i++) {
|
||||
if (mTexMtxAnm[i].getAnmFlag()) {
|
||||
J3DTexMtx* texMtx = pMat->getTexGenBlock()->getTexMtx(i);
|
||||
mTexMtxAnm[i].calc(&texMtx->getTexMtxInfo().mSRT);
|
||||
J3DTextureSRTInfo* pSRT = &pMaterial->mTexGenBlock->getTexMtx(i)->getTexMtxInfo().mSRT;
|
||||
mTexMtxAnm[i].calc(pSRT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMaterialAnm::setMatColorAnm(int idx, J3DMatColorAnm* p_matColorAnm) {
|
||||
if (p_matColorAnm == NULL) {
|
||||
void J3DMaterialAnm::setMatColorAnm(int idx, J3DMatColorAnm* pMatColorAnm) {
|
||||
J3D_ASSERT_RANGE(106, idx >= 0 && idx < 2);
|
||||
|
||||
if (pMatColorAnm == NULL) {
|
||||
mMatColorAnm[idx].setAnmFlag(false);
|
||||
} else {
|
||||
mMatColorAnm[idx] = *p_matColorAnm;
|
||||
mMatColorAnm[idx] = *pMatColorAnm;
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMaterialAnm::setTexMtxAnm(int idx, J3DTexMtxAnm* p_texMtxAnm) {
|
||||
if (p_texMtxAnm == NULL) {
|
||||
void J3DMaterialAnm::setTexMtxAnm(int idx, J3DTexMtxAnm* pTexMtxAnm) {
|
||||
J3D_ASSERT_RANGE(117, idx >= 0 && idx < 8);
|
||||
|
||||
if (pTexMtxAnm == NULL) {
|
||||
mTexMtxAnm[idx].setAnmFlag(false);
|
||||
} else {
|
||||
mTexMtxAnm[idx] = *p_texMtxAnm;
|
||||
mTexMtxAnm[idx] = *pTexMtxAnm;
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMaterialAnm::setTexNoAnm(int idx, J3DTexNoAnm* p_texNoAnm) {
|
||||
if (p_texNoAnm == NULL) {
|
||||
void J3DMaterialAnm::setTexNoAnm(int idx, J3DTexNoAnm* pTexNoAnm) {
|
||||
J3D_ASSERT_RANGE(128, idx >= 0 && idx < 8);
|
||||
|
||||
if (pTexNoAnm == NULL) {
|
||||
mTexNoAnm[idx].setAnmFlag(false);
|
||||
} else {
|
||||
mTexNoAnm[idx] = *p_texNoAnm;
|
||||
mTexNoAnm[idx] = *pTexNoAnm;
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMaterialAnm::setTevColorAnm(int idx, J3DTevColorAnm* p_tevColorAnm) {
|
||||
if (p_tevColorAnm == NULL) {
|
||||
void J3DMaterialAnm::setTevColorAnm(int idx, J3DTevColorAnm* pTevColorAnm) {
|
||||
J3D_ASSERT_RANGE(139, idx >= 0 && idx < 4);
|
||||
|
||||
if (pTevColorAnm == NULL) {
|
||||
mTevColorAnm[idx].setAnmFlag(false);
|
||||
} else {
|
||||
mTevColorAnm[idx] = *p_tevColorAnm;
|
||||
mTevColorAnm[idx] = *pTevColorAnm;
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMaterialAnm::setTevKColorAnm(int idx, J3DTevKColorAnm* p_tevKColorAnm) {
|
||||
if (p_tevKColorAnm == NULL) {
|
||||
void J3DMaterialAnm::setTevKColorAnm(int idx, J3DTevKColorAnm* pTevKColorAnm) {
|
||||
J3D_ASSERT_RANGE(150, idx >= 0 && idx < 4);
|
||||
|
||||
if (pTevKColorAnm == NULL) {
|
||||
mTevKColorAnm[idx].setAnmFlag(false);
|
||||
} else {
|
||||
mTevKColorAnm[idx] = *p_tevKColorAnm;
|
||||
mTevKColorAnm[idx] = *pTevKColorAnm;
|
||||
}
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 803CEE60-803CEE70 02BF80 0010+00 0/0 10/10 74/74 .data __vt__14J3DMaterialAnm */
|
||||
SECTION_DATA extern void* __vt__14J3DMaterialAnm[4] = {
|
||||
(void*)NULL /* RTTI */,
|
||||
(void*)NULL,
|
||||
(void*)__dt__14J3DMaterialAnmFv,
|
||||
(void*)calc__14J3DMaterialAnmCFP11J3DMaterial,
|
||||
};
|
||||
@@ -1,8 +1,3 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DMaterialAttach
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAttach.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
@@ -38,13 +33,14 @@ J3DMaterialTable::~J3DMaterialTable() {}
|
||||
/* 8032F64C-8032F6F8 329F8C 00AC+00 0/0 1/1 5/5 .text
|
||||
* removeMatColorAnimator__16J3DMaterialTableFP11J3DAnmColor */
|
||||
int J3DMaterialTable::removeMatColorAnimator(J3DAnmColor* pAnmColor) {
|
||||
JUT_ASSERT_MSG(208, pAnmColor != NULL, "Error : null pointer.")
|
||||
J3D_ASSERT_NULLPTR(208, pAnmColor != NULL);
|
||||
int ret = false;
|
||||
|
||||
u16 updateMatNum = pAnmColor->getUpdateMaterialNum();
|
||||
for (u16 i = 0; i < updateMatNum; i++) {
|
||||
if (pAnmColor->isValidUpdateMaterialID(i)) {
|
||||
u16 materialUpdateId = pAnmColor->getUpdateMaterialID(i);
|
||||
J3DMaterialAnm* materialAnm = getMaterialNodePointer(materialUpdateId)->getMaterialAnm();
|
||||
u16 matNo = pAnmColor->getUpdateMaterialID(i);
|
||||
J3DMaterialAnm* materialAnm = getMaterialNodePointer(matNo)->getMaterialAnm();
|
||||
if (materialAnm == NULL) {
|
||||
ret = true;
|
||||
} else {
|
||||
@@ -52,22 +48,23 @@ int J3DMaterialTable::removeMatColorAnimator(J3DAnmColor* pAnmColor) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 8032F6F8-8032F7B4 32A038 00BC+00 0/0 5/5 10/10 .text
|
||||
* removeTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern */
|
||||
int J3DMaterialTable::removeTexNoAnimator(J3DAnmTexPattern* anm) {
|
||||
JUT_ASSERT_MSG(242, anm != NULL, "Error : null pointer.")
|
||||
int J3DMaterialTable::removeTexNoAnimator(J3DAnmTexPattern* pAnmTexPattern) {
|
||||
J3D_ASSERT_NULLPTR(242, pAnmTexPattern != NULL);
|
||||
int ret = 0;
|
||||
u16 materialNum = anm->getUpdateMaterialNum();
|
||||
J3DAnmTexPatternFullTable* anm_table = (J3DAnmTexPatternFullTable*)anm->getAnmTable();
|
||||
|
||||
u16 materialNum = pAnmTexPattern->getUpdateMaterialNum();
|
||||
J3DAnmTexPatternFullTable* anm_table = (J3DAnmTexPatternFullTable*)pAnmTexPattern->getAnmTable();
|
||||
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
if (anm->isValidUpdateMaterialID(i)) {
|
||||
u16 materialID = anm->getUpdateMaterialID(i);
|
||||
|
||||
J3DMaterialAnm* pMatAnm = getMaterialNodePointer(materialID)->getMaterialAnm();
|
||||
if (pAnmTexPattern->isValidUpdateMaterialID(i)) {
|
||||
u16 matNo = pAnmTexPattern->getUpdateMaterialID(i);
|
||||
J3DMaterialAnm* pMatAnm = getMaterialNodePointer(matNo)->getMaterialAnm();
|
||||
u8 texNo = anm_table[i].mTexNo;
|
||||
if (pMatAnm == NULL)
|
||||
ret = 1;
|
||||
@@ -81,19 +78,20 @@ int J3DMaterialTable::removeTexNoAnimator(J3DAnmTexPattern* anm) {
|
||||
|
||||
/* 8032F7B4-8032F880 32A0F4 00CC+00 0/0 4/4 26/26 .text
|
||||
* removeTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */
|
||||
int J3DMaterialTable::removeTexMtxAnimator(J3DAnmTextureSRTKey* pAnm) {
|
||||
JUT_ASSERT_MSG(278, pAnm != NULL, "Error : null pointer.")
|
||||
int J3DMaterialTable::removeTexMtxAnimator(J3DAnmTextureSRTKey* pAnmTexSRTKey) {
|
||||
J3D_ASSERT_NULLPTR(278, pAnmTexSRTKey != NULL);
|
||||
s32 ret = 0;
|
||||
u16 materialNum = pAnm->getUpdateMaterialNum();
|
||||
|
||||
u16 materialNum = pAnmTexSRTKey->getUpdateMaterialNum();
|
||||
u16 postUpdateMaterialNum[1];
|
||||
postUpdateMaterialNum[0] = pAnm->getPostUpdateMaterialNum();
|
||||
postUpdateMaterialNum[0] = pAnmTexSRTKey->getPostUpdateMaterialNum();
|
||||
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
if (pAnm->isValidUpdateMaterialID(i)) {
|
||||
u16 updateMaterial = pAnm->getUpdateMaterialID(i);
|
||||
J3DMaterial* pMaterial = getMaterialNodePointer(updateMaterial);
|
||||
if (pAnmTexSRTKey->isValidUpdateMaterialID(i)) {
|
||||
u16 matNo = pAnmTexSRTKey->getUpdateMaterialID(i);
|
||||
J3DMaterial* pMaterial = getMaterialNodePointer(matNo);
|
||||
J3DMaterialAnm* pMatAnm = pMaterial->getMaterialAnm();
|
||||
u8 texMtxID = pAnm->getUpdateTexMtxID(i);
|
||||
u8 texMtxID = pAnmTexSRTKey->getUpdateTexMtxID(i);
|
||||
if (pMatAnm == NULL) {
|
||||
ret = 1;
|
||||
} else if (texMtxID != 0xFF) {
|
||||
@@ -107,15 +105,19 @@ int J3DMaterialTable::removeTexMtxAnimator(J3DAnmTextureSRTKey* pAnm) {
|
||||
|
||||
/* 8032F880-8032F9C0 32A1C0 0140+00 0/0 7/7 24/24 .text
|
||||
* removeTevRegAnimator__16J3DMaterialTableFP15J3DAnmTevRegKey */
|
||||
int J3DMaterialTable::removeTevRegAnimator(J3DAnmTevRegKey* pAnm) {
|
||||
int J3DMaterialTable::removeTevRegAnimator(J3DAnmTevRegKey* pAnmTevRegKey) {
|
||||
J3D_ASSERT_NULLPTR(320, pAnmTevRegKey != NULL);
|
||||
s32 ret = 0;
|
||||
u16 cRegMaterialNum = pAnm->getCRegUpdateMaterialNum();
|
||||
u16 kRegMaterialNum = pAnm->getKRegUpdateMaterialNum();
|
||||
|
||||
u16 cRegMaterialNum = pAnmTevRegKey->getCRegUpdateMaterialNum();
|
||||
u16 kRegMaterialNum = pAnmTevRegKey->getKRegUpdateMaterialNum();
|
||||
|
||||
for (u16 i = 0; i < cRegMaterialNum; i++) {
|
||||
if (pAnm->getCRegUpdateMaterialID(i) != 0xFFFF) {
|
||||
J3DMaterialAnm * pMatAnm = getMaterialNodePointer(pAnm->getCRegUpdateMaterialID(i))->getMaterialAnm();
|
||||
u32 colorId = pAnm->getAnmCRegKeyTable()[i].mColorId;
|
||||
if (pAnmTevRegKey->isValidCRegUpdateMaterialID(i)) {
|
||||
const u16 spC = pAnmTevRegKey->getCRegUpdateMaterialID(i);
|
||||
J3DMaterialAnm* pMatAnm = getMaterialNodePointer(spC)->getMaterialAnm();
|
||||
const J3DAnmCRegKeyTable* table = pAnmTevRegKey->getAnmCRegKeyTable();
|
||||
const u8 colorId = table[i].mColorId;
|
||||
if (pMatAnm == NULL)
|
||||
ret = 1;
|
||||
else
|
||||
@@ -124,9 +126,11 @@ int J3DMaterialTable::removeTevRegAnimator(J3DAnmTevRegKey* pAnm) {
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < kRegMaterialNum; i++) {
|
||||
if (pAnm->getKRegUpdateMaterialID(i) != 0xFFFF) {
|
||||
J3DMaterialAnm * pMatAnm = getMaterialNodePointer(pAnm->getKRegUpdateMaterialID(i))->getMaterialAnm();
|
||||
u32 colorId = pAnm->getAnmKRegKeyTable()[i].mColorId;
|
||||
if (pAnmTevRegKey->isValidKRegUpdateMaterialID(i)) {
|
||||
const u16 spA = pAnmTevRegKey->getKRegUpdateMaterialID(i);
|
||||
J3DMaterialAnm* pMatAnm = getMaterialNodePointer(spA)->getMaterialAnm();
|
||||
const J3DAnmKRegKeyTable* table = pAnmTevRegKey->getAnmKRegKeyTable();
|
||||
const u8 colorId = table[i].mColorId;
|
||||
if (pMatAnm == NULL) {
|
||||
ret = 1;
|
||||
} else {
|
||||
@@ -140,99 +144,117 @@ int J3DMaterialTable::removeTevRegAnimator(J3DAnmTevRegKey* pAnm) {
|
||||
|
||||
/* 8032F9C0-8032FAF4 32A300 0134+00 1/1 0/0 0/0 .text
|
||||
* createTexMtxForAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */
|
||||
int J3DMaterialTable::createTexMtxForAnimator(J3DAnmTextureSRTKey* param_1) {
|
||||
int J3DMaterialTable::createTexMtxForAnimator(J3DAnmTextureSRTKey* pTexSRTKey) {
|
||||
J3D_ASSERT_NULLPTR(382, pTexSRTKey != NULL);
|
||||
int rv = 0;
|
||||
u16 materialNum = param_1->getUpdateMaterialNum();
|
||||
|
||||
u16 materialNum = pTexSRTKey->getUpdateMaterialNum();
|
||||
if (isLocked()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
if (param_1->isValidUpdateMaterialID(i)) {
|
||||
J3DMaterial* material = getMaterialNodePointer(param_1->getUpdateMaterialID(i));
|
||||
u8 mtxId = param_1->getUpdateTexMtxID(i);
|
||||
if (material->getMaterialAnm() == 0) {
|
||||
if (pTexSRTKey->isValidUpdateMaterialID(i)) {
|
||||
const u16 matNo = pTexSRTKey->getUpdateMaterialID(i);
|
||||
J3DMaterial* material = getMaterialNodePointer(matNo);
|
||||
u8 texMtx = pTexSRTKey->getUpdateTexMtxID(i);
|
||||
|
||||
J3DMaterialAnm* pMaterialAnm = material->getMaterialAnm();
|
||||
if (pMaterialAnm == NULL) {
|
||||
rv = 1;
|
||||
} else {
|
||||
u32 mtxId2 = mtxId;
|
||||
if (mtxId2 != 0xff && material->getTexMtx(mtxId2) == 0) {
|
||||
if (texMtx != 0xff && material->getTexMtx(texMtx) == NULL) {
|
||||
J3DTexMtx* mtx = new J3DTexMtx();
|
||||
rv = 4;
|
||||
material->setTexMtx(mtxId2, mtx);
|
||||
JUT_WARN(420, "matNo<%d> : texMtx%d nothing !\n", i, mtxId);
|
||||
material->setTexMtx(texMtx, mtx);
|
||||
JUT_WARN(420, "matNo<%d> : texMtx%d nothing !\n", matNo, texMtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 8032FAF4-8032FBC8 32A434 00D4+00 0/0 1/1 0/0 .text
|
||||
* entryMatColorAnimator__16J3DMaterialTableFP11J3DAnmColor */
|
||||
int J3DMaterialTable::entryMatColorAnimator(J3DAnmColor* param_1) {
|
||||
int J3DMaterialTable::entryMatColorAnimator(J3DAnmColor* pAnmColor) {
|
||||
J3D_ASSERT_NULLPTR(450, pAnmColor != NULL);
|
||||
int rv = 0;
|
||||
u16 materialNum = param_1->getUpdateMaterialNum();
|
||||
|
||||
u16 materialNum = pAnmColor->getUpdateMaterialNum();
|
||||
if (isLocked()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
if (param_1->isValidUpdateMaterialID(i)) {
|
||||
J3DMaterial* material = getMaterialNodePointer(param_1->getUpdateMaterialID(i));
|
||||
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
|
||||
if (materialAnm == 0) {
|
||||
if (pAnmColor->isValidUpdateMaterialID(i)) {
|
||||
const u16 matNo = pAnmColor->getUpdateMaterialID(i);
|
||||
J3DMaterialAnm* materialAnm = getMaterialNodePointer(matNo)->getMaterialAnm();
|
||||
if (materialAnm == NULL) {
|
||||
rv = 1;
|
||||
} else {
|
||||
J3DMatColorAnm matColorAnm(i, param_1);
|
||||
J3DMatColorAnm matColorAnm(i, pAnmColor);
|
||||
materialAnm->setMatColorAnm(0, &matColorAnm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 8032FBC8-8032FCC4 32A508 00FC+00 0/0 7/7 1/1 .text
|
||||
* entryTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern */
|
||||
int J3DMaterialTable::entryTexNoAnimator(J3DAnmTexPattern* param_1) {
|
||||
int J3DMaterialTable::entryTexNoAnimator(J3DAnmTexPattern* pAnmTexPattern) {
|
||||
J3D_ASSERT_NULLPTR(489, pAnmTexPattern != NULL);
|
||||
int rv = 0;
|
||||
u16 materialNum = param_1->getUpdateMaterialNum();
|
||||
|
||||
u16 materialNum = pAnmTexPattern->getUpdateMaterialNum();
|
||||
if (isLocked()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
if (param_1->isValidUpdateMaterialID(i)) {
|
||||
J3DMaterial* material = getMaterialNodePointer(param_1->getUpdateMaterialID(i));
|
||||
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
|
||||
u8 texNo = param_1->getAnmTable()[i].mTexNo;
|
||||
if (materialAnm == 0) {
|
||||
if (pAnmTexPattern->isValidUpdateMaterialID(i)) {
|
||||
const u16 matNo = pAnmTexPattern->getUpdateMaterialID(i);
|
||||
J3DMaterialAnm* materialAnm = getMaterialNodePointer(matNo)->getMaterialAnm();
|
||||
const J3DAnmTexPatternFullTable* table = pAnmTexPattern->getAnmTable();
|
||||
const u8 texNo = table[i].mTexNo;
|
||||
if (materialAnm == NULL) {
|
||||
rv = 1;
|
||||
} else {
|
||||
J3DTexNoAnm texNoAnm(i, param_1);
|
||||
J3DTexNoAnm texNoAnm(i, pAnmTexPattern);
|
||||
materialAnm->setTexNoAnm(texNo, &texNoAnm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 8032FCC4-8032FE70 32A604 01AC+00 0/0 14/14 6/6 .text
|
||||
* entryTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */
|
||||
int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* btk) {
|
||||
JUT_ASSERT_MSG(532, btk != NULL, "Error : null pointer.")
|
||||
int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* pAnmTexSRTKey) {
|
||||
J3D_ASSERT_NULLPTR(532, pAnmTexSRTKey != NULL);
|
||||
int rv = 0;
|
||||
u16 materialNum = btk->getUpdateMaterialNum();
|
||||
rv = createTexMtxForAnimator(btk);
|
||||
u16 materialNum = pAnmTexSRTKey->getUpdateMaterialNum();
|
||||
|
||||
rv = createTexMtxForAnimator(pAnmTexSRTKey);
|
||||
if (rv != 0) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (isLocked()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (u16 no = 0; no < materialNum; no++) {
|
||||
if (btk->isValidUpdateMaterialID(no)) {
|
||||
u16 updateMaterialId = btk->getUpdateMaterialID(no);
|
||||
J3DMaterial* material = getMaterialNodePointer((u16)updateMaterialId);
|
||||
if (pAnmTexSRTKey->isValidUpdateMaterialID(no)) {
|
||||
const u16 matNo = pAnmTexSRTKey->getUpdateMaterialID(no);
|
||||
J3DMaterial* material = getMaterialNodePointer(matNo);
|
||||
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
|
||||
u8 texMtxID = btk->getUpdateTexMtxID(no);
|
||||
if (materialAnm == 0) {
|
||||
u8 texMtxID = pAnmTexSRTKey->getUpdateTexMtxID(no);
|
||||
if (materialAnm == NULL) {
|
||||
rv = 1;
|
||||
} else {
|
||||
if (texMtxID != 0xff) {
|
||||
@@ -240,53 +262,61 @@ int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* btk) {
|
||||
material->getTexCoord(texMtxID)->setTexGenMtx((u8)texMtxID * 3 + 30);
|
||||
}
|
||||
J3DTexMtxInfo& tmtxinfo = material->getTexMtx(texMtxID)->getTexMtxInfo();
|
||||
tmtxinfo.mInfo = (tmtxinfo.mInfo & 0x3f) | (btk->getTexMtxCalcType() << 7);
|
||||
tmtxinfo.mCenter.x = btk->getSRTCenter(no)->x;
|
||||
tmtxinfo.mCenter.y = btk->getSRTCenter(no)->y;
|
||||
tmtxinfo.mCenter.z = btk->getSRTCenter(no)->z;
|
||||
J3DTexMtxAnm texMtxAnm(no, btk);
|
||||
tmtxinfo.mInfo = (tmtxinfo.mInfo & 0x3f) | (pAnmTexSRTKey->getTexMtxCalcType() << 7);
|
||||
tmtxinfo.mCenter.x = pAnmTexSRTKey->getSRTCenter(no)->x;
|
||||
tmtxinfo.mCenter.y = pAnmTexSRTKey->getSRTCenter(no)->y;
|
||||
tmtxinfo.mCenter.z = pAnmTexSRTKey->getSRTCenter(no)->z;
|
||||
J3DTexMtxAnm texMtxAnm(no, pAnmTexSRTKey);
|
||||
materialAnm->setTexMtxAnm(texMtxID, &texMtxAnm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 8032FE70-8032FFEC 32A7B0 017C+00 0/0 10/10 4/4 .text
|
||||
* entryTevRegAnimator__16J3DMaterialTableFP15J3DAnmTevRegKey */
|
||||
int J3DMaterialTable::entryTevRegAnimator(J3DAnmTevRegKey* param_1) {
|
||||
int J3DMaterialTable::entryTevRegAnimator(J3DAnmTevRegKey* pAnmTevRegKey) {
|
||||
J3D_ASSERT_NULLPTR(599, pAnmTevRegKey != NULL);
|
||||
int rv = 0;
|
||||
u16 cRegNum = param_1->getCRegUpdateMaterialNum();
|
||||
u16 kRegNum = param_1->getKRegUpdateMaterialNum();
|
||||
|
||||
u16 cRegNum = pAnmTevRegKey->getCRegUpdateMaterialNum();
|
||||
u16 kRegNum = pAnmTevRegKey->getKRegUpdateMaterialNum();
|
||||
if (isLocked()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < cRegNum; i++) {
|
||||
if (param_1->isValidCRegUpdateMaterialID(i)) {
|
||||
J3DMaterial* material = getMaterialNodePointer(param_1->getCRegUpdateMaterialID(i));
|
||||
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
|
||||
u8 colorId = param_1->getAnmCRegKeyTable()[i].mColorId;
|
||||
if (pAnmTevRegKey->isValidCRegUpdateMaterialID(i)) {
|
||||
const u16 matNo = pAnmTevRegKey->getCRegUpdateMaterialID(i);
|
||||
J3DMaterialAnm* materialAnm = getMaterialNodePointer(matNo)->getMaterialAnm();
|
||||
const J3DAnmCRegKeyTable* table = pAnmTevRegKey->getAnmCRegKeyTable();
|
||||
u8 colorId = table[i].mColorId;
|
||||
if (materialAnm == NULL) {
|
||||
rv = 1;
|
||||
} else {
|
||||
J3DTevColorAnm tevColorAnm(i, param_1);
|
||||
J3DTevColorAnm tevColorAnm(i, pAnmTevRegKey);
|
||||
materialAnm->setTevColorAnm(colorId, &tevColorAnm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < kRegNum; i++) {
|
||||
if (param_1->isValidKRegUpdateMaterialID(i)) {
|
||||
J3DMaterial* material = getMaterialNodePointer(param_1->getKRegUpdateMaterialID(i));
|
||||
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
|
||||
u32 colorId = param_1->getAnmKRegKeyTable()[i].mColorId;
|
||||
if (pAnmTevRegKey->isValidKRegUpdateMaterialID(i)) {
|
||||
const u16 matNo = pAnmTevRegKey->getKRegUpdateMaterialID(i);
|
||||
J3DMaterialAnm* materialAnm = getMaterialNodePointer(matNo)->getMaterialAnm();
|
||||
const J3DAnmKRegKeyTable* table = pAnmTevRegKey->getAnmKRegKeyTable();
|
||||
const u8 colorId = table[i].mColorId;
|
||||
if (materialAnm == NULL) {
|
||||
rv = 1;
|
||||
} else {
|
||||
J3DTevKColorAnm tevKColorAnm(i, param_1);
|
||||
J3DTevKColorAnm tevKColorAnm(i, pAnmTevRegKey);
|
||||
materialAnm->setTevKColorAnm(colorId, &tevKColorAnm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DModel
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
|
||||
#include "dolphin/os.h"
|
||||
|
||||
#define J3D_ASSERTMSG(LINE, COND, MSG) JUT_ASSERT_MSG(LINE, (COND) != 0, MSG)
|
||||
#define J3D_WARN1(LINE, MSG, ARG1) JUT_WARN(LINE, MSG, ARG1)
|
||||
|
||||
/* 80327100-80327184 321A40 0084+00 0/0 3/3 0/0 .text initialize__8J3DModelFv */
|
||||
void J3DModel::initialize() {
|
||||
@@ -36,72 +33,80 @@ void J3DModel::initialize() {
|
||||
|
||||
/* 80327184-80327300 321AC4 017C+00 0/0 3/3 0/0 .text
|
||||
* entryModelData__8J3DModelFP12J3DModelDataUlUl */
|
||||
s32 J3DModel::entryModelData(J3DModelData* p_modelData, u32 modelFlag, u32 mtxBufferFlag) {
|
||||
mModelData = p_modelData;
|
||||
s32 J3DModel::entryModelData(J3DModelData* pModelData, u32 mdlFlags, u32 mtxNum) {
|
||||
J3D_ASSERTMSG(83, pModelData != NULL, "Error : null pointer.");
|
||||
J3D_ASSERTMSG(84, mtxNum != 0, "Error : non-zero argument is specified 0.");
|
||||
int ret = kJ3DError_Success;
|
||||
|
||||
mModelData = pModelData;
|
||||
mMtxBuffer = new J3DMtxBuffer();
|
||||
|
||||
if (mMtxBuffer == NULL) {
|
||||
return 4;
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
s32 ret = mMtxBuffer->create(p_modelData, mtxBufferFlag);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
ret = createShapePacket(p_modelData);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
ret = createMatPacket(p_modelData, modelFlag);
|
||||
if (ret) {
|
||||
ret = mMtxBuffer->create(pModelData, mtxNum);
|
||||
if (ret != kJ3DError_Success) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
mVertexBuffer.setVertexData(&p_modelData->getVertexData());
|
||||
ret = createShapePacket(pModelData);
|
||||
if (ret != kJ3DError_Success) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = createMatPacket(pModelData, mdlFlags);
|
||||
if (ret != kJ3DError_Success) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
mVertexBuffer.setVertexData(&pModelData->getVertexData());
|
||||
prepareShapePackets();
|
||||
|
||||
if (modelFlag & J3DMdlFlag_Unk00001) {
|
||||
onFlag(J3DMdlFlag_Unk00001);
|
||||
if (mdlFlags & J3DMdlFlag_Unk1) {
|
||||
onFlag(J3DMdlFlag_Unk1);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_Unk00002) {
|
||||
onFlag(J3DMdlFlag_Unk00002);
|
||||
if (mdlFlags & J3DMdlFlag_UseDefaultJ3D) {
|
||||
onFlag(J3DMdlFlag_UseDefaultJ3D);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_Unk00010) {
|
||||
onFlag(J3DMdlFlag_Unk00010);
|
||||
if (mdlFlags & J3DMdlFlag_EnableLOD) {
|
||||
onFlag(J3DMdlFlag_EnableLOD);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_Unk20000) {
|
||||
onFlag(J3DMdlFlag_Unk20000);
|
||||
if (mdlFlags & J3DMdlFlag_UseSharedDL) {
|
||||
onFlag(J3DMdlFlag_UseSharedDL);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_Unk40000) {
|
||||
onFlag(J3DMdlFlag_Unk40000);
|
||||
if (mdlFlags & J3DMdlFlag_UseSingleDL) {
|
||||
onFlag(J3DMdlFlag_UseSingleDL);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_Unk80000) {
|
||||
onFlag(J3DMdlFlag_Unk80000);
|
||||
if (mdlFlags & J3DMdlFlag_DifferedDLBuffer) {
|
||||
onFlag(J3DMdlFlag_DifferedDLBuffer);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_SkinPosCpu) {
|
||||
if (mdlFlags & J3DMdlFlag_SkinPosCpu) {
|
||||
J3D_WARN1(149, "%s", "Don't forget to call J3DModel::setSkinDeform\n if you set J3DMdlFlag_SkinPosCpu.");
|
||||
onFlag(J3DMdlFlag_SkinPosCpu);
|
||||
}
|
||||
if (modelFlag & J3DMdlFlag_SkinNrmCpu) {
|
||||
if (mdlFlags & J3DMdlFlag_SkinNrmCpu) {
|
||||
J3D_WARN1(154, "%s", "Don't forget to call J3DModel::setSkinDeform\n if you set J3DMdlFlag_SkinNrmCpu.");
|
||||
onFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* 80327300-803273CC 321C40 00CC+00 1/1 0/0 0/0 .text createShapePacket__8J3DModelFP12J3DModelData
|
||||
*/
|
||||
s32 J3DModel::createShapePacket(J3DModelData* p_modelData) {
|
||||
if (p_modelData->getShapeNum() != 0) {
|
||||
u16 shapeNum = p_modelData->getShapeNum();
|
||||
s32 J3DModel::createShapePacket(J3DModelData* pModelData) {
|
||||
J3D_ASSERTMSG(173, pModelData != NULL, "Error : null pointer.");
|
||||
|
||||
mShapePacket = new J3DShapePacket[shapeNum];
|
||||
if (pModelData->getShapeNum() != 0) {
|
||||
mShapePacket = new J3DShapePacket[pModelData->getShapeNum()];
|
||||
|
||||
if (mShapePacket == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
for (int i = 0; i < p_modelData->getShapeNum(); i++) {
|
||||
J3DShape* shapeNode = p_modelData->getShapeNodePointer(i);
|
||||
mShapePacket[i].setShape(shapeNode);
|
||||
for (int i = 0; i < pModelData->getShapeNum(); i++) {
|
||||
mShapePacket[i].setShape(pModelData->getShapeNodePointer(i));
|
||||
mShapePacket[i].setModel(this);
|
||||
}
|
||||
}
|
||||
@@ -111,76 +116,78 @@ s32 J3DModel::createShapePacket(J3DModelData* p_modelData) {
|
||||
|
||||
/* 803273CC-803275FC 321D0C 0230+00 1/1 0/0 0/0 .text createMatPacket__8J3DModelFP12J3DModelDataUl
|
||||
*/
|
||||
s32 J3DModel::createMatPacket(J3DModelData* p_modelData, u32 flag) {
|
||||
if (p_modelData->getMaterialNum() != 0) {
|
||||
mMatPacket = new J3DMatPacket[p_modelData->getMaterialNum()];
|
||||
s32 J3DModel::createMatPacket(J3DModelData* pModelData, u32 mdlFlags) {
|
||||
J3D_ASSERTMSG(207, pModelData != NULL, "Error : null pointer.");
|
||||
s32 ret = 0;
|
||||
|
||||
if (pModelData->getMaterialNum() != 0) {
|
||||
mMatPacket = new J3DMatPacket[pModelData->getMaterialNum()];
|
||||
|
||||
if (mMatPacket == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
}
|
||||
|
||||
s32 ret;
|
||||
u16 matNum = p_modelData->getMaterialNum();
|
||||
|
||||
u32 singleDLFlag = flag & 0x40000;
|
||||
|
||||
u16 matNum = pModelData->getMaterialNum();
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
J3DMaterial* materialNode = p_modelData->getMaterialNodePointer(i);
|
||||
J3DMatPacket* pkt = mMatPacket + i;
|
||||
J3DMaterial* materialNode = pModelData->getMaterialNodePointer(i);
|
||||
J3DMatPacket* matPacket = mMatPacket + i;
|
||||
J3DShapePacket* shapePacket = mShapePacket + materialNode->getShape()->getIndex();
|
||||
|
||||
u16 shapeIndex = materialNode->getShape()->getIndex();
|
||||
J3DShapePacket* shapePacket = mShapePacket + shapeIndex;
|
||||
matPacket->setMaterial(materialNode);
|
||||
matPacket->setInitShapePacket(shapePacket);
|
||||
matPacket->addShapePacket(shapePacket);
|
||||
matPacket->setTexture(pModelData->getTexture());
|
||||
matPacket->setMaterialID(materialNode->mDiffFlag);
|
||||
|
||||
pkt->setMaterial(materialNode);
|
||||
pkt->setInitShapePacket(shapePacket);
|
||||
pkt->addShapePacket(shapePacket);
|
||||
pkt->setTexture(p_modelData->getTexture());
|
||||
pkt->setMaterialID(materialNode->mDiffFlag);
|
||||
|
||||
if (p_modelData->getModelDataType() == 1) {
|
||||
pkt->mFlags |= 0x01;
|
||||
if (pModelData->getModelDataType() == 1) {
|
||||
matPacket->lock();
|
||||
}
|
||||
|
||||
if (!!(flag & 0x80000)) {
|
||||
pkt->mpDisplayListObj = materialNode->getSharedDisplayListObj();
|
||||
if (mdlFlags & J3DMdlFlag_DifferedDLBuffer) {
|
||||
J3DDisplayListObj* dlobj = materialNode->getSharedDisplayListObj();
|
||||
J3D_ASSERTMSG(253, dlobj != NULL, "Error : User need to call J3DModelData::newSharedDisplayList() before using DifferedDLBuffer.");
|
||||
matPacket->setDisplayListObj(dlobj);
|
||||
} else {
|
||||
if (p_modelData->getModelDataType() == 1) {
|
||||
if (!!(flag & 0x40000)) {
|
||||
pkt->mpDisplayListObj = materialNode->getSharedDisplayListObj();
|
||||
if (pModelData->getModelDataType() == 1) {
|
||||
if (mdlFlags & J3DMdlFlag_UseSingleDL) {
|
||||
matPacket->mpDisplayListObj = materialNode->getSharedDisplayListObj();
|
||||
matPacket->setDisplayListObj(matPacket->mpDisplayListObj);
|
||||
} else {
|
||||
J3DDisplayListObj* sharedDL = materialNode->getSharedDisplayListObj();
|
||||
ret = sharedDL->single_To_Double();
|
||||
J3DDisplayListObj* dlobj = materialNode->getSharedDisplayListObj();
|
||||
ret = dlobj->single_To_Double();
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
pkt->mpDisplayListObj = sharedDL;
|
||||
matPacket->setDisplayListObj(dlobj);
|
||||
}
|
||||
} else if (!!(flag & 0x20000)) {
|
||||
if (!!(flag & 0x40000)) {
|
||||
} else if (mdlFlags & J3DMdlFlag_UseSharedDL) {
|
||||
if (mdlFlags & J3DMdlFlag_UseSingleDL) {
|
||||
ret = materialNode->newSingleSharedDisplayList(materialNode->countDLSize());
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
pkt->mpDisplayListObj = materialNode->getSharedDisplayListObj();
|
||||
J3DDisplayListObj* dlobj = materialNode->getSharedDisplayListObj();
|
||||
matPacket->setDisplayListObj(dlobj);
|
||||
} else {
|
||||
ret = materialNode->newSharedDisplayList(materialNode->countDLSize());
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
J3DDisplayListObj* sharedDL = materialNode->getSharedDisplayListObj();
|
||||
ret = sharedDL->single_To_Double();
|
||||
J3DDisplayListObj* dlobj = materialNode->getSharedDisplayListObj();
|
||||
ret = dlobj->single_To_Double();
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
pkt->mpDisplayListObj = sharedDL;
|
||||
matPacket->setDisplayListObj(dlobj);
|
||||
}
|
||||
} else {
|
||||
if (!!(flag & 0x40000)) {
|
||||
ret = pkt->newSingleDisplayList(materialNode->countDLSize());
|
||||
if (mdlFlags & J3DMdlFlag_UseSingleDL) {
|
||||
ret = matPacket->newSingleDisplayList(materialNode->countDLSize());
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
} else {
|
||||
ret = pkt->newDisplayList(materialNode->countDLSize());
|
||||
ret = matPacket->newDisplayList(materialNode->countDLSize());
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
}
|
||||
@@ -192,21 +199,40 @@ s32 J3DModel::createMatPacket(J3DModelData* p_modelData, u32 flag) {
|
||||
}
|
||||
|
||||
/* 803275FC-8032767C 321F3C 0080+00 0/0 1/1 0/0 .text newDifferedDisplayList__8J3DModelFUl */
|
||||
s32 J3DModel::newDifferedDisplayList(u32 flag) {
|
||||
mDiffFlag = flag;
|
||||
s32 J3DModel::newDifferedDisplayList(u32 diffFlags) {
|
||||
mDiffFlag = diffFlags;
|
||||
|
||||
u16 shapeNum = getModelData()->getShapeNum();
|
||||
for (u16 i = 0; i < shapeNum; i++) {
|
||||
s32 ret = mShapePacket[i].newDifferedDisplayList(flag);
|
||||
s32 ret = getShapePacket(i)->newDifferedDisplayList(diffFlags);
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
void J3DModel::ptrToIndex() {
|
||||
j3dSys.setModel(this);
|
||||
j3dSys.setTexture(mModelData->getTexture());
|
||||
|
||||
u16 matNum = mModelData->getMaterialNum();
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
J3DMatPacket* matPacket = getMatPacket(i);
|
||||
|
||||
GDLObj dlobj;
|
||||
GDInitGDLObj(&dlobj, matPacket->getDisplayList(0), matPacket->getDisplayListSize());
|
||||
GDSetCurrent(&dlobj);
|
||||
|
||||
mModelData->getMaterialNodePointer(i)->getTevBlock()->ptrToIndex();
|
||||
|
||||
GDSetCurrent(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* 8032767C-803276B4 321FBC 0038+00 0/0 4/4 0/0 .text lock__8J3DModelFv */
|
||||
void J3DModel::lock() {
|
||||
u16 matNum = mModelData->getMaterialNum();
|
||||
|
||||
int matNum = mModelData->getMaterialNum();
|
||||
for (int i = 0; i < matNum; i++) {
|
||||
mMatPacket[i].lock();
|
||||
}
|
||||
@@ -214,24 +240,34 @@ void J3DModel::lock() {
|
||||
|
||||
/* 803276B4-803276EC 321FF4 0038+00 0/0 2/2 0/0 .text unlock__8J3DModelFv */
|
||||
void J3DModel::unlock() {
|
||||
u16 matNum = mModelData->getMaterialNum();
|
||||
|
||||
int matNum = mModelData->getMaterialNum();
|
||||
for (int i = 0; i < matNum; i++) {
|
||||
mMatPacket[i].unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void J3DModel::makeDL() {
|
||||
j3dSys.setModel(this);
|
||||
j3dSys.setTexture(mModelData->getTexture());
|
||||
|
||||
u16 matNum = mModelData->getMaterialNum();
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
j3dSys.setMatPacket(&mMatPacket[i]);
|
||||
mModelData->getMaterialNodePointer(i)->makeDisplayList();
|
||||
}
|
||||
}
|
||||
|
||||
/* 803276EC-80327858 32202C 016C+00 1/0 0/0 0/0 .text calcMaterial__8J3DModelFv */
|
||||
void J3DModel::calcMaterial() {
|
||||
j3dSys.setModel(this);
|
||||
|
||||
if (checkFlag(4)) {
|
||||
if (checkFlag(J3DMdlFlag_SkinPosCpu)) {
|
||||
j3dSys.onFlag(4);
|
||||
} else {
|
||||
j3dSys.offFlag(4);
|
||||
}
|
||||
|
||||
if (checkFlag(8)) {
|
||||
if (checkFlag(J3DMdlFlag_SkinNrmCpu)) {
|
||||
j3dSys.onFlag(8);
|
||||
} else {
|
||||
j3dSys.offFlag(8);
|
||||
@@ -249,31 +285,31 @@ void J3DModel::calcMaterial() {
|
||||
material->getMaterialAnm()->calc(material);
|
||||
}
|
||||
|
||||
int jntNo = material->getJoint()->getJntNo();
|
||||
material->calc(getAnmMtx(jntNo));
|
||||
material->calc(getAnmMtx(material->getJoint()->getJntNo()));
|
||||
}
|
||||
}
|
||||
|
||||
/* 80327858-803279A0 322198 0148+00 1/0 0/0 0/0 .text calcDiffTexMtx__8J3DModelFv */
|
||||
// NONMATCHING regalloc
|
||||
void J3DModel::calcDiffTexMtx() {
|
||||
j3dSys.setModel(this);
|
||||
|
||||
for (u16 num = mModelData->getMaterialNum(), i = 0; i < num; i++) {
|
||||
u16 matNum = mModelData->getMaterialNum();
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
j3dSys.setMatPacket(&mMatPacket[i]);
|
||||
J3DMaterial* materialNode = mModelData->getMaterialNodePointer(i);
|
||||
materialNode->calcDiffTexMtx(getAnmMtx(materialNode->getJoint()->getJntNo()));
|
||||
}
|
||||
|
||||
for (u16 num = mModelData->getShapeNum(), i = 0; i < num; i++) {
|
||||
u16 shapeNum = getModelData()->getShapeNum();
|
||||
for (u16 i = 0; i < shapeNum; i++) {
|
||||
J3DShapePacket* shapePacket = getShapePacket(i);
|
||||
J3DTexGenBlock* texGenBlock =
|
||||
mModelData->getShapeNodePointer(i)->getMaterial()->getTexGenBlock();
|
||||
J3DTexGenBlock* texGenBlock = mModelData->getShapeNodePointer(i)->getMaterial()->getTexGenBlock();
|
||||
|
||||
for (u16 j = 0; (int)j < 8; j++) {
|
||||
J3DTexMtx* texMtxNode = texGenBlock->getTexMtx(j);
|
||||
J3DTexMtxObj* texMtxObj = shapePacket->getTexMtxObj();
|
||||
if (texMtxNode != NULL && texMtxObj != NULL) {
|
||||
texMtxObj->setMtx(j, &texMtxNode->getMtx());
|
||||
texMtxObj->setMtx(j, texMtxNode->getMtx());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -281,9 +317,10 @@ void J3DModel::calcDiffTexMtx() {
|
||||
|
||||
/* 803279A0-80327A2C 3222E0 008C+00 0/0 2/2 0/0 .text diff__8J3DModelFv */
|
||||
void J3DModel::diff() {
|
||||
for (u16 n = getModelData()->getMaterialNum(), i = 0; i < n; i++) {
|
||||
u16 matNum = mModelData->getMaterialNum();
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
j3dSys.setMatPacket(&mMatPacket[i]);
|
||||
getModelData()->getMaterialNodePointer(i)->diff(mDiffFlag);
|
||||
mModelData->getMaterialNodePointer(i)->diff(mDiffFlag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,17 +330,19 @@ s32 J3DModel::setDeformData(J3DDeformData* p_deformData, u32 param_1) {
|
||||
mDeformData = p_deformData;
|
||||
|
||||
if (p_deformData == NULL) {
|
||||
return 0;
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
s32 ret = mVertexBuffer.copyLocalVtxArray(param_1);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (param_1 & 4) {
|
||||
p_deformData->offAllFlag(1);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* 80327AA0-80327BD4 3223E0 0134+00 0/0 0/0 2/2 .text setSkinDeform__8J3DModelFP13J3DSkinDeformUl
|
||||
@@ -311,46 +350,43 @@ s32 J3DModel::setDeformData(J3DDeformData* p_deformData, u32 param_1) {
|
||||
s32 J3DModel::setSkinDeform(J3DSkinDeform* p_skinDeform, u32 flags) {
|
||||
mSkinDeform = p_skinDeform;
|
||||
|
||||
s32 ret = kJ3DError_Success;
|
||||
|
||||
if (p_skinDeform == NULL) {
|
||||
offFlag(J3DMdlFlag_SkinPosCpu);
|
||||
offFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
return 5;
|
||||
} else {
|
||||
mSkinDeform->initMtxIndexArray(mModelData);
|
||||
}
|
||||
|
||||
ret = mModelData->checkFlag(0x100);
|
||||
mSkinDeform->initMtxIndexArray(mModelData);
|
||||
|
||||
if (mModelData->checkFlag(0x100)) {
|
||||
mSkinDeform->changeFastSkinDL(mModelData);
|
||||
flags &= ~2;
|
||||
flags &= ~4;
|
||||
mSkinDeform->transformVtxPosNrm(mModelData);
|
||||
mSkinDeform->initSkinInfo(mModelData);
|
||||
}
|
||||
|
||||
s32 ret = kJ3DError_Success;
|
||||
if ((~flags & 2)) {
|
||||
ret = mVertexBuffer.allocTransformedVtxPosArray();
|
||||
if (ret != kJ3DError_Success) {
|
||||
mSkinDeform->changeFastSkinDL(mModelData);
|
||||
flags &= ~2;
|
||||
flags &= ~4;
|
||||
mSkinDeform->transformVtxPosNrm(mModelData);
|
||||
mSkinDeform->initSkinInfo(mModelData);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
if ((~flags & 2)) {
|
||||
ret = mVertexBuffer.allocTransformedVtxPosArray();
|
||||
if (ret != kJ3DError_Success) {
|
||||
offFlag(J3DMdlFlag_SkinPosCpu);
|
||||
return ret;
|
||||
}
|
||||
onFlag(J3DMdlFlag_SkinPosCpu);
|
||||
} else {
|
||||
offFlag(J3DMdlFlag_SkinPosCpu);
|
||||
return ret;
|
||||
}
|
||||
onFlag(J3DMdlFlag_SkinPosCpu);
|
||||
} else {
|
||||
offFlag(J3DMdlFlag_SkinPosCpu);
|
||||
}
|
||||
|
||||
if ((~flags & 4)) {
|
||||
ret = mVertexBuffer.allocTransformedVtxNrmArray();
|
||||
if (ret != kJ3DError_Success) {
|
||||
offFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
return ret;
|
||||
}
|
||||
onFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
} else {
|
||||
if ((~flags & 4)) {
|
||||
ret = mVertexBuffer.allocTransformedVtxNrmArray();
|
||||
if (ret != kJ3DError_Success) {
|
||||
offFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
return ret;
|
||||
}
|
||||
onFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
} else {
|
||||
offFlag(J3DMdlFlag_SkinNrmCpu);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -360,7 +396,7 @@ s32 J3DModel::setSkinDeform(J3DSkinDeform* p_skinDeform, u32 flags) {
|
||||
void J3DModel::calcAnmMtx() {
|
||||
j3dSys.setModel(this);
|
||||
|
||||
if (checkFlag(2)) {
|
||||
if (checkFlag(J3DMdlFlag_UseDefaultJ3D)) {
|
||||
getModelData()->getJointTree().calc(mMtxBuffer, j3dDefaultScale, j3dDefaultMtx);
|
||||
} else {
|
||||
getModelData()->getJointTree().calc(mMtxBuffer, mBaseScale, mBaseTransformMtx);
|
||||
@@ -370,7 +406,7 @@ void J3DModel::calcAnmMtx() {
|
||||
/* 80327C58-80327CA4 322598 004C+00 1/1 1/1 1/1 .text calcWeightEnvelopeMtx__8J3DModelFv
|
||||
*/
|
||||
void J3DModel::calcWeightEnvelopeMtx() {
|
||||
if (getModelData()->getWEvlpMtxNum() != 0 && !checkFlag(0x10)) {
|
||||
if (getModelData()->getWEvlpMtxNum() != 0 && !checkFlag(J3DMdlFlag_EnableLOD)) {
|
||||
if (!getModelData()->checkFlag(0x100)) {
|
||||
mMtxBuffer->calcWeightEnvelopeMtx();
|
||||
}
|
||||
@@ -383,7 +419,6 @@ void J3DModel::update() {
|
||||
entry();
|
||||
}
|
||||
|
||||
|
||||
/* 80327CF0-80327E4C 322630 015C+00 1/0 0/0 0/0 .text calc__8J3DModelFv */
|
||||
void J3DModel::calc() {
|
||||
j3dSys.setModel(this);
|
||||
@@ -400,11 +435,11 @@ void J3DModel::calc() {
|
||||
j3dSys.offFlag(J3DSysFlag_SkinNrmCpu);
|
||||
}
|
||||
|
||||
getModelData()->syncJ3DSysFlags();
|
||||
mModelData->syncJ3DSysFlags();
|
||||
mVertexBuffer.frameInit();
|
||||
|
||||
if (mUnkCalc2 != NULL) {
|
||||
mUnkCalc2->calc(getModelData());
|
||||
mUnkCalc2->calc(mModelData);
|
||||
}
|
||||
|
||||
if (mDeformData != NULL) {
|
||||
@@ -447,11 +482,11 @@ void J3DModel::entry() {
|
||||
j3dSys.offFlag(J3DSysFlag_SkinNrmCpu);
|
||||
}
|
||||
|
||||
getModelData()->syncJ3DSysFlags();
|
||||
j3dSys.setTexture(getModelData()->getTexture());
|
||||
mModelData->syncJ3DSysFlags();
|
||||
j3dSys.setTexture(mModelData->getTexture());
|
||||
|
||||
for (u16 i = 0; i < getModelData()->getJointNum(); i++) {
|
||||
J3DJoint* joint = getModelData()->getJointNodePointer(i);
|
||||
for (u16 i = 0; i < mModelData->getJointNum(); i++) {
|
||||
J3DJoint* joint = mModelData->getJointNodePointer(i);
|
||||
if (joint->getMesh() != NULL) {
|
||||
joint->entryIn();
|
||||
}
|
||||
@@ -463,7 +498,7 @@ void J3DModel::viewCalc() {
|
||||
mMtxBuffer->swapDrawMtx();
|
||||
mMtxBuffer->swapNrmMtx();
|
||||
|
||||
if (mModelData->checkFlag(0x10)) {
|
||||
if (getModelData()->checkFlag(0x10)) {
|
||||
if (getMtxCalcMode() == 2) {
|
||||
J3DCalcViewBaseMtx(j3dSys.getViewMtx(), mBaseScale, mBaseTransformMtx,
|
||||
(MtxP)&mInternalView);
|
||||
@@ -502,17 +537,16 @@ void J3DModel::calcNrmMtx() {
|
||||
|
||||
/* 803281B4-803282B8 322AF4 0104+00 1/1 0/0 0/0 .text calcBumpMtx__8J3DModelFv */
|
||||
void J3DModel::calcBumpMtx() {
|
||||
if (getModelData()->checkBumpFlag() == 1) {
|
||||
if (getModelData()->checkBumpFlag()) {
|
||||
u32 bumpMtxIdx = 0;
|
||||
u16 materialNum = getModelData()->getMaterialNum();
|
||||
u16 i = 0;
|
||||
|
||||
for (; i < materialNum; i++) {
|
||||
for (u16 i = 0; i < materialNum; i++) {
|
||||
J3DMaterial* material = getModelData()->getMaterialNodePointer(i);
|
||||
if (material->getNBTScale()->mbHasScale == 1) {
|
||||
if (material->getNBTScale()->mbHasScale == TRUE) {
|
||||
material->getShape()->calcNBTScale(*material->getNBTScale()->getScale(),
|
||||
getNrmMtxPtr(), getBumpMtxPtr(bumpMtxIdx));
|
||||
DCStoreRange(getBumpMtxPtr(bumpMtxIdx), getModelData()->getDrawMtxNum() * 0x24);
|
||||
DCStoreRange(getBumpMtxPtr(bumpMtxIdx), mModelData->getDrawMtxNum() * sizeof(Mtx33));
|
||||
bumpMtxIdx++;
|
||||
}
|
||||
}
|
||||
@@ -521,23 +555,24 @@ void J3DModel::calcBumpMtx() {
|
||||
|
||||
/* 803282B8-803282EC 322BF8 0034+00 1/1 0/0 0/0 .text calcBBoardMtx__8J3DModelFv */
|
||||
void J3DModel::calcBBoardMtx() {
|
||||
if (mModelData->checkBBoardFlag()) {
|
||||
if (getModelData()->checkBBoardFlag()) {
|
||||
mMtxBuffer->calcBBoardMtx();
|
||||
}
|
||||
}
|
||||
|
||||
/* 803282EC-80328350 322C2C 0064+00 2/2 0/0 0/0 .text prepareShapePackets__8J3DModelFv */
|
||||
void J3DModel::prepareShapePackets() {
|
||||
u16 shapeNum = getModelData()->getShapeNum();
|
||||
u16 shapeNum = mModelData->getShapeNum();
|
||||
|
||||
for (u16 i = 0; i < shapeNum; i++) {
|
||||
J3DShape* xx = mModelData->getShapeNodePointer(i);
|
||||
J3DShapePacket* pkt = getShapePacket(i);
|
||||
pkt->setMtxBuffer(mMtxBuffer);
|
||||
J3DShape* shapeNode = mModelData->getShapeNodePointer(i);
|
||||
J3DShapePacket* shapePacket = &mShapePacket[i];
|
||||
shapePacket->setMtxBuffer(mMtxBuffer);
|
||||
|
||||
if (getMtxCalcMode() == 2) {
|
||||
pkt->setBaseMtxPtr(&mInternalView);
|
||||
shapePacket->setBaseMtxPtr(&mInternalView);
|
||||
} else {
|
||||
pkt->setBaseMtxPtr(&j3dSys.mViewMtx);
|
||||
shapePacket->setBaseMtxPtr((Mtx*)j3dSys.getViewMtx());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "JSystem/J3DGraphAnimator/J3DModelData.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
|
||||
/* 80325D88-80325DA0 3206C8 0018+00 1/1 2/2 0/0 .text clear__12J3DModelDataFv */
|
||||
void J3DModelData::clear() {
|
||||
@@ -21,16 +21,17 @@ J3DModelData::J3DModelData() {
|
||||
}
|
||||
|
||||
/* 80325E14-80325EC8 320754 00B4+00 0/0 2/2 0/0 .text newSharedDisplayList__12J3DModelDataFUl */
|
||||
s32 J3DModelData::newSharedDisplayList(u32 flag) {
|
||||
s32 J3DModelData::newSharedDisplayList(u32 mdlFlags) {
|
||||
u16 matNum = getMaterialNum();
|
||||
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
if (!!(flag & 0x40000)) {
|
||||
s32 ret = getMaterialNodePointer(i)->newSingleSharedDisplayList(getMaterialNodePointer(i)->countDLSize());
|
||||
s32 ret;
|
||||
if (mdlFlags & J3DMdlFlag_UseSingleDL) {
|
||||
ret = getMaterialNodePointer(i)->newSingleSharedDisplayList(getMaterialNodePointer(i)->countDLSize());
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
} else {
|
||||
s32 ret = getMaterialNodePointer(i)->newSharedDisplayList(getMaterialNodePointer(i)->countDLSize());
|
||||
ret = getMaterialNodePointer(i)->newSharedDisplayList(getMaterialNodePointer(i)->countDLSize());
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
}
|
||||
@@ -39,22 +40,11 @@ s32 J3DModelData::newSharedDisplayList(u32 flag) {
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804515E8-804515EC 000AE8 0004+00 1/1 0/0 0/0 .sbss sInterruptFlag$965 */
|
||||
static s32 sInterruptFlag;
|
||||
|
||||
/* 804515EC-804515F0 000AEC 0004+00 1/1 0/0 0/0 .sbss None */
|
||||
static s8 sInitInterruptFlag;
|
||||
|
||||
/* 80325EC8-80325F94 320808 00CC+00 0/0 1/1 0/0 .text indexToPtr__12J3DModelDataFv */
|
||||
void J3DModelData::indexToPtr() {
|
||||
J3DTexture* tex = getTexture();
|
||||
j3dSys.setTexture(tex);
|
||||
j3dSys.setTexture(getTexture());
|
||||
|
||||
if (!sInitInterruptFlag) {
|
||||
sInterruptFlag = OSDisableInterrupts();
|
||||
sInitInterruptFlag = true;
|
||||
}
|
||||
static BOOL sInterruptFlag = OSDisableInterrupts();
|
||||
OSDisableScheduler();
|
||||
|
||||
GDLObj gdl_obj;
|
||||
@@ -67,6 +57,7 @@ void J3DModelData::indexToPtr() {
|
||||
GDSetCurrent(&gdl_obj);
|
||||
matNode->getTevBlock()->indexToPtr();
|
||||
}
|
||||
|
||||
GDSetCurrent(NULL);
|
||||
OSEnableScheduler();
|
||||
OSRestoreInterrupts(sInterruptFlag);
|
||||
@@ -74,8 +65,7 @@ void J3DModelData::indexToPtr() {
|
||||
|
||||
/* 80325F94-8032600C 3208D4 0078+00 0/0 2/2 0/0 .text makeSharedDL__12J3DModelDataFv */
|
||||
void J3DModelData::makeSharedDL() {
|
||||
J3DTexture* tex = getTexture();
|
||||
j3dSys.setTexture(tex);
|
||||
j3dSys.setTexture(getTexture());
|
||||
|
||||
u16 matNum = getMaterialNum();
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
@@ -88,8 +78,9 @@ void J3DModelData::makeSharedDL() {
|
||||
void J3DModelData::simpleCalcMaterial(u16 idx, Mtx param_1) {
|
||||
syncJ3DSysFlags();
|
||||
|
||||
J3DMaterial* mat;
|
||||
J3DJoint* jointNode = getJointNodePointer(idx);
|
||||
for (J3DMaterial* mat = jointNode->getMesh(); mat != NULL; mat = mat->getNext()) {
|
||||
for (mat = jointNode->getMesh(); mat != NULL; mat = mat->getNext()) {
|
||||
if (mat->getMaterialAnm() != NULL) {
|
||||
mat->getMaterialAnm()->calc(mat);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DMtxBuffer
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DMtxBuffer.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
/* 804371C0-804371F0 063EE0 0030+00 1/0 0/0 0/0 .bss sNoUseDrawMtx__12J3DMtxBuffer */
|
||||
Mtx J3DMtxBuffer::sNoUseDrawMtx;
|
||||
@@ -43,7 +37,7 @@ void J3DMtxBuffer::initialize() {
|
||||
mpNrmMtxArr[1] = NULL;
|
||||
mpBumpMtxArr[0] = NULL;
|
||||
mpBumpMtxArr[1] = NULL;
|
||||
mFlags = 1;
|
||||
mMtxNum = 1;
|
||||
mCurrentViewNo = 0;
|
||||
mpUserAnmMtx = NULL;
|
||||
}
|
||||
@@ -54,33 +48,33 @@ enum {
|
||||
J3DMdlDataFlag_NoAnimation = 0x100,
|
||||
};
|
||||
|
||||
s32 J3DMtxBuffer::create(J3DModelData* p_modelData, u32 flag) {
|
||||
J3D_ASSERT(76, p_modelData, "Error : null pointer.");
|
||||
J3D_ASSERT(77, flag, "Error : non-zero argument is specified 0.");
|
||||
s32 J3DMtxBuffer::create(J3DModelData* pModelData, u32 mtxNum) {
|
||||
J3D_ASSERT_NULLPTR(76, pModelData != NULL);
|
||||
J3D_ASSERT_NONZEROARG(77, mtxNum != 0);
|
||||
|
||||
s32 ret = 0;
|
||||
mFlags = flag;
|
||||
mJointTree = &p_modelData->getJointTree();
|
||||
s32 ret = kJ3DError_Success;
|
||||
mMtxNum = mtxNum;
|
||||
mJointTree = &pModelData->getJointTree();
|
||||
|
||||
ret = createAnmMtx(p_modelData);
|
||||
ret = createAnmMtx(pModelData);
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
ret = createWeightEnvelopeMtx(p_modelData);
|
||||
ret = createWeightEnvelopeMtx(pModelData);
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
if (p_modelData->checkFlag(J3DMdlDataFlag_NoAnimation)) {
|
||||
if (pModelData->checkFlag(J3DMdlDataFlag_NoAnimation)) {
|
||||
setNoUseDrawMtx();
|
||||
} else {
|
||||
u32 loadType = getMdlDataFlag_MtxLoadType(p_modelData->getFlag());
|
||||
u32 loadType = getMdlDataFlag_MtxLoadType(pModelData->getFlag());
|
||||
switch (loadType) {
|
||||
case J3DMdlDataFlag_ConcatView:
|
||||
ret = setNoUseDrawMtx();
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
ret = createDoubleDrawMtx(p_modelData, flag);
|
||||
ret = createDoubleDrawMtx(pModelData, mtxNum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -88,10 +82,10 @@ s32 J3DMtxBuffer::create(J3DModelData* p_modelData, u32 flag) {
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
|
||||
if (p_modelData->getFlag() & J3DMdlDataFlag_ConcatView) {
|
||||
p_modelData->setBumpFlag(0);
|
||||
if (pModelData->getFlag() & J3DMdlDataFlag_ConcatView) {
|
||||
pModelData->setBumpFlag(0);
|
||||
} else {
|
||||
ret = createBumpMtxArray(p_modelData, flag);
|
||||
ret = createBumpMtxArray(pModelData, mtxNum);
|
||||
|
||||
if (ret != kJ3DError_Success)
|
||||
return ret;
|
||||
@@ -102,10 +96,10 @@ s32 J3DMtxBuffer::create(J3DModelData* p_modelData, u32 flag) {
|
||||
|
||||
/* 80326364-803263F0 320CA4 008C+00 1/1 0/0 0/0 .text createAnmMtx__12J3DMtxBufferFP12J3DModelData
|
||||
*/
|
||||
J3DError J3DMtxBuffer::createAnmMtx(J3DModelData* p_modelData) {
|
||||
if (p_modelData->getJointNum() != 0) {
|
||||
mpScaleFlagArr = new u8[p_modelData->getJointNum()];
|
||||
mpAnmMtx = new Mtx[p_modelData->getJointNum()];
|
||||
J3DError J3DMtxBuffer::createAnmMtx(J3DModelData* pModelData) {
|
||||
if (pModelData->getJointNum() != 0) {
|
||||
mpScaleFlagArr = new u8[pModelData->getJointNum()];
|
||||
mpAnmMtx = new Mtx[pModelData->getJointNum()];
|
||||
mpUserAnmMtx = mpAnmMtx;
|
||||
}
|
||||
|
||||
@@ -115,20 +109,21 @@ s32 J3DMtxBuffer::create(J3DModelData* p_modelData, u32 flag) {
|
||||
if (mpAnmMtx == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* 803263F0-8032648C 320D30 009C+00 1/1 0/0 0/0 .text
|
||||
* createWeightEnvelopeMtx__12J3DMtxBufferFP12J3DModelData */
|
||||
s32 J3DMtxBuffer::createWeightEnvelopeMtx(J3DModelData* p_modelData) {
|
||||
if (p_modelData->getWEvlpMtxNum() != 0) {
|
||||
mpEvlpScaleFlagArr = new u8[p_modelData->getWEvlpMtxNum()];
|
||||
mpWeightEvlpMtx = new Mtx[p_modelData->getWEvlpMtxNum()];
|
||||
s32 J3DMtxBuffer::createWeightEnvelopeMtx(J3DModelData* pModelData) {
|
||||
if (pModelData->getWEvlpMtxNum() != 0) {
|
||||
mpEvlpScaleFlagArr = new u8[pModelData->getWEvlpMtxNum()];
|
||||
mpWeightEvlpMtx = new Mtx[pModelData->getWEvlpMtxNum()];
|
||||
}
|
||||
|
||||
if (p_modelData->getWEvlpMtxNum() != 0 && mpEvlpScaleFlagArr == NULL)
|
||||
if (pModelData->getWEvlpMtxNum() != 0 && mpEvlpScaleFlagArr == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
if (p_modelData->getWEvlpMtxNum() != 0 && mpWeightEvlpMtx == NULL)
|
||||
if (pModelData->getWEvlpMtxNum() != 0 && mpWeightEvlpMtx == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
|
||||
return kJ3DError_Success;
|
||||
@@ -145,16 +140,16 @@ s32 J3DMtxBuffer::setNoUseDrawMtx() {
|
||||
|
||||
/* 803264B8-80326664 320DF8 01AC+00 1/1 0/0 0/0 .text
|
||||
* createDoubleDrawMtx__12J3DMtxBufferFP12J3DModelDataUl */
|
||||
s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* p_modelData, u32 num) {
|
||||
if (num != 0) {
|
||||
s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* pModelData, u32 mtxNum) {
|
||||
if (mtxNum != 0) {
|
||||
for (s32 i = 0; i < 2; i++) {
|
||||
mpDrawMtxArr[i] = new Mtx*[num];
|
||||
mpNrmMtxArr[i] = new Mtx33*[num];
|
||||
mpDrawMtxArr[i] = new Mtx*[mtxNum];
|
||||
mpNrmMtxArr[i] = new Mtx33*[mtxNum];
|
||||
mpBumpMtxArr[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (num != 0) {
|
||||
if (mtxNum != 0) {
|
||||
for (s32 i = 0; i < 2; i++) {
|
||||
if (mpDrawMtxArr[i] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
@@ -164,17 +159,17 @@ s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* p_modelData, u32 num) {
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < 2; i++) {
|
||||
for (u32 j = 0; j < num; j++) {
|
||||
if (p_modelData->getDrawMtxNum() != 0) {
|
||||
mpDrawMtxArr[i][j] = new (0x20) Mtx[p_modelData->getDrawMtxNum()];
|
||||
mpNrmMtxArr[i][j] = new (0x20) Mtx33[p_modelData->getDrawMtxNum()];
|
||||
for (u32 j = 0; j < mtxNum; j++) {
|
||||
if (pModelData->getDrawMtxNum() != 0) {
|
||||
mpDrawMtxArr[i][j] = new (0x20) Mtx[pModelData->getDrawMtxNum()];
|
||||
mpNrmMtxArr[i][j] = new (0x20) Mtx33[pModelData->getDrawMtxNum()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < 2; i++) {
|
||||
for (u32 j = 0; j < num; j++) {
|
||||
if (p_modelData->getDrawMtxNum() != 0) {
|
||||
for (u32 j = 0; j < mtxNum; j++) {
|
||||
if (pModelData->getDrawMtxNum() != 0) {
|
||||
if (mpDrawMtxArr[i][j] == NULL)
|
||||
return kJ3DError_Alloc;
|
||||
if (mpNrmMtxArr[i][j] == NULL)
|
||||
@@ -188,8 +183,9 @@ s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* p_modelData, u32 num) {
|
||||
|
||||
/* 80326664-803268D4 320FA4 0270+00 1/1 0/0 0/0 .text
|
||||
* createBumpMtxArray__12J3DMtxBufferFP12J3DModelDataUl */
|
||||
s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 param_1) {
|
||||
J3D_ASSERT(295, i_modelData, "Error : null pointer.");
|
||||
s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 mtxNum) {
|
||||
J3D_ASSERT_NULLPTR(295, i_modelData != NULL);
|
||||
|
||||
if (i_modelData->getModelDataType() == 0) {
|
||||
u16 bumpMtxNum = 0;
|
||||
u16 materialCount = 0;
|
||||
@@ -202,7 +198,7 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 param_1) {
|
||||
}
|
||||
}
|
||||
|
||||
if (bumpMtxNum != 0 && param_1 != 0) {
|
||||
if (bumpMtxNum != 0 && mtxNum != 0) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpBumpMtxArr[i] = new Mtx33**[(u16)materialCount];
|
||||
if (mpBumpMtxArr[i] == NULL) {
|
||||
@@ -217,7 +213,7 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 param_1) {
|
||||
for (u16 j = 0; j < materialNum; j++) {
|
||||
J3DMaterial* material = i_modelData->getMaterialNodePointer(j);
|
||||
if (material->getNBTScale()->mbHasScale == true) {
|
||||
mpBumpMtxArr[i][offset] = new Mtx33*[param_1];
|
||||
mpBumpMtxArr[i][offset] = new Mtx33*[mtxNum];
|
||||
if (mpBumpMtxArr[i][offset] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
@@ -233,7 +229,7 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 param_1) {
|
||||
for (u16 j = 0; j < materialNum; j++) {
|
||||
J3DMaterial* material = i_modelData->getMaterialNodePointer((u16)j);
|
||||
if (material->getNBTScale()->mbHasScale == true) {
|
||||
for (int k = 0; k < param_1; k++) {
|
||||
for (int k = 0; k < mtxNum; k++) {
|
||||
mpBumpMtxArr[i][offset][k] = new (0x20) Mtx33[i_modelData->getDrawMtxNum()];
|
||||
if (mpBumpMtxArr[i][offset][k] == NULL) {
|
||||
return kJ3DError_Alloc;
|
||||
@@ -273,10 +269,12 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
f32* weights;
|
||||
u8* pScale;
|
||||
Mtx mtx;
|
||||
|
||||
i = -1;
|
||||
max = mJointTree->getWEvlpMtxNum();
|
||||
indices = mJointTree->getWEvlpMixMtxIndex() - 1;
|
||||
weights = mJointTree->getWEvlpMixWeight() - 1;
|
||||
|
||||
while (++i < max) {
|
||||
pScale = &mpEvlpScaleFlagArr[i];
|
||||
*pScale = 1;
|
||||
@@ -284,6 +282,7 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
weightAnmMtx[0][0] = weightAnmMtx[0][1] = weightAnmMtx[0][2] = weightAnmMtx[0][3] =
|
||||
weightAnmMtx[1][0] = weightAnmMtx[1][1] = weightAnmMtx[1][2] = weightAnmMtx[1][3] =
|
||||
weightAnmMtx[2][0] = weightAnmMtx[2][1] = weightAnmMtx[2][2] = weightAnmMtx[2][3] = 0.0f;
|
||||
|
||||
j = 0;
|
||||
mixNum = mJointTree->getWEvlpMixMtxNum(i);
|
||||
do {
|
||||
@@ -291,6 +290,7 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
worldMtx = &mpAnmMtx[idx];
|
||||
invMtx = &mJointTree->getInvJointMtx((u16)idx);
|
||||
MTXConcat(*worldMtx, *invMtx, mtx);
|
||||
|
||||
weight = *++weights;
|
||||
weightAnmMtx[0][0] += mtx[0][0] * weight;
|
||||
weightAnmMtx[0][1] += mtx[0][1] * weight;
|
||||
@@ -304,6 +304,7 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
weightAnmMtx[2][1] += mtx[2][1] * weight;
|
||||
weightAnmMtx[2][2] += mtx[2][2] * weight;
|
||||
weightAnmMtx[2][3] += mtx[2][3] * weight;
|
||||
|
||||
*pScale &= mpScaleFlagArr[idx];
|
||||
} while (++j < mixNum);
|
||||
}
|
||||
@@ -311,12 +312,17 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
|
||||
/* 80326ACC-80326D3C 32140C 0270+00 0/0 1/1 0/0 .text
|
||||
* calcDrawMtx__12J3DMtxBufferFUlRC3VecRA3_A4_Cf */
|
||||
void J3DMtxBuffer::calcDrawMtx(u32 param_0, Vec const& param_1, Mtx const& param_2) {
|
||||
void J3DMtxBuffer::calcDrawMtx(u32 mdlFlag, Vec const& param_1, Mtx const& param_2) {
|
||||
Mtx* sp24, *sp20;
|
||||
int sp1C = 0;
|
||||
sp20 = mpAnmMtx;
|
||||
sp24 = mpWeightEvlpMtx;
|
||||
|
||||
MtxP viewMtx;
|
||||
Mtx viewBaseMtx;
|
||||
u16 fullWgtNum;
|
||||
|
||||
switch (param_0) {
|
||||
switch (mdlFlag) {
|
||||
case 0:
|
||||
viewMtx = j3dSys.getViewMtx();
|
||||
fullWgtNum = mJointTree->getDrawFullWgtMtxNum();
|
||||
@@ -327,8 +333,7 @@ void J3DMtxBuffer::calcDrawMtx(u32 param_0, Vec const& param_1, Mtx const& param
|
||||
J3DPSMtxArrayConcat(viewMtx, *mpWeightEvlpMtx, *getDrawMtx(fullWgtNum),
|
||||
mJointTree->getWEvlpMtxNum());
|
||||
}
|
||||
break;
|
||||
|
||||
return;
|
||||
case 1:
|
||||
fullWgtNum = mJointTree->getDrawFullWgtMtxNum();
|
||||
for (u16 i = 0; i < fullWgtNum; i++) {
|
||||
@@ -339,7 +344,6 @@ void J3DMtxBuffer::calcDrawMtx(u32 param_0, Vec const& param_1, Mtx const& param
|
||||
MTXCopy(getWeightAnmMtx(i), *getDrawMtx(mJointTree->getDrawFullWgtMtxNum() + i));
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
J3DCalcViewBaseMtx(j3dSys.getViewMtx(), param_1, param_2, viewBaseMtx);
|
||||
fullWgtNum = mJointTree->getDrawFullWgtMtxNum();
|
||||
@@ -351,25 +355,25 @@ void J3DMtxBuffer::calcDrawMtx(u32 param_0, Vec const& param_1, Mtx const& param
|
||||
*getDrawMtx(mJointTree->getDrawFullWgtMtxNum()),
|
||||
mJointTree->getWEvlpMtxNum());
|
||||
}
|
||||
break;
|
||||
return;
|
||||
default:
|
||||
JUT_ASSERT_MSG(778, 0, "Error : model flag is invalid.")
|
||||
}
|
||||
}
|
||||
|
||||
extern void J3DPSCalcInverseTranspose(Mtx p1, Mtx33 p2);
|
||||
|
||||
/* 80326D3C-80326EF0 32167C 01B4+00 0/0 1/1 0/0 .text calcNrmMtx__12J3DMtxBufferFv */
|
||||
void J3DMtxBuffer::calcNrmMtx() {
|
||||
u16 drawMtxNum = mJointTree->getDrawMtxNum();
|
||||
for (u16 i = 0; i < drawMtxNum; i++) {
|
||||
if (mJointTree->getDrawMtxFlag(i) == 0) {
|
||||
if (getScaleFlag(mJointTree->getDrawMtxIndex(i)) == 1) {
|
||||
setNrmMtx(i, getDrawMtx(i));
|
||||
setNrmMtx(i, *getDrawMtx(i));
|
||||
} else {
|
||||
J3DPSCalcInverseTranspose(*getDrawMtx(i), *getNrmMtx(i));
|
||||
}
|
||||
} else {
|
||||
if (getEnvScaleFlag(mJointTree->getDrawMtxIndex(i)) == 1) {
|
||||
setNrmMtx(i, getDrawMtx(i));
|
||||
setNrmMtx(i, *getDrawMtx(i));
|
||||
} else {
|
||||
J3DPSCalcInverseTranspose(*getDrawMtx(i), *getNrmMtx(i));
|
||||
}
|
||||
@@ -386,6 +390,7 @@ void J3DMtxBuffer::calcBBoardMtx() {
|
||||
if (mJointTree->getJointNodePointer(index)->getMtxType() == 1) {
|
||||
MtxP drawMtx = *getDrawMtx(i);
|
||||
J3DCalcBBoardMtx(drawMtx);
|
||||
|
||||
Mtx33* nrmMtx = getNrmMtx(i);
|
||||
(*nrmMtx)[0][0] = 1.0f / drawMtx[0][0];
|
||||
(*nrmMtx)[0][1] = 0.0f;
|
||||
|
||||
@@ -30,9 +30,8 @@ void J3DShapeTable::sortVcdVatCmd() {
|
||||
for (u16 next = 0; next < shapeNum; next++) {
|
||||
for (u16 prev = 0; prev < next; prev++) {
|
||||
if (mShapeNodePointer[next]->isSameVcdVatCmd(mShapeNodePointer[prev])) {
|
||||
void* nodeVatCmd = mShapeNodePointer[prev]->getVcdVatCmd();
|
||||
mShapeNodePointer[next]->setVcdVatCmd(nodeVatCmd);
|
||||
mShapeNodePointer[next]->setVcdVatCmd(mShapeNodePointer[prev]->getVcdVatCmd());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: J3DSkinDeform
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DSkinDeform.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "string.h"
|
||||
#include <string.h>
|
||||
|
||||
/* 8032C6E4-8032C704 327024 0020+00 1/1 0/0 0/0 .text __ct__12J3DSkinNListFv */
|
||||
J3DSkinNList::J3DSkinNList() {
|
||||
@@ -78,8 +71,6 @@ void J3DSkinNList::calcSkin_VtxNrmF32(f32 (*param_0)[4], void* param_1, void* pa
|
||||
}
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
|
||||
/* 8032C96C-8032C9B0 3272AC 0044+00 0/0 0/0 2/2 .text __ct__13J3DSkinDeformFv */
|
||||
J3DSkinDeform::J3DSkinDeform() {
|
||||
mPosData = NULL;
|
||||
@@ -94,7 +85,6 @@ J3DSkinDeform::J3DSkinDeform() {
|
||||
mSkinNList = NULL;
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80437218-80438218 063F38 1000+00 1/1 0/0 0/0 .bss sWorkArea_WEvlpMixMtx__13J3DSkinDeform */
|
||||
u16* J3DSkinDeform::sWorkArea_WEvlpMixMtx[1024];
|
||||
|
||||
@@ -103,32 +93,34 @@ f32* J3DSkinDeform::sWorkArea_WEvlpMixWeight[1024];
|
||||
|
||||
/* 8032C9B0-8032CF44 3272F0 0594+00 0/0 1/1 0/0 .text
|
||||
* initSkinInfo__13J3DSkinDeformFP12J3DModelData */
|
||||
void J3DSkinDeform::initSkinInfo(J3DModelData* param_0) {
|
||||
J3D_ASSERT(322, param_0, "Error : null pointer.");
|
||||
int vtxNum = param_0->getVtxNum();
|
||||
int wevlpMtxNum = param_0->getWEvlpMtxNum();
|
||||
u16* wevlpMtxIndex = param_0->getWEvlpMixMtxIndex();
|
||||
f32* wevlpMixWeights = param_0->getWEvlpMixWeight();
|
||||
void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) {
|
||||
J3D_ASSERT_NULLPTR(322, pModelData != NULL);
|
||||
|
||||
int vtxNum = pModelData->getVtxNum();
|
||||
int wevlpMtxNum = pModelData->getWEvlpMtxNum();
|
||||
u16* wevlpMtxIndex = pModelData->getWEvlpMixMtxIndex();
|
||||
f32* wevlpMixWeights = pModelData->getWEvlpMixWeight();
|
||||
int currentOffset = 0;
|
||||
|
||||
for (int i = 0; i < wevlpMtxNum; i++) {
|
||||
sWorkArea_WEvlpMixMtx[i] = wevlpMtxIndex + currentOffset;
|
||||
sWorkArea_WEvlpMixWeight[i] = wevlpMixWeights + currentOffset;
|
||||
currentOffset += param_0->getWEvlpMixMtxNum(i);
|
||||
currentOffset += pModelData->getWEvlpMixMtxNum(i);
|
||||
}
|
||||
|
||||
if (param_0->getJointNum() != 0) {
|
||||
mSkinNList = new J3DSkinNList[param_0->getJointNum()];
|
||||
if (pModelData->getJointNum() != 0) {
|
||||
mSkinNList = new J3DSkinNList[pModelData->getJointNum()];
|
||||
}
|
||||
|
||||
for (int i = 0; i < param_0->getVtxNum(); i++) {
|
||||
for (int i = 0; i < pModelData->getVtxNum(); i++) {
|
||||
u16 uVar8 = mPosData[i];
|
||||
if (uVar8 != 0xffff) {
|
||||
if (param_0->getDrawMtxFlag(uVar8) == 0) {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
if (!pModelData->getDrawMtxFlag(uVar8)) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
mSkinNList[drawMtxIndex].field_0x10++;
|
||||
} else {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = param_0->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
for (int j = 0; j < wevlpMtxNum; j++) {
|
||||
mSkinNList[indices[j]].field_0x10++;
|
||||
@@ -136,15 +128,16 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* param_0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < param_0->getNrmNum(); i++) {
|
||||
|
||||
for (int i = 0; i < pModelData->getNrmNum(); i++) {
|
||||
u16 uVar8 = mNrmData[i];
|
||||
if (uVar8 != 0xffff) {
|
||||
if (param_0->getDrawMtxFlag(uVar8) == 0) {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
if (!pModelData->getDrawMtxFlag(uVar8)) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
mSkinNList[drawMtxIndex].field_0x12++;
|
||||
} else {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = param_0->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
for (int j = 0; j < wevlpMtxNum; j++) {
|
||||
mSkinNList[indices[j]].field_0x12++;
|
||||
@@ -152,7 +145,8 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* param_0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (u16 i = 0; i < param_0->getJointNum(); i++) {
|
||||
|
||||
for (u16 i = 0; i < pModelData->getJointNum(); i++) {
|
||||
if (mSkinNList[i].field_0x10) {
|
||||
mSkinNList[i].field_0x0 = new u16[mSkinNList[i].field_0x10];
|
||||
mSkinNList[i].field_0x8 = new f32[mSkinNList[i].field_0x10];
|
||||
@@ -164,17 +158,18 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* param_0) {
|
||||
mSkinNList[i].field_0x12 = 0;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < param_0->getVtxNum(); i++) {
|
||||
|
||||
for (int i = 0; i < pModelData->getVtxNum(); i++) {
|
||||
u16 uVar8 = mPosData[i];
|
||||
if (uVar8 != 0xffff) {
|
||||
if (param_0->getDrawMtxFlag(uVar8) == 0) {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
if (!pModelData->getDrawMtxFlag(uVar8)) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int uVar9 = mSkinNList[drawMtxIndex].field_0x10++;
|
||||
mSkinNList[drawMtxIndex].field_0x0[uVar9] = i;
|
||||
mSkinNList[drawMtxIndex].field_0x8[uVar9] = 1.0f;
|
||||
} else {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = param_0->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
f32* weights = sWorkArea_WEvlpMixWeight[drawMtxIndex];
|
||||
for (int j = 0; j < wevlpMtxNum; j++) {
|
||||
@@ -185,17 +180,18 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* param_0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < param_0->getNrmNum(); i++) {
|
||||
|
||||
for (int i = 0; i < pModelData->getNrmNum(); i++) {
|
||||
u16 uVar8 = mNrmData[i];
|
||||
if (uVar8 != 0xffff) {
|
||||
if (param_0->getDrawMtxFlag(uVar8) == 0) {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
if (!pModelData->getDrawMtxFlag(uVar8)) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int uVar9 = mSkinNList[drawMtxIndex].field_0x12++;
|
||||
mSkinNList[drawMtxIndex].field_0x4[uVar9] = i;
|
||||
mSkinNList[drawMtxIndex].field_0xc[uVar9] = 1.0f;
|
||||
} else {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = param_0->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8);
|
||||
int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex);
|
||||
u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex];
|
||||
f32* weights = sWorkArea_WEvlpMixWeight[drawMtxIndex];
|
||||
for (int j = 0; j < wevlpMtxNum; j++) {
|
||||
@@ -210,128 +206,133 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* param_0) {
|
||||
|
||||
/* 80439218-80439A20 065F38 0800+08 1/1 0/0 0/0 .bss sWorkArea_MtxReg__13J3DSkinDeform
|
||||
*/
|
||||
u16 J3DSkinDeform::sWorkArea_MtxReg[1024 + 4 /* padding */];
|
||||
u16 J3DSkinDeform::sWorkArea_MtxReg[1024];
|
||||
|
||||
/* 8032CF44-8032D378 327884 0434+00 0/0 1/1 0/0 .text
|
||||
* initMtxIndexArray__13J3DSkinDeformFP12J3DModelData */
|
||||
// NONMATCHING - local_58 issue
|
||||
int J3DSkinDeform::initMtxIndexArray(J3DModelData* param_0) {
|
||||
J3D_ASSERT(507, param_0, "Error : null pointer.");
|
||||
// NONMATCHING - matches debug, not retail
|
||||
int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) {
|
||||
J3D_ASSERT_NULLPTR(507, pModelData != NULL);
|
||||
if (mPosData != NULL && mNrmData != NULL) {
|
||||
return 0;
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
mPosData = new u16[param_0->getVtxNum()];
|
||||
mPosData = new u16[pModelData->getVtxNum()];
|
||||
if (mPosData == NULL) {
|
||||
return 4;
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
for (int i = 0; i < param_0->getVtxNum(); i++) {
|
||||
for (int i = 0; i < pModelData->getVtxNum(); i++) {
|
||||
mPosData[i] = 0xffff;
|
||||
}
|
||||
|
||||
if (param_0->getNrmNum()) {
|
||||
mNrmData = new u16[param_0->getNrmNum()];
|
||||
if (pModelData->getNrmNum()) {
|
||||
mNrmData = new u16[pModelData->getNrmNum()];
|
||||
if (mNrmData == NULL) {
|
||||
return 4;
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
for (int i = 0; i < param_0->getNrmNum(); i++) {
|
||||
for (int i = 0; i < pModelData->getNrmNum(); i++) {
|
||||
mNrmData[i] = 0;
|
||||
}
|
||||
} else {
|
||||
mNrmData = NULL;
|
||||
}
|
||||
|
||||
mPosMtx = new Mtx[param_0->getJointNum()];
|
||||
mNrmMtx = new (32) Mtx33[param_0->getDrawMtxNum()];
|
||||
mPosMtx = new Mtx[pModelData->getJointNum()];
|
||||
mNrmMtx = new (32) Mtx33[pModelData->getDrawMtxNum()];
|
||||
if (mPosMtx == NULL) {
|
||||
return 4;
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
if (mNrmMtx == NULL) {
|
||||
return 4;
|
||||
return kJ3DError_Alloc;
|
||||
}
|
||||
|
||||
for (u16 local_6c = 0; local_6c < param_0->getShapeNum(); local_6c++) {
|
||||
u32 local_28[4] = {0,1,1,2};
|
||||
int r26 = -1;
|
||||
int r25 = -1;
|
||||
int r24 = -1;
|
||||
int stack_3c = -1;
|
||||
for (u16 i = 0; i < pModelData->getShapeNum(); i++) {
|
||||
u32 kSize[4] = {0, 1, 1, 2};
|
||||
int pnmtx_num = -1;
|
||||
int vtx_num = -1;
|
||||
int nrm_num = -1;
|
||||
int tex_num = -1;
|
||||
int r23 = 0;
|
||||
for (GXVtxDescList* local_4c = param_0->getShapeNodePointer(local_6c)->getVtxDesc(); local_4c->attr != 0xff; local_4c++) {
|
||||
switch (local_4c->attr) {
|
||||
for (GXVtxDescList* vtxDesc = pModelData->getShapeNodePointer(i)->getVtxDesc(); vtxDesc->attr != 0xff; vtxDesc++) {
|
||||
switch (vtxDesc->attr) {
|
||||
case GX_VA_PNMTXIDX:
|
||||
r26 = r23;
|
||||
pnmtx_num = r23;
|
||||
break;
|
||||
case GX_VA_POS:
|
||||
r25 = r23;
|
||||
if (local_4c->type != GX_INDEX16) {
|
||||
vtx_num = r23;
|
||||
if (vtxDesc->type != GX_INDEX16) {
|
||||
OSReport(" Invlid Data : CPU Pipeline process GX_INDEX16 Data Only\n");
|
||||
return 6;
|
||||
}
|
||||
break;
|
||||
case GX_VA_NRM:
|
||||
r24 = r23;
|
||||
if (local_4c->type != GX_INDEX16) {
|
||||
nrm_num = r23;
|
||||
if (vtxDesc->type != GX_INDEX16) {
|
||||
OSReport(" Invlid Data : CPU Pipeline process GX_INDEX16 Data Only\n");
|
||||
return 6;
|
||||
}
|
||||
break;
|
||||
case GX_VA_TEX0:
|
||||
stack_3c = r23;
|
||||
if (local_4c->type != GX_INDEX16) {
|
||||
tex_num = r23;
|
||||
if (vtxDesc->type != GX_INDEX16) {
|
||||
OSReport(" Invlid Data : CPU Pipeline process GX_INDEX16 Data Only\n");
|
||||
return 6;
|
||||
}
|
||||
break;
|
||||
}
|
||||
r23 += local_28[(int)local_4c->type];
|
||||
r23 += kSize[(int)vtxDesc->type];
|
||||
}
|
||||
for (u16 local_6e = 0; local_6e < param_0->getShapeNodePointer(local_6c)->getMtxGroupNum(); local_6e++) {
|
||||
J3DShapeMtx* piVar8 = param_0->getShapeNodePointer(local_6c)->getShapeMtx(local_6e);
|
||||
u8* pcVar10 = param_0->getShapeNodePointer(local_6c)->getShapeDraw(local_6e)->getDisplayList();
|
||||
u8* local_58 = pcVar10;
|
||||
|
||||
for (u16 j = 0; j < (u16)pModelData->getShapeNodePointer(i)->getMtxGroupNum(); j++) {
|
||||
J3DShapeMtx* pShapeMtx = pModelData->getShapeNodePointer(i)->getShapeMtx(j);
|
||||
u8* pDList = pModelData->getShapeNodePointer(i)->getShapeDraw(j)->getDisplayList();
|
||||
u8* pDListPos = pDList;
|
||||
int uVar13;
|
||||
for (;
|
||||
(int)local_58 - (int)pcVar10 < param_0->getShapeNodePointer(local_6c)->getShapeDraw(local_6e)->getDisplayListSize();
|
||||
local_58 += r23 * uVar13) {
|
||||
u8 uVar1 = *local_58;
|
||||
local_58++;
|
||||
if (uVar1 != 0xA0 && uVar1 != 0x98) {
|
||||
(int)pDListPos - (int)pDList < pModelData->getShapeNodePointer(i)->getShapeDraw(j)->getDisplayListSize();
|
||||
pDListPos += r23 * uVar13)
|
||||
{
|
||||
u8 command = *pDListPos;
|
||||
pDListPos++;
|
||||
if (command != GX_TRIANGLEFAN && command != GX_TRIANGLESTRIP) {
|
||||
break;
|
||||
}
|
||||
|
||||
uVar13 = *(u16*)local_58;
|
||||
local_58 += 2;
|
||||
uVar13 = *(u16*)pDListPos;
|
||||
pDListPos += 2;
|
||||
for (int local_60 = 0; local_60 < uVar13; local_60++) {
|
||||
u8* iVar5 = local_58 + r23 * local_60;
|
||||
u8 bVar3 = *(iVar5 + r26) / 3U;
|
||||
u16 uVar1 = *(u16*)(iVar5 + r25);
|
||||
u16 uVar2 = *(u16*)(iVar5 + r24);
|
||||
u16 uVar3 = *(u16*)(iVar5 + stack_3c);
|
||||
u16 local_76 = piVar8->getUseMtxIndex(bVar3);
|
||||
u8* iVar5 = pDListPos + r23 * local_60;
|
||||
u8 bVar3 = *(iVar5 + pnmtx_num) / 3U;
|
||||
u16 vtx_idx = *(u16*)(iVar5 + vtx_num);
|
||||
u16 nrm_idx = *(u16*)(iVar5 + nrm_num);
|
||||
u16 uVar3 = *(u16*)(iVar5 + tex_num);
|
||||
u16 local_76 = pShapeMtx->getUseMtxIndex(bVar3);
|
||||
if (local_76 == 0xffff) {
|
||||
local_76 = sWorkArea_MtxReg[bVar3];
|
||||
} else if (r26 != -1) {
|
||||
} else if (pnmtx_num != -1) {
|
||||
sWorkArea_MtxReg[bVar3] = local_76;
|
||||
}
|
||||
J3D_ASSERT(673, local_76 < param_0->getDrawMtxNum(), "Error : range over.");
|
||||
J3D_ASSERT(674, uVar1 < param_0->getVtxNum(), "Error : range over.");
|
||||
mPosData[uVar1] = local_76;
|
||||
if (r24 != -1) {
|
||||
J3D_ASSERT(680, uVar2 < param_0->getNrmNum(), "Error : range over.");
|
||||
mNrmData[uVar2] = local_76;
|
||||
|
||||
J3D_ASSERT_RANGE(673, local_76 < pModelData->getDrawMtxNum());
|
||||
J3D_ASSERT_RANGE(674, vtx_idx < pModelData->getVtxNum());
|
||||
mPosData[vtx_idx] = local_76;
|
||||
|
||||
if (nrm_num != -1) {
|
||||
J3D_ASSERT_RANGE(680, nrm_idx < pModelData->getNrmNum());
|
||||
mNrmData[nrm_idx] = local_76;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r24 == -1) {
|
||||
param_0->getShapeNodePointer(local_6c)->onFlag(0x100);
|
||||
param_0->getShapeNodePointer(local_6c)->offFlag(8);
|
||||
|
||||
if (nrm_num == -1) {
|
||||
pModelData->getShapeNodePointer(i)->onFlag(J3DShpFlag_EnableLod);
|
||||
pModelData->getShapeNodePointer(i)->offFlag(J3DShpFlag_SkinNrmCpu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < param_0->getVtxNum(); i++) {
|
||||
for (int i = 0; i < pModelData->getVtxNum(); i++) {
|
||||
if (mPosData[i] == 0xffff) {
|
||||
field_0x18 = 0x0;
|
||||
mPosData[i] = 0;
|
||||
@@ -340,36 +341,38 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* param_0) {
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
/* 8032D378-8032D5C4 327CB8 024C+00 0/0 1/1 0/0 .text
|
||||
* changeFastSkinDL__13J3DSkinDeformFP12J3DModelData */
|
||||
// NONMATCHING - regalloc, display list access issues
|
||||
void J3DSkinDeform::changeFastSkinDL(J3DModelData* param_0) {
|
||||
J3D_ASSERT(740, param_0, "Error : null pointer.");
|
||||
for (u16 i = 0; i < param_0->getShapeNum(); i++) {
|
||||
u32 local_28[4] = {0,1,1,2};
|
||||
void J3DSkinDeform::changeFastSkinDL(J3DModelData* pModelData) {
|
||||
J3D_ASSERT_NULLPTR(740, pModelData != NULL);
|
||||
for (u16 i = 0; i < pModelData->getShapeNum(); i++) {
|
||||
u32 kSize[4] = {0,1,1,2};
|
||||
int local_30 = -1;
|
||||
int local_34 = 0;
|
||||
J3DShape* pShapeNode = param_0->getShapeNodePointer(i);
|
||||
for (GXVtxDescList* local_3c = pShapeNode->getVtxDesc(); local_3c->attr != GX_VA_NULL; local_3c++) {
|
||||
if (local_3c->attr == GX_VA_PNMTXIDX) {
|
||||
J3DShape* pShapeNode = pModelData->getShapeNodePointer(i);
|
||||
for (GXVtxDescList* vtxDesc = pShapeNode->getVtxDesc(); vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
|
||||
if (vtxDesc->attr == GX_VA_PNMTXIDX) {
|
||||
local_30 = local_34;
|
||||
}
|
||||
local_34 += local_28[local_3c->type];
|
||||
local_34 += kSize[vtxDesc->type];
|
||||
}
|
||||
|
||||
if (local_30 != -1) {
|
||||
for (u16 j = 0; j < pShapeNode->getMtxGroupNum(); j++) {
|
||||
u8* puVar5 = pShapeNode->getShapeDraw(j)->getDisplayList();
|
||||
u8* local_44 = puVar5;
|
||||
u8* puVar10 = puVar5;
|
||||
while (local_44 - puVar5 < pShapeNode->getShapeDraw(j)->getDisplayListSize()) {
|
||||
u8 cVar1 = *local_44;
|
||||
for (u16 j = 0; j < (u16)pShapeNode->getMtxGroupNum(); j++) {
|
||||
u8* pDList = pShapeNode->getShapeDraw(j)->getDisplayList();
|
||||
u8* local_44 = pDList;
|
||||
u8* puVar10 = pDList;
|
||||
while (local_44 - pDList < pShapeNode->getShapeDraw(j)->getDisplayListSize()) {
|
||||
u8 command = *local_44;
|
||||
local_44++;
|
||||
*puVar10++ = cVar1;
|
||||
if ((cVar1 != 0xA0) && (cVar1 != 0x98))
|
||||
*puVar10++ = command;
|
||||
if (command != GX_TRIANGLEFAN && command != GX_TRIANGLESTRIP)
|
||||
break;
|
||||
|
||||
int uVar9 = *(u16*)local_44;
|
||||
local_44 += 2;
|
||||
*(u16*)puVar10 = uVar9;
|
||||
@@ -381,19 +384,20 @@ void J3DSkinDeform::changeFastSkinDL(J3DModelData* param_0) {
|
||||
}
|
||||
local_44 += local_34 * uVar9;
|
||||
}
|
||||
int pcVar2 = ((int)puVar10 - (int)puVar5 + 0x1f) & ~0x1f;
|
||||
while ((int)puVar10 - (int)puVar5 < pShapeNode->getShapeDraw(j)->getDisplayListSize()) {
|
||||
|
||||
int dlistSize = ((int)puVar10 - (int)pDList + 0x1f) & ~0x1f;
|
||||
while ((int)puVar10 - (int)pDList < pShapeNode->getShapeDraw(j)->getDisplayListSize()) {
|
||||
*puVar10++ = 0;
|
||||
}
|
||||
pShapeNode->getShapeDraw(j)->setDisplayListSize(pcVar2);
|
||||
DCStoreRange(puVar5, pShapeNode->getShapeDraw(j)->getDisplayListSize());
|
||||
|
||||
pShapeNode->getShapeDraw(j)->setDisplayListSize(dlistSize);
|
||||
DCStoreRange(pDList, pShapeNode->getShapeDraw(j)->getDisplayListSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
;
|
||||
for (u16 i = 0; i < param_0->getShapeNum(); i++) {
|
||||
J3DShape* pShape = param_0->getShapeNodePointer(i);
|
||||
|
||||
for (u16 i = 0; i < pModelData->getShapeNum(); i++) {
|
||||
J3DShape* pShape = pModelData->getShapeNodePointer(i);
|
||||
GXVtxDescList* local_5c = pShape->getVtxDesc();
|
||||
GXVtxDescList* local_60 = local_5c;
|
||||
for (; local_5c->attr != GX_VA_NULL; local_5c++) {
|
||||
@@ -411,21 +415,21 @@ void J3DSkinDeform::changeFastSkinDL(J3DModelData* param_0) {
|
||||
|
||||
/* 8032D5C4-8032D738 327F04 0174+00 1/1 0/0 0/0 .text calcNrmMtx__13J3DSkinDeformFP12J3DMtxBuffer
|
||||
*/
|
||||
void J3DSkinDeform::calcNrmMtx(J3DMtxBuffer* param_0) {
|
||||
J3DJointTree* jointTree = param_0->getJointTree();
|
||||
void J3DSkinDeform::calcNrmMtx(J3DMtxBuffer* pMtxBuffer) {
|
||||
J3DJointTree* jointTree = pMtxBuffer->getJointTree();
|
||||
u16 drawMtxNum = jointTree->getDrawMtxNum();
|
||||
for (u16 i = 0; i < drawMtxNum; i++) {
|
||||
if (jointTree->getDrawMtxFlag(i) == 0) {
|
||||
if (param_0->getScaleFlag(jointTree->getDrawMtxIndex(i)) == 1) {
|
||||
setNrmMtx(i, param_0->getAnmMtx(jointTree->getDrawMtxIndex(i)));
|
||||
if (pMtxBuffer->getScaleFlag(jointTree->getDrawMtxIndex(i)) == 1) {
|
||||
setNrmMtx(i, pMtxBuffer->getAnmMtx(jointTree->getDrawMtxIndex(i)));
|
||||
} else {
|
||||
J3DPSCalcInverseTranspose(param_0->getAnmMtx(jointTree->getDrawMtxIndex(i)), getNrmMtx(i));
|
||||
J3DPSCalcInverseTranspose(pMtxBuffer->getAnmMtx(jointTree->getDrawMtxIndex(i)), getNrmMtx(i));
|
||||
}
|
||||
} else {
|
||||
if (param_0->getEnvScaleFlag(jointTree->getDrawMtxIndex(i)) == 1) {
|
||||
setNrmMtx(i, param_0->getWeightAnmMtx(jointTree->getDrawMtxIndex(i)));
|
||||
if (pMtxBuffer->getEnvScaleFlag(jointTree->getDrawMtxIndex(i)) == 1) {
|
||||
setNrmMtx(i, pMtxBuffer->getWeightAnmMtx(jointTree->getDrawMtxIndex(i)));
|
||||
} else {
|
||||
J3DPSCalcInverseTranspose(param_0->getWeightAnmMtx(jointTree->getDrawMtxIndex(i)), getNrmMtx(i));
|
||||
J3DPSCalcInverseTranspose(pMtxBuffer->getWeightAnmMtx(jointTree->getDrawMtxIndex(i)), getNrmMtx(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -433,41 +437,46 @@ void J3DSkinDeform::calcNrmMtx(J3DMtxBuffer* param_0) {
|
||||
|
||||
/* 8032D738-8032D87C 328078 0144+00 0/0 1/1 0/0 .text
|
||||
* transformVtxPosNrm__13J3DSkinDeformFP12J3DModelData */
|
||||
void J3DSkinDeform::transformVtxPosNrm(J3DModelData* param_0) {
|
||||
if (param_0->getWEvlpMtxNum() != 0 && field_0x19 == 0) {
|
||||
int vtmNum = param_0->getVtxNum();
|
||||
int nrmNum = param_0->getNrmNum();
|
||||
void J3DSkinDeform::transformVtxPosNrm(J3DModelData* pModelData) {
|
||||
if (pModelData->getWEvlpMtxNum() != 0 && field_0x19 == 0) {
|
||||
int vtmNum = pModelData->getVtxNum();
|
||||
int nrmNum = pModelData->getNrmNum();
|
||||
|
||||
for (int i = 0; i < vtmNum; i++) {
|
||||
u16 posIndex = mPosData[i];
|
||||
if (param_0->getDrawMtxFlag(posIndex) == 0) {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(posIndex);
|
||||
Vec* pos = ((Vec*)param_0->getVtxPosArray()) + i;
|
||||
if (pModelData->getDrawMtxFlag(posIndex) == 0) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(posIndex);
|
||||
Vec* pos = ((Vec*)pModelData->getVtxPosArray()) + i;
|
||||
Mtx invMtx;
|
||||
MTXInverse(param_0->getInvJointMtx(drawMtxIndex), invMtx);
|
||||
MTXInverse(pModelData->getInvJointMtx(drawMtxIndex), invMtx);
|
||||
MTXMultVec(invMtx, pos, pos);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < nrmNum; i++) {
|
||||
u16 nrmIndex = mNrmData[i];
|
||||
if (param_0->getDrawMtxFlag(nrmIndex) == 0) {
|
||||
u16 drawMtxIndex = param_0->getDrawMtxIndex(nrmIndex);
|
||||
Vec* nrm = ((Vec*)param_0->getVtxNrmArray()) + i;
|
||||
if (pModelData->getDrawMtxFlag(nrmIndex) == 0) {
|
||||
u16 drawMtxIndex = pModelData->getDrawMtxIndex(nrmIndex);
|
||||
Vec* nrm = ((Vec*)pModelData->getVtxNrmArray()) + i;
|
||||
Mtx invMtx;
|
||||
MTXInverse(param_0->getInvJointMtx(drawMtxIndex), invMtx);
|
||||
MTXInverse(pModelData->getInvJointMtx(drawMtxIndex), invMtx);
|
||||
MTXMultVecSR(invMtx, nrm, nrm);
|
||||
}
|
||||
}
|
||||
|
||||
field_0x19 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* 8032D87C-8032D8F4 3281BC 0078+00 1/1 0/0 0/0 .text
|
||||
* calcAnmInvJointMtx__13J3DSkinDeformFP12J3DMtxBuffer */
|
||||
void J3DSkinDeform::calcAnmInvJointMtx(J3DMtxBuffer* param_0) {
|
||||
if (param_0->getJointTree()->getWEvlpMtxNum() != 0) {
|
||||
u16 jointNum = param_0->getJointTree()->getJointNum();
|
||||
Mtx* anmMtx = (Mtx*)param_0->getAnmMtx(0);
|
||||
Mtx* invJointMtx = ¶m_0->getJointTree()->getInvJointMtx(0);
|
||||
void J3DSkinDeform::calcAnmInvJointMtx(J3DMtxBuffer* pMtxBuffer) {
|
||||
J3D_ASSERT_NULLPTR(978, pMtxBuffer != NULL);
|
||||
|
||||
if (pMtxBuffer->getJointTree()->getWEvlpMtxNum() != 0) {
|
||||
int jointNum = pMtxBuffer->getJointTree()->getJointNum();
|
||||
Mtx* anmMtx = (Mtx*)pMtxBuffer->getAnmMtx(0);
|
||||
Mtx* invJointMtx = &pMtxBuffer->getJointTree()->getInvJointMtx(0);
|
||||
Mtx* posMtx = mPosMtx;
|
||||
for (int i = 0; i < jointNum; i++) {
|
||||
MTXConcat(anmMtx[i], invJointMtx[i], posMtx[i]);
|
||||
@@ -477,177 +486,208 @@ void J3DSkinDeform::calcAnmInvJointMtx(J3DMtxBuffer* param_0) {
|
||||
|
||||
/* 8032D8F4-8032DA1C 328234 0128+00 1/1 0/0 0/0 .text
|
||||
* deformFastVtxPos_F32__13J3DSkinDeformCFP15J3DVertexBufferP12J3DMtxBuffer */
|
||||
void J3DSkinDeform::deformFastVtxPos_F32(J3DVertexBuffer* param_0, J3DMtxBuffer* param_1) const {
|
||||
param_0->swapTransformedVtxPos();
|
||||
J3DJointTree* jointTree = param_1->getJointTree();
|
||||
u32 vtxNum = param_0->getVertexData()->getVtxNum();
|
||||
void* currentVtxPos = param_0->getCurrentVtxPos();
|
||||
void* transformedVtxPos = param_0->getTransformedVtxPos(0);
|
||||
J3DFillZero32B(transformedVtxPos, (vtxNum * sizeof(Vec) + 0x1f) & ~0x1f);
|
||||
void J3DSkinDeform::deformFastVtxPos_F32(J3DVertexBuffer* pVtxBuffer, J3DMtxBuffer* pMtxBuffer) const {
|
||||
pVtxBuffer->swapTransformedVtxPos();
|
||||
J3DJointTree* jointTree = pMtxBuffer->getJointTree();
|
||||
u32 vtxNum = pVtxBuffer->getVertexData()->getVtxNum();
|
||||
int sp14 = jointTree->getDrawMtxNum();
|
||||
void* currentVtxPos = pVtxBuffer->getCurrentVtxPos();
|
||||
void* transformedVtxPos = pVtxBuffer->getTransformedVtxPos(0);
|
||||
|
||||
J3DFillZero32B(transformedVtxPos, OSRoundUp32B(vtxNum * sizeof(Vec)));
|
||||
|
||||
if (jointTree->getWEvlpMtxNum() != 0) {
|
||||
u16 jointNum = jointTree->getJointNum();
|
||||
for (u16 i = 0; i < jointNum; i++) {
|
||||
mSkinNList[i].calcSkin_VtxPosF32(mPosMtx[i], currentVtxPos, transformedVtxPos);
|
||||
J3DSkinNList* skinList = mSkinNList + i;
|
||||
skinList->calcSkin_VtxPosF32(mPosMtx[i], currentVtxPos, transformedVtxPos);
|
||||
}
|
||||
} else {
|
||||
u16 jointNum = jointTree->getJointNum();
|
||||
for (u16 i = 0; i < jointNum; i++) {
|
||||
J3DSkinNList* skinList = mSkinNList + i;
|
||||
skinList->calcSkin_VtxPosF32(param_1->getAnmMtx(i), currentVtxPos, transformedVtxPos);
|
||||
skinList->calcSkin_VtxPosF32(pMtxBuffer->getAnmMtx(i), currentVtxPos, transformedVtxPos);
|
||||
}
|
||||
}
|
||||
DCStoreRange(param_0->getTransformedVtxPos(0), param_0->getVertexData()->getVtxNum() * sizeof(Vec));
|
||||
param_0->setCurrentVtxPos(transformedVtxPos);
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
DCStoreRange(pVtxBuffer->getTransformedVtxPos(0), pVtxBuffer->getVertexData()->getVtxNum() * sizeof(Vec));
|
||||
pVtxBuffer->setCurrentVtxPos(transformedVtxPos);
|
||||
}
|
||||
|
||||
/* 8032DA1C-8032DB50 32835C 0134+00 1/1 0/0 0/0 .text
|
||||
* deformFastVtxNrm_F32__13J3DSkinDeformCFP15J3DVertexBufferP12J3DMtxBuffer */
|
||||
void J3DSkinDeform::deformFastVtxNrm_F32(J3DVertexBuffer* param_0, J3DMtxBuffer* param_1) const {
|
||||
param_0->swapTransformedVtxNrm();
|
||||
J3DJointTree* jointTree = param_1->getJointTree();
|
||||
int nrmNum = param_0->getVertexData()->getNrmNum();
|
||||
void* currentVtxNrm = param_0->getCurrentVtxNrm();
|
||||
void* transformedVtxNrm = param_0->getTransformedVtxNrm(0);
|
||||
void J3DSkinDeform::deformFastVtxNrm_F32(J3DVertexBuffer* pVtxBuffer, J3DMtxBuffer* pMtxBuffer) const {
|
||||
pVtxBuffer->swapTransformedVtxNrm();
|
||||
J3DJointTree* jointTree = pMtxBuffer->getJointTree();
|
||||
int nrmNum = pVtxBuffer->getVertexData()->getNrmNum();
|
||||
int sp18 = jointTree->getDrawMtxNum();
|
||||
void* currentVtxNrm = pVtxBuffer->getCurrentVtxNrm();
|
||||
void* transformedVtxNrm = pVtxBuffer->getTransformedVtxNrm(0);
|
||||
|
||||
for (int i = 0; i < nrmNum; i++) {
|
||||
((Vec*)transformedVtxNrm)[i].x = 0.0f;
|
||||
((Vec*)transformedVtxNrm)[i].y = 0.0f;
|
||||
((Vec*)transformedVtxNrm)[i].z = 0.0f;
|
||||
((f32*)transformedVtxNrm)[(i * 3) + 0] = 0.0f;
|
||||
((f32*)transformedVtxNrm)[(i * 3) + 1] = 0.0f;
|
||||
((f32*)transformedVtxNrm)[(i * 3) + 2] = 0.0f;
|
||||
}
|
||||
|
||||
if (jointTree->getWEvlpMtxNum() != 0) {
|
||||
u16 jointNum = jointTree->getJointNum();
|
||||
for (u16 i = 0; i < jointNum; i++) {
|
||||
mSkinNList[i].calcSkin_VtxNrmF32(mPosMtx[i], currentVtxNrm, transformedVtxNrm);
|
||||
J3DSkinNList* skinList = mSkinNList + i;
|
||||
skinList->calcSkin_VtxNrmF32(mPosMtx[i], currentVtxNrm, transformedVtxNrm);
|
||||
}
|
||||
} else {
|
||||
u16 jointNum = jointTree->getJointNum();
|
||||
for (u16 i = 0; i < jointNum; i++) {
|
||||
J3DSkinNList* skinList = mSkinNList + i;
|
||||
skinList->calcSkin_VtxNrmF32(param_1->getAnmMtx(i), currentVtxNrm, transformedVtxNrm);
|
||||
skinList->calcSkin_VtxNrmF32(pMtxBuffer->getAnmMtx(i), currentVtxNrm, transformedVtxNrm);
|
||||
}
|
||||
}
|
||||
DCStoreRange(param_0->getTransformedVtxNrm(0), param_0->getVertexData()->getNrmNum() * sizeof(Vec));
|
||||
param_0->setCurrentVtxNrm(transformedVtxNrm);
|
||||
|
||||
DCStoreRange(pVtxBuffer->getTransformedVtxNrm(0), pVtxBuffer->getVertexData()->getNrmNum() * sizeof(Vec));
|
||||
pVtxBuffer->setCurrentVtxNrm(transformedVtxNrm);
|
||||
}
|
||||
|
||||
/* 8032DB50-8032DC74 328490 0124+00 1/1 0/0 0/0 .text
|
||||
* deformVtxPos_F32__13J3DSkinDeformCFP15J3DVertexBufferP12J3DMtxBuffer */
|
||||
// NONMATCHING - J3DPSMulMtxVec regalloc
|
||||
void J3DSkinDeform::deformVtxPos_F32(J3DVertexBuffer* param_0, J3DMtxBuffer* param_1) const {
|
||||
void J3DSkinDeform::deformVtxPos_F32(J3DVertexBuffer* pVtxBuffer, J3DMtxBuffer* pMtxBuffer) const {
|
||||
Mtx* anmMtx = NULL;
|
||||
Mtx* anmMtxs[2];
|
||||
anmMtxs[0] = (Mtx*)param_1->getAnmMtx(0);
|
||||
anmMtxs[1] = (Mtx*)param_1->getWeightAnmMtx(0);
|
||||
param_0->swapTransformedVtxPos();
|
||||
J3DJointTree* jointTree = param_1->getJointTree();
|
||||
int vtxNum = param_0->getVertexData()->getVtxNum();
|
||||
void* currentVtxPos = param_0->getCurrentVtxPos();
|
||||
void* transformedVtxPos = param_0->getTransformedVtxPos(0);
|
||||
anmMtxs[0] = (Mtx*)pMtxBuffer->getAnmMtx(0);
|
||||
anmMtxs[1] = (Mtx*)pMtxBuffer->getWeightAnmMtx(0);
|
||||
pVtxBuffer->swapTransformedVtxPos();
|
||||
|
||||
J3DJointTree* jointTree = pMtxBuffer->getJointTree();
|
||||
int vtxNum = pVtxBuffer->getVertexData()->getVtxNum();
|
||||
int sp8 = jointTree->getDrawMtxNum();
|
||||
void* currentVtxPos = pVtxBuffer->getCurrentVtxPos();
|
||||
void* transformedVtxPos = pVtxBuffer->getTransformedVtxPos(0);
|
||||
|
||||
for (int i = 0; i < vtxNum; i++) {
|
||||
Mtx* anmMtx = anmMtxs[jointTree->getDrawMtxFlag(mPosData[i])];
|
||||
J3DPSMulMtxVec(anmMtx[jointTree->getDrawMtxIndex(mPosData[i])], ((Vec*)currentVtxPos) + i, ((Vec*)transformedVtxPos) + i);
|
||||
anmMtx = anmMtxs[jointTree->getDrawMtxFlag(mPosData[i])];
|
||||
J3DPSMulMtxVec(anmMtx[jointTree->getDrawMtxIndex(mPosData[i])], (Vec*)(((f32*)currentVtxPos) + (i * 3)), (Vec*)(((f32*)transformedVtxPos) + (i * 3)));
|
||||
}
|
||||
DCStoreRange(param_0->getTransformedVtxPos(0), param_0->getVertexData()->getVtxNum() * sizeof(Vec));
|
||||
param_0->setCurrentVtxPos(transformedVtxPos);
|
||||
|
||||
DCStoreRange(pVtxBuffer->getTransformedVtxPos(0), pVtxBuffer->getVertexData()->getVtxNum() * sizeof(Vec));
|
||||
pVtxBuffer->setCurrentVtxPos(transformedVtxPos);
|
||||
}
|
||||
|
||||
/* 8032DC74-8032DDB8 3285B4 0144+00 1/1 0/0 0/0 .text
|
||||
* deformVtxPos_S16__13J3DSkinDeformCFP15J3DVertexBufferP12J3DMtxBuffer */
|
||||
// NONMATCHING - J3DPSMulMtxVec regalloc
|
||||
void J3DSkinDeform::deformVtxPos_S16(J3DVertexBuffer* param_0, J3DMtxBuffer* param_1) const {
|
||||
void J3DSkinDeform::deformVtxPos_S16(J3DVertexBuffer* pVtxBuffer, J3DMtxBuffer* pMtxBuffer) const {
|
||||
Mtx* anmMtx = NULL;
|
||||
Mtx* anmMtxs[2];
|
||||
anmMtxs[0] = (Mtx*)param_1->getAnmMtx(0);
|
||||
anmMtxs[1] = (Mtx*)param_1->getWeightAnmMtx(0);
|
||||
u8 vtxPosFrac = param_0->getVertexData()->getVtxPosFrac();
|
||||
anmMtxs[0] = (Mtx*)pMtxBuffer->getAnmMtx(0);
|
||||
anmMtxs[1] = (Mtx*)pMtxBuffer->getWeightAnmMtx(0);
|
||||
int vtxPosFrac = pVtxBuffer->getVertexData()->getVtxPosFrac();
|
||||
J3DGQRSetup7(vtxPosFrac, 7, vtxPosFrac, 7);
|
||||
param_0->swapTransformedVtxPos();
|
||||
J3DJointTree* jointTree = param_1->getJointTree();
|
||||
int vtxNum = param_0->getVertexData()->getVtxNum();
|
||||
void* currentVtxPos = param_0->getCurrentVtxPos();
|
||||
void* transformedVtxPos = param_0->getTransformedVtxPos(0);
|
||||
pVtxBuffer->swapTransformedVtxPos();
|
||||
|
||||
J3DJointTree* jointTree = pMtxBuffer->getJointTree();
|
||||
int vtxNum = pVtxBuffer->getVertexData()->getVtxNum();
|
||||
int sp8 = jointTree->getDrawMtxNum();
|
||||
void* currentVtxPos = pVtxBuffer->getCurrentVtxPos();
|
||||
void* transformedVtxPos = pVtxBuffer->getTransformedVtxPos(0);
|
||||
|
||||
for (int i = 0; i < vtxNum; i++) {
|
||||
Mtx* anmMtx = anmMtxs[jointTree->getDrawMtxFlag(mPosData[i])];
|
||||
J3DPSMulMtxVec(anmMtx[jointTree->getDrawMtxIndex(mPosData[i])], ((S16Vec*)currentVtxPos) + i, ((S16Vec*)transformedVtxPos) + i);
|
||||
anmMtx = anmMtxs[jointTree->getDrawMtxFlag(mPosData[i])];
|
||||
J3DPSMulMtxVec(anmMtx[jointTree->getDrawMtxIndex(mPosData[i])], (S16Vec*)(((s16*)currentVtxPos) + (i * 3)), (S16Vec*)(((s16*)transformedVtxPos) + (i * 3)));
|
||||
}
|
||||
DCStoreRange(param_0->getTransformedVtxPos(0), param_0->getVertexData()->getVtxNum() * sizeof(S16Vec));
|
||||
param_0->setCurrentVtxPos(transformedVtxPos);
|
||||
|
||||
DCStoreRange(pVtxBuffer->getTransformedVtxPos(0), pVtxBuffer->getVertexData()->getVtxNum() * sizeof(S16Vec));
|
||||
pVtxBuffer->setCurrentVtxPos(transformedVtxPos);
|
||||
}
|
||||
|
||||
/* 8032DDB8-8032DEBC 3286F8 0104+00 1/1 0/0 0/0 .text
|
||||
* deformVtxNrm_F32__13J3DSkinDeformCFP15J3DVertexBuffer */
|
||||
// NONMATCHING - J3DPSMulMtxVec regalloc
|
||||
void J3DSkinDeform::deformVtxNrm_F32(J3DVertexBuffer* param_0) const {
|
||||
param_0->swapTransformedVtxNrm();
|
||||
int nrmNum = param_0->getVertexData()->getNrmNum();
|
||||
void* currentVtxNrm = param_0->getCurrentVtxNrm();
|
||||
void* transformedVtxNrm = param_0->getTransformedVtxNrm(0);
|
||||
void J3DSkinDeform::deformVtxNrm_F32(J3DVertexBuffer* pVtxBuffer) const {
|
||||
pVtxBuffer->swapTransformedVtxNrm();
|
||||
int nrmNum = pVtxBuffer->getVertexData()->getNrmNum();
|
||||
void* currentVtxNrm = pVtxBuffer->getCurrentVtxNrm();
|
||||
void* transformedVtxNrm = pVtxBuffer->getTransformedVtxNrm(0);
|
||||
|
||||
for (int i = 0; i < nrmNum; i++) {
|
||||
J3DPSMulMtxVec(mNrmMtx[mNrmData[i]], (Vec*)((u8*)currentVtxNrm + i * 3 * 4), (Vec*)((u8*)transformedVtxNrm + i * 3 * 4));
|
||||
}
|
||||
DCStoreRange(param_0->getTransformedVtxNrm(0), param_0->getVertexData()->getNrmNum() * sizeof(Vec));
|
||||
param_0->setCurrentVtxNrm(transformedVtxNrm);
|
||||
|
||||
DCStoreRange(pVtxBuffer->getTransformedVtxNrm(0), pVtxBuffer->getVertexData()->getNrmNum() * sizeof(Vec));
|
||||
pVtxBuffer->setCurrentVtxNrm(transformedVtxNrm);
|
||||
}
|
||||
|
||||
/* 8032DEBC-8032DFDC 3287FC 0120+00 1/1 0/0 0/0 .text
|
||||
* deformVtxNrm_S16__13J3DSkinDeformCFP15J3DVertexBuffer */
|
||||
// NONMATCHING - J3DPSMulMtxVec regalloc
|
||||
void J3DSkinDeform::deformVtxNrm_S16(J3DVertexBuffer* param_0) const {
|
||||
u8 vtxNrmFrac = param_0->getVertexData()->getVtxNrmFrac();
|
||||
void J3DSkinDeform::deformVtxNrm_S16(J3DVertexBuffer* pVtxBuffer) const {
|
||||
int vtxNrmFrac = pVtxBuffer->getVertexData()->getVtxNrmFrac();
|
||||
J3DGQRSetup7(vtxNrmFrac, 7, vtxNrmFrac, 7);
|
||||
param_0->swapTransformedVtxNrm();
|
||||
int nrmNum = param_0->getVertexData()->getNrmNum();
|
||||
void* currentVtxNrm = param_0->getCurrentVtxNrm();
|
||||
void* transformedVtxNrm = param_0->getTransformedVtxNrm(0);
|
||||
pVtxBuffer->swapTransformedVtxNrm();
|
||||
|
||||
int nrmNum = pVtxBuffer->getVertexData()->getNrmNum();
|
||||
void* currentVtxNrm = pVtxBuffer->getCurrentVtxNrm();
|
||||
void* transformedVtxNrm = pVtxBuffer->getTransformedVtxNrm(0);
|
||||
|
||||
for (int i = 0; i < nrmNum; i++) {
|
||||
J3DPSMulMtxVec(mNrmMtx[mNrmData[i]], ((S16Vec*)currentVtxNrm) + i, ((S16Vec*)transformedVtxNrm) + i);
|
||||
J3DPSMulMtxVec(mNrmMtx[mNrmData[i]], (S16Vec*)(((s16*)currentVtxNrm) + (i * 3)), (S16Vec*)(((s16*)transformedVtxNrm) + (i * 3)));
|
||||
}
|
||||
DCStoreRange(param_0->getTransformedVtxNrm(0), param_0->getVertexData()->getNrmNum() * sizeof(S16Vec));
|
||||
param_0->setCurrentVtxNrm(transformedVtxNrm);
|
||||
|
||||
DCStoreRange(pVtxBuffer->getTransformedVtxNrm(0), pVtxBuffer->getVertexData()->getNrmNum() * sizeof(S16Vec));
|
||||
pVtxBuffer->setCurrentVtxNrm(transformedVtxNrm);
|
||||
}
|
||||
|
||||
/* 8032DFDC-8032E064 32891C 0088+00 0/0 1/1 0/0 .text deform__13J3DSkinDeformFP8J3DModel
|
||||
*/
|
||||
void J3DSkinDeform::deform(J3DModel* param_0) {
|
||||
if (param_0->checkFlag(4)) {
|
||||
void J3DSkinDeform::deform(J3DModel* pModel) {
|
||||
J3D_ASSERT_NULLPTR(1270, pModel != NULL);
|
||||
|
||||
if (pModel->checkFlag(J3DMdlFlag_SkinPosCpu)) {
|
||||
onFlag(2);
|
||||
} else {
|
||||
offFlag(2);
|
||||
}
|
||||
|
||||
if (param_0->checkFlag(8)) {
|
||||
if (pModel->checkFlag(J3DMdlFlag_SkinNrmCpu)) {
|
||||
onFlag(1);
|
||||
} else {
|
||||
offFlag(1);
|
||||
}
|
||||
deform(param_0->getVertexBuffer(), param_0->getMtxBuffer());
|
||||
|
||||
deform(pModel->getVertexBuffer(), pModel->getMtxBuffer());
|
||||
}
|
||||
|
||||
/* 8032E064-8032E180 3289A4 011C+00 1/0 0/0 0/0 .text
|
||||
* deform__13J3DSkinDeformFP15J3DVertexBufferP12J3DMtxBuffer */
|
||||
void J3DSkinDeform::deform(J3DVertexBuffer* param_0, J3DMtxBuffer* param_1) {
|
||||
if (param_1->getJointTree()->checkFlag(0x100)) {
|
||||
calcAnmInvJointMtx(param_1);
|
||||
void J3DSkinDeform::deform(J3DVertexBuffer* pVtxBuffer, J3DMtxBuffer* pMtxBuffer) {
|
||||
J3D_ASSERT_NULLPTR(1299, pVtxBuffer != NULL);
|
||||
J3D_ASSERT_NULLPTR(1300, pMtxBuffer != NULL);
|
||||
|
||||
if (pMtxBuffer->getJointTree()->checkFlag(0x100)) {
|
||||
calcAnmInvJointMtx(pMtxBuffer);
|
||||
}
|
||||
|
||||
if (checkFlag(2) != 0) {
|
||||
if (param_1->getJointTree()->checkFlag(0x100)) {
|
||||
deformFastVtxPos_F32(param_0, param_1);
|
||||
if (pMtxBuffer->getJointTree()->checkFlag(0x100)) {
|
||||
deformFastVtxPos_F32(pVtxBuffer, pMtxBuffer);
|
||||
} else {
|
||||
if (param_0->getVertexData()->getVtxPosType() == 4) {
|
||||
deformVtxPos_F32(param_0, param_1);
|
||||
if (pVtxBuffer->getVertexData()->getVtxPosType() == 4) {
|
||||
deformVtxPos_F32(pVtxBuffer, pMtxBuffer);
|
||||
} else {
|
||||
deformVtxPos_S16(param_0, param_1);
|
||||
deformVtxPos_S16(pVtxBuffer, pMtxBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (checkFlag(1) != 0) {
|
||||
if (param_1->getJointTree()->checkFlag(0x100)) {
|
||||
deformFastVtxNrm_F32(param_0, param_1);
|
||||
|
||||
if (checkFlag(1)) {
|
||||
if (pMtxBuffer->getJointTree()->checkFlag(0x100)) {
|
||||
deformFastVtxNrm_F32(pVtxBuffer, pMtxBuffer);
|
||||
} else {
|
||||
calcNrmMtx(param_1);
|
||||
if (param_0->getVertexData()->getVtxNrmType() == 4) {
|
||||
deformVtxNrm_F32(param_0);
|
||||
calcNrmMtx(pMtxBuffer);
|
||||
if (pVtxBuffer->getVertexData()->getVtxNrmType() == 4) {
|
||||
deformVtxNrm_F32(pVtxBuffer);
|
||||
} else {
|
||||
deformVtxNrm_S16(param_0);
|
||||
deformVtxNrm_S16(pVtxBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -655,11 +695,10 @@ void J3DSkinDeform::deform(J3DVertexBuffer* param_0, J3DMtxBuffer* param_1) {
|
||||
|
||||
/* 8032E180-8032E1B0 328AC0 0030+00 0/0 1/1 0/0 .text calc__15J3DVtxColorCalcFP8J3DModel
|
||||
*/
|
||||
void J3DVtxColorCalc::calc(J3DModel* param_0) {
|
||||
calc(param_0->getVertexBuffer());
|
||||
void J3DVtxColorCalc::calc(J3DModel* pModel) {
|
||||
J3D_ASSERT_NULLPTR(1351, pModel != NULL);
|
||||
calc(pModel->getVertexBuffer());
|
||||
}
|
||||
|
||||
/* 8032E1B0-8032E1F8 328AF0 0048+00 1/0 0/0 0/0 .text __dt__13J3DSkinDeformFv */
|
||||
J3DSkinDeform::~J3DSkinDeform() {}
|
||||
|
||||
/* 803A2028-803A2028 02E688 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
|
||||
|
||||
Reference in New Issue
Block a user