metaforce/Runtime/Particle/CRealElement.hpp

361 lines
11 KiB
C++
Raw Normal View History

2018-10-06 20:42:33 -07:00
#pragma once
#include <memory>
#include <vector>
#include "Runtime/GCNTypes.hpp"
#include "Runtime/Particle/IElement.hpp"
2016-02-05 00:34:14 -08:00
/* Documentation at: https://wiki.axiodl.com/w/Particle_Script#Real_Elements */
2016-02-27 22:55:05 -08:00
2021-04-10 01:42:06 -07:00
namespace metaforce {
2018-12-07 21:30:43 -08:00
class CREKeyframeEmitter : public CRealElement {
u32 x4_percent;
u32 x8_unk1;
bool xc_loop;
bool xd_unk2;
u32 x10_loopEnd;
u32 x14_loopStart;
std::vector<float> x18_keys;
2016-02-05 23:31:53 -08:00
public:
explicit CREKeyframeEmitter(CInputStream& in);
bool GetValue(int frame, float& valOut) const override;
2016-02-05 23:31:53 -08:00
};
2018-12-07 21:30:43 -08:00
class CRELifetimeTween : public CRealElement {
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CRELifetimeTween(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREConstant : public CRealElement {
float x4_val;
2016-02-05 00:34:14 -08:00
public:
explicit CREConstant(float val) : x4_val(val) {}
bool GetValue(int frame, float& valOut) const override;
bool IsConstant() const override { return true; }
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CRETimeChain : public CRealElement {
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
std::unique_ptr<CIntElement> xc_swFrame;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CRETimeChain(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b, std::unique_ptr<CIntElement>&& c)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_swFrame(std::move(c)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREAdd : public CRealElement {
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CREAdd(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREClamp : public CRealElement {
std::unique_ptr<CRealElement> x4_min;
std::unique_ptr<CRealElement> x8_max;
std::unique_ptr<CRealElement> xc_val;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CREClamp(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b, std::unique_ptr<CRealElement>&& c)
: x4_min(std::move(a)), x8_max(std::move(b)), xc_val(std::move(c)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREInitialRandom : public CRealElement {
std::unique_ptr<CRealElement> x4_min;
std::unique_ptr<CRealElement> x8_max;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CREInitialRandom(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_min(std::move(a)), x8_max(std::move(b)) {}
bool GetValue(int frame, float& valOut) const override;
bool IsConstant() const override { return true; }
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CRERandom : public CRealElement {
std::unique_ptr<CRealElement> x4_min;
std::unique_ptr<CRealElement> x8_max;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CRERandom(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_min(std::move(a)), x8_max(std::move(b)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREDotProduct : public CRealElement {
std::unique_ptr<CVectorElement> x4_a;
std::unique_ptr<CVectorElement> x8_b;
2016-02-11 22:06:17 -08:00
public:
2018-12-07 21:30:43 -08:00
CREDotProduct(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-11 22:06:17 -08:00
};
2018-12-07 21:30:43 -08:00
class CREMultiply : public CRealElement {
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CREMultiply(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREPulse : public CRealElement {
std::unique_ptr<CIntElement> x4_aDuration;
std::unique_ptr<CIntElement> x8_bDuration;
std::unique_ptr<CRealElement> xc_valA;
std::unique_ptr<CRealElement> x10_valB;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CREPulse(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b, std::unique_ptr<CRealElement>&& c,
std::unique_ptr<CRealElement>&& d)
: x4_aDuration(std::move(a)), x8_bDuration(std::move(b)), xc_valA(std::move(c)), x10_valB(std::move(d)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CRETimeScale : public CRealElement {
std::unique_ptr<CRealElement> x4_a;
2016-02-05 00:34:14 -08:00
public:
explicit CRETimeScale(std::unique_ptr<CRealElement>&& a) : x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CRELifetimePercent : public CRealElement {
std::unique_ptr<CRealElement> x4_percentVal;
2016-02-05 00:34:14 -08:00
public:
explicit CRELifetimePercent(std::unique_ptr<CRealElement>&& a) : x4_percentVal(std::move(a)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CRESineWave : public CRealElement {
std::unique_ptr<CRealElement> x4_frequency;
std::unique_ptr<CRealElement> x8_amplitude;
std::unique_ptr<CRealElement> xc_phase;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CRESineWave(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b, std::unique_ptr<CRealElement>&& c)
2022-10-29 08:04:53 -07:00
: x4_frequency(std::move(b)), x8_amplitude(std::move(c)), xc_phase(std::move(a)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREInitialSwitch : public CRealElement {
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CREInitialSwitch(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CRECompareLessThan : public CRealElement {
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
std::unique_ptr<CRealElement> xc_c;
std::unique_ptr<CRealElement> x10_d;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CRECompareLessThan(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_c(std::move(c)), x10_d(std::move(d)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CRECompareEquals : public CRealElement {
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
std::unique_ptr<CRealElement> xc_c;
std::unique_ptr<CRealElement> x10_d;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CRECompareEquals(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_c(std::move(c)), x10_d(std::move(d)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREParticleAccessParam1 : public CRealElement {
2016-02-05 00:34:14 -08:00
public:
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREParticleAccessParam2 : public CRealElement {
2016-02-05 00:34:14 -08:00
public:
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREParticleAccessParam3 : public CRealElement {
2016-02-05 00:34:14 -08:00
public:
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREParticleAccessParam4 : public CRealElement {
2016-02-05 00:34:14 -08:00
public:
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREParticleAccessParam5 : public CRealElement {
2016-02-05 00:34:14 -08:00
public:
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREParticleAccessParam6 : public CRealElement {
2016-02-05 00:34:14 -08:00
public:
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREParticleAccessParam7 : public CRealElement {
2016-02-05 00:34:14 -08:00
public:
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREParticleAccessParam8 : public CRealElement {
2016-02-05 00:34:14 -08:00
public:
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREParticleSizeOrLineLength : public CRealElement {
2016-02-05 00:34:14 -08:00
public:
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREParticleRotationOrLineWidth : public CRealElement {
2016-02-05 00:34:14 -08:00
public:
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CRESubtract : public CRealElement {
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CRESubtract(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREVectorMagnitude : public CRealElement {
std::unique_ptr<CVectorElement> x4_a;
2016-02-05 00:34:14 -08:00
public:
explicit CREVectorMagnitude(std::unique_ptr<CVectorElement>&& a) : x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREVectorXToReal : public CRealElement {
std::unique_ptr<CVectorElement> x4_a;
2016-02-05 00:34:14 -08:00
public:
explicit CREVectorXToReal(std::unique_ptr<CVectorElement>&& a) : x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREVectorYToReal : public CRealElement {
std::unique_ptr<CVectorElement> x4_a;
2016-02-05 00:34:14 -08:00
public:
explicit CREVectorYToReal(std::unique_ptr<CVectorElement>&& a) : x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREVectorZToReal : public CRealElement {
std::unique_ptr<CVectorElement> x4_a;
2016-02-05 00:34:14 -08:00
public:
explicit CREVectorZToReal(std::unique_ptr<CVectorElement>&& a) : x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
class CREExternalVar : public CRealElement {
2018-12-07 21:30:43 -08:00
std::unique_ptr<CIntElement> x4_a;
2016-02-05 00:34:14 -08:00
public:
explicit CREExternalVar(std::unique_ptr<CIntElement>&& a) : x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const override;
2016-02-05 00:34:14 -08:00
};
2018-12-07 21:30:43 -08:00
class CREIntTimesReal : public CRealElement {
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
2016-02-05 00:34:14 -08:00
public:
2018-12-07 21:30:43 -08:00
CREIntTimesReal(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const override;
};
2018-12-07 21:30:43 -08:00
class CREConstantRange : public CRealElement {
std::unique_ptr<CRealElement> x4_val;
std::unique_ptr<CRealElement> x8_min;
std::unique_ptr<CRealElement> xc_max;
std::unique_ptr<CRealElement> x10_inRange;
std::unique_ptr<CRealElement> x14_outOfRange;
2016-02-11 22:06:17 -08:00
public:
2018-12-07 21:30:43 -08:00
CREConstantRange(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d,
std::unique_ptr<CRealElement>&& e)
: x4_val(std::move(a))
, x8_min(std::move(b))
, xc_max(std::move(c))
, x10_inRange(std::move(d))
, x14_outOfRange(std::move(e)) {}
2016-02-11 22:06:17 -08:00
bool GetValue(int frame, float& valOut) const override;
2016-02-11 22:06:17 -08:00
};
2018-12-07 21:30:43 -08:00
class CREGetComponentRed : public CRealElement {
std::unique_ptr<CColorElement> x4_a;
2016-02-11 22:06:17 -08:00
public:
explicit CREGetComponentRed(std::unique_ptr<CColorElement>&& a) : x4_a(std::move(a)) {}
2016-02-11 22:06:17 -08:00
bool GetValue(int frame, float& valOut) const override;
2016-02-11 22:06:17 -08:00
};
2018-12-07 21:30:43 -08:00
class CREGetComponentGreen : public CRealElement {
std::unique_ptr<CColorElement> x4_a;
2016-02-11 22:06:17 -08:00
public:
explicit CREGetComponentGreen(std::unique_ptr<CColorElement>&& a) : x4_a(std::move(a)) {}
2016-02-11 22:06:17 -08:00
bool GetValue(int frame, float& valOut) const override;
2016-02-11 22:06:17 -08:00
};
2018-12-07 21:30:43 -08:00
class CREGetComponentBlue : public CRealElement {
std::unique_ptr<CColorElement> x4_a;
2016-02-11 22:06:17 -08:00
public:
explicit CREGetComponentBlue(std::unique_ptr<CColorElement>&& a) : x4_a(std::move(a)) {}
2016-02-11 22:06:17 -08:00
bool GetValue(int frame, float& valOut) const override;
2016-02-11 22:06:17 -08:00
};
2018-12-07 21:30:43 -08:00
class CREGetComponentAlpha : public CRealElement {
std::unique_ptr<CColorElement> x4_a;
2016-02-11 22:06:17 -08:00
public:
explicit CREGetComponentAlpha(std::unique_ptr<CColorElement>&& a) : x4_a(std::move(a)) {}
2016-02-11 22:06:17 -08:00
bool GetValue(int frame, float& valOut) const override;
2016-02-11 22:06:17 -08:00
};
2021-04-10 01:42:06 -07:00
} // namespace metaforce