metaforce/DataSpec/DNACommon/ParticleCommon.hpp

1554 lines
42 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-02-02 04:29:58 +00:00
#include <memory>
#include <vector>
#include "DataSpec/DNACommon/DNACommon.hpp"
#include <logvisor/logvisor.hpp>
2016-02-02 04:29:58 +00:00
2018-12-08 05:30:43 +00:00
namespace DataSpec::DNAParticle {
2016-03-04 23:04:53 +00:00
extern logvisor::Module LogModule;
2016-02-02 04:29:58 +00:00
enum class ParticleType {
GPSM = SBIG('GPSM'),
SWSH = SBIG('SWSH'),
ELSM = SBIG('ELSM'),
DPSM = SBIG('DPSM'),
CRSM = SBIG('CRSM'),
WPSM = SBIG('WPSM')
};
/*
* The particle property (PP) metaclass system provides common compile-time utilities
* for storing, enumerating, and streaming particle scripts.
*/
template <class _Basis>
struct PPImpl : BigDNA, _Basis {
AT_DECL_EXPLICIT_DNA_YAML
2021-06-07 19:29:18 +00:00
template <typename T>
static constexpr bool _shouldStore(T& p, bool defaultBool) {
if constexpr (std::is_same_v<T, bool>) {
return p != defaultBool;
} else if constexpr (std::is_same_v<T, uint32_t>) {
return p != 0xffffffff;
} else if constexpr (std::is_same_v<T, float>) {
return true;
} else {
return p.operator bool();
}
}
constexpr void _read(athena::io::IStreamReader& r) {
constexpr FourCC RefType = uint32_t(_Basis::Type);
DNAFourCC clsId(r);
if (clsId != RefType) {
2020-04-11 22:51:39 +00:00
LogModule.report(logvisor::Warning, FMT_STRING("non {} provided to {} parser"), RefType, RefType);
return;
}
clsId.read(r);
while (clsId != SBIG('_END')) {
if (!_Basis::Lookup(clsId, [&](auto& p) {
2021-06-07 19:29:18 +00:00
using Tp = std::decay_t<decltype(p)>;
if constexpr (std::is_same_v<Tp, bool>) {
DNAFourCC tp(r);
if (tp == SBIG('CNST'))
p = r.readBool();
} else if constexpr (std::is_same_v<Tp, uint32_t>) {
DNAFourCC tp(r);
if (tp == SBIG('CNST'))
p = r.readUint32Big();
} else if constexpr (std::is_same_v<Tp, float>) {
DNAFourCC tp(r);
if (tp == SBIG('CNST'))
p = r.readFloatBig();
} else {
p.read(r);
}
})) {
2020-04-11 22:51:39 +00:00
LogModule.report(logvisor::Fatal, FMT_STRING("Unknown {} class {} @{}"), RefType, clsId, r.position());
}
clsId.read(r);
}
}
constexpr void _write(athena::io::IStreamWriter& w) {
constexpr DNAFourCC RefType = uint32_t(_Basis::Type);
RefType.write(w);
_Basis::Enumerate([&](FourCC fcc, auto& p, bool defaultBool = false) {
if (_shouldStore(p, defaultBool)) {
using Tp = std::decay_t<decltype(p)>;
DNAFourCC(fcc).write(w);
if constexpr (std::is_same_v<Tp, bool>) {
w.writeBytes("CNST", 4);
w.writeBool(p);
} else if constexpr (std::is_same_v<Tp, uint32_t>) {
w.writeBytes("CNST", 4);
w.writeUint32Big(p);
} else if constexpr (std::is_same_v<Tp, float>) {
w.writeBytes("CNST", 4);
w.writeFloatBig(p);
} else {
p.write(w);
}
}
});
w.writeBytes("_END", 4);
}
constexpr void _binarySize(std::size_t& s) {
constexpr DNAFourCC RefType = uint32_t(_Basis::Type);
RefType.binarySize(s);
_Basis::Enumerate([&](FourCC fcc, auto& p, bool defaultBool = false) {
if (_shouldStore(p, defaultBool)) {
using Tp = std::decay_t<decltype(p)>;
DNAFourCC(fcc).binarySize(s);
if constexpr (std::is_same_v<Tp, bool>) {
s += 5;
} else if constexpr (std::is_same_v<Tp, uint32_t> || std::is_same_v<Tp, float>) {
s += 8;
} else {
p.binarySize(s);
}
}
});
s += 4;
}
void _read(athena::io::YAMLDocReader& r) {
constexpr DNAFourCC RefType = uint32_t(_Basis::Type);
for (const auto& [key, value] : r.getCurNode()->m_mapChildren) {
if (key == "DNAType"sv)
continue;
if (key.size() < 4) {
2020-04-11 22:51:39 +00:00
LogModule.report(logvisor::Warning, FMT_STRING("short FourCC in element '{}'"), key);
continue;
}
if (auto rec = r.enterSubRecord(key)) {
const DNAFourCC clsId = key.c_str();
if (!_Basis::Lookup(clsId, [&](auto& p) {
2021-06-07 19:29:18 +00:00
using Tp = std::decay_t<decltype(p)>;
if constexpr (std::is_same_v<Tp, bool>) {
p = r.readBool();
} else if constexpr (std::is_same_v<Tp, uint32_t>) {
p = r.readUint32();
} else if constexpr (std::is_same_v<Tp, float>) {
p = r.readFloat();
} else {
p.read(r);
}
})) {
2020-04-11 22:51:39 +00:00
LogModule.report(logvisor::Fatal, FMT_STRING("Unknown {} class {}"), RefType, clsId);
}
}
}
}
constexpr void _write(athena::io::YAMLDocWriter& w) {
_Basis::Enumerate([&](FourCC fcc, auto& p, bool defaultBool = false) {
if (_shouldStore(p, defaultBool)) {
using Tp = std::decay_t<decltype(p)>;
if (auto rec = w.enterSubRecord(fcc.toStringView())) {
if constexpr (std::is_same_v<Tp, bool>) {
w.writeBool(p);
} else if constexpr (std::is_same_v<Tp, uint32_t>) {
w.writeUint32(p);
} else if constexpr (std::is_same_v<Tp, float>) {
w.writeFloat(p);
} else {
p.write(w);
}
}
}
});
}
constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& deps) {
_Basis::Enumerate([&](FourCC fcc, auto& p, bool defaultBool = false) {
using Tp = std::decay_t<decltype(p)>;
if constexpr (!std::is_same_v<Tp, bool> && !std::is_same_v<Tp, uint32_t> && !std::is_same_v<Tp, float>)
p.gatherDependencies(deps);
});
}
constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& deps) const {
const_cast<PPImpl&>(*this).gatherDependencies(deps);
}
};
template <typename _Type>
struct PEType {
using Type = _Type;
};
template <class _Basis>
struct PEImpl : BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
using _PtrType = typename _Basis::PtrType;
void _read(athena::io::IStreamReader& r) {
DNAFourCC clsId(r);
if (clsId == FOURCC('NONE')) {
m_elem.reset();
return;
}
if (!_Basis::Lookup(clsId, [&](auto&& p) {
2021-06-07 19:29:18 +00:00
using Tp = std::decay_t<decltype(p)>;
m_elem = std::make_unique<typename Tp::Type>();
m_elem->read(r);
})) {
2020-04-11 22:51:39 +00:00
LogModule.report(logvisor::Fatal, FMT_STRING("Unknown {} class {} @{}"), _PtrType::TypeName, clsId, r.position());
}
}
void _write(athena::io::IStreamWriter& w) {
if (m_elem) {
w.writeBytes(m_elem->ClassID().data(), 4);
m_elem->write(w);
} else {
w.writeBytes("NONE", 4);
}
}
void _binarySize(std::size_t& s) {
if (m_elem)
m_elem->binarySize(s);
s += 4;
}
void _read(athena::io::YAMLDocReader& r) {
const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty()) {
m_elem.reset();
return;
}
const auto& [key, value] = mapChildren[0];
if (key.size() < 4)
2020-04-11 22:51:39 +00:00
LogModule.report(logvisor::Fatal, FMT_STRING("short FourCC in element '{}'"), key);
if (auto rec = r.enterSubRecord(key)) {
const DNAFourCC clsId = key.c_str();
if (!_Basis::Lookup(clsId, [&](auto&& p) {
2021-06-07 19:29:18 +00:00
using Tp = std::decay_t<decltype(p)>;
m_elem = std::make_unique<typename Tp::Type>();
m_elem->read(r);
})) {
2020-04-11 22:51:39 +00:00
LogModule.report(logvisor::Fatal, FMT_STRING("Unknown {} class {}"), _PtrType::TypeName, clsId);
}
}
}
void _write(athena::io::YAMLDocWriter& w) {
if (m_elem)
if (auto rec = w.enterSubRecord(m_elem->ClassID()))
m_elem->write(w);
}
2021-06-07 19:29:18 +00:00
void gatherDependencies(std::vector<hecl::ProjectPath>& deps) const { _Basis::gatherDependencies(deps, m_elem); }
explicit operator bool() const { return m_elem.operator bool(); }
auto* get() const { return m_elem.get(); }
auto* operator->() const { return get(); }
void reset() { m_elem.reset(); }
2021-06-07 19:29:18 +00:00
private:
std::unique_ptr<_PtrType> m_elem;
};
2018-12-08 05:30:43 +00:00
struct IElement : BigDNAVYaml {
Delete _d;
~IElement() override = default;
2019-10-01 07:38:03 +00:00
virtual std::string_view ClassID() const = 0;
std::string_view DNATypeV() const override { return ClassID(); }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct IRealElement : IElement {
Delete _d2;
static constexpr std::string_view TypeName = "RealElement"sv;
};
struct RELifetimeTween;
struct REConstant;
struct RETimeChain;
struct REAdd;
struct REClamp;
struct REKeyframeEmitter;
struct REKeyframeEmitter;
struct REInitialRandom;
struct RERandom;
struct REMultiply;
struct REPulse;
struct RETimeScale;
struct RELifetimePercent;
struct RESineWave;
struct REInitialSwitch;
struct RECompareLessThan;
struct RECompareEquals;
struct REParticleAdvanceParam1;
struct REParticleAdvanceParam2;
struct REParticleAdvanceParam3;
struct REParticleAdvanceParam4;
struct REParticleAdvanceParam5;
struct REParticleAdvanceParam6;
struct REParticleAdvanceParam7;
struct REParticleAdvanceParam8;
struct REParticleSizeOrLineLength;
struct REParticleRotationOrLineWidth;
struct RESubtract;
struct REVectorMagnitude;
struct REVectorXToReal;
struct REVectorYToReal;
struct REVectorZToReal;
struct RECEXT;
struct REIntTimesReal;
struct _RealElementFactory {
using PtrType = IRealElement;
2021-06-07 19:29:18 +00:00
template <typename _Func>
static bool constexpr Lookup(FourCC fcc, _Func f) {
switch (fcc.toUint32()) {
2021-06-07 19:29:18 +00:00
case SBIG('LFTW'):
f(PEType<RELifetimeTween>{});
return true;
case SBIG('CNST'):
f(PEType<REConstant>{});
return true;
case SBIG('CHAN'):
f(PEType<RETimeChain>{});
return true;
case SBIG('ADD_'):
f(PEType<REAdd>{});
return true;
case SBIG('CLMP'):
f(PEType<REClamp>{});
return true;
case SBIG('KEYE'):
f(PEType<REKeyframeEmitter>{});
return true;
case SBIG('KEYP'):
f(PEType<REKeyframeEmitter>{});
return true;
case SBIG('IRND'):
f(PEType<REInitialRandom>{});
return true;
case SBIG('RAND'):
f(PEType<RERandom>{});
return true;
case SBIG('MULT'):
f(PEType<REMultiply>{});
return true;
case SBIG('PULS'):
f(PEType<REPulse>{});
return true;
case SBIG('SCAL'):
f(PEType<RETimeScale>{});
return true;
case SBIG('RLPT'):
f(PEType<RELifetimePercent>{});
return true;
case SBIG('SINE'):
f(PEType<RESineWave>{});
return true;
case SBIG('ISWT'):
f(PEType<REInitialSwitch>{});
return true;
case SBIG('CLTN'):
f(PEType<RECompareLessThan>{});
return true;
case SBIG('CEQL'):
f(PEType<RECompareEquals>{});
return true;
case SBIG('PAP1'):
f(PEType<REParticleAdvanceParam1>{});
return true;
case SBIG('PAP2'):
f(PEType<REParticleAdvanceParam2>{});
return true;
case SBIG('PAP3'):
f(PEType<REParticleAdvanceParam3>{});
return true;
case SBIG('PAP4'):
f(PEType<REParticleAdvanceParam4>{});
return true;
case SBIG('PAP5'):
f(PEType<REParticleAdvanceParam5>{});
return true;
case SBIG('PAP6'):
f(PEType<REParticleAdvanceParam6>{});
return true;
case SBIG('PAP7'):
f(PEType<REParticleAdvanceParam7>{});
return true;
case SBIG('PAP8'):
f(PEType<REParticleAdvanceParam8>{});
return true;
case SBIG('PSLL'):
f(PEType<REParticleSizeOrLineLength>{});
return true;
case SBIG('PRLW'):
f(PEType<REParticleRotationOrLineWidth>{});
return true;
case SBIG('SUB_'):
f(PEType<RESubtract>{});
return true;
case SBIG('VMAG'):
f(PEType<REVectorMagnitude>{});
return true;
case SBIG('VXTR'):
f(PEType<REVectorXToReal>{});
return true;
case SBIG('VYTR'):
f(PEType<REVectorYToReal>{});
return true;
case SBIG('VZTR'):
f(PEType<REVectorZToReal>{});
return true;
case SBIG('CEXT'):
f(PEType<RECEXT>{});
return true;
case SBIG('ITRL'):
f(PEType<REIntTimesReal>{});
return true;
default:
return false;
}
}
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IRealElement>& elemPtr) {}
2018-12-08 05:30:43 +00:00
};
using RealElementFactory = PEImpl<_RealElementFactory>;
2016-02-02 04:29:58 +00:00
2018-12-08 05:30:43 +00:00
struct IIntElement : IElement {
Delete _d2;
static constexpr std::string_view TypeName = "IntElement"sv;
};
struct IEKeyframeEmitter;
struct IEKeyframeEmitter;
struct IEDeath;
struct IEClamp;
struct IETimeChain;
struct IEAdd;
struct IEConstant;
struct IEImpulse;
struct IELifetimePercent;
struct IEInitialRandom;
struct IEPulse;
struct IEMultiply;
struct IESampleAndHold;
struct IERandom;
struct IETimeScale;
struct IEGTCP;
struct IEModulo;
struct IESubtract;
struct _IntElementFactory {
using PtrType = IIntElement;
2021-06-07 19:29:18 +00:00
template <typename _Func>
static bool constexpr Lookup(FourCC fcc, _Func f) {
switch (fcc.toUint32()) {
2021-06-07 19:29:18 +00:00
case SBIG('KEYE'):
f(PEType<IEKeyframeEmitter>{});
return true;
case SBIG('KEYP'):
f(PEType<IEKeyframeEmitter>{});
return true;
case SBIG('DETH'):
f(PEType<IEDeath>{});
return true;
case SBIG('CLMP'):
f(PEType<IEClamp>{});
return true;
case SBIG('CHAN'):
f(PEType<IETimeChain>{});
return true;
case SBIG('ADD_'):
f(PEType<IEAdd>{});
return true;
case SBIG('CNST'):
f(PEType<IEConstant>{});
return true;
case SBIG('IMPL'):
f(PEType<IEImpulse>{});
return true;
case SBIG('ILPT'):
f(PEType<IELifetimePercent>{});
return true;
case SBIG('IRND'):
f(PEType<IEInitialRandom>{});
return true;
case SBIG('PULS'):
f(PEType<IEPulse>{});
return true;
case SBIG('MULT'):
f(PEType<IEMultiply>{});
return true;
case SBIG('SPAH'):
f(PEType<IESampleAndHold>{});
return true;
case SBIG('RAND'):
f(PEType<IERandom>{});
return true;
case SBIG('TSCL'):
f(PEType<IETimeScale>{});
return true;
case SBIG('GTCP'):
f(PEType<IEGTCP>{});
return true;
case SBIG('MODU'):
f(PEType<IEModulo>{});
return true;
case SBIG('SUB_'):
f(PEType<IESubtract>{});
return true;
default:
return false;
}
}
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IIntElement>& elemPtr) {}
2018-12-08 05:30:43 +00:00
};
using IntElementFactory = PEImpl<_IntElementFactory>;
2016-02-02 04:29:58 +00:00
2018-12-08 05:30:43 +00:00
struct IVectorElement : IElement {
Delete _d2;
static constexpr std::string_view TypeName = "VectorElement"sv;
};
struct VECone;
struct VETimeChain;
struct VEAngleCone;
struct VEAdd;
struct VECircleCluster;
struct VEConstant;
struct VECircle;
struct VEKeyframeEmitter;
struct VEKeyframeEmitter;
struct VEMultiply;
struct VERealToVector;
struct VEPulse;
struct VEParticleVelocity;
struct VESPOS;
struct VEPLCO;
struct VEPLOC;
struct VEPSOR;
struct VEPSOF;
struct _VectorElementFactory {
using PtrType = IVectorElement;
2021-06-07 19:29:18 +00:00
template <typename _Func>
static bool constexpr Lookup(FourCC fcc, _Func f) {
switch (fcc.toUint32()) {
2021-06-07 19:29:18 +00:00
case SBIG('CONE'):
f(PEType<VECone>{});
return true;
case SBIG('CHAN'):
f(PEType<VETimeChain>{});
return true;
case SBIG('ANGC'):
f(PEType<VEAngleCone>{});
return true;
case SBIG('ADD_'):
f(PEType<VEAdd>{});
return true;
case SBIG('CCLU'):
f(PEType<VECircleCluster>{});
return true;
case SBIG('CNST'):
f(PEType<VEConstant>{});
return true;
case SBIG('CIRC'):
f(PEType<VECircle>{});
return true;
case SBIG('KEYE'):
f(PEType<VEKeyframeEmitter>{});
return true;
case SBIG('KEYP'):
f(PEType<VEKeyframeEmitter>{});
return true;
case SBIG('MULT'):
f(PEType<VEMultiply>{});
return true;
case SBIG('RTOV'):
f(PEType<VERealToVector>{});
return true;
case SBIG('PULS'):
f(PEType<VEPulse>{});
return true;
case SBIG('PVEL'):
f(PEType<VEParticleVelocity>{});
return true;
case SBIG('SPOS'):
f(PEType<VESPOS>{});
return true;
case SBIG('PLCO'):
f(PEType<VEPLCO>{});
return true;
case SBIG('PLOC'):
f(PEType<VEPLOC>{});
return true;
case SBIG('PSOR'):
f(PEType<VEPSOR>{});
return true;
case SBIG('PSOF'):
f(PEType<VEPSOF>{});
return true;
default:
return false;
}
}
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IVectorElement>& elemPtr) {}
2018-12-08 05:30:43 +00:00
};
using VectorElementFactory = PEImpl<_VectorElementFactory>;
2016-02-02 08:22:01 +00:00
2018-12-08 05:30:43 +00:00
struct IColorElement : IElement {
Delete _d2;
static constexpr std::string_view TypeName = "ColorElement"sv;
};
struct CEKeyframeEmitter;
struct CEKeyframeEmitter;
struct CEConstant;
struct CETimeChain;
struct CEFadeEnd;
struct CEFade;
struct CEPulse;
struct _ColorElementFactory {
using PtrType = IColorElement;
2021-06-07 19:29:18 +00:00
template <typename _Func>
static bool constexpr Lookup(FourCC fcc, _Func f) {
switch (fcc.toUint32()) {
2021-06-07 19:29:18 +00:00
case SBIG('KEYE'):
f(PEType<CEKeyframeEmitter>{});
return true;
case SBIG('KEYP'):
f(PEType<CEKeyframeEmitter>{});
return true;
case SBIG('CNST'):
f(PEType<CEConstant>{});
return true;
case SBIG('CHAN'):
f(PEType<CETimeChain>{});
return true;
case SBIG('CFDE'):
f(PEType<CEFadeEnd>{});
return true;
case SBIG('FADE'):
f(PEType<CEFade>{});
return true;
case SBIG('PULS'):
f(PEType<CEPulse>{});
return true;
default:
return false;
}
}
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IColorElement>& elemPtr) {}
2018-12-08 05:30:43 +00:00
};
using ColorElementFactory = PEImpl<_ColorElementFactory>;
2016-02-02 08:22:01 +00:00
2018-12-08 05:30:43 +00:00
struct IModVectorElement : IElement {
Delete _d2;
static constexpr std::string_view TypeName = "ModVectorElement"sv;
};
struct MVEImplosion;
struct MVEExponentialImplosion;
struct MVETimeChain;
struct MVEBounce;
struct MVEConstant;
struct MVEGravity;
struct MVEExplode;
struct MVESetPosition;
struct MVELinearImplosion;
struct MVEPulse;
struct MVEWind;
struct MVESwirl;
struct _ModVectorElementFactory {
using PtrType = IModVectorElement;
2021-06-07 19:29:18 +00:00
template <typename _Func>
static bool constexpr Lookup(FourCC fcc, _Func f) {
switch (fcc.toUint32()) {
2021-06-07 19:29:18 +00:00
case SBIG('IMPL'):
f(PEType<MVEImplosion>{});
return true;
case SBIG('EMPL'):
f(PEType<MVEExponentialImplosion>{});
return true;
case SBIG('CHAN'):
f(PEType<MVETimeChain>{});
return true;
case SBIG('BNCE'):
f(PEType<MVEBounce>{});
return true;
case SBIG('CNST'):
f(PEType<MVEConstant>{});
return true;
case SBIG('GRAV'):
f(PEType<MVEGravity>{});
return true;
case SBIG('EXPL'):
f(PEType<MVEExplode>{});
return true;
case SBIG('SPOS'):
f(PEType<MVESetPosition>{});
return true;
case SBIG('LMPL'):
f(PEType<MVELinearImplosion>{});
return true;
case SBIG('PULS'):
f(PEType<MVEPulse>{});
return true;
case SBIG('WIND'):
f(PEType<MVEWind>{});
return true;
case SBIG('SWRL'):
f(PEType<MVESwirl>{});
return true;
default:
return false;
}
}
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IModVectorElement>& elemPtr) {}
2018-12-08 05:30:43 +00:00
};
using ModVectorElementFactory = PEImpl<_ModVectorElementFactory>;
2016-02-02 08:22:01 +00:00
2018-12-08 05:30:43 +00:00
struct IEmitterElement : IElement {
Delete _d2;
static constexpr std::string_view TypeName = "EmitterElement"sv;
};
struct EESimpleEmitterTR;
struct EESimpleEmitter;
struct VESphere;
struct VEAngleSphere;
struct _EmitterElementFactory {
using PtrType = IEmitterElement;
2021-06-07 19:29:18 +00:00
template <typename _Func>
static bool constexpr Lookup(FourCC fcc, _Func f) {
switch (fcc.toUint32()) {
2021-06-07 19:29:18 +00:00
case SBIG('SETR'):
f(PEType<EESimpleEmitterTR>{});
return true;
case SBIG('SEMR'):
f(PEType<EESimpleEmitter>{});
return true;
case SBIG('SPHE'):
f(PEType<VESphere>{});
return true;
case SBIG('ASPH'):
f(PEType<VEAngleSphere>{});
return true;
default:
return false;
}
}
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IEmitterElement>& elemPtr) {}
2018-12-08 05:30:43 +00:00
};
using EmitterElementFactory = PEImpl<_EmitterElementFactory>;
2018-12-08 05:30:43 +00:00
struct IUVElement : IElement {
Delete _d2;
virtual void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const = 0;
static constexpr std::string_view TypeName = "UVElement"sv;
2016-10-02 22:41:36 +00:00
};
2016-02-02 08:22:01 +00:00
2018-12-08 05:30:43 +00:00
struct BoolHelper : IElement {
2019-08-11 00:49:41 +00:00
AT_DECL_EXPLICIT_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
bool value = false;
explicit operator bool() const { return value; }
2018-12-08 05:30:43 +00:00
BoolHelper& operator=(bool val) {
value = val;
return *this;
}
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "BoolHelper"sv; }
2016-03-02 22:37:10 +00:00
};
template <typename Tp>
struct ValueHelper : BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
void _read(athena::io::IStreamReader& r) {
hecl::DNAFourCC ValueType;
ValueType.read(r);
if (ValueType == FOURCC('CNST'))
athena::io::Read<athena::io::PropType::None>::Do<Tp, athena::Endian::Big>({}, value.emplace(), r);
else
value = std::nullopt;
}
void _write(athena::io::IStreamWriter& w) {
if (value) {
w.writeBytes("CNST", 4);
athena::io::Write<athena::io::PropType::None>::Do<Tp, athena::Endian::Big>({}, *value, w);
} else {
w.writeBytes("NONE", 4);
}
}
void _binarySize(std::size_t& s) {
s += 4;
if (value)
athena::io::BinarySize<athena::io::PropType::None>::Do<Tp, athena::Endian::Big>({}, *value, s);
}
void _read(athena::io::YAMLDocReader& r) {
athena::io::ReadYaml<athena::io::PropType::None>::Do<Tp, athena::Endian::Big>({}, value.emplace(), r);
}
void _write(athena::io::YAMLDocWriter& w) {
athena::io::WriteYaml<athena::io::PropType::None>::Do<Tp, athena::Endian::Big>({}, *value, w);
}
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) {}
std::optional<Tp> value = {};
void emplace(Tp val) { value.emplace(val); }
Tp operator*() const { return *value; }
explicit operator bool() const { return value.operator bool(); }
};
2018-12-08 05:30:43 +00:00
struct RELifetimeTween : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory a;
RealElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "LFTW"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct REConstant : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_EXPLICIT_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
Value<float> val;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CNST"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct RETimeChain : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory a;
RealElementFactory b;
IntElementFactory thresholdFrame;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CHAN"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct REAdd : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory a;
RealElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "ADD_"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct REClamp : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory min;
RealElementFactory max;
RealElementFactory val;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CLMP"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct REKeyframeEmitter : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
Value<atUint32> percentageTween;
Value<atUint32> unk1;
Value<bool> loop;
Value<atUint8> unk2;
Value<atUint32> loopEnd;
Value<atUint32> loopStart;
Value<atUint32> count;
Vector<float, AT_DNA_COUNT(count)> keys;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return percentageTween ? "KEYP"sv : "KEYE"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct REInitialRandom : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory a;
RealElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "IRND"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct RERandom : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory a;
RealElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "RAND"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REMultiply : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory a;
RealElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "MULT"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REPulse : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory aDuration;
IntElementFactory bDuration;
RealElementFactory a;
RealElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PULS"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct RETimeScale : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory dv;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "SCAL"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct RELifetimePercent : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory percent;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "RLPT"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct RESineWave : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory frequency;
RealElementFactory amplitude;
RealElementFactory phase;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "SINE"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REInitialSwitch : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory a;
RealElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "ISWT"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct RECompareLessThan : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory ca;
RealElementFactory cb;
RealElementFactory pass;
RealElementFactory fail;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CLTN"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct RECompareEquals : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory ca;
RealElementFactory cb;
RealElementFactory pass;
RealElementFactory fail;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CEQL"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REParticleAdvanceParam1 : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PAP1"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REParticleAdvanceParam2 : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PAP2"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REParticleAdvanceParam3 : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PAP3"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REParticleAdvanceParam4 : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PAP4"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REParticleAdvanceParam5 : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PAP5"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REParticleAdvanceParam6 : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PAP6"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REParticleAdvanceParam7 : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PAP7"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REParticleAdvanceParam8 : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PAP8"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REParticleSizeOrLineLength : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PSLL"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REParticleRotationOrLineWidth : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PRLW"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct RESubtract : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory a;
RealElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "SUB_"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct REVectorMagnitude : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory vec;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "VMAG"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct REVectorXToReal : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory vec;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "VXTR"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct REVectorYToReal : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory vec;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "VYTR"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct REVectorZToReal : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory vec;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "VZTR"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct RECEXT : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory index;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CEXT"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct REIntTimesReal : IRealElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory a;
RealElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "ITRL"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct IEKeyframeEmitter : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
Value<atUint32> percentageTween;
Value<atUint32> unk1;
Value<bool> loop;
Value<atUint8> unk2;
Value<atUint32> loopEnd;
Value<atUint32> loopStart;
Value<atUint32> count;
Vector<atUint32, AT_DNA_COUNT(count)> keys;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return percentageTween ? "KEYP"sv : "KEYE"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct IEDeath : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory passthrough;
IntElementFactory thresholdFrame;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "DETH"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct IEClamp : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory min;
IntElementFactory max;
IntElementFactory val;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CLMP"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct IETimeChain : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory a;
IntElementFactory b;
IntElementFactory thresholdFrame;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CHAN"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct IEAdd : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory a;
IntElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "ADD_"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct IEConstant : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_EXPLICIT_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
Value<atUint32> val;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CNST"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct IEImpulse : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory val;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "IMPL"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct IELifetimePercent : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory percent;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "ILPT"sv; }
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
struct IEInitialRandom : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory a;
IntElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "IRND"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct IEPulse : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory aDuration;
IntElementFactory bDuration;
IntElementFactory a;
IntElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PULS"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct IEMultiply : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory a;
IntElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "MULT"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct IESampleAndHold : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory waitMin;
IntElementFactory waitMax;
IntElementFactory val;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "SPAH"sv; }
2016-02-02 08:22:01 +00:00
};
2018-12-08 05:30:43 +00:00
struct IERandom : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory a;
IntElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "RAND"sv; }
2016-02-02 08:22:01 +00:00
};
2018-12-08 05:30:43 +00:00
struct IETimeScale : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory dv;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "TSCL"sv; }
2016-02-02 08:22:01 +00:00
};
2018-12-08 05:30:43 +00:00
struct IEGTCP : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "GTCP"sv; }
2016-02-02 08:22:01 +00:00
};
2018-12-08 05:30:43 +00:00
struct IEModulo : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory a;
IntElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "MODU"sv; }
2016-02-02 08:22:01 +00:00
};
2018-12-08 05:30:43 +00:00
struct IESubtract : IIntElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory direction;
IntElementFactory baseRadius;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "SUB_"sv; }
2016-02-02 08:22:01 +00:00
};
2018-12-08 05:30:43 +00:00
struct VECone : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory a;
RealElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CONE"sv; }
2016-02-02 08:22:01 +00:00
};
2018-12-08 05:30:43 +00:00
struct VETimeChain : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory a;
VectorElementFactory b;
IntElementFactory thresholdFrame;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CHAN"sv; }
2016-02-02 08:22:01 +00:00
};
2018-12-08 05:30:43 +00:00
struct VEAngleCone : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory angleXBias;
RealElementFactory angleYBias;
RealElementFactory angleXRange;
RealElementFactory angleYRange;
RealElementFactory magnitude;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "ANGC"sv; }
2016-02-02 08:22:01 +00:00
};
2018-12-08 05:30:43 +00:00
struct VEAdd : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory a;
VectorElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "ADD_"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct VECircleCluster : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory circleOffset;
VectorElementFactory circleNormal;
IntElementFactory cycleFrames;
RealElementFactory randomFactor;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CCLU"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct VEConstant : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_EXPLICIT_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory comps[3];
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CNST"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct VECircle : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory circleOffset;
VectorElementFactory circleNormal;
RealElementFactory angleConstant;
RealElementFactory angleLinear;
RealElementFactory circleRadius;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CIRC"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct VEKeyframeEmitter : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
Value<atUint32> percentageTween;
Value<atUint32> unk1;
Value<bool> loop;
Value<atUint8> unk2;
Value<atUint32> loopEnd;
Value<atUint32> loopStart;
Value<atUint32> count;
Vector<atVec3f, AT_DNA_COUNT(count)> keys;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return percentageTween ? "KEYP"sv : "KEYE"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct VEMultiply : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory a;
VectorElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "MULT"sv; }
2016-02-04 00:55:39 +00:00
};
2018-12-08 05:30:43 +00:00
struct VERealToVector : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory a;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "RTOV"sv; }
2018-12-08 05:30:43 +00:00
};
struct VEPulse : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory aDuration;
IntElementFactory bDuration;
VectorElementFactory a;
VectorElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PULS"sv; }
2018-12-08 05:30:43 +00:00
};
struct VEParticleVelocity : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PVEL"sv; }
2018-12-08 05:30:43 +00:00
};
struct VESPOS : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory a;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "SPOS"sv; }
2018-12-08 05:30:43 +00:00
};
struct VEPLCO : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PLCO"sv; }
2018-12-08 05:30:43 +00:00
};
struct VEPLOC : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PLOC"sv; }
2018-12-08 05:30:43 +00:00
};
struct VEPSOR : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PSOR"sv; }
2018-12-08 05:30:43 +00:00
};
struct VEPSOF : IVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PSOF"sv; }
2018-12-08 05:30:43 +00:00
};
struct CEKeyframeEmitter : IColorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
Value<atUint32> percentageTween;
Value<atUint32> unk1;
Value<bool> loop;
Value<atUint8> unk2;
Value<atUint32> loopEnd;
Value<atUint32> loopStart;
Value<atUint32> count;
Vector<atVec4f, AT_DNA_COUNT(count)> keys;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return percentageTween ? "KEYP"sv : "KEYE"sv; }
2018-12-08 05:30:43 +00:00
};
struct CEConstant : IColorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_EXPLICIT_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory comps[4];
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CNST"sv; }
2018-12-08 05:30:43 +00:00
};
struct CETimeChain : IColorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
ColorElementFactory a;
ColorElementFactory b;
IntElementFactory thresholdFrame;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CHAN"sv; }
2018-12-08 05:30:43 +00:00
};
struct CEFadeEnd : IColorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
ColorElementFactory a;
ColorElementFactory b;
RealElementFactory startFrame;
RealElementFactory endFrame;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CFDE"sv; }
2018-12-08 05:30:43 +00:00
};
struct CEFade : IColorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
ColorElementFactory a;
ColorElementFactory b;
RealElementFactory endFrame;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "FADE"sv; }
2018-12-08 05:30:43 +00:00
};
struct CEPulse : IColorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory aDuration;
IntElementFactory bDuration;
ColorElementFactory a;
ColorElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PULS"sv; }
2018-12-08 05:30:43 +00:00
};
struct MVEImplosion : IModVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory implodePoint;
RealElementFactory velocityScale;
RealElementFactory maxRadius;
RealElementFactory minRadius;
BoolHelper enableMinRadius;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "IMPL"sv; }
2018-12-08 05:30:43 +00:00
};
struct MVEExponentialImplosion : IModVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory implodePoint;
RealElementFactory velocityScale;
RealElementFactory maxRadius;
RealElementFactory minRadius;
BoolHelper enableMinRadius;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "EMPL"sv; }
2018-12-08 05:30:43 +00:00
};
struct MVETimeChain : IModVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
ModVectorElementFactory a;
ModVectorElementFactory b;
IntElementFactory thresholdFrame;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CHAN"sv; }
2018-12-08 05:30:43 +00:00
};
struct MVEBounce : IModVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory planePoint;
VectorElementFactory planeNormal;
RealElementFactory friction;
RealElementFactory restitution;
BoolHelper dieOnPenetrate;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "BNCE"sv; }
2018-12-08 05:30:43 +00:00
};
struct MVEConstant : IModVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_EXPLICIT_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory comps[3];
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CNST"sv; }
2018-12-08 05:30:43 +00:00
};
struct MVEGravity : IModVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory acceleration;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "GRAV"sv; }
2018-12-08 05:30:43 +00:00
};
struct MVEExplode : IModVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
RealElementFactory impulseMagnitude;
RealElementFactory falloffFactor;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "EXPL"sv; }
2018-12-08 05:30:43 +00:00
};
struct MVESetPosition : IModVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory position;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "SPOS"sv; }
2018-12-08 05:30:43 +00:00
};
struct MVELinearImplosion : IModVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory implodePoint;
RealElementFactory velocityScale;
RealElementFactory maxRadius;
RealElementFactory minRadius;
BoolHelper enableMinRadius;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "LMPL"sv; }
2018-12-08 05:30:43 +00:00
};
struct MVEPulse : IModVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
IntElementFactory aDuration;
IntElementFactory bDuration;
ModVectorElementFactory a;
ModVectorElementFactory b;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "PULS"sv; }
2018-12-08 05:30:43 +00:00
};
struct MVEWind : IModVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory windVelocity;
RealElementFactory factor;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "WIND"sv; }
2018-12-08 05:30:43 +00:00
};
struct MVESwirl : IModVectorElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory helixPoint;
VectorElementFactory curveBinormal;
RealElementFactory filterGain;
RealElementFactory tangentialVelocity;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "SWRL"sv; }
2018-12-08 05:30:43 +00:00
};
struct EESimpleEmitter : IEmitterElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory position;
VectorElementFactory velocity;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "SEMR"sv; }
2018-12-08 05:30:43 +00:00
};
struct VESphere : IEmitterElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory sphereOrigin;
RealElementFactory sphereRadius;
RealElementFactory magnitude;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "SPHE"sv; }
2018-12-08 05:30:43 +00:00
};
struct VEAngleSphere : IEmitterElement {
2019-08-11 00:49:41 +00:00
AT_DECL_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
VectorElementFactory sphereOrigin;
RealElementFactory angleXBias;
RealElementFactory angleYBias;
RealElementFactory angleXRange;
RealElementFactory angleYRange;
RealElementFactory sphereRadius;
RealElementFactory magnitude;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "ASPH"sv; }
2018-12-08 05:30:43 +00:00
};
struct EESimpleEmitterTR : EESimpleEmitter {
2019-08-11 00:49:41 +00:00
AT_DECL_EXPLICIT_DNA_YAMLV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "SETR"sv; }
};
2016-02-02 08:22:01 +00:00
template <class IDType>
2018-12-08 05:30:43 +00:00
struct UVEConstant : IUVElement {
2019-08-11 00:49:41 +00:00
AT_DECL_EXPLICIT_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
AT_SUBDECL_DNA
CastIDToZero<IDType> tex;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "CNST"sv; }
2016-10-02 22:41:36 +00:00
2019-08-11 00:49:41 +00:00
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const override {
if (tex.isValid())
g_curSpec->flattenDependencies(tex, pathsOut);
2018-12-08 05:30:43 +00:00
}
2016-02-02 08:22:01 +00:00
};
template <class IDType>
2018-12-08 05:30:43 +00:00
struct UVEAnimTexture : IUVElement {
2019-08-11 00:49:41 +00:00
AT_DECL_EXPLICIT_DNA_YAMLV_NO_TYPE
2018-12-08 05:30:43 +00:00
AT_SUBDECL_DNA
CastIDToZero<IDType> tex;
IntElementFactory tileW;
IntElementFactory tileH;
IntElementFactory strideW;
IntElementFactory strideH;
IntElementFactory cycleFrames;
Value<bool> loop = false;
2019-10-01 07:38:03 +00:00
std::string_view ClassID() const override { return "ATEX"sv; }
2018-12-08 05:30:43 +00:00
2019-08-11 00:49:41 +00:00
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const override {
if (tex.isValid())
g_curSpec->flattenDependencies(tex, pathsOut);
2018-12-08 05:30:43 +00:00
}
2016-02-02 08:22:01 +00:00
};
template <class IDType>
struct _UVElementFactory {
using PtrType = IUVElement;
2021-06-07 19:29:18 +00:00
template <typename _Func>
static bool constexpr Lookup(FourCC fcc, _Func f) {
switch (fcc.toUint32()) {
2021-06-07 19:29:18 +00:00
case SBIG('CNST'):
f(PEType<UVEConstant<IDType>>{});
return true;
case SBIG('ATEX'):
f(PEType<UVEAnimTexture<IDType>>{});
return true;
default:
return false;
}
}
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IUVElement>& elemPtr) {
if (elemPtr)
elemPtr->gatherDependencies(pathsOut);
}
2016-02-02 08:22:01 +00:00
};
template <class IDType>
using UVElementFactory = PEImpl<_UVElementFactory<IDType>>;
2016-02-02 04:29:58 +00:00
template <class IDType>
2018-12-08 05:30:43 +00:00
struct SpawnSystemKeyframeData : BigDNA {
Value<atUint32> a;
Value<atUint32> b;
Value<atUint32> endFrame;
Value<atUint32> d;
struct SpawnSystemKeyframeInfo : BigDNA {
IDType id;
Value<atUint32> a;
Value<atUint32> b;
2018-12-08 05:30:43 +00:00
Value<atUint32> c;
AT_DECL_EXPLICIT_DNA_YAML
};
2018-12-08 05:30:43 +00:00
std::vector<std::pair<atUint32, std::vector<SpawnSystemKeyframeInfo>>> spawns;
2018-12-08 05:30:43 +00:00
AT_DECL_EXPLICIT_DNA_YAML
AT_SUBDECL_DNA
2016-02-04 00:55:39 +00:00
explicit operator bool() const { return spawns.size() != 0; }
2016-10-02 22:41:36 +00:00
2018-12-08 05:30:43 +00:00
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const {
for (const auto& p : spawns)
for (const SpawnSystemKeyframeInfo& info : p.second)
g_curSpec->flattenDependencies(info.id, pathsOut);
}
};
template <class IDType>
2018-12-08 05:30:43 +00:00
struct ChildResourceFactory : BigDNA {
IDType id;
AT_DECL_EXPLICIT_DNA_YAML
AT_SUBDECL_DNA
explicit operator bool() const { return id.isValid(); }
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const {
if (id.isValid())
g_curSpec->flattenDependencies(id, pathsOut);
}
2016-02-02 04:29:58 +00:00
};
2018-12-08 05:30:43 +00:00
} // namespace DataSpec::DNAParticle