some various J2D/J3D work (#2043)

* most of J2DPicture done

* fix GXSetTexCoordGen

* some j3d work
This commit is contained in:
TakaRikka 2024-01-22 07:23:54 -08:00 committed by GitHub
parent 5a735a4956
commit 697cd08979
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 1096 additions and 377 deletions

View File

@ -112,12 +112,12 @@ lbl_8087667C:
/* 80876834 38 80 00 01 */ li r4, 1
/* 80876838 38 A0 00 04 */ li r5, 4
/* 8087683C 38 C0 00 3C */ li r6, 0x3c
/* 80876840 48 00 03 69 */ bl GXSetTexCoordGen
/* 80876840 48 00 03 69 */ bl i_GXSetTexCoordGen
/* 80876844 38 60 00 01 */ li r3, 1
/* 80876848 38 80 00 01 */ li r4, 1
/* 8087684C 38 A0 00 04 */ li r5, 4
/* 80876850 38 C0 00 3C */ li r6, 0x3c
/* 80876854 48 00 03 55 */ bl GXSetTexCoordGen
/* 80876854 48 00 03 55 */ bl i_GXSetTexCoordGen
/* 80876858 4B AE 7E 0D */ bl GXInvalidateTexAll
/* 8087685C 4B AE 4D 31 */ bl GXClearVtxDesc
/* 80876860 38 60 00 09 */ li r3, 9

View File

@ -119,7 +119,7 @@ public:
protected:
/* 0x100 */ JUTTexture* mTexture[2];
/* 0x108 */ u8 mTextureCount;
/* 0x108 */ u8 mTextureNum;
/* 0x109 */ u8 field_0x109;
/* 0x10A */ JGeometry::TVec2<s16> field_0x10a[4];
/* 0x11C */ f32 field_0x11c[2];
@ -128,8 +128,8 @@ protected:
/* 0x130 */ JUtility::TColor mWhite;
/* 0x134 */ JUtility::TColor mBlack;
/* 0x138 */ JUtility::TColor mCornerColor[4];
/* 0x148 */ JUtility::TColor field_0x148;
/* 0x14C */ JUtility::TColor field_0x14c;
/* 0x148 */ JUtility::TColor mBlendKonstColor;
/* 0x14C */ JUtility::TColor mBlendKonstAlpha;
};
#endif /* J2DPICTURE_H */

View File

@ -64,7 +64,7 @@ struct J3DAnmTransformFullTable {
struct J3DAnmTexPatternFullTable {
/* 0x00 */ u16 mMaxFrame;
/* 0x02 */ u16 mOffset;
/* 0x04 */ u8 _4;
/* 0x04 */ u8 mTexNo;
/* 0x06 */ u16 _6;
}; // Size = 0x8
@ -421,13 +421,18 @@ public:
/* 8032BD20 */ virtual ~J3DAnmTexPattern();
/* 8032BD94 */ virtual s32 getKind() const;
u16 getUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx]; }
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
bool isValidUpdateMaterialID(u16 id) const { return mUpdateMaterialID[id] != 0xFFFF; }
J3DAnmTexPatternFullTable* getAnmTable() { return mAnmTable; }
private:
/* 0x0C */ void* field_0xc;
/* 0x10 */ void* mAnmTable;
/* 0x10 */ J3DAnmTexPatternFullTable* mAnmTable;
/* 0x14 */ u16 field_0x14;
/* 0x16 */ u16 mUpdateMaterialNum;
/* 0x18 */ u16* field_0x18;
/* 0x1C */ JUTNameTab field_0x1c;
/* 0x18 */ u16* mUpdateMaterialID;
/* 0x1C */ JUTNameTab mUpdateMaterialName;
}; // Size: 0x2C
class J3DAnmTevRegKey : public J3DAnmBase {

View File

@ -4,21 +4,59 @@
#include "dolphin/types.h"
class J3DDeformer;
class J3DClusterKey;
class J3DClusterVertex;
class J3DVertexBuffer;
class J3DModel;
class J3DAnmCluster;
class JUTNameTab;
struct J3DCluster {
/* 0x00 */ f32 field_0x0;
/* 0x04 */ f32 field_0x4;
/* 0x08 */ int field_0x8;
/* 0x0C */ int field_0xc;
/* 0x10 */ u16 field_0x10;
/* 0x12 */ u16 field_0x12;
class J3DCluster {
public:
J3DDeformer* getDeformer() { return mDeformer; }
void setDeformer(J3DDeformer* deformer) { mDeformer = deformer; }
/* 0x00 */ f32 mMaxAngle;
/* 0x04 */ f32 mMinAngle;
/* 0x08 */ J3DClusterKey* mClusterKey;
/* 0x0C */ u8 mFlags;
/* 0x0E */ u8 field_0xe[0x10 - 0xD];
/* 0x10 */ u16 mKeyNum;
/* 0x12 */ u16 mPosNum;
/* 0x14 */ u16 field_0x14;
/* 0x16 */ u16 field_0x16;
/* 0x18 */ u16 field_0x18[2];
/* 0x1C */ int field_0x1c;
/* 0x18 */ u16* field_0x18;
/* 0x1C */ J3DClusterVertex* mClusterVertex;
/* 0x20 */ J3DDeformer* mDeformer;
};
struct J3DClusterKey {};
class J3DDeformData {
public:
/* 8032E1F8 */ J3DDeformData();
/* 8032E230 */ void offAllFlag(u32);
/* 8032E298 */ void deform(J3DVertexBuffer*);
/* 8032E274 */ void deform(J3DModel*);
/* 8032E364 */ void setAnm(J3DAnmCluster*);
J3DCluster* getClusterPointer(u16 index) {
return &mClusterPointer[index];
}
private:
/* 0x00 */ u16 mClusterNum;
/* 0x02 */ u16 mClusterKeyNum;
/* 0x04 */ u16 mClusterVertexNum;
/* 0x08 */ J3DCluster* mClusterPointer;
/* 0x0C */ J3DClusterKey* mClusterKeyPointer;
/* 0x10 */ J3DClusterVertex* mClusterVertex;
/* 0x14 */ u16 mVtxPosNum;
/* 0x16 */ u16 mVtxNrmNum;
/* 0x18 */ f32* mVtxPos;
/* 0x1C */ f32* mVtxNrm;
/* 0x20 */ JUTNameTab* mClusterName;
/* 0x24 */ JUTNameTab* mClusterKeyName;
}; // Size: 0x28
#endif /* J3DCLUSTER_H */

View File

@ -8,29 +8,8 @@
class J3DModel;
class J3DAnmCluster;
class J3DDeformData {
public:
/* 8032E1F8 */ J3DDeformData();
/* 8032E230 */ void offAllFlag(u32);
/* 8032E298 */ void deform(J3DVertexBuffer*);
/* 8032E274 */ void deform(J3DModel*);
/* 8032E364 */ void setAnm(J3DAnmCluster*);
private:
/* 0x00 */ u16 mClusterNum;
/* 0x02 */ u16 mClusterKeyNum;
/* 0x04 */ u16 field_0x4;
/* 0x08 */ J3DCluster** mClusterPointer;
/* 0x0C */ J3DClusterKey** mClusterKeyPointer;
/* 0x10 */ int field_0x10;
/* 0x14 */ u16 field_0x14;
/* 0x16 */ u16 field_0x16;
/* 0x18 */ void* mVtxPos;
/* 0x1C */ void* mVtxNrm;
/* 0x20 */ int field_0x20;
/* 0x24 */ int field_0x24;
}; // Size: 0x28
class J3DClusterVertex;
class JUTNameTab;
struct J3DSkinNList {
/* 8032C6E4 */ J3DSkinNList();
@ -98,11 +77,14 @@ public:
/* 8032E60C */ void deform_VtxNrmF32(J3DVertexBuffer*, J3DCluster*, J3DClusterKey*, f32*);
/* 8032EBCC */ void normalizeWeight(int, f32*);
void offFlag(u32 i_flag) { mFlags &= ~i_flag; }
void setAnmCluster(J3DAnmCluster* anm) { mAnmCluster = anm; }
private:
/* 0x00 */ J3DDeformData* mDeformData;
/* 0x04 */ J3DAnmCluster* mAnmCluster;
/* 0x08 */ int field_0x8;
/* 0x0C */ int field_0xc;
/* 0x08 */ f32* field_0x8;
/* 0x0C */ f32* field_0xc;
/* 0x10 */ u32 mFlags;
}; // Size: 0x14

View File

@ -105,6 +105,26 @@ public:
mTransformedVtxNrmArray[1] = tmp;
}
void swapVtxPosArrayPointer() {
void* temp = mVtxPosArray[0];
mVtxPosArray[0] = mVtxPosArray[1];
mVtxPosArray[1] = temp;
}
void swapVtxNrmArrayPointer() {
void* temp = mVtxNrmArray[0];
mVtxNrmArray[0] = mVtxNrmArray[1];
mVtxNrmArray[1] = temp;
}
void* getVtxPosArrayPointer(int index) {
return mVtxPosArray[index];
}
void* getVtxNrmArrayPointer(int index) {
return mVtxNrmArray[index];
}
private:
/* 0x00 */ J3DVertexData* mVtxData;
/* 0x04 */ void* mVtxPosArray[2];

View File

@ -296,8 +296,11 @@ struct TVec3<f32> {
template <typename T>
struct TVec2 {
TVec2() {}
TVec2(T v) { set(v); }
TVec2(T x, T y) { set(x, y); }
void set(T v) { y = x = v; }
void set(T x, T y) {
this->x = x;
this->y = y;

View File

@ -11,10 +11,6 @@ struct TColor : public GXColor {
TColor(GXColor color) { set(color); }
// TColor(const TColor& other) { set(other.toUInt32()); }
TColor& operator=(const TColor& other) {
((GXColor*)this)->operator=(other);
return *this;
}
operator u32() const { return toUInt32(); }
u32 toUInt32() const { return *(u32*)&r; }

View File

@ -38,6 +38,10 @@ void GXGetVtxAttrFmt(GXVtxFmt param_0, int param_1, GXCompCnt* param_2, GXCompTy
u8* param_4);
void GXGetVtxDescv(GXVtxDescList* attrPtr);
static inline void GXSetTexCoordGen(GXTexCoordID dst, GXTexGenType type, GXTexGenSrc src, u32 mtx) {
GXSetTexCoordGen2(dst, type, src, mtx, GX_FALSE, GX_PTIDENTITY);
}
#ifdef __cplusplus
};
#endif

View File

@ -25,10 +25,6 @@ void J2DGrafContext::setPort() {
GXSetViewport(bounds.i.x, bounds.i.y, bounds.getWidth(), bounds.getHeight(), 0.0f, 1.0f);
}
static inline void GXSetTexCoordGen(GXTexCoordID dst, GXTexGenType type, GXTexGenSrc src, u32 mtx) {
GXSetTexCoordGen2(dst, type, src, mtx, GX_FALSE, GX_PTIDENTITY);
}
/* 802E8C44-802E8E20 2E3584 01DC+00 1/0 1/0 0/0 .text setup2D__14J2DGrafContextFv */
void J2DGrafContext::setup2D() {
GXSetNumIndStages(0);

View File

@ -406,10 +406,6 @@ void J2DTexGenBlock::initialize() {
}
}
static inline void GXSetTexCoordGen(GXTexCoordID dst, GXTexGenType type, GXTexGenSrc src, u32 mtx) {
GXSetTexCoordGen2(dst, type, src, mtx, GX_FALSE, GX_PTIDENTITY);
}
/* 802EB570-802EB620 2E5EB0 00B0+00 0/0 1/1 0/0 .text setGX__14J2DTexGenBlockFv */
void J2DTexGenBlock::setGX() {
GXSetNumTexGens(mTexGenNum);

View File

@ -342,7 +342,7 @@ void J2DMaterial::setAnimation(J2DAnmTexPattern* anm) {
u16 matID = anm->getUpdateMaterialID(i);
if (index == matID) {
mAnmPointer->field_0x22[anmTbl[i]._4] = i;
mAnmPointer->field_0x22[anmTbl[i].mTexNo] = i;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -208,7 +208,7 @@ SECTION_SDATA2 static f32 lit_1563[1 + 1 /* padding */] = {
// almost
#ifdef NONMATCHING
J2DScreen::J2DScreen()
: J2DPane(NULL, true, 'root', JGeometry::TBox2<f32>(0.0f, 0.0f, 0.0f, 0.0f)), mColor() {
: J2DPane(NULL, true, 'root', JGeometry::TBox2<f32>(0.0f, 0.0f, 640.0f, 480.0f)), mColor() {
field_0x4 = -1;
mScissor = false;
mMaterialNum = 0;
@ -342,14 +342,12 @@ bool J2DScreen::getScreenInformation(JSURandomInputStream* p_stream) {
/* 802F8990-802F8B98 2F32D0 0208+00 1/1 0/0 0/0 .text
* makeHierarchyPanes__9J2DScreenFP7J2DPaneP20JSURandomInputStreamUlP10JKRArchive */
// goto can probably be replaced
s32 J2DScreen::makeHierarchyPanes(J2DPane* p_basePane, JSURandomInputStream* p_stream, u32 param_2,
JKRArchive* p_archive) {
J2DScrnBlockHeader header;
J2DPane* next_pane = p_basePane;
do {
loop:
while (true) {
J2DScrnBlockHeader header;
p_stream->peek(&header, sizeof(J2DScrnBlockHeader));
switch (header.mTag) {
@ -360,10 +358,10 @@ s32 J2DScreen::makeHierarchyPanes(J2DPane* p_basePane, JSURandomInputStream* p_s
p_stream->seek(header.mSize, JSUStreamSeekFrom_CUR);
int ret = makeHierarchyPanes(next_pane, p_stream, param_2, p_archive);
if (ret == 0) {
goto loop;
if (ret != 0) {
return ret;
}
return ret;
break;
case 'END1':
p_stream->seek(header.mSize, JSUStreamSeekFrom_CUR);
return 0;
@ -371,33 +369,36 @@ s32 J2DScreen::makeHierarchyPanes(J2DPane* p_basePane, JSURandomInputStream* p_s
J2DResReference* texRes = getResReference(p_stream, param_2);
mTexRes = texRes;
if (texRes != NULL) {
goto loop;
if (texRes == NULL) {
return 2;
}
return 2;
break;
case 'FNT1':
J2DResReference* fntRes = getResReference(p_stream, param_2);
mFontRes = fntRes;
if (fntRes != NULL) {
goto loop;
if (fntRes == NULL) {
return 2;
}
return 2;
break;
case 'MAT1':
if (createMaterial(p_stream, param_2, p_archive)) {
goto loop;
if (!createMaterial(p_stream, param_2, p_archive)) {
return 2;
}
break;
default:
if (p_archive == NULL) {
next_pane = createPane(header, p_stream, p_basePane, param_2);
} else {
next_pane = createPane(header, p_stream, p_basePane, param_2, p_archive);
}
return 2;
}
if (p_archive == NULL) {
next_pane = createPane(header, p_stream, p_basePane, param_2);
} else {
next_pane = createPane(header, p_stream, p_basePane, param_2, p_archive);
if (next_pane == NULL) {
return 2;
}
break;
}
} while (next_pane != NULL);
return 2;
}
}
/* 802F8B98-802F8ED4 2F34D8 033C+00 1/0 0/0 0/0 .text

View File

@ -557,10 +557,6 @@ void J2DWindow::drawContentsTexture(f32 param_0, f32 param_1, f32 param_2, f32 p
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
}
static inline void GXSetTexCoordGen(GXTexCoordID dst, GXTexGenType type, GXTexGenSrc src, u32 mtx) {
GXSetTexCoordGen2(dst, type, src, mtx, GX_FALSE, GX_PTIDENTITY);
}
/* 802FBB90-802FBE60 2F64D0 02D0+00 2/2 0/0 0/0 .text
* setTevMode__9J2DWindowFP10JUTTextureQ28JUtility6TColorQ28JUtility6TColor */
void J2DWindow::setTevMode(JUTTexture* param_0, JUtility::TColor param_1,

View File

@ -786,11 +786,11 @@ asm void J3DAnmTexPattern::getTexNo(u16 param_0, u16* param_1) const {
* searchUpdateMaterialID__16J3DAnmTexPatternFP16J3DMaterialTable */
void J3DAnmTexPattern::searchUpdateMaterialID(J3DMaterialTable* param_0) {
for (u16 i = 0; i < mUpdateMaterialNum; i++) {
s32 r3 = param_0->getMaterialName()->getIndex(field_0x1c.getName(i));
s32 r3 = param_0->getMaterialName()->getIndex(mUpdateMaterialName.getName(i));
if (r3 != -1) {
field_0x18[i] = r3;
mUpdateMaterialID[i] = r3;
} else {
field_0x18[i] = -1;
mUpdateMaterialID[i] = -1;
}
}
}

View File

@ -4,38 +4,24 @@
//
#include "JSystem/J3DGraphAnimator/J3DCluster.h"
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
#include "JSystem/J3DGraphAnimator/J3DSkinDeform.h"
#include "JSystem/JMath/JMath.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "dol2asm.h"
#include "dolphin/os.h"
//
// Types:
//
struct JMath {
static f32 asinAcosTable_[1032];
};
struct J3DVertexBuffer {};
struct J3DModel {};
struct J3DAnmCluster {};
struct J3DDeformData {
/* 8032E1F8 */ J3DDeformData();
/* 8032E230 */ void offAllFlag(u32);
/* 8032E298 */ void deform(J3DVertexBuffer*);
/* 8032E274 */ void deform(J3DModel*);
/* 8032E364 */ void setAnm(J3DAnmCluster*);
};
struct J3DDeformer {
/* 8032E39C */ J3DDeformer(J3DDeformData*);
/* 8032EAB4 */ void deform(J3DVertexBuffer*, u16, f32*);
/* 8032E3BC */ void deform(J3DVertexBuffer*, u16);
/* 8032E4A4 */ void deform_VtxPosF32(J3DVertexBuffer*, J3DCluster*, J3DClusterKey*, f32*);
/* 8032E60C */ void deform_VtxNrmF32(J3DVertexBuffer*, J3DCluster*, J3DClusterKey*, f32*);
/* 8032EBCC */ void normalizeWeight(int, f32*);
};
#ifdef DEBUG
#define J3D_ASSERT(COND) \
if ((COND) == 0) { \
JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, __LINE__, \
"Error : null pointer"); \
OSPanic(__FILE__, __LINE__, "Halt"); \
}
#else
#define J3D_ASSERT(COND)
#endif
//
// Forward References:
@ -58,8 +44,6 @@ extern "C" void normalizeWeight__11J3DDeformerFiPf();
//
extern "C" void PPCSync();
extern "C" void DCStoreRangeNoSync();
extern "C" void PSVECNormalize();
extern "C" void __cvt_fp2unsigned();
extern "C" void _savegpr_21();
extern "C" void _savegpr_26();
@ -76,77 +60,93 @@ extern "C" f32 asinAcosTable___5JMath[1032];
//
/* 8032E1F8-8032E230 328B38 0038+00 0/0 1/1 0/0 .text __ct__13J3DDeformDataFv */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm J3DDeformData::J3DDeformData() {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/__ct__13J3DDeformDataFv.s"
J3DDeformData::J3DDeformData() {
mClusterNum = 0;
mClusterKeyNum = 0;
mClusterVertexNum = 0;
mClusterPointer = NULL;
mClusterKeyPointer = NULL;
mClusterVertex = NULL;
mVtxPosNum = 0;
mVtxNrmNum = 0;
mVtxPos = NULL;
mVtxNrm = NULL;
mClusterName = NULL;
mClusterKeyName = NULL;
}
#pragma pop
/* 8032E230-8032E274 328B70 0044+00 0/0 1/1 0/0 .text offAllFlag__13J3DDeformDataFUl */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void J3DDeformData::offAllFlag(u32 param_0) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/offAllFlag__13J3DDeformDataFUl.s"
void J3DDeformData::offAllFlag(u32 i_flag) {
for (u16 i = 0; i < mClusterNum; i++) {
mClusterPointer[i].getDeformer()->offFlag(i_flag);
}
}
#pragma pop
/* 8032E274-8032E298 328BB4 0024+00 0/0 1/1 0/0 .text deform__13J3DDeformDataFP8J3DModel
*/
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void J3DDeformData::deform(J3DModel* param_0) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/deform__13J3DDeformDataFP8J3DModel.s"
void J3DDeformData::deform(J3DModel* model) {
J3D_ASSERT(model != NULL);
deform(model->getVertexBuffer());
}
#pragma pop
/* 8032E298-8032E364 328BD8 00CC+00 1/1 0/0 0/0 .text deform__13J3DDeformDataFP15J3DVertexBuffer
*/
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void J3DDeformData::deform(J3DVertexBuffer* param_0) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/deform__13J3DDeformDataFP15J3DVertexBuffer.s"
void J3DDeformData::deform(J3DVertexBuffer* buffer) {
J3D_ASSERT(buffer != NULL);
buffer->swapVtxPosArrayPointer();
buffer->swapVtxNrmArrayPointer();
for (u16 i = 0; i < mClusterNum; i++) {
mClusterPointer[i].getDeformer()->deform(buffer, i);
}
DCStoreRangeNoSync(buffer->getVtxPosArrayPointer(0),
buffer->getVertexData()->getVtxNum() * sizeof(Vec));
DCStoreRangeNoSync(buffer->getVtxNrmArrayPointer(0),
buffer->getVertexData()->getNrmNum() * sizeof(Vec));
PPCSync();
buffer->setCurrentVtxPos(buffer->getVtxPosArrayPointer(0));
buffer->setCurrentVtxNrm(buffer->getVtxNrmArrayPointer(0));
}
#pragma pop
/* 8032E364-8032E39C 328CA4 0038+00 0/0 1/1 0/0 .text setAnm__13J3DDeformDataFP13J3DAnmCluster */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void J3DDeformData::setAnm(J3DAnmCluster* param_0) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/setAnm__13J3DDeformDataFP13J3DAnmCluster.s"
void J3DDeformData::setAnm(J3DAnmCluster* anm) {
for (u16 i = 0; i < mClusterNum; i++) {
mClusterPointer[i].getDeformer()->setAnmCluster(anm);
}
}
#pragma pop
/* 8032E39C-8032E3BC 328CDC 0020+00 0/0 1/1 0/0 .text __ct__11J3DDeformerFP13J3DDeformData */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm J3DDeformer::J3DDeformer(J3DDeformData* param_0) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/__ct__11J3DDeformerFP13J3DDeformData.s"
J3DDeformer::J3DDeformer(J3DDeformData* data) {
mDeformData = data;
mAnmCluster = NULL;
field_0x8 = NULL;
field_0xc = NULL;
mFlags = 3;
}
#pragma pop
/* 8032E3BC-8032E4A4 328CFC 00E8+00 1/1 0/0 0/0 .text deform__11J3DDeformerFP15J3DVertexBufferUs
*/
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void J3DDeformer::deform(J3DVertexBuffer* param_0, u16 param_1) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DCluster/deform__11J3DDeformerFP15J3DVertexBufferUs.s"
void J3DDeformer::deform(J3DVertexBuffer* buffer, u16 param_1) {
J3D_ASSERT(buffer != 0);
u16 var_r31 = 0;
if (mAnmCluster != NULL) {
for (u16 i = 0; i < param_1; i++) {
var_r31 += mDeformData->getClusterPointer(i)->mKeyNum;
}
u16 num = mDeformData->getClusterPointer(param_1)->mKeyNum;
for (u16 i = 0; i < num; i++) {
field_0x8[i] = mAnmCluster->getWeight(var_r31++);
}
deform(buffer, param_1, field_0x8);
}
}
#pragma pop
/* ############################################################################################## */
/* 80456470-80456474 004A70 0004+00 2/2 0/0 0/0 .sdata2 @830 */

View File

@ -1,34 +1,12 @@
//
// Generated By: dol2asm
// Translation Unit: J3DJoint
//
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
#include "JSystem/J3DGraphBase/J3DDrawBuffer.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "JSystem/JMath/JMath.h"
#include "dol2asm.h"
#include "dolphin/types.h"
#include "m_Do/m_Do_mtx.h"
//
// Types:
//
//
// Forward References:
//
//
// External References:
//
//
// Declarations:
//
/* 8032EC28-8032ECAC 329568 0084+00 0/0 1/1 0/0 .text
* init__25J3DMtxCalcJ3DSysInitBasicFRC3VecRA3_A4_Cf */
void J3DMtxCalcJ3DSysInitBasic::init(Vec const& scale, Mtx const& mtx) {
@ -181,7 +159,7 @@ void J3DJoint::appendChild(J3DJoint* pChild) {
#pragma push
#pragma force_active on
/* dead data */
SECTION_DEAD static u32 const pad_803A2080[2] = {0,0};
SECTION_DEAD static u32 const pad_803A2080[2] = {0, 0};
#pragma pop
/* 8032F170-8032F254 329AB0 00E4+00 0/0 1/1 0/0 .text __ct__8J3DJointFv */
@ -210,12 +188,13 @@ void J3DJoint::entryIn() {
MtxP anmMtx = j3dSys.getModel()->i_getAnmMtx(mJntNo);
j3dSys.getDrawBuffer(0)->setZMtx(anmMtx);
j3dSys.getDrawBuffer(1)->setZMtx(anmMtx);
for (J3DMaterial* mesh = mMesh; mesh != NULL; ) {
for (J3DMaterial* mesh = mMesh; mesh != NULL;) {
if (mesh->getShape()->checkFlag(1)) {
mesh = mesh->getNext();
} else {
J3DMatPacket* matPacket = j3dSys.getModel()->getMatPacket(mesh->getIndex());
J3DShapePacket* shapePacket = j3dSys.getModel()->getShapePacket(mesh->getShape()->getIndex());
J3DShapePacket* shapePacket =
j3dSys.getModel()->getShapePacket(mesh->getShape()->getIndex());
if (!matPacket->isLocked()) {
if (mesh->getMaterialAnm()) {
J3DMaterialAnm* piVar8 = mesh->getMaterialAnm();
@ -276,7 +255,7 @@ void J3DJoint::recursiveCalc() {
child->recursiveCalc();
}
mDoMtx_copy(prevCurrentMtx, J3DSys::mCurrentMtx);
J3DSys::mCurrentS.x = currentX;
J3DSys::mCurrentS.y = currentY;
J3DSys::mCurrentS.z = currentZ;

View File

@ -1,13 +1,7 @@
//
// Generated By: dol2asm
// Translation Unit: J3DJointTree
//
#include "JSystem/J3DGraphAnimator/J3DJointTree.h"
#include "JSystem/J3DGraphAnimator/J3DMaterialAttach.h"
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "dolphin/types.h"
/* 80325A18-80325A9C 320358 0084+00 0/0 1/1 0/0 .text __ct__12J3DJointTreeFv */
J3DJointTree::J3DJointTree()

View File

@ -111,6 +111,29 @@ int J3DMaterialTable::removeMatColorAnimator(J3DAnmColor* pAnmColor) {
/* 8032F6F8-8032F7B4 32A038 00BC+00 0/0 5/5 10/10 .text
* removeTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern */
// regalloc
#ifdef NONMATCHING
int J3DMaterialTable::removeTexNoAnimator(J3DAnmTexPattern* anm) {
int ret = 0;
u16 materialNum = anm->getUpdateMaterialNum();
J3DAnmTexPatternFullTable* anm_table = anm->getAnmTable();
for (u16 i = 0; i < materialNum; i++) {
if (anm->isValidUpdateMaterialID(i)) {
u16 materialID = anm->getUpdateMaterialID(i);
J3DMaterialAnm* pMatAnm = getMaterialNodePointer(materialID)->getMaterialAnm();
u8 texNo = anm_table[i].mTexNo;
if (pMatAnm == NULL)
ret = 1;
else
pMatAnm->setTexNoAnm(texNo, NULL);
}
}
return ret;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@ -119,6 +142,7 @@ asm int J3DMaterialTable::removeTexNoAnimator(J3DAnmTexPattern* param_0) {
#include "asm/JSystem/J3DGraphAnimator/J3DMaterialAttach/removeTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern.s"
}
#pragma pop
#endif
/* 8032F7B4-8032F880 32A0F4 00CC+00 0/0 4/4 26/26 .text
* removeTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */

View File

@ -40,7 +40,7 @@ void JMAEulerToQuat(s16 x, s16 y, s16 z, Quaternion* quat) {
f32 cyz = cosY * cosZ;
f32 syz = sinY * sinZ;
quat->w = cosX * (cyz) + sinX * (syz);
quat->x = sinX * (cyz) - cosX * (syz);
quat->x = sinX * (cyz)-cosX * (syz);
quat->y = cosZ * (cosX * sinY) + sinZ * (sinX * cosY);
quat->z = sinZ * (cosX * cosY) - cosZ * (sinX * sinY);
}
@ -61,8 +61,10 @@ void JMAQuatLerp(register const Quaternion* p, register const Quaternion* q, f32
Quaternion* dst) {
register f32 pxy, pzw, qxy, qzw;
register f32 dp;
__asm // compute dot product
{
#ifdef __MWERKS__ // clang-format off
// compute dot product
asm {
psq_l pxy, 0(p), 0, 0
psq_l qxy, 0(q), 0, 0
ps_mul dp, pxy, qxy
@ -73,14 +75,14 @@ void JMAQuatLerp(register const Quaternion* p, register const Quaternion* q, f32
ps_sum0 dp, dp, dp, dp
}
#endif // clang-format on
if (dp < 0.0) {
dst->x = -t * (p->x + q->x) + p->x;
dst->y = -t * (p->y + q->y) + p->y;
dst->z = -t * (p->z + q->z) + p->z;
dst->w = -t * (p->w + q->w) + p->w;
}
else {
} else {
dst->x = -t * (p->x - q->x) + p->x;
dst->y = -t * (p->y - q->y) + p->y;
dst->z = -t * (p->z - q->z) + p->z;
@ -90,42 +92,78 @@ void JMAQuatLerp(register const Quaternion* p, register const Quaternion* q, f32
/* 80339A30-80339A5C 334370 002C+00 0/0 1/1 0/0 .text JMAFastVECNormalize__FPC3VecP3Vec
*/
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JMAFastVECNormalize(Vec const* param_0, Vec* param_1) {
nofralloc
#include "asm/JSystem/JMath/JMath/JMAFastVECNormalize__FPC3VecP3Vec.s"
void JMAFastVECNormalize(register const Vec* src, register Vec* dst) {
register f32 vxy, rxy, vz, length;
#ifdef __MWERKS__ // clang-format off
asm {
psq_l vxy, 0(src), 0, 0
ps_mul rxy, vxy, vxy
lfs vz, src->z
ps_madd length, vz, vz, rxy
ps_sum0 length, length, rxy, rxy
frsqrte length, length
ps_muls0 vxy, vxy, length;
psq_st vxy, 0(dst), 0, 0
fmuls vz, vz, length
stfs vz, dst->z
}
#endif // clang-format on
}
#pragma pop
/* 80339A5C-80339A84 33439C 0028+00 0/0 1/1 0/0 .text JMAVECScaleAdd__FPC3VecPC3VecP3Vecf
*/
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JMAVECScaleAdd(Vec const* param_0, Vec const* param_1, Vec* param_2, f32 param_3) {
nofralloc
#include "asm/JSystem/JMath/JMath/JMAVECScaleAdd__FPC3VecPC3VecP3Vecf.s"
}
#pragma pop
void JMAVECScaleAdd(register const Vec* vec1, register const Vec* vec2, register Vec* dst,
register f32 scale) {
register f32 v1xy;
register f32 v2xy = scale;
register f32 rxy, v1z, v2z, rz;
#ifdef __MWERKS__ // clang-format off
asm {
psq_l v1xy, 0(vec1), 0, 0
psq_l v2xy, 0(vec2), 0, 0
ps_madds0 rxy, v1xy, scale, v2xy
psq_st rxy, 0(dst), 0, 0
/* ############################################################################################## */
/* 804564D0-804564D8 004AD0 0004+04 1/1 0/0 0/0 .sdata2 @411 */
SECTION_SDATA2 static f32 lit_411[1 + 1 /* padding */] = {
1.0f,
/* padding */
0.0f,
};
psq_l v1z, 8(vec1), 1, 0
psq_l v2z, 8(vec2), 1, 0
ps_madds0 rz, v1z, scale, v2z
psq_st rz, 8(dst), 1, 0
}
#endif // clang-format on
}
/* 80339A84-80339AE4 3343C4 0060+00 0/0 5/5 0/0 .text JMAMTXApplyScale__FPA4_CfPA4_ffff
*/
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JMAMTXApplyScale(f32 const (*param_0)[4], f32 (*param_1)[4], f32 param_2, f32 param_3,
f32 param_4) {
nofralloc
#include "asm/JSystem/JMath/JMath/JMAMTXApplyScale__FPA4_CfPA4_ffff.s"
void JMAMTXApplyScale(register const Mtx src, register Mtx dst, register f32 xScale,
register f32 yScale, register f32 zScale) {
register f32 scale = yScale;
register f32 x, y, z;
register f32 normal = 1.0f;
#ifdef __MWERKS__ // clang-format off
asm {
// scale first 2 components
ps_merge00 scale, xScale, scale
psq_l x, 0(src), 0, 0
psq_l y, 16(src), 0, 0
psq_l z, 32(src), 0, 0
ps_mul x, x, scale
ps_mul y, y, scale
ps_mul z, z, scale
psq_st x, 0(dst), 0, 0
psq_st y, 16(dst), 0, 0
psq_st z, 32(dst), 0, 0
// scale last 2 components
ps_merge00 scale, zScale, normal
psq_l x, 8(src), 0, 0
psq_l y, 24(src), 0, 0
psq_l z, 40(src), 0, 0
ps_mul x, x, scale
ps_mul y, y, scale
ps_mul z, z, scale
psq_st x, 8(dst), 0, 0
psq_st y, 24(dst), 0, 0
psq_st z, 40(dst), 0, 0
}
#endif // clang-format on
}
#pragma pop

View File

@ -1050,6 +1050,7 @@ O_FILES_SYM_ON := \
$(BUILD_DIR)/libs/JSystem/JUtility/JUTResFont.o \
$(BUILD_DIR)/libs/JSystem/JAudio2/JAUAudioArcLoader.o \
$(BUILD_DIR)/libs/JSystem/J2DGraph/J2DAnmLoader.o \
$(BUILD_DIR)/libs/JSystem/J2DGraph/J2DPicture.o \
$(BUILD_DIR)/libs/JSystem/JUtility/JUTProcBar.o \
$(BUILD_DIR)/libs/Z2AudioLib/Z2AudioArcLoader.o \
$(BUILD_DIR)/src/c/c_dylink.o \

View File

@ -249,10 +249,6 @@ SECTION_RODATA static f32 const lit_3948 = -100.0f;
COMPILER_STRIP_GATE(0x808725A4, &lit_3948);
#pragma pop
inline static void GXSetTexCoordGen(GXTexCoordID dst, GXTexGenType type, GXTexGenSrc src, u32 mtx) {
GXSetTexCoordGen2(dst, type, src, mtx, 0, 125);
}
inline static void damirror_GXEnd() {
GXEnd();
}

View File

@ -129,7 +129,7 @@ extern "C" static void daMP_AudioDecodeThreadStart__Fv();
extern "C" static void daMP_AudioDecodeThreadCancel__Fv();
extern "C" static void daMP_THPGXRestore__Fv();
extern "C" static void daMP_THPGXYuv2RgbSetup__FPC16_GXRenderModeObj();
extern "C" static void GXSetTexCoordGen();
extern "C" static void i_GXSetTexCoordGen();
extern "C" static void daMP_THPGXYuv2RgbDraw__FPUcPUcPUcssssss();
extern "C" static void i_GXTexCoord2u16();
extern "C" static void daMP_MixAudio__FPsPsUl();
@ -1315,7 +1315,7 @@ static asm void daMP_THPGXYuv2RgbSetup(_GXRenderModeObj const* param_0) {
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
static asm void GXSetTexCoordGen() {
static asm void i_GXSetTexCoordGen() {
nofralloc
#include "asm/rel/d/a/d_a_movie_player/d_a_movie_player/GXSetTexCoordGen.s"
}

View File

@ -187,10 +187,6 @@ public:
/* 0x3c */ dDlst_shadowPoly_c* mPoly;
};
static inline void GXSetTexCoordGen(GXTexCoordID dst, GXTexGenType type, GXTexGenSrc src, u32 mtx) {
GXSetTexCoordGen2(dst, type, src, mtx, GX_FALSE, GX_PTIDENTITY);
}
//
// Forward References:
//

View File

@ -406,7 +406,7 @@ void J2DPicture::setBlendRatio(f32 param_0, f32 param_1) {
/* 80020338-80020368 01AC78 0030+00 0/0 1/0 0/0 .text append__10J2DPictureFPCcf */
bool J2DPicture::append(char const* param_0, f32 param_1) {
return insert(param_0, mTextureCount, param_1);
return insert(param_0, mTextureNum, param_1);
}
/* 80020368-8002039C 01ACA8 0034+00 0/0 1/0 0/0 .text insert__10J2DPictureFPCcUcf */

View File

@ -929,10 +929,6 @@ SECTION_SDATA2 static f64 lit_4595 = 4503599627370496.0 /* cast u32 to float */;
/* 80456B60-80456B68 000000 0004+04 1/1 0/0 0/0 .sbss2 @4530 */
SECTION_SBSS2 static GXColor lit_4530;
static inline void GXSetTexCoordGen(GXTexCoordID param_1, GXTexGenType param_2, GXTexGenSrc param_3, u32 param_4){
GXSetTexCoordGen2(param_1, param_2, param_3, param_4, GX_FALSE, 0x7d);
}
/* 80009650-8000A160 003F90 0B10+00 1/1 0/0 0/0 .text draw__Q213mDoGph_gInf_c7bloom_cFv
*/
// Matches with literals