Skip to content

Commit

Permalink
J3D work (#2212)
Browse files Browse the repository at this point in the history
  • Loading branch information
randomsalience authored Oct 15, 2024
1 parent 9895999 commit 9f58034
Show file tree
Hide file tree
Showing 26 changed files with 1,503 additions and 1,648 deletions.
8 changes: 4 additions & 4 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,10 +988,10 @@ def JSystemLib(lib_name, objects, progress_category="third_party"):
[
Object(Matching, "JSystem/J3DGraphAnimator/J3DShapeTable.cpp"),
Object(Matching, "JSystem/J3DGraphAnimator/J3DJointTree.cpp"),
Object(NonMatching, "JSystem/J3DGraphAnimator/J3DModelData.cpp"),
Object(Equivalent, "JSystem/J3DGraphAnimator/J3DModelData.cpp"),
Object(NonMatching, "JSystem/J3DGraphAnimator/J3DMtxBuffer.cpp"),
Object(NonMatching, "JSystem/J3DGraphAnimator/J3DModel.cpp"),
Object(NonMatching, "JSystem/J3DGraphAnimator/J3DAnimation.cpp"),
Object(Matching, "JSystem/J3DGraphAnimator/J3DModel.cpp"),
Object(Equivalent, "JSystem/J3DGraphAnimator/J3DAnimation.cpp"),
Object(Matching, "JSystem/J3DGraphAnimator/J3DMaterialAnm.cpp"),
Object(NonMatching, "JSystem/J3DGraphAnimator/J3DSkinDeform.cpp"),
Object(NonMatching, "JSystem/J3DGraphAnimator/J3DCluster.cpp"),
Expand All @@ -1005,7 +1005,7 @@ def JSystemLib(lib_name, objects, progress_category="third_party"):
Object(NonMatching, "JSystem/J3DGraphLoader/J3DMaterialFactory.cpp"),
Object(NonMatching, "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.cpp"),
Object(NonMatching, "JSystem/J3DGraphLoader/J3DClusterLoader.cpp"),
Object(NonMatching, "JSystem/J3DGraphLoader/J3DModelLoader.cpp"),
Object(Equivalent, "JSystem/J3DGraphLoader/J3DModelLoader.cpp"),
Object(NonMatching, "JSystem/J3DGraphLoader/J3DModelLoaderCalcSize.cpp"),
Object(NonMatching, "JSystem/J3DGraphLoader/J3DJointFactory.cpp"),
Object(NonMatching, "JSystem/J3DGraphLoader/J3DShapeFactory.cpp"),
Expand Down
32 changes: 1 addition & 31 deletions include/JSystem/J2DGraph/J2DAnimation.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef J2DANIMATION_H
#define J2DANIMATION_H

#include "JSystem/JMath/JMath.h"
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"

typedef struct _GXColor GXColor;
Expand Down Expand Up @@ -468,37 +469,6 @@ class J2DAnmColorFull : public J2DAnmColor {
template <typename T>
inline f32 J2DHermiteInterpolation(f32, T*, T*, T*, T*, T*, T*);

inline f32 JMAHermiteInterpolation(register f32 p1, register f32 p2, register f32 p3,
register f32 p4, register f32 p5, register f32 p6,
register f32 p7) {
register f32 ff25;
register f32 ff31;
register f32 ff30;
register f32 ff29;
register f32 ff28;
register f32 ff27;
register f32 ff26;
// clang-format off
asm {
fsubs ff31, p1, p2
fsubs ff30, p5, p2
fdivs ff29, ff31, ff30
fmuls ff28,ff29,ff29
fadds ff25,ff29,ff29
fsubs ff27,ff28,ff29
fsubs ff30, p3, p6
fmsubs ff26,ff25,ff27,ff28
fmadds ff25,p4,ff27,p4
fmadds ff26,ff26,ff30,p3
fmadds ff25,p7,ff27,ff25
fmsubs ff25,ff29,p4,ff25
fnmsubs ff25,ff31,ff25,ff26

}
// clang-format on
return ff25;
}

template <>
inline f32 J2DHermiteInterpolation<f32>(f32 f1, f32* f2, f32* f3, f32* f4, f32* f5, f32* f6,
f32* f7) {
Expand Down
104 changes: 52 additions & 52 deletions include/JSystem/J3DGraphAnimator/J3DAnimation.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ class J3DAnmBase {
mFrame = 0.0f;
}

virtual ~J3DAnmBase();
virtual ~J3DAnmBase() {}
virtual s32 getKind() const = 0;

u8 getAttribute() const { return mAttribute; }
Expand All @@ -486,7 +486,7 @@ class J3DAnmTransform : public J3DAnmBase {
public:
/* 80328E40 */ J3DAnmTransform(s16, f32*, s16*, f32*);

/* 8003B93C */ virtual ~J3DAnmTransform();
/* 8003B93C */ virtual ~J3DAnmTransform() {}
/* 8003C77C */ virtual s32 getKind() const;
virtual void getTransform(u16, J3DTransformInfo*) const = 0;

Expand Down Expand Up @@ -528,8 +528,8 @@ class J3DAnmTransformFull : public J3DAnmTransform {
public:
J3DAnmTransformFull() : J3DAnmTransform(0, NULL, NULL, NULL) { mAnmTable = NULL; }

/* 8032C2AC */ virtual ~J3DAnmTransformFull();
/* 8032C318 */ virtual s32 getKind() const;
/* 8032C2AC */ virtual ~J3DAnmTransformFull() {}
/* 8032C318 */ virtual s32 getKind() const { return 9; }
/* 80328E90 */ virtual void getTransform(u16, J3DTransformInfo*) const;

/* 0x20 */ J3DAnmTransformFullTable* mAnmTable;
Expand All @@ -541,8 +541,8 @@ class J3DAnmTransformFull : public J3DAnmTransform {
*/
class J3DAnmTransformFullWithLerp : public J3DAnmTransformFull {
public:
/* 8032C228 */ virtual ~J3DAnmTransformFullWithLerp();
/* 8032C2A4 */ virtual s32 getKind() const;
/* 8032C228 */ virtual ~J3DAnmTransformFullWithLerp() {}
/* 8032C2A4 */ virtual s32 getKind() const { return 16; }
/* 803291F0 */ virtual void getTransform(u16, J3DTransformInfo*) const;
}; // Size: 0x24

Expand All @@ -561,8 +561,8 @@ class J3DAnmTextureSRTKey : public J3DAnmBase {
/* 8032B0C0 */ void searchUpdateMaterialID(J3DMaterialTable*);
/* 8032B1D4 */ void searchUpdateMaterialID(J3DModelData*);

/* 8032C198 */ virtual ~J3DAnmTextureSRTKey();
/* 8032C220 */ virtual s32 getKind() const;
/* 8032C198 */ virtual ~J3DAnmTextureSRTKey() {}
/* 8032C220 */ virtual s32 getKind() const { return 4; }

void getTransform(u16 param_0, J3DTextureSRTInfo* pSRTInfo) const {
calcTransform(getFrame(), param_0, pSRTInfo);
Expand Down Expand Up @@ -615,8 +615,8 @@ class J3DAnmTexPattern : public J3DAnmBase {
/* 8032B004 */ void searchUpdateMaterialID(J3DMaterialTable*);
/* 8032B09C */ void searchUpdateMaterialID(J3DModelData*);

/* 8032BD20 */ virtual ~J3DAnmTexPattern();
/* 8032BD94 */ virtual s32 getKind() const;
/* 8032BD20 */ virtual ~J3DAnmTexPattern() {}
/* 8032BD94 */ virtual s32 getKind() const { return 2; }

u16 getUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx]; }
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
Expand All @@ -643,8 +643,8 @@ class J3DAnmTevRegKey : public J3DAnmBase {
/* 8032B780 */ void searchUpdateMaterialID(J3DMaterialTable*);
/* 8032B87C */ void searchUpdateMaterialID(J3DModelData*);

/* 8032BD9C */ virtual ~J3DAnmTevRegKey();
/* 8032BE24 */ virtual s32 getKind() const;
/* 8032BD9C */ virtual ~J3DAnmTevRegKey() {}
/* 8032BE24 */ virtual s32 getKind() const { return 5; }

u16 getCRegUpdateMaterialNum() const { return mCRegUpdateMaterialNum; }
u16 getKRegUpdateMaterialNum() const { return mKRegUpdateMaterialNum; }
Expand Down Expand Up @@ -693,9 +693,9 @@ class J3DAnmColor : public J3DAnmBase {
/* 8032A828 */ J3DAnmColor();
/* 8032A8A4 */ void searchUpdateMaterialID(J3DMaterialTable*);

/* 8032BCAC */ virtual ~J3DAnmColor();
/* 8032BF44 */ virtual s32 getKind() const;
/* 8032BF4C */ virtual void getColor(u16, _GXColor*) const;
/* 8032BCAC */ virtual ~J3DAnmColor() {}
/* 8032BF44 */ virtual s32 getKind() const { return 1; }
/* 8032BF4C */ virtual void getColor(u16, GXColor*) const {}

u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
bool isValidUpdateMaterialID(u16 id) const { return mUpdateMaterialID[id] != 0xFFFF; }
Expand All @@ -718,15 +718,15 @@ class J3DAnmColorKey : public J3DAnmColor {
public:
/* 8032AB00 */ J3DAnmColorKey();

/* 8032BE2C */ virtual ~J3DAnmColorKey();
/* 8032BEB0 */ virtual s32 getKind() const;
/* 8032AB54 */ virtual void getColor(u16, _GXColor*) const;
/* 8032BE2C */ virtual ~J3DAnmColorKey() {}
/* 8032BEB0 */ virtual s32 getKind() const { return 11; }
/* 8032AB54 */ virtual void getColor(u16, GXColor*) const;

/* 0x2C */ s16* field_0x2c;
/* 0x30 */ s16* field_0x30;
/* 0x34 */ s16* field_0x34;
/* 0x38 */ s16* field_0x38;
/* 0x3C */ J3DAnmColorKeyTable* field_0x3c;
/* 0x2C */ s16* mColorR;
/* 0x30 */ s16* mColorG;
/* 0x34 */ s16* mColorB;
/* 0x38 */ s16* mColorA;
/* 0x3C */ J3DAnmColorKeyTable* mAnmTable;
};

/**
Expand All @@ -737,9 +737,9 @@ class J3DAnmColorFull : public J3DAnmColor {
public:
/* 8032AB00 */ J3DAnmColorFull();

/* 8032BE2C */ virtual ~J3DAnmColorFull();
/* 8032BEB0 */ virtual s32 getKind() const;
/* 8032AB54 */ virtual void getColor(u16, _GXColor*) const;
/* 8032BE2C */ virtual ~J3DAnmColorFull() {}
/* 8032BEB0 */ virtual s32 getKind() const { return 10; }
/* 8032AB54 */ virtual void getColor(u16, GXColor*) const;

/* 0x2C */ u8* mColorR;
/* 0x30 */ u8* mColorG;
Expand All @@ -756,9 +756,9 @@ class J3DAnmVtxColor : public J3DAnmBase {
public:
J3DAnmVtxColor();

virtual ~J3DAnmVtxColor();
virtual s32 getKind() const;
virtual void getColor(u8, u16, _GXColor*) const;
virtual ~J3DAnmVtxColor() {}
virtual s32 getKind() const { return 7; }
virtual void getColor(u8, u16, GXColor*) const {}

/* 0x0C */ u16 mAnmTableNum[2];
/* 0x10 */ J3DAnmVtxColorIndexData* mAnmVtxColorIndexData[2];
Expand All @@ -772,15 +772,15 @@ class J3DAnmVtxColorKey : public J3DAnmVtxColor {
public:
/* 8032A4E0 */ J3DAnmVtxColorKey();

/* 8032BF50 */ virtual ~J3DAnmVtxColorKey();
/* 8032BFBC */ virtual s32 getKind() const;
/* 8032A53C */ virtual void getColor(u8, u16, _GXColor*) const;
/* 8032BF50 */ virtual ~J3DAnmVtxColorKey() {}
/* 8032BFBC */ virtual s32 getKind() const { return 15; }
/* 8032A53C */ virtual void getColor(u8, u16, GXColor*) const;

/* 0x1C */ J3DAnmColorKeyTable* mpTable[2];
/* 0x24 */ s16* mColorR;
/* 0x28 */ s16* mColorG;
/* 0x2C */ s16* mColorB;
/* 0x30 */ s16* mColorA;
/* 0x18 */ J3DAnmColorKeyTable* mpTable[2];
/* 0x20 */ s16* mColorR;
/* 0x24 */ s16* mColorG;
/* 0x28 */ s16* mColorB;
/* 0x2C */ s16* mColorA;
};

/**
Expand All @@ -791,15 +791,15 @@ class J3DAnmVtxColorFull : public J3DAnmVtxColor {
public:
/* 8032A30C */ J3DAnmVtxColorFull();

/* 8032BFC4 */ virtual ~J3DAnmVtxColorFull();
/* 8032C030 */ virtual s32 getKind() const;
/* 8032A368 */ virtual void getColor(u8, u16, _GXColor*) const;
/* 8032BFC4 */ virtual ~J3DAnmVtxColorFull() {}
/* 8032C030 */ virtual s32 getKind() const { return 14; }
/* 8032A368 */ virtual void getColor(u8, u16, GXColor*) const;

/* 0x1C */ J3DAnmColorFullTable* mpTable[2];
/* 0x24 */ u8* mColorR;
/* 0x28 */ u8* mColorG;
/* 0x2C */ u8* mColorB;
/* 0x30 */ u8* mColorA;
/* 0x18 */ J3DAnmColorFullTable* mpTable[2];
/* 0x20 */ u8* mColorR;
/* 0x24 */ u8* mColorG;
/* 0x28 */ u8* mColorB;
/* 0x2C */ u8* mColorA;
};

/**
Expand All @@ -810,9 +810,9 @@ class J3DAnmCluster : public J3DAnmBase {
public:
J3DAnmCluster(s16 param_1, f32* param_2) : J3DAnmBase(param_1) { mWeight = param_2; }

/* 8032BCAC */ virtual ~J3DAnmCluster();
/* 8032BF44 */ virtual s32 getKind() const;
/* 8032BF4C */ virtual f32 getWeight(u16) const;
/* 8032BCAC */ virtual ~J3DAnmCluster() {}
/* 8032BF44 */ virtual s32 getKind() const { return 3; }
/* 8032BF4C */ virtual f32 getWeight(u16) const { return 1.0f; }

/* 0x0C */ f32* mWeight;
}; // Size: 0x10
Expand All @@ -825,8 +825,8 @@ class J3DAnmClusterFull : public J3DAnmCluster {
public:
J3DAnmClusterFull() : J3DAnmCluster(0, 0) { mAnmTable = NULL; }

/* 8032BCAC */ virtual ~J3DAnmClusterFull();
/* 8032BF44 */ virtual s32 getKind() const;
/* 8032BCAC */ virtual ~J3DAnmClusterFull() {}
/* 8032BF44 */ virtual s32 getKind() const { return 12; }
/* 8032BF4C */ virtual f32 getWeight(u16) const;

/* 0x10 */ J3DAnmClusterFullTable* mAnmTable;
Expand All @@ -840,8 +840,8 @@ class J3DAnmClusterKey : public J3DAnmCluster {
public:
J3DAnmClusterKey() : J3DAnmCluster(0, NULL) { mAnmTable = NULL; }

/* 8032C044 */ virtual ~J3DAnmClusterKey();
/* 8032C0B0 */ virtual s32 getKind() const;
/* 8032C044 */ virtual ~J3DAnmClusterKey() {}
/* 8032C0B0 */ virtual s32 getKind() const { return 13; }
/* 8032A218 */ virtual f32 getWeight(u16) const;

/* 0x10 */ J3DAnmClusterKeyTable* mAnmTable;
Expand Down
60 changes: 36 additions & 24 deletions include/JSystem/J3DGraphAnimator/J3DJoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define J3DJOINT_H

#include "JSystem/J3DGraphBase/J3DTransform.h"
#include "JSystem/J3DGraphBase/J3DSys.h"

class J3DAnmTransform;
class J3DJoint;
Expand All @@ -16,7 +17,7 @@ class J3DMtxCalc {
public:
/* 80325D1C */ static void setMtxBuffer(J3DMtxBuffer*);

/* 8000D948 */ virtual ~J3DMtxCalc();
/* 8000D948 */ virtual ~J3DMtxCalc() {}
/* 80014E90 */ virtual void setAnmTransform(J3DAnmTransform*);
/* 80014E9C */ virtual J3DAnmTransform* getAnmTransform();
/* 80014E8C */ virtual void setAnmTransform(u8, J3DAnmTransform*);
Expand All @@ -34,29 +35,6 @@ class J3DMtxCalc {
static J3DJoint* mJoint;
}; // Size: 0x4

/**
* @ingroup jsystem-j3d
*
*/
class J3DMtxCalcNoAnmBase : public J3DMtxCalc {
public:
/* 8000FA8C */ virtual ~J3DMtxCalcNoAnmBase();
};

/**
* @ingroup jsystem-j3d
*
*/
template <class A, class B>
class J3DMtxCalcNoAnm : public J3DMtxCalcNoAnmBase {
public:
J3DMtxCalcNoAnm() {}
virtual ~J3DMtxCalcNoAnm() {}
virtual void init(const Vec& param_0, const Mtx& param_1);
virtual void calc();
};

class J3DJoint;
typedef int (*J3DJointCallBack)(J3DJoint*, int);

/**
Expand Down Expand Up @@ -85,6 +63,7 @@ class J3DJoint {
J3DMtxCalc* getMtxCalc() { return mMtxCalc; }
J3DMtxCalc* getCurrentMtxCalc() { return mCurrentMtxCalc; };
J3DJoint* getChild() { return mChild; }
u8 getMtxType() { return (mKind & 0xf0) >> 4; }
void setMtxType(u8 type) { mKind = (mKind & ~0xf0) | (type << 4); }

static J3DMtxCalc* mCurrentMtxCalc;
Expand All @@ -109,6 +88,39 @@ class J3DJoint {
/* 0x58 */ J3DMaterial* mMesh;
}; // Size: 0x5C

/**
* @ingroup jsystem-j3d
*
*/
class J3DMtxCalcNoAnmBase : public J3DMtxCalc {
public:
/* 8000FA8C */ virtual ~J3DMtxCalcNoAnmBase() {}
};

/**
* @ingroup jsystem-j3d
*
*/
template <class A, class B>
class J3DMtxCalcNoAnm : public J3DMtxCalcNoAnmBase {
public:
J3DMtxCalcNoAnm() {}
virtual ~J3DMtxCalcNoAnm() {}
virtual void init(const Vec& param_0, const Mtx& param_1) { B::init(param_0, param_1); }
virtual void calc() { A::calcTransform(mJoint->getTransformInfo()); }
};

/**
* @ingroup jsystem-j3d
*
*/
struct J3DMtxCalcJ3DSysInitSoftimage {
/* 8032ECAC */ static void init(const Vec& param_0, const Mtx& param_1) {
J3DSys::mCurrentS = param_0;
MTXCopy(param_1, J3DSys::mCurrentMtx);
}
};

/**
* @ingroup jsystem-j3d
*
Expand Down
Loading

0 comments on commit 9f58034

Please sign in to comment.