mirror of
https://github.com/zeldaret/tp
synced 2026-05-23 15:01:53 -04:00
Work on JPABaseShape (#1884)
This commit is contained in:
@@ -148,7 +148,7 @@ struct TVec3<f32> {
|
||||
return *this;
|
||||
}
|
||||
|
||||
f32 squared() {
|
||||
f32 squared() const {
|
||||
return C_VECSquareMag((Vec*)&x);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ struct TVec3<f32> {
|
||||
scale(norm);
|
||||
}
|
||||
|
||||
f32 length() {
|
||||
f32 length() const {
|
||||
return PSVECMag((Vec*)this);
|
||||
}
|
||||
|
||||
@@ -184,6 +184,55 @@ struct TVec3<f32> {
|
||||
psq_st zres, 8(dst), 1, 0
|
||||
};
|
||||
}
|
||||
|
||||
void negateInternal(TVec3<f32>* dst) {
|
||||
register f32* rdst = &dst->x;
|
||||
const register f32* src = &x;
|
||||
register f32 x_y;
|
||||
register f32 z;
|
||||
asm {
|
||||
psq_l x_y, 0(src), 0, 0
|
||||
ps_neg x_y, x_y
|
||||
psq_st x_y, 0(rdst), 0, 0
|
||||
lfs z, 8(src)
|
||||
fneg z, z
|
||||
stfs z, 8(rdst)
|
||||
};
|
||||
}
|
||||
|
||||
void negate() {
|
||||
negateInternal(this);
|
||||
}
|
||||
|
||||
void sub(const TVec3<f32>& b) {
|
||||
C_VECSubtract((Vec*)&x, (Vec*)&b.x, (Vec*)&x);
|
||||
}
|
||||
|
||||
void sub(const TVec3<f32>& a, const TVec3<f32>& b) {
|
||||
C_VECSubtract((Vec*)&a.x, (Vec*)&b.x, (Vec*)&x);
|
||||
}
|
||||
|
||||
bool isZero() const {
|
||||
return squared() <= 32.0f * FLT_EPSILON;
|
||||
}
|
||||
|
||||
void cross(const TVec3<f32>& a, const TVec3<f32>& b) {
|
||||
PSVECCrossProduct(a, b, *this);
|
||||
}
|
||||
|
||||
void setLength(f32 len) {
|
||||
f32 sq = squared();
|
||||
if (sq <= FLT_EPSILON * 32.0f) {
|
||||
return;
|
||||
}
|
||||
f32 norm;
|
||||
if (sq <= 0.0f) {
|
||||
norm = sq;
|
||||
} else {
|
||||
norm = fsqrt_step(sq);
|
||||
}
|
||||
scale(norm * len);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -97,9 +97,26 @@ public:
|
||||
bool isTexAnm() const { return !!(mpData->mTexFlg & 0x01); }
|
||||
u8 getTexAnmType() const { return (mpData->mTexFlg >> 2) & 0x07; }
|
||||
u32 getTexIdx() const { return mpData->mTexIdx; }
|
||||
u8 getTexIdx(u8 idx) const { return mpTexIdxAnimTbl[idx]; }
|
||||
|
||||
f32 getBaseSizeX() const { return mpData->mBaseSizeX; }
|
||||
f32 getBaseSizeY() const { return mpData->mBaseSizeY; }
|
||||
u8 getClrLoopOfstMask() const { return mpData->mClrAnmRndmMask; }
|
||||
u32 getClrLoopOfst(u32 param_1) const { return getClrLoopOfstMask() & param_1; }
|
||||
u8 getTexLoopOfstMask() const { return mpData->mTexAnmRndmMask; }
|
||||
u32 getTexLoopOfst(u8 param_1) const { return getTexLoopOfstMask() & param_1; }
|
||||
|
||||
f32 getIncTransX() const { return ((f32*)mpTexCrdMtxAnmTbl)[5]; }
|
||||
f32 getInitTransX() const { return ((f32*)mpTexCrdMtxAnmTbl)[0]; }
|
||||
f32 getIncTransY() const { return ((f32*)mpTexCrdMtxAnmTbl)[6]; }
|
||||
f32 getInitTransY() const { return ((f32*)mpTexCrdMtxAnmTbl)[1]; }
|
||||
f32 getIncScaleX() const { return ((f32*)mpTexCrdMtxAnmTbl)[7]; }
|
||||
f32 getInitScaleX() const { return ((f32*)mpTexCrdMtxAnmTbl)[2]; }
|
||||
f32 getIncScaleY() const { return ((f32*)mpTexCrdMtxAnmTbl)[8]; }
|
||||
f32 getInitScaleY() const { return ((f32*)mpTexCrdMtxAnmTbl)[3]; }
|
||||
f32 getIncRot() const { return ((f32*)mpTexCrdMtxAnmTbl)[9]; }
|
||||
f32 getInitRot() const { return ((f32*)mpTexCrdMtxAnmTbl)[4]; }
|
||||
u8 getTexAnmKeyNum() const { return mpData->mTexAnmNum; }
|
||||
|
||||
public:
|
||||
/* 0x00 */ const JPABaseShapeData* mpData;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "JSystem/JParticle/JPADynamicsBlock.h"
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
|
||||
struct JPABaseEmitter;
|
||||
struct JPAResourceManager;
|
||||
struct JPABaseEmitter;
|
||||
struct JPAEmitterManager;
|
||||
@@ -164,6 +163,7 @@ public:
|
||||
void setParticleCallBackPtr(JPAParticleCallBack* cb) { mpPtclCallBack = cb; }
|
||||
JPAParticleCallBack* getParticleCallBackPtr() { return mpPtclCallBack; }
|
||||
JPAEmitterCallBack* getEmitterCallBackPtr() const { return mpEmtrCallBack; }
|
||||
u32 getAge() const { return mTick; }
|
||||
|
||||
public:
|
||||
/* 0x00 */ JGeometry::TVec3<f32> mLocalScl;
|
||||
|
||||
@@ -10,6 +10,9 @@ struct JPANode {
|
||||
mpNext = NULL;
|
||||
}
|
||||
~JPANode() {}
|
||||
JPANode<T>* getPrev() { return mpPrev; }
|
||||
JPANode<T>* getNext() { return mpNext; }
|
||||
T* getObject() { return &mData; }
|
||||
JPANode<T>* mpPrev;
|
||||
JPANode<T>* mpNext;
|
||||
T mData;
|
||||
@@ -23,6 +26,7 @@ struct JPAList {
|
||||
|
||||
JPAList() : mpFirst(NULL), mpLast(NULL), mNum() {}
|
||||
|
||||
JPANode<T>* getEnd() { return NULL; }
|
||||
JPANode<T>* getFirst() const { return mpFirst; }
|
||||
JPANode<T>* getLast() const { return mpLast; }
|
||||
u32 getNum() const { return mNum; }
|
||||
|
||||
@@ -32,22 +32,25 @@ public:
|
||||
void setOffsetPosition(f32 x, f32 y, f32 z) { mOffsetPosition.set(x, y, z); }
|
||||
void getOffsetPosition(JGeometry::TVec3<f32>& pos) { pos.set(mOffsetPosition); }
|
||||
u16 getRotateAngle() const { return mRotateAngle; }
|
||||
void getGlobalPosition(JGeometry::TVec3<f32>& pos) { pos.set(mPosition); }
|
||||
void getGlobalPosition(JGeometry::TVec3<f32>& pos) const { pos.set(mPosition); }
|
||||
f32 getParticleScaleX() const { return mParticleScaleX; }
|
||||
f32 getParticleScaleY() const { return mParticleScaleY; }
|
||||
void setStatus(u32 flag) { mStatus |= flag; }
|
||||
u32 checkStatus(u32 flag) { return mStatus & flag; }
|
||||
void setInvisibleParticleFlag() { setStatus(8); }
|
||||
void setDeleteParticleFlag() { setStatus(2); }
|
||||
void getVelVec(JGeometry::TVec3<f32>& vec) const { vec.set(mVelocity); }
|
||||
void getLocalPosition(JGeometry::TVec3<f32>& vec) const { vec.set(mLocalPosition); }
|
||||
|
||||
public:
|
||||
/* 0x00 */ JGeometry::TVec3<f32> mPosition;
|
||||
/* 0x0C */ Vec mLocalPosition;
|
||||
/* 0x0C */ JGeometry::TVec3<f32> mLocalPosition;
|
||||
/* 0x18 */ JGeometry::TVec3<f32> mOffsetPosition;
|
||||
/* 0x24 */ Vec mVelocity;
|
||||
/* 0x24 */ JGeometry::TVec3<f32> mVelocity;
|
||||
/* 0x30 */ Vec mVelType1;
|
||||
/* 0x3C */ Vec mVelType0;
|
||||
/* 0x48 */ Vec mVelType2;
|
||||
/* 0x54 */ Vec mBaseAxis;
|
||||
/* 0x54 */ JGeometry::TVec3<f32> mBaseAxis;
|
||||
/* 0x60 */ f32 mParticleScaleX;
|
||||
/* 0x64 */ f32 mParticleScaleY;
|
||||
/* 0x68 */ f32 mScaleOut;
|
||||
|
||||
@@ -51,6 +51,24 @@ inline void C_VECAdd(register const Vec* a, register const Vec* b, register Vec*
|
||||
}
|
||||
}
|
||||
|
||||
inline void C_VECSubtract(register const Vec* a, register const Vec* b, register Vec* ab) {
|
||||
register f32 axy;
|
||||
register f32 bxy;
|
||||
register f32 az;
|
||||
register f32 subz;
|
||||
register f32 bz;
|
||||
asm {
|
||||
psq_l axy, 0(a), 0, 0
|
||||
psq_l bxy, 0(b), 0, 0
|
||||
ps_sub bxy, axy, bxy
|
||||
psq_st bxy, 0(ab), 0, 0
|
||||
psq_l az, 8(a), 1, 0
|
||||
psq_l bz, 8(b), 1, 0
|
||||
ps_sub subz, az, bz
|
||||
psq_st subz, 8(ab), 1, 0
|
||||
}
|
||||
}
|
||||
|
||||
inline f32 C_VECSquareMag(const Vec* v) {
|
||||
register f32 x_y;
|
||||
register f32 z;
|
||||
|
||||
Reference in New Issue
Block a user