move jasper's jsystem work over

This commit is contained in:
TakaRikka
2022-10-04 21:17:53 -07:00
parent a3578d0c7c
commit 74c248990c
37 changed files with 153 additions and 1292 deletions
+3 -1
View File
@@ -68,13 +68,15 @@ public:
static J3DMtxCalc* mCurrentMtxCalc;
private:
friend struct J3DJointFactory;
/* 0x00 */ void* mCallBackUserData;
/* 0x04 */ J3DJointCallBack mCallBack;
/* 0x08 */ void* field_0x8;
/* 0x0C */ J3DJoint* mChild;
/* 0x10 */ J3DJoint* mYounger;
/* 0x14 */ u16 mJntNo;
/* 0x16 */ u8 mMtxType;
/* 0x16 */ u8 mKind;
/* 0x17 */ u8 mScaleCompensate;
/* 0x18 */ J3DTransformInfo mTransformInfo;
/* 0x38 */ f32 mBoundingSphereRadius;
+10 -8
View File
@@ -51,29 +51,29 @@ public:
class J3DPacket {
public:
J3DPacket() {
mpNextSibling = NULL;
mpNextPacket = NULL;
mpFirstChild = NULL;
mpUserData = NULL;
}
void addChildPacket(J3DPacket*);
J3DPacket* getNextPacket() const { return mpNextSibling; }
void setNextPacket(J3DPacket* i_packet) { mpNextSibling = i_packet; }
J3DPacket* getNextPacket() const { return mpNextPacket; }
void setNextPacket(J3DPacket* i_packet) { mpNextPacket = i_packet; }
void drawClear() {
mpNextSibling = NULL;
mpNextPacket = NULL;
mpFirstChild = NULL;
}
void setUserArea(u32 area) { mpUserData = (void*)area; }
virtual bool entry(J3DDrawBuffer*);
virtual int entry(J3DDrawBuffer*);
virtual void draw();
virtual ~J3DPacket() {}
public:
/* 0x04 */ J3DPacket* mpNextSibling;
/* 0x04 */ J3DPacket* mpNextPacket;
/* 0x08 */ J3DPacket* mpFirstChild;
/* 0x0C */ void* mpUserData;
}; // Size: 0x10
@@ -145,19 +145,21 @@ public:
void endDiff();
bool isSame(J3DMatPacket*) const;
J3DMaterial* getMaterial() const { return mpMaterial; }
J3DShapePacket* getShapePacket() const { return mpShapePacket; }
void setShapePacket(J3DShapePacket* packet) { mpShapePacket = packet; }
void setInitShapePacket(J3DShapePacket* packet) { mpInitShapePacket = packet; }
bool isChanged() const { return mDiffFlag < 0; }
virtual ~J3DMatPacket();
virtual bool entry(J3DDrawBuffer*);
virtual int entry(J3DDrawBuffer*);
virtual void draw();
public:
/* 0x28 */ J3DShapePacket* mpInitShapePacket;
/* 0x2C */ J3DShapePacket* mpShapePacket;
/* 0x30 */ J3DMaterial* mpMaterial;
/* 0x34 */ u32 mSortFlags;
/* 0x34 */ u32 mDiffFlag;
/* 0x38 */ J3DTexture* mpTexture;
/* 0x3C */ J3DMaterialAnm* mpMaterialAnm;
}; // Size: 0x40
+3
View File
@@ -93,6 +93,9 @@ struct J3DSys {
void setMaterialMode(u32 mode) { mMaterialMode = mode; }
void setTexture(J3DTexture* pTex) { mTexture = pTex; }
J3DTexture* getTexture() { return mTexture; }
void setNBTScale(Vec* scale) { mNBTScale = scale; }
void onFlag(u32 flag) { mFlags |= flag; }
+4 -3
View File
@@ -1,13 +1,14 @@
#ifndef J3DTRANSFORM_H
#define J3DTRANSFORM_H
#include "JSystem/JGeometry.h"
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/types.h"
struct J3DTransformInfo {
/* 0x00 */ Vec mScale;
/* 0x0C */ SVec mRotation;
/* 0x14 */ Vec mTranslate;
/* 0x00 */ JGeometry::TVec3<f32> mScale;
/* 0x0C */ JGeometry::TVec3<s16> mRotation;
/* 0x14 */ JGeometry::TVec3<f32> mTranslate;
}; // Size: 0x20
extern J3DTransformInfo const j3dDefaultTransformInfo;
@@ -1,6 +1,49 @@
#ifndef J3DJOINTFACTORY_H
#define J3DJOINTFACTORY_H
#include "JSystem/J3DGraphBase/J3DTransform.h"
#include "JSystem/JGeometry.h"
#include "dolphin/types.h"
#endif /* J3DJOINTFACTORY_H */
struct J3DJoint;
struct ResNTAB;
struct J3DJointInitData {
/* 0x00 */ u16 mKind;
/* 0x02 */ bool mScaleCompensate;
/* 0x04 */ J3DTransformInfo mTransformInfo;
/* 0x24 */ f32 mRadius;
/* 0x28 */ Vec mMin;
/* 0x2C */ Vec mMax;
}; // Size: 0x30
struct J3DJointBlock {
/* 0x00 */ u8 mMagic[4];
/* 0x04 */ u32 mSize;
/* 0x08 */ u16 mJointNum;
/* 0x0A */ u16 _pad;
/* 0x0C */ J3DJointInitData* mJointInitData;
/* 0x10 */ u16* mIndexTable;
/* 0x14 */ ResNTAB* mNameTable;
};
struct J3DJointFactory {
/* 80337178 */ J3DJointFactory(J3DJointBlock const&);
/* 803371D0 */ J3DJoint* create(int);
J3DJointInitData* mJointInitData;
u16* mIndexTable;
u16 getKind(int no) const { return mJointInitData[mIndexTable[no]].mKind; }
u8 getScaleCompensate(int no) const { return mJointInitData[mIndexTable[no]].mScaleCompensate; }
const J3DTransformInfo& getTransformInfo(int no) const {
return mJointInitData[mIndexTable[no]].mTransformInfo;
}
f32 getRadius(int no) const { return mJointInitData[mIndexTable[no]].mRadius; }
Vec& getMin(int no) const { return mJointInitData[mIndexTable[no]].mMin; }
Vec& getMax(int no) const { return mJointInitData[mIndexTable[no]].mMax; }
};
#endif /* J3DJOINTFACTORY_H */
+26
View File
@@ -19,6 +19,18 @@ struct TVec3 {
}
};
template <>
struct TVec3<s16> {
s16 x, y, z;
TVec3& operator=(const TVec3& b) {
// Force copies to use lwz/lha
*((s32*)this) = *((s32*)&b);
z = b.z;
return *this;
}
};
template <>
struct TVec3<f32> {
f32 x;
@@ -47,6 +59,20 @@ struct TVec3<f32> {
y = a.y * b.y;
z = a.z * b.z;
}
inline TVec3<f32>& operator=(const TVec3<f32>& b) {
register f32* dst = &x;
const register f32* src = &b.x;
register f32 x_y;
register f32 z;
asm {
psq_l x_y, 0(src), 0, 0
psq_st x_y, 0(dst), 0, 0
lfs z, 8(src)
stfs z, 8(dst)
};
return *this;
}
};
template <typename T>