mirror of https://github.com/AxioDL/metaforce.git
Parameter renaming and minor bug fixes
This commit is contained in:
parent
02d605cbb9
commit
c1af78e7ed
|
@ -114,7 +114,7 @@ bool CCEFadeEnd::GetValue(int frame, Zeus::CColor& valOut) const
|
|||
bool CCEFade::GetValue(int frame, Zeus::CColor& valOut) const
|
||||
{
|
||||
float c;
|
||||
xc_startFrame->GetValue(frame, c);
|
||||
xc_endFrame->GetValue(frame, c);
|
||||
|
||||
float t = frame / c;
|
||||
if (t > 1.f)
|
||||
|
|
|
@ -70,10 +70,10 @@ class CCEFade : public CColorElement
|
|||
{
|
||||
std::unique_ptr<CColorElement> x4_a;
|
||||
std::unique_ptr<CColorElement> x8_b;
|
||||
std::unique_ptr<CRealElement> xc_startFrame;
|
||||
std::unique_ptr<CRealElement> xc_endFrame;
|
||||
public:
|
||||
CCEFade(CColorElement* a, CColorElement* b, CRealElement* c)
|
||||
: x4_a(a), x8_b(b), xc_startFrame(c) {}
|
||||
: x4_a(a), x8_b(b), xc_endFrame(c) {}
|
||||
bool GetValue(int frame, Zeus::CColor& colorOut) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ bool CEESimpleEmitter::GetValue(int frame, Zeus::CVector3f& pPos, Zeus::CVector3
|
|||
bool CVESphere::GetValue(int frame, Zeus::CVector3f& pPos, Zeus::CVector3f& pVel) const
|
||||
{
|
||||
Zeus::CVector3f a;
|
||||
x4_a->GetValue(frame, a);
|
||||
x4_sphereOrigin->GetValue(frame, a);
|
||||
float b;
|
||||
x8_b->GetValue(frame, b);
|
||||
x8_sphereRadius->GetValue(frame, b);
|
||||
CRandom16* rand = CRandom16::GetRandomNumber();
|
||||
int rand1 = rand->Range(-100, 100);
|
||||
int rand2 = rand->Range(-100, 100);
|
||||
|
@ -42,7 +42,7 @@ bool CVESphere::GetValue(int frame, Zeus::CVector3f& pPos, Zeus::CVector3f& pVel
|
|||
normVec2.normalize();
|
||||
|
||||
float c;
|
||||
xc_c->GetValue(frame, c);
|
||||
xc_velocityMag->GetValue(frame, c);
|
||||
pVel = c * normVec2;
|
||||
|
||||
return false;
|
||||
|
@ -51,17 +51,17 @@ bool CVESphere::GetValue(int frame, Zeus::CVector3f& pPos, Zeus::CVector3f& pVel
|
|||
bool CVEAngleSphere::GetValue(int frame, Zeus::CVector3f& pPos, Zeus::CVector3f& pVel) const
|
||||
{
|
||||
Zeus::CVector3f a;
|
||||
x4_a->GetValue(frame, a);
|
||||
x4_sphereOrigin->GetValue(frame, a);
|
||||
|
||||
float b, d, e, f, g;
|
||||
x8_b->GetValue(frame, b);
|
||||
x10_d->GetValue(frame, d);
|
||||
x14_e->GetValue(frame, e);
|
||||
x18_f->GetValue(frame, f);
|
||||
x1c_g->GetValue(frame, g);
|
||||
x8_sphereRadius->GetValue(frame, b);
|
||||
x10_angleXBias->GetValue(frame, d);
|
||||
x14_angleYBias->GetValue(frame, e);
|
||||
x18_angleXRange->GetValue(frame, f);
|
||||
x1c_angleYRange->GetValue(frame, g);
|
||||
CRandom16* rand = CRandom16::GetRandomNumber();
|
||||
d = (d + ((0.5f * (f * rand->Float())) - f)) * M_PI / 180.f;
|
||||
e = (e + ((0.5f * (f * rand->Float())) - f)) * M_PI / 180.f;
|
||||
e = (e + ((0.5f * (g * rand->Float())) - g)) * M_PI / 180.f;
|
||||
|
||||
float cosD = Zeus::Math::fastCosR(d);
|
||||
pPos.x = a.x + (b * (-Zeus::Math::fastSinR(e) * cosD));
|
||||
|
@ -70,7 +70,7 @@ bool CVEAngleSphere::GetValue(int frame, Zeus::CVector3f& pPos, Zeus::CVector3f&
|
|||
Zeus::CVector3f normVec = (pPos - a).normalized();
|
||||
|
||||
float c;
|
||||
xc_c->GetValue(frame, c);
|
||||
xc_velocityMag->GetValue(frame, c);
|
||||
pVel = c * normVec;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -20,28 +20,28 @@ public:
|
|||
|
||||
class CVESphere : public CEmitterElement
|
||||
{
|
||||
std::unique_ptr<CVectorElement> x4_a;
|
||||
std::unique_ptr<CRealElement> x8_b;
|
||||
std::unique_ptr<CRealElement> xc_c;
|
||||
std::unique_ptr<CVectorElement> x4_sphereOrigin;
|
||||
std::unique_ptr<CRealElement> x8_sphereRadius;
|
||||
std::unique_ptr<CRealElement> xc_velocityMag;
|
||||
public:
|
||||
CVESphere(CVectorElement* a, CRealElement* b, CRealElement* c)
|
||||
: x4_a(a), x8_b(b), xc_c(c) {}
|
||||
: x4_sphereOrigin(a), x8_sphereRadius(b), xc_velocityMag(c) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& pPos, Zeus::CVector3f& pVel) const;
|
||||
};
|
||||
|
||||
class CVEAngleSphere : public CEmitterElement
|
||||
{
|
||||
std::unique_ptr<CVectorElement> x4_a;
|
||||
std::unique_ptr<CRealElement> x8_b;
|
||||
std::unique_ptr<CRealElement> xc_c;
|
||||
std::unique_ptr<CRealElement> x10_d;
|
||||
std::unique_ptr<CRealElement> x14_e;
|
||||
std::unique_ptr<CRealElement> x18_f;
|
||||
std::unique_ptr<CRealElement> x1c_g;
|
||||
std::unique_ptr<CVectorElement> x4_sphereOrigin;
|
||||
std::unique_ptr<CRealElement> x8_sphereRadius;
|
||||
std::unique_ptr<CRealElement> xc_velocityMag;
|
||||
std::unique_ptr<CRealElement> x10_angleXBias;
|
||||
std::unique_ptr<CRealElement> x14_angleYBias;
|
||||
std::unique_ptr<CRealElement> x18_angleXRange;
|
||||
std::unique_ptr<CRealElement> x1c_angleYRange;
|
||||
public:
|
||||
CVEAngleSphere(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d,
|
||||
CRealElement* e, CRealElement* f, CRealElement* g)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d), x14_e(e), x18_f(f), x1c_g(g) {}
|
||||
: x4_sphereOrigin(a), x8_sphereRadius(b), xc_velocityMag(c), x10_angleXBias(d), x14_angleYBias(e), x18_angleXRange(f), x1c_angleYRange(g) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& pPos, Zeus::CVector3f& pVel) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -186,26 +186,20 @@ bool CMVEGravity::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& /*
|
|||
bool CMVEExplode::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& /*pPos*/) const
|
||||
{
|
||||
if (frame == 0)
|
||||
{
|
||||
float b;
|
||||
x8_b->GetValue(frame, b);
|
||||
pVel *= b;
|
||||
}
|
||||
else
|
||||
{
|
||||
CRandom16* rand = CRandom16::GetRandomNumber();
|
||||
Zeus::CVector3f vec;
|
||||
do
|
||||
{
|
||||
vec = {rand->Float() - 0.5f, rand->Float() - 0.5f, rand->Float() - 0.5f};
|
||||
}
|
||||
while (vec.magSquared() > 1.0);
|
||||
|
||||
Zeus::CVector3f vec = {rand->Float() - 0.5f, rand->Float() - 0.5f, rand->Float() - 0.5f};
|
||||
vec.normalize();
|
||||
float a;
|
||||
x4_a->GetValue(frame, a);
|
||||
pVel = vec * a;
|
||||
}
|
||||
else
|
||||
{
|
||||
float b;
|
||||
x8_b->GetValue(frame, b);
|
||||
pVel *= b;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -239,27 +233,32 @@ bool CMVEPulse::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos
|
|||
|
||||
bool CMVEWind::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& /*pPos*/) const
|
||||
{
|
||||
Zeus::CVector3f direction;
|
||||
x4_direction->GetValue(frame, direction);
|
||||
float speed;
|
||||
x8_speed->GetValue(frame, speed);
|
||||
pVel += (direction - pVel) * speed;
|
||||
Zeus::CVector3f wVel;
|
||||
x4_velocity->GetValue(frame, wVel);
|
||||
float factor;
|
||||
x8_factor->GetValue(frame, factor);
|
||||
pVel += (wVel - pVel) * factor;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMVESwirl::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const
|
||||
{
|
||||
Zeus::CVector3f a, b;
|
||||
x4_a->GetValue(frame, a);
|
||||
x8_b->GetValue(frame, b);
|
||||
x4_helixPoint->GetValue(frame, a);
|
||||
x8_curveBinormal->GetValue(frame, b);
|
||||
|
||||
/* Compute Frenet–Serret normal
|
||||
* https://en.wikipedia.org/wiki/Frenet–Serret_formulas */
|
||||
const Zeus::CVector3f diff = a - pPos;
|
||||
float x = (diff.x - (((diff.z * ((diff.x * (diff.y * b.y)) + b.x)) + b.z) * b.x));
|
||||
float y = (diff.y - (((diff.z * ((diff.x * (diff.y * b.y)) + b.x)) + b.z) * b.y));
|
||||
float z = (diff.z - (((diff.z * ((diff.x * (diff.y * b.y)) + b.x)) + b.z) * b.z));
|
||||
float c = 0.0f, d = 0.0f;
|
||||
xc_c->GetValue(frame, c);
|
||||
x10_d->GetValue(frame, d);
|
||||
xc_targetRadius->GetValue(frame, c);
|
||||
x10_tangentialVelocity->GetValue(frame, d);
|
||||
|
||||
/* Integrate tangential velocity by crossing particle normal with binormal,
|
||||
* also "homing" towards the target radius */
|
||||
const float f9 = (b.z * ((b.x * (b.y * pVel.y)) + pVel.x)) + pVel.x;
|
||||
pVel.x = (c * ((f9 * b.x) + (d * ((b.y * (y * b.z)) - z)))) + ((1.0 - c) * pVel.x);
|
||||
pVel.y = (c * ((f9 * b.y) + (d * ((b.z * x) - (z * b.x))))) + ((1.0 - c) * pVel.y);
|
||||
|
|
|
@ -135,23 +135,23 @@ public:
|
|||
|
||||
class CMVEWind : public CModVectorElement
|
||||
{
|
||||
std::unique_ptr<CVectorElement> x4_direction;
|
||||
std::unique_ptr<CRealElement> x8_speed;
|
||||
std::unique_ptr<CVectorElement> x4_velocity;
|
||||
std::unique_ptr<CRealElement> x8_factor;
|
||||
public:
|
||||
CMVEWind(CVectorElement* a, CRealElement* b)
|
||||
: x4_direction(a), x8_speed(b) {}
|
||||
: x4_velocity(a), x8_factor(b) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVESwirl : public CModVectorElement
|
||||
{
|
||||
std::unique_ptr<CVectorElement> x4_a;
|
||||
std::unique_ptr<CVectorElement> x8_b;
|
||||
std::unique_ptr<CRealElement> xc_c;
|
||||
std::unique_ptr<CRealElement> x10_d;
|
||||
std::unique_ptr<CVectorElement> x4_helixPoint;
|
||||
std::unique_ptr<CVectorElement> x8_curveBinormal;
|
||||
std::unique_ptr<CRealElement> xc_targetRadius;
|
||||
std::unique_ptr<CRealElement> x10_tangentialVelocity;
|
||||
public:
|
||||
CMVESwirl(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d) {}
|
||||
: x4_helixPoint(a), x8_curveBinormal(b), xc_targetRadius(c), x10_tangentialVelocity(d) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace pshag
|
|||
|
||||
CUVEAnimTexture::CUVEAnimTexture(TToken<CTexture>&& tex, CIntElement* a, CIntElement* b,
|
||||
CIntElement* c, CIntElement* d, CIntElement* e, bool f)
|
||||
: x4_tex(std::move(tex)), x24_loop(f), x28_cycleFrameRate(e)
|
||||
: x4_tex(std::move(tex)), x24_loop(f), x28_cycleFrames(e)
|
||||
{
|
||||
a->GetValue(0, x10_tileW);
|
||||
delete a;
|
||||
|
@ -42,7 +42,7 @@ CUVEAnimTexture::CUVEAnimTexture(TToken<CTexture>&& tex, CIntElement* a, CIntEle
|
|||
void CUVEAnimTexture::GetValueUV(int frame, SUVElementSet& valOut) const
|
||||
{
|
||||
int cv;
|
||||
x28_cycleFrameRate->GetValue(frame, cv);
|
||||
x28_cycleFrames->GetValue(frame, cv);
|
||||
float cvf = cv / float(x20_tiles);
|
||||
cvf = frame / cvf;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ struct CUVEAnimTexture : public CUVElement
|
|||
int x10_tileW, x14_tileH, x18_strideW, x1c_strideH;
|
||||
int x20_tiles;
|
||||
bool x24_loop;
|
||||
std::unique_ptr<CIntElement> x28_cycleFrameRate;
|
||||
std::unique_ptr<CIntElement> x28_cycleFrames;
|
||||
std::vector<SUVElementSet> x2c_uvElems;
|
||||
public:
|
||||
CUVEAnimTexture(TToken<CTexture>&& tex, CIntElement* a, CIntElement* b,
|
||||
|
|
Loading…
Reference in New Issue