mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-09 22:11:35 -04:00
JPA work
This commit is contained in:
+14
-56
@@ -144,7 +144,7 @@ struct TVec3<f32> : public Vec {
|
||||
return C_VECSquareMag((Vec*)&x);
|
||||
}
|
||||
|
||||
f32 normalize_broken() {
|
||||
f32 normalize() {
|
||||
f32 sq = squared();
|
||||
if (sq <= TUtil<f32>::epsilon()) {
|
||||
return 0.0f;
|
||||
@@ -154,52 +154,21 @@ struct TVec3<f32> : public Vec {
|
||||
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);
|
||||
return norm;
|
||||
}
|
||||
|
||||
f32 length() const {
|
||||
f32 sqr = squared();
|
||||
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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user