mirror of https://github.com/AxioDL/metaforce.git
More element implementation
This commit is contained in:
parent
3b67666ffb
commit
080c484a96
|
@ -0,0 +1,153 @@
|
|||
#include "CColorElement.hpp"
|
||||
#include "CParticleGlobals.hpp"
|
||||
#include "CRandom16.hpp"
|
||||
#include <math.h>
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
CCEKeyframeEmitter::CCEKeyframeEmitter(CInputStream& in)
|
||||
{
|
||||
x4_percent = in.readUint32Big();
|
||||
x8_unk1 = in.readUint32Big();
|
||||
xc_loop = in.readBool();
|
||||
xd_unk2 = in.readBool();
|
||||
x10_loopEnd = in.readUint32Big();
|
||||
x14_loopStart = in.readUint32Big();
|
||||
|
||||
u32 count = in.readUint32Big();
|
||||
x18_keys.reserve(count);
|
||||
for (u32 i=0 ; i<count ; ++i)
|
||||
x18_keys.push_back(in.readVec4fBig());
|
||||
}
|
||||
|
||||
bool CCEKeyframeEmitter::GetValue(int frame, Zeus::CColor& valOut) const
|
||||
{
|
||||
if (!x4_percent)
|
||||
{
|
||||
int emitterTime = CParticleGlobals::g_emitterTimeInt;
|
||||
int calcKey = emitterTime;
|
||||
if (xc_loop)
|
||||
{
|
||||
if (emitterTime >= x10_loopEnd)
|
||||
{
|
||||
int v1 = emitterTime - x14_loopStart;
|
||||
int v2 = x10_loopEnd - x14_loopStart;
|
||||
calcKey = v1 % v2;
|
||||
calcKey += x14_loopStart;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int v1 = x10_loopEnd - 1;
|
||||
if (v1 < emitterTime)
|
||||
calcKey = v1;
|
||||
}
|
||||
valOut = x18_keys[calcKey];
|
||||
}
|
||||
else
|
||||
{
|
||||
int ltPerc = CParticleGlobals::g_particleLifetimePercentTweenInt;
|
||||
float ltPercRem = CParticleGlobals::g_particleLifetimePercentTweenIntFloatRem;
|
||||
if (ltPerc == 100)
|
||||
valOut = x18_keys[100];
|
||||
else
|
||||
valOut = ltPercRem * x18_keys[ltPerc+1] + (1.0f - ltPercRem) * x18_keys[ltPerc];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CCEConstant::GetValue(int frame, Zeus::CColor& valOut) const
|
||||
{
|
||||
float a, b, c, d;
|
||||
x4_a->GetValue(frame, a);
|
||||
x8_b->GetValue(frame, b);
|
||||
xc_c->GetValue(frame, c);
|
||||
x10_d->GetValue(frame, d);
|
||||
valOut = Zeus::CColor(a, b, c, d);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CCEFastConstant::GetValue(int frame, Zeus::CColor& valOut) const
|
||||
{
|
||||
valOut = x4_val;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CCETimeChain::GetValue(int frame, Zeus::CColor& valOut) const
|
||||
{
|
||||
int v;
|
||||
xc_swFrame->GetValue(frame, v);
|
||||
if (frame >= v)
|
||||
return x8_b->GetValue(frame, valOut);
|
||||
else
|
||||
return x4_a->GetValue(frame, valOut);
|
||||
}
|
||||
|
||||
bool CCEFadeEnd::GetValue(int frame, Zeus::CColor& valOut) const
|
||||
{
|
||||
float c;
|
||||
xc_startFrame->GetValue(frame, c);
|
||||
|
||||
if (frame < c)
|
||||
{
|
||||
x4_a->GetValue(frame, valOut);
|
||||
return false;
|
||||
}
|
||||
|
||||
float d;
|
||||
x10_endFrame->GetValue(frame, d);
|
||||
|
||||
Zeus::CColor colA;
|
||||
Zeus::CColor colB;
|
||||
x4_a->GetValue(frame, colA);
|
||||
x8_b->GetValue(frame, colB);
|
||||
|
||||
float t = (frame - c) / (d - c);
|
||||
valOut = Zeus::CColor::lerp(colA, colB, t);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CCEFade::GetValue(int frame, Zeus::CColor& valOut) const
|
||||
{
|
||||
float c;
|
||||
xc_startFrame->GetValue(frame, c);
|
||||
|
||||
float t = frame / c;
|
||||
if (t > 1.f)
|
||||
{
|
||||
x8_b->GetValue(frame, valOut);
|
||||
return false;
|
||||
}
|
||||
|
||||
Zeus::CColor colA;
|
||||
Zeus::CColor colB;
|
||||
x4_a->GetValue(frame, colA);
|
||||
x8_b->GetValue(frame, colB);
|
||||
|
||||
valOut = Zeus::CColor::lerp(colA, colB, t);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CCEPulse::GetValue(int frame, Zeus::CColor& valOut) const
|
||||
{
|
||||
int a, b;
|
||||
x4_aDuration->GetValue(frame, a);
|
||||
x8_bDuration->GetValue(frame, b);
|
||||
int cv = std::max(1, a + b + 1);
|
||||
|
||||
if (b >= 1)
|
||||
{
|
||||
int cv2 = frame % cv;
|
||||
if (cv2 >= a)
|
||||
x10_bVal->GetValue(frame, valOut);
|
||||
else
|
||||
xc_aVal->GetValue(frame, valOut);
|
||||
}
|
||||
else
|
||||
xc_aVal->GetValue(frame, valOut);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -45,10 +45,10 @@ class CCETimeChain : public CColorElement
|
|||
{
|
||||
std::unique_ptr<CColorElement> x4_a;
|
||||
std::unique_ptr<CColorElement> x8_b;
|
||||
std::unique_ptr<CIntElement> xc_c;
|
||||
std::unique_ptr<CIntElement> xc_swFrame;
|
||||
public:
|
||||
CCETimeChain(CColorElement* a, CColorElement* b, CIntElement* c)
|
||||
: x4_a(a), x8_b(b), xc_c(c) {}
|
||||
: x4_a(a), x8_b(b), xc_swFrame(c) {}
|
||||
bool GetValue(int frame, Zeus::CColor& colorOut) const;
|
||||
};
|
||||
|
||||
|
@ -56,11 +56,11 @@ class CCEFadeEnd : public CColorElement
|
|||
{
|
||||
std::unique_ptr<CColorElement> x4_a;
|
||||
std::unique_ptr<CColorElement> x8_b;
|
||||
std::unique_ptr<CRealElement> xc_c;
|
||||
std::unique_ptr<CRealElement> x10_d;
|
||||
std::unique_ptr<CRealElement> xc_startFrame;
|
||||
std::unique_ptr<CRealElement> x10_endFrame;
|
||||
public:
|
||||
CCEFadeEnd(CColorElement* a, CColorElement* b, CRealElement* c, CRealElement* d)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d) {}
|
||||
: x4_a(a), x8_b(b), xc_startFrame(c), x10_endFrame(d) {}
|
||||
bool GetValue(int frame, Zeus::CColor& colorOut) const;
|
||||
};
|
||||
|
||||
|
@ -68,22 +68,22 @@ class CCEFade : public CColorElement
|
|||
{
|
||||
std::unique_ptr<CColorElement> x4_a;
|
||||
std::unique_ptr<CColorElement> x8_b;
|
||||
std::unique_ptr<CRealElement> xc_c;
|
||||
std::unique_ptr<CRealElement> xc_startFrame;
|
||||
public:
|
||||
CCEFade(CColorElement* a, CColorElement* b, CRealElement* c)
|
||||
: x4_a(a), x8_b(b), xc_c(c) {}
|
||||
: x4_a(a), x8_b(b), xc_startFrame(c) {}
|
||||
bool GetValue(int frame, Zeus::CColor& colorOut) const;
|
||||
};
|
||||
|
||||
class CCEPulse : public CColorElement
|
||||
{
|
||||
std::unique_ptr<CIntElement> x4_a;
|
||||
std::unique_ptr<CIntElement> x8_b;
|
||||
std::unique_ptr<CColorElement> xc_c;
|
||||
std::unique_ptr<CColorElement> x10_d;
|
||||
std::unique_ptr<CIntElement> x4_aDuration;
|
||||
std::unique_ptr<CIntElement> x8_bDuration;
|
||||
std::unique_ptr<CColorElement> xc_aVal;
|
||||
std::unique_ptr<CColorElement> x10_bVal;
|
||||
public:
|
||||
CCEPulse(CIntElement* a, CIntElement* b, CColorElement* c, CColorElement* d)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d) {}
|
||||
: x4_aDuration(a), x8_bDuration(b), xc_aVal(c), x10_bVal(d) {}
|
||||
bool GetValue(int frame, Zeus::CColor& colorOut) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ CIEKeyframeEmitter::CIEKeyframeEmitter(CInputStream& in)
|
|||
u32 count = in.readUint32Big();
|
||||
x18_keys.reserve(count);
|
||||
for (u32 i=0 ; i<count ; ++i)
|
||||
x18_keys.push_back(in.readUint32Big());
|
||||
x18_keys.push_back(in.readInt32Big());
|
||||
}
|
||||
|
||||
bool CIEKeyframeEmitter::GetValue(int frame, int& valOut) const
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
#include "CModVectorElement.hpp"
|
||||
#include "CParticleGlobals.hpp"
|
||||
#include "CRandom16.hpp"
|
||||
#include <math.h>
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
bool CMVEImplosion::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const
|
||||
{
|
||||
Zeus::CVector3f av;
|
||||
x4_implPoint->GetValue(frame, av);
|
||||
|
||||
Zeus::CVector3f dv = av - pPos;
|
||||
float dvm = dv.magnitude();
|
||||
|
||||
float c;
|
||||
xc_maxMag->GetValue(frame, c);
|
||||
if (dvm > c)
|
||||
return false;
|
||||
|
||||
float d;
|
||||
x10_minMag->GetValue(frame, d);
|
||||
if (x14_enableMinMag && dvm < d)
|
||||
return false;
|
||||
|
||||
if (0.f == dvm)
|
||||
return false;
|
||||
|
||||
float b;
|
||||
x8_magScale->GetValue(frame, b);
|
||||
pVel += Zeus::CVector3f(b / dvm) * dv;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMVEExponentialImplosion::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const
|
||||
{
|
||||
Zeus::CVector3f av;
|
||||
x4_implPoint->GetValue(frame, av);
|
||||
|
||||
Zeus::CVector3f dv = av - pPos;
|
||||
float dvm = dv.magnitude();
|
||||
|
||||
float c;
|
||||
xc_maxMag->GetValue(frame, c);
|
||||
if (dvm > c)
|
||||
return false;
|
||||
|
||||
float d;
|
||||
x10_minMag->GetValue(frame, d);
|
||||
if (x14_enableMinMag && dvm < d)
|
||||
return false;
|
||||
|
||||
if (0.f == dvm)
|
||||
return false;
|
||||
|
||||
float b;
|
||||
x8_magScale->GetValue(frame, b);
|
||||
pVel += Zeus::CVector3f(b) * dv;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMVELinearImplosion::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const
|
||||
{
|
||||
Zeus::CVector3f av;
|
||||
x4_implPoint->GetValue(frame, av);
|
||||
|
||||
Zeus::CVector3f dv = av - pPos;
|
||||
float dvm = dv.magnitude();
|
||||
|
||||
float c;
|
||||
xc_maxMag->GetValue(frame, c);
|
||||
if (dvm > c)
|
||||
return false;
|
||||
|
||||
float d;
|
||||
x10_minMag->GetValue(frame, d);
|
||||
if (x14_enableMinMag && dvm < d)
|
||||
return false;
|
||||
|
||||
if (0.f == dvm)
|
||||
return false;
|
||||
|
||||
float b;
|
||||
x8_magScale->GetValue(frame, b);
|
||||
pVel = Zeus::CVector3f(b / dvm) * dv;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMVETimeChain::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const
|
||||
{
|
||||
int v;
|
||||
xc_swFrame->GetValue(frame, v);
|
||||
if (frame >= v)
|
||||
return x8_b->GetValue(frame, pVel, pPos);
|
||||
else
|
||||
return x4_a->GetValue(frame, pVel, pPos);
|
||||
}
|
||||
|
||||
}
|
|
@ -8,39 +8,52 @@ namespace Retro
|
|||
|
||||
class CMVEImplosion : public CModVectorElement
|
||||
{
|
||||
std::unique_ptr<CVectorElement> x4_a;
|
||||
std::unique_ptr<CRealElement> x8_b;
|
||||
std::unique_ptr<CRealElement> xc_c;
|
||||
std::unique_ptr<CRealElement> x10_d;
|
||||
bool x14_e;
|
||||
std::unique_ptr<CVectorElement> x4_implPoint;
|
||||
std::unique_ptr<CRealElement> x8_magScale;
|
||||
std::unique_ptr<CRealElement> xc_maxMag;
|
||||
std::unique_ptr<CRealElement> x10_minMag;
|
||||
bool x14_enableMinMag;
|
||||
public:
|
||||
CMVEImplosion(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d, bool e)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d), x14_e(e) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
: x4_implPoint(a), x8_magScale(b), xc_maxMag(c), x10_minMag(d), x14_enableMinMag(e) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVEExponentialImplosion : public CModVectorElement
|
||||
{
|
||||
std::unique_ptr<CVectorElement> x4_a;
|
||||
std::unique_ptr<CRealElement> x8_b;
|
||||
std::unique_ptr<CRealElement> xc_c;
|
||||
std::unique_ptr<CRealElement> x10_d;
|
||||
bool x14_e;
|
||||
std::unique_ptr<CVectorElement> x4_implPoint;
|
||||
std::unique_ptr<CRealElement> x8_magScale;
|
||||
std::unique_ptr<CRealElement> xc_maxMag;
|
||||
std::unique_ptr<CRealElement> x10_minMag;
|
||||
bool x14_enableMinMag;
|
||||
public:
|
||||
CMVEExponentialImplosion(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d, bool e)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d), x14_e(e) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
: x4_implPoint(a), x8_magScale(b), xc_maxMag(c), x10_minMag(d), x14_enableMinMag(e) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVELinearImplosion : public CModVectorElement
|
||||
{
|
||||
std::unique_ptr<CVectorElement> x4_implPoint;
|
||||
std::unique_ptr<CRealElement> x8_magScale;
|
||||
std::unique_ptr<CRealElement> xc_maxMag;
|
||||
std::unique_ptr<CRealElement> x10_minMag;
|
||||
bool x14_enableMinMag;
|
||||
public:
|
||||
CMVELinearImplosion(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d, bool e)
|
||||
: x4_implPoint(a), x8_magScale(b), xc_maxMag(c), x10_minMag(d), x14_enableMinMag(e) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVETimeChain : public CModVectorElement
|
||||
{
|
||||
std::unique_ptr<CModVectorElement> x4_a;
|
||||
std::unique_ptr<CModVectorElement> x8_b;
|
||||
std::unique_ptr<CIntElement> xc_c;
|
||||
std::unique_ptr<CIntElement> xc_swFrame;
|
||||
public:
|
||||
CMVETimeChain(CModVectorElement* a, CModVectorElement* b, CIntElement* c)
|
||||
: x4_a(a), x8_b(b), xc_c(c) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
: x4_a(a), x8_b(b), xc_swFrame(c) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVEBounce : public CModVectorElement
|
||||
|
@ -53,7 +66,7 @@ class CMVEBounce : public CModVectorElement
|
|||
public:
|
||||
CMVEBounce(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, bool e)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d), x14_e(e) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVEConstant : public CModVectorElement
|
||||
|
@ -64,7 +77,7 @@ class CMVEConstant : public CModVectorElement
|
|||
public:
|
||||
CMVEConstant(CRealElement* a, CRealElement* b, CRealElement* c)
|
||||
: x4_a(a), x8_b(b), xc_c(c) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVEFastConstant : public CModVectorElement
|
||||
|
@ -73,7 +86,7 @@ class CMVEFastConstant : public CModVectorElement
|
|||
public:
|
||||
CMVEFastConstant(float a, float b, float c)
|
||||
: x4_val(a, b, c) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVEGravity : public CModVectorElement
|
||||
|
@ -82,7 +95,7 @@ class CMVEGravity : public CModVectorElement
|
|||
public:
|
||||
CMVEGravity(CVectorElement* a)
|
||||
: x4_a(a) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVEExplode : public CModVectorElement
|
||||
|
@ -92,7 +105,7 @@ class CMVEExplode : public CModVectorElement
|
|||
public:
|
||||
CMVEExplode(CRealElement* a, CRealElement* b)
|
||||
: x4_a(a), x8_b(b) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVESetPosition : public CModVectorElement
|
||||
|
@ -101,20 +114,7 @@ class CMVESetPosition : public CModVectorElement
|
|||
public:
|
||||
CMVESetPosition(CVectorElement* a)
|
||||
: x4_a(a) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
};
|
||||
|
||||
class CMVELinearImplosion : public CModVectorElement
|
||||
{
|
||||
std::unique_ptr<CVectorElement> x4_a;
|
||||
std::unique_ptr<CRealElement> x8_b;
|
||||
std::unique_ptr<CRealElement> xc_c;
|
||||
std::unique_ptr<CRealElement> x10_d;
|
||||
bool x14_e;
|
||||
public:
|
||||
CMVELinearImplosion(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d, bool e)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d), x14_e(e) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVEPulse : public CModVectorElement
|
||||
|
@ -126,7 +126,7 @@ class CMVEPulse : public CModVectorElement
|
|||
public:
|
||||
CMVEPulse(CIntElement* a, CIntElement* b, CModVectorElement* c, CModVectorElement* d)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVEWind : public CModVectorElement
|
||||
|
@ -136,7 +136,7 @@ class CMVEWind : public CModVectorElement
|
|||
public:
|
||||
CMVEWind(CVectorElement* a, CRealElement* b)
|
||||
: x4_a(a), x8_b(b) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
class CMVESwirl : public CModVectorElement
|
||||
|
@ -148,7 +148,7 @@ class CMVESwirl : public CModVectorElement
|
|||
public:
|
||||
CMVESwirl(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d) {}
|
||||
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const;
|
||||
bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ CVEKeyframeEmitter::CVEKeyframeEmitter(CInputStream& in)
|
|||
u32 count = in.readUint32Big();
|
||||
x18_keys.reserve(count);
|
||||
for (u32 i=0 ; i<count ; ++i)
|
||||
x18_keys.push_back(in.readFloatBig());
|
||||
x18_keys.push_back(in.readVec3fBig());
|
||||
}
|
||||
|
||||
bool CVEKeyframeEmitter::GetValue(int frame, Zeus::CVector3f& valOut) const
|
||||
|
@ -62,12 +62,12 @@ CVECone::CVECone(CVectorElement* a, CRealElement* b)
|
|||
{
|
||||
Zeus::CVector3f av;
|
||||
x4_direction->GetValue(0, av);
|
||||
Zeus::CVector3f avNorm = av.normalized();
|
||||
if (avNorm[0] > 0.8)
|
||||
xc_xVec = avNorm.cross(Zeus::CVector3f(0.f, 1.f, 0.f));
|
||||
av.normalize();
|
||||
if (av[0] > 0.8)
|
||||
xc_xVec = av.cross(Zeus::CVector3f(0.f, 1.f, 0.f));
|
||||
else
|
||||
xc_xVec = avNorm.cross(Zeus::CVector3f(1.f, 0.f, 0.f));
|
||||
x18_yVec = avNorm.cross(xc_xVec);
|
||||
xc_xVec = av.cross(Zeus::CVector3f(1.f, 0.f, 0.f));
|
||||
x18_yVec = av.cross(xc_xVec);
|
||||
}
|
||||
|
||||
bool CVECone::GetValue(int frame, Zeus::CVector3f& valOut) const
|
||||
|
@ -132,9 +132,94 @@ bool CVEAdd::GetValue(int frame, Zeus::CVector3f& valOut) const
|
|||
return false;
|
||||
}
|
||||
|
||||
CVECircleCluster::CVECircleCluster(CVectorElement* a, CVectorElement* b, CIntElement* c, CRealElement* d)
|
||||
: x4_a(a), x24_magnitude(d)
|
||||
{
|
||||
int cv;
|
||||
c->GetValue(0, cv);
|
||||
x20_deltaAngle = 360.f / float(cv) * M_PI / 180.f;
|
||||
|
||||
Zeus::CVector3f bv;
|
||||
b->GetValue(0, bv);
|
||||
bv.normalize();
|
||||
if (bv[0] > 0.8)
|
||||
x8_xVec = bv.cross(Zeus::CVector3f(0.f, 1.f, 0.f));
|
||||
else
|
||||
x8_xVec = bv.cross(Zeus::CVector3f(1.f, 0.f, 0.f));
|
||||
x14_yVec = bv.cross(x8_xVec);
|
||||
|
||||
delete b;
|
||||
delete c;
|
||||
}
|
||||
|
||||
bool CVECircleCluster::GetValue(int frame, Zeus::CVector3f& valOut) const
|
||||
{
|
||||
Zeus::CVector3f av;
|
||||
x4_a->GetValue(frame, av);
|
||||
|
||||
float curAngle = frame * x20_deltaAngle;
|
||||
Zeus::CVector3f x = x8_xVec * cosf(curAngle);
|
||||
Zeus::CVector3f y = x14_yVec * sinf(curAngle);
|
||||
Zeus::CVector3f tv = x + y + av;
|
||||
|
||||
float dv;
|
||||
x24_magnitude->GetValue(frame, dv);
|
||||
|
||||
Zeus::CVector3f magVec(dv * tv.magnitude());
|
||||
Zeus::CVector3f rv = magVec * Zeus::CVector3f(CRandom16::GetRandomNumber()->Float(),
|
||||
CRandom16::GetRandomNumber()->Float(),
|
||||
CRandom16::GetRandomNumber()->Float());
|
||||
|
||||
valOut = tv + rv;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CVEConstant::GetValue(int frame, Zeus::CVector3f& valOut) const
|
||||
{
|
||||
float a, b, c;
|
||||
x4_a->GetValue(frame, a);
|
||||
x8_b->GetValue(frame, b);
|
||||
xc_c->GetValue(frame, c);
|
||||
valOut = Zeus::CVector3f(a, b, c);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CVEFastConstant::GetValue(int frame, Zeus::CVector3f& valOut) const
|
||||
{
|
||||
valOut = x4_val;
|
||||
return false;
|
||||
}
|
||||
|
||||
CVECircle::CVECircle(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, CRealElement* e)
|
||||
: x4_direction(a), x20_angleConstant(c), x24_angleLinear(d), x28_magnitude(e)
|
||||
{
|
||||
Zeus::CVector3f bv;
|
||||
b->GetValue(0, bv);
|
||||
bv.normalize();
|
||||
if (bv[0] > 0.8)
|
||||
x8_xVec = bv.cross(Zeus::CVector3f(0.f, 1.f, 0.f));
|
||||
else
|
||||
x8_xVec = bv.cross(Zeus::CVector3f(1.f, 0.f, 0.f));
|
||||
x14_yVec = bv.cross(x8_xVec);
|
||||
delete b;
|
||||
}
|
||||
|
||||
bool CVECircle::GetValue(int frame, Zeus::CVector3f& valOut) const
|
||||
{
|
||||
float c, d, e;
|
||||
x20_angleConstant->GetValue(frame, c);
|
||||
x24_angleLinear->GetValue(frame, d);
|
||||
x28_magnitude->GetValue(frame, e);
|
||||
|
||||
float curAngle = (d * frame + c) * M_PI / 180.f;
|
||||
|
||||
Zeus::CVector3f av;
|
||||
x4_direction->GetValue(frame, av);
|
||||
|
||||
Zeus::CVector3f x = x8_xVec * e * cosf(curAngle);
|
||||
Zeus::CVector3f y = x14_yVec * e * sinf(curAngle);
|
||||
|
||||
valOut = x + y + av;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,12 +68,12 @@ public:
|
|||
class CVECircleCluster : public CVectorElement
|
||||
{
|
||||
std::unique_ptr<CVectorElement> x4_a;
|
||||
std::unique_ptr<CVectorElement> x8_b;
|
||||
std::unique_ptr<CIntElement> xc_c;
|
||||
std::unique_ptr<CRealElement> x10_d;
|
||||
Zeus::CVector3f x8_xVec;
|
||||
Zeus::CVector3f x14_yVec;
|
||||
float x20_deltaAngle;
|
||||
std::unique_ptr<CRealElement> x24_magnitude;
|
||||
public:
|
||||
CVECircleCluster(CVectorElement* a, CVectorElement* b, CIntElement* c, CRealElement* d)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d) {}
|
||||
CVECircleCluster(CVectorElement* a, CVectorElement* b, CIntElement* c, CRealElement* d);
|
||||
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
|
||||
};
|
||||
|
||||
|
@ -99,14 +99,14 @@ public:
|
|||
|
||||
class CVECircle : public CVectorElement
|
||||
{
|
||||
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<CRealElement> x14_e;
|
||||
std::unique_ptr<CVectorElement> x4_direction;
|
||||
Zeus::CVector3f x8_xVec;
|
||||
Zeus::CVector3f x14_yVec;
|
||||
std::unique_ptr<CRealElement> x20_angleConstant;
|
||||
std::unique_ptr<CRealElement> x24_angleLinear;
|
||||
std::unique_ptr<CRealElement> x28_magnitude;
|
||||
public:
|
||||
CVECircle(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, CRealElement* e)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d), x14_e(e) {}
|
||||
CVECircle(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, CRealElement* e);
|
||||
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
class CModVectorElement : public IElement
|
||||
{
|
||||
public:
|
||||
virtual bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
|
||||
virtual bool GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const=0;
|
||||
};
|
||||
|
||||
class CColorElement : public IElement
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8ab78bf19dcaa322700eb03a201942c43d38ac91
|
||||
Subproject commit 56dfa0a19591b46e4735c77e6a28fdbff5aa84ed
|
Loading…
Reference in New Issue