diff options
| author | Jasper St. Pierre <jstpierre@mecheye.net> | 2024-04-14 09:05:44 -0700 |
|---|---|---|
| committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2024-04-14 09:05:54 -0700 |
| commit | 4ce4072fef3c296dc2e7fcd18ae949c464c6a71e (patch) | |
| tree | 1d27e9233fe2c8bb2aec3d14df560f778e06c55d /include/JSystem | |
| parent | 5b3b66015a8da8b4c038ccab9bb0786b200eec6f (diff) | |
JPA work
Diffstat (limited to 'include/JSystem')
| -rw-r--r-- | include/JSystem/JGeometry.h | 70 | ||||
| -rw-r--r-- | include/JSystem/JParticle/JPAEmitter.h | 20 |
2 files changed, 29 insertions, 61 deletions
diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index 212334cd..56268aea 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -144,34 +144,13 @@ struct TVec3<f32> : public Vec { return C_VECSquareMag((Vec*)&x); } - f32 normalize_broken() { - f32 sq = squared(); - if (sq <= TUtil<f32>::epsilon()) { - return 0.0f; - } - f32 norm = TUtil<f32>::inv_sqrt(sq); - scale(norm); - return norm; - } - f32 normalize() { f32 sq = squared(); if (sq <= TUtil<f32>::epsilon()) { return 0.0f; } f32 norm = TUtil<f32>::inv_sqrt(sq); - scale(1.0f / norm); - return norm; - } - - f32 normalize(const TVec3<f32>& other) { - f32 sq = other.squared(); - if (sq <= TUtil<f32>::epsilon()) { - zero(); - return 0.0f; - } - f32 norm = TUtil<f32>::inv_sqrt(sq); - scale(1.0f / norm, other); + scale(norm); return norm; } @@ -180,26 +159,16 @@ struct TVec3<f32> : public Vec { return TUtil<f32>::sqrt(sqr); } - void scale(register f32 sc) { + void scale(f32 sc) { x *= sc; y *= sc; z *= sc; } - void scale(register f32 sc, const TVec3<f32>& other) { - register const f32* src = &other.x; - register f32 z; - register f32 x_y; - register f32* dst = &x; - register f32 zres; - asm { - psq_l x_y, 0(src), 0, 0 - psq_l z, 8(src), 1, 0 - ps_muls0 x_y, x_y, sc - psq_st x_y, 0(dst), 0, 0 - ps_muls0 zres, z, sc - psq_st zres, 8(dst), 1, 0 - }; + void scale(f32 sc, const TVec3<f32>& b) { + x = b.x * sc; + y = b.y * sc; + z = b.z * sc; } void negate() { @@ -209,11 +178,15 @@ struct TVec3<f32> : public Vec { } void sub(const TVec3<f32>& b) { - C_VECSubtract((Vec*)&x, (Vec*)&b.x, (Vec*)&x); + x -= b.x; + y -= b.y; + z -= b.z; } void sub(const TVec3<f32>& a, const TVec3<f32>& b) { - C_VECSubtract((Vec*)&a.x, (Vec*)&b.x, (Vec*)&x); + x = a.x - b.x; + y = a.y - b.y; + z = a.z - b.z; } bool isZero() const { @@ -233,23 +206,8 @@ struct TVec3<f32> : public Vec { scale(norm * len); } - f32 dot(const TVec3<f32>& other) const { - register const f32* pThis = &x; - register const f32* pOther = &other.x; - register f32 otherReg; - register f32 thisyz; - register f32 res; - register f32 thisxy; - asm { - psq_l thisyz, 4(pThis), 0, 0 - psq_l otherReg, 4(pOther), 0, 0 - ps_mul thisyz, thisyz, otherReg - psq_l thisxy, 0(pThis), 0, 0 - psq_l otherReg, 0(pOther), 0, 0 - ps_madd res, thisxy, otherReg, thisyz - ps_sum0 res, res, thisyz, thisyz - }; - return res; + f32 dot(const TVec3<f32>& b) const { + return x*b.x + y*b.y * z*b.z; } template<typename S> diff --git a/include/JSystem/JParticle/JPAEmitter.h b/include/JSystem/JParticle/JPAEmitter.h index ddf815f3..77b25b49 100644 --- a/include/JSystem/JParticle/JPAEmitter.h +++ b/include/JSystem/JParticle/JPAEmitter.h @@ -168,6 +168,8 @@ public: bool checkStatus(u32 status) { return mFlags & status; } void initStatus(u32 status) { mFlags = status; } + bool checkEmDataFlag(u32 mask) { return mDataFlag & mask; } + int getParticleNumber() { return mActiveParticles.getNumLinks() + mChildParticles.getNumLinks(); } @@ -226,6 +228,7 @@ public: void setVolumeSweep(f32 i_volSweep) { mVolumeSweep = i_volSweep; } void setVolumeSize(u16 size) { mVolumeSize = size; } void setLifeTime(s16 i_lifeTime) { mLifeTime = i_lifeTime; } + f32 getRate() const { return mRate; } void setRate(f32 i_rate) { mRate = i_rate; } void setRandomDirectionSpeed(f32 i_speed) { mInitialVelRndm = i_speed; } void setDirectionalSpeed(f32 i_speed) { mInitialVelDir = i_speed; } @@ -241,6 +244,7 @@ public: void becomeImmortalEmitter() { setStatus(JPAEmtrStts_Immortal); } void quitImmortalEmitter() { clearStatus(JPAEmtrStts_Immortal); } + void becomeContinuousParticle() { mMaxFrame = 0; } void becomeInvalidEmitter() { mMaxFrame = -1; stopCreateParticle(); @@ -267,11 +271,7 @@ public: void setUserWork(u32 work) { mUserData = work; } // TODO - void becomeContinuousParticle() {} - void calcAfterCB() {} - void calcBeforeCB() {} void calcEmitterGlobalTranslation(JGeometry::TVec3<f32>&) {} - void checkEmDataFlag(u32) {} void drawCB() {} void drawEmitterCallBack() {} void getAxisYVec(JGeometry::TVec3<f32>&) const {} @@ -283,7 +283,6 @@ public: void getFrame() {} void getGlobalParticleScale(JGeometry::TVec3<f32>&) const {} void getParticleList() {} - void getRate() const {} void getgReRDirection(JGeometry::TVec3<f32>&) {} void isChildDraw() {} void isContinuousParticle() {} @@ -308,6 +307,17 @@ public: static f32 getAspect() { return emtrInfo.mAspect; } static f32 getFovy() { return emtrInfo.mFovy; } +private: + void calcAfterCB() { + if (mpEmitterCallBack != NULL) + mpEmitterCallBack->executeAfter(this); + } + void calcBeforeCB() { + if (mpEmitterCallBack != NULL) + mpEmitterCallBack->execute(this); + } + +public: /* 0x000 */ VolumeFunc mVolumeFunc; /* 0x00C */ JGeometry::TVec3<f32> mEmitterScale; /* 0x018 */ JGeometry::TVec3<f32> mEmitterTranslation; |
