2016-02-02 04:29:58 +00:00
|
|
|
#include "ParticleCommon.hpp"
|
|
|
|
|
2017-12-29 08:08:12 +00:00
|
|
|
namespace DataSpec::DNAParticle
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
logvisor::Module LogModule("urde::DNAParticle");
|
2016-02-02 04:29:58 +00:00
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void REConstant::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
|
|
|
{
|
|
|
|
val = r.readFloat(nullptr);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void REConstant::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
|
|
|
{
|
|
|
|
w.writeFloat(nullptr, val);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void REConstant::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
|
|
|
{
|
|
|
|
s += 4;
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void REConstant::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
|
|
|
{
|
|
|
|
val = r.readFloatBig();
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void REConstant::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
|
|
|
{
|
|
|
|
w.writeFloatBig(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void IEConstant::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
|
|
|
{
|
|
|
|
val = r.readUint32(nullptr);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void IEConstant::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
|
|
|
{
|
|
|
|
w.writeUint32(nullptr, val);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void IEConstant::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
|
|
|
{
|
|
|
|
s += 4;
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void IEConstant::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
|
|
|
{
|
|
|
|
val = r.readUint32Big();
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void IEConstant::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
|
|
|
{
|
|
|
|
w.writeUint32Big(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void VEConstant::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
|
|
|
{
|
|
|
|
size_t elemCount;
|
|
|
|
if (auto v = r.enterSubVector(nullptr, elemCount))
|
|
|
|
{
|
|
|
|
for (int i=0 ; i<3 && i<elemCount ; ++i)
|
|
|
|
{
|
|
|
|
if (auto rec = r.enterSubRecord(nullptr))
|
|
|
|
comps[i].read(r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void VEConstant::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
|
|
|
{
|
|
|
|
if (auto v = w.enterSubVector(nullptr))
|
|
|
|
for (int i=0 ; i<3 ; ++i)
|
|
|
|
if (auto rec = w.enterSubRecord(nullptr))
|
|
|
|
comps[i].write(w);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void VEConstant::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
|
|
|
{
|
|
|
|
comps[0].binarySize(s);
|
|
|
|
comps[1].binarySize(s);
|
|
|
|
comps[2].binarySize(s);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void VEConstant::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
|
|
|
{
|
|
|
|
comps[0].read(r);
|
|
|
|
comps[1].read(r);
|
|
|
|
comps[2].read(r);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void VEConstant::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
|
|
|
{
|
|
|
|
comps[0].write(w);
|
|
|
|
comps[1].write(w);
|
|
|
|
comps[2].write(w);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void CEConstant::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
|
|
|
{
|
|
|
|
for (int i=0 ; i<4 ; ++i)
|
|
|
|
if (auto rec = r.enterSubRecord(nullptr))
|
|
|
|
comps[i].read(r);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void CEConstant::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
|
|
|
{
|
|
|
|
if (auto v = w.enterSubVector(nullptr))
|
|
|
|
for (int i=0 ; i<4 ; ++i)
|
|
|
|
if (auto rec = w.enterSubRecord(nullptr))
|
|
|
|
comps[i].write(w);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void CEConstant::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
|
|
|
{
|
|
|
|
comps[0].binarySize(s);
|
|
|
|
comps[1].binarySize(s);
|
|
|
|
comps[2].binarySize(s);
|
|
|
|
comps[3].binarySize(s);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void CEConstant::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
|
|
|
{
|
|
|
|
comps[0].read(r);
|
|
|
|
comps[1].read(r);
|
|
|
|
comps[2].read(r);
|
|
|
|
comps[3].read(r);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void CEConstant::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
|
|
|
{
|
|
|
|
comps[0].write(w);
|
|
|
|
comps[1].write(w);
|
|
|
|
comps[2].write(w);
|
|
|
|
comps[3].write(w);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void MVEConstant::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
|
|
|
{
|
|
|
|
for (int i=0 ; i<3 ; ++i)
|
|
|
|
if (auto rec = r.enterSubRecord(nullptr))
|
|
|
|
comps[i].read(r);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void MVEConstant::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
|
|
|
{
|
|
|
|
if (auto v = w.enterSubVector(nullptr))
|
|
|
|
for (int i=0 ; i<3 ; ++i)
|
|
|
|
if (auto rec = w.enterSubRecord(nullptr))
|
|
|
|
comps[i].write(w);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void MVEConstant::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
|
|
|
{
|
|
|
|
comps[0].binarySize(s);
|
|
|
|
comps[1].binarySize(s);
|
|
|
|
comps[2].binarySize(s);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void MVEConstant::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
|
|
|
{
|
|
|
|
comps[0].read(r);
|
|
|
|
comps[1].read(r);
|
|
|
|
comps[2].read(r);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void MVEConstant::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
|
|
|
{
|
|
|
|
comps[0].write(w);
|
|
|
|
comps[1].write(w);
|
|
|
|
comps[2].write(w);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void RealElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
|
|
|
if (mapChildren.empty())
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
m_elem.reset();
|
|
|
|
return;
|
2016-02-02 04:29:58 +00:00
|
|
|
}
|
2016-02-02 23:41:55 +00:00
|
|
|
|
|
|
|
const auto& elem = mapChildren[0];
|
|
|
|
if (elem.first.size() < 4)
|
2016-03-04 23:04:53 +00:00
|
|
|
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
2016-02-02 23:41:55 +00:00
|
|
|
|
|
|
|
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
case SBIG('LFTW'):
|
|
|
|
m_elem.reset(new struct RELifetimeTween);
|
|
|
|
break;
|
|
|
|
case SBIG('CNST'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct REConstant);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CHAN'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct RETimeChain);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('ADD_'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct REAdd);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CLMP'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct REClamp);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('KEYE'):
|
|
|
|
case SBIG('KEYP'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct REKeyframeEmitter);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('IRND'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct REInitialRandom);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('RAND'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct RERandom);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('MULT'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct REMultiply);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PULS'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct REPulse);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('SCAL'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct RETimeScale);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('RLPT'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct RELifetimePercent);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('SINE'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct RESineWave);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
2016-02-04 00:55:39 +00:00
|
|
|
case SBIG('ISWT'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REInitialSwitch);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CLTN'):
|
|
|
|
m_elem.reset(new struct RECompareLessThan);
|
|
|
|
break;
|
|
|
|
case SBIG('CEQL'):
|
|
|
|
m_elem.reset(new struct RECompareEquals);
|
|
|
|
break;
|
|
|
|
case SBIG('PAP1'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam1);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP2'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam2);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP3'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam3);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP4'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam4);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP5'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam5);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP6'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam6);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP7'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam7);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP8'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam8);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PSLL'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleSizeOrLineLength);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PRLW'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleRotationOrLineWidth);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('SUB_'):
|
|
|
|
m_elem.reset(new struct RESubtract);
|
|
|
|
break;
|
|
|
|
case SBIG('VMAG'):
|
|
|
|
m_elem.reset(new struct REVectorMagnitude);
|
|
|
|
break;
|
|
|
|
case SBIG('VXTR'):
|
|
|
|
m_elem.reset(new struct REVectorXToReal);
|
|
|
|
break;
|
|
|
|
case SBIG('VYTR'):
|
|
|
|
m_elem.reset(new struct REVectorYToReal);
|
|
|
|
break;
|
|
|
|
case SBIG('VZTR'):
|
|
|
|
m_elem.reset(new struct REVectorZToReal);
|
|
|
|
break;
|
|
|
|
case SBIG('CEXT'):
|
|
|
|
m_elem.reset(new struct RECEXT);
|
|
|
|
break;
|
|
|
|
case SBIG('ITRL'):
|
2016-02-07 00:19:59 +00:00
|
|
|
m_elem.reset(new struct REIntTimesReal);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
2016-02-02 23:41:55 +00:00
|
|
|
default:
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset();
|
2016-02-02 23:41:55 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = r.enterSubRecord(elem.first.c_str()))
|
|
|
|
m_elem->read(r);
|
2016-02-02 04:29:58 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void RealElementFactory::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
|
|
|
if (m_elem)
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = w.enterSubRecord(m_elem->ClassID()))
|
|
|
|
m_elem->write(w);
|
2016-02-02 04:29:58 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void RealElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
s += 4;
|
2016-02-02 04:29:58 +00:00
|
|
|
if (m_elem)
|
2018-02-22 07:24:51 +00:00
|
|
|
m_elem->binarySize(s);
|
2016-02-02 04:29:58 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void RealElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
switch (clsId)
|
|
|
|
{
|
|
|
|
case SBIG('LFTW'):
|
|
|
|
m_elem.reset(new struct RELifetimeTween);
|
|
|
|
break;
|
|
|
|
case SBIG('CNST'):
|
|
|
|
m_elem.reset(new struct REConstant);
|
|
|
|
break;
|
|
|
|
case SBIG('CHAN'):
|
|
|
|
m_elem.reset(new struct RETimeChain);
|
|
|
|
break;
|
|
|
|
case SBIG('ADD_'):
|
|
|
|
m_elem.reset(new struct REAdd);
|
|
|
|
break;
|
|
|
|
case SBIG('CLMP'):
|
|
|
|
m_elem.reset(new struct REClamp);
|
|
|
|
break;
|
|
|
|
case SBIG('KEYE'):
|
2016-02-02 08:22:01 +00:00
|
|
|
case SBIG('KEYP'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct REKeyframeEmitter);
|
|
|
|
break;
|
|
|
|
case SBIG('IRND'):
|
|
|
|
m_elem.reset(new struct REInitialRandom);
|
|
|
|
break;
|
|
|
|
case SBIG('RAND'):
|
|
|
|
m_elem.reset(new struct RERandom);
|
|
|
|
break;
|
|
|
|
case SBIG('MULT'):
|
|
|
|
m_elem.reset(new struct REMultiply);
|
|
|
|
break;
|
|
|
|
case SBIG('PULS'):
|
|
|
|
m_elem.reset(new struct REPulse);
|
|
|
|
break;
|
|
|
|
case SBIG('SCAL'):
|
|
|
|
m_elem.reset(new struct RETimeScale);
|
|
|
|
break;
|
|
|
|
case SBIG('RLPT'):
|
|
|
|
m_elem.reset(new struct RELifetimePercent);
|
|
|
|
break;
|
|
|
|
case SBIG('SINE'):
|
|
|
|
m_elem.reset(new struct RESineWave);
|
|
|
|
break;
|
2016-02-04 00:55:39 +00:00
|
|
|
case SBIG('ISWT'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REInitialSwitch);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CLTN'):
|
|
|
|
m_elem.reset(new struct RECompareLessThan);
|
|
|
|
break;
|
|
|
|
case SBIG('CEQL'):
|
|
|
|
m_elem.reset(new struct RECompareEquals);
|
|
|
|
break;
|
|
|
|
case SBIG('PAP1'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam1);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP2'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam2);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP3'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam3);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP4'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam4);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP5'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam5);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP6'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam6);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP7'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam7);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PAP8'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleAdvanceParam8);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PSLL'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleSizeOrLineLength);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PRLW'):
|
2016-03-02 22:37:10 +00:00
|
|
|
m_elem.reset(new struct REParticleRotationOrLineWidth);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('SUB_'):
|
|
|
|
m_elem.reset(new struct RESubtract);
|
|
|
|
break;
|
|
|
|
case SBIG('VMAG'):
|
|
|
|
m_elem.reset(new struct REVectorMagnitude);
|
|
|
|
break;
|
|
|
|
case SBIG('VXTR'):
|
|
|
|
m_elem.reset(new struct REVectorXToReal);
|
|
|
|
break;
|
|
|
|
case SBIG('VYTR'):
|
|
|
|
m_elem.reset(new struct REVectorYToReal);
|
|
|
|
break;
|
|
|
|
case SBIG('VZTR'):
|
|
|
|
m_elem.reset(new struct REVectorZToReal);
|
|
|
|
break;
|
|
|
|
case SBIG('CEXT'):
|
|
|
|
m_elem.reset(new struct RECEXT);
|
|
|
|
break;
|
|
|
|
case SBIG('ITRL'):
|
2016-02-07 00:19:59 +00:00
|
|
|
m_elem.reset(new struct REIntTimesReal);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('NONE'):
|
|
|
|
m_elem.reset();
|
|
|
|
return;
|
2016-02-02 04:29:58 +00:00
|
|
|
default:
|
|
|
|
m_elem.reset();
|
2016-03-04 23:04:53 +00:00
|
|
|
LogModule.report(logvisor::Fatal, "Unknown RealElement class %.4s @%" PRIi64, &clsId, r.position());
|
2016-02-02 04:29:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_elem->read(r);
|
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void RealElementFactory::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
|
|
|
if (m_elem)
|
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
w.writeBytes((atInt8*)m_elem->ClassID(), 4);
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem->write(w);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
w.writeBytes((atInt8*)"NONE", 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void IntElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
|
|
|
if (mapChildren.empty())
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
m_elem.reset();
|
|
|
|
return;
|
2016-02-02 04:29:58 +00:00
|
|
|
}
|
2016-02-02 23:41:55 +00:00
|
|
|
|
|
|
|
const auto& elem = mapChildren[0];
|
|
|
|
if (elem.first.size() < 4)
|
2016-03-04 23:04:53 +00:00
|
|
|
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
2016-02-02 23:41:55 +00:00
|
|
|
|
|
|
|
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
case SBIG('KEYE'):
|
|
|
|
case SBIG('KEYP'):
|
|
|
|
m_elem.reset(new struct IEKeyframeEmitter);
|
|
|
|
break;
|
|
|
|
case SBIG('DETH'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IEDeath);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CLMP'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IEClamp);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CHAN'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IETimeChain);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('ADD_'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IEAdd);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CNST'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IEConstant);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('IMPL'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IEImpulse);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('ILPT'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IELifetimePercent);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('IRND'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IEInitialRandom);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PULS'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IEPulse);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('MULT'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IEMultiply);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('SPAH'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IESampleAndHold);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('RAND'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IERandom);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('TSCL'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IETimeScale);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
2016-02-04 00:55:39 +00:00
|
|
|
case SBIG('GTCP'):
|
|
|
|
m_elem.reset(new struct IEGTCP);
|
|
|
|
break;
|
|
|
|
case SBIG('MODU'):
|
|
|
|
m_elem.reset(new struct IEModulo);
|
|
|
|
break;
|
|
|
|
case SBIG('SUB_'):
|
|
|
|
m_elem.reset(new struct IESubtract);
|
|
|
|
break;
|
2016-02-02 23:41:55 +00:00
|
|
|
default:
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset();
|
2016-02-02 23:41:55 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = r.enterSubRecord(elem.first.c_str()))
|
|
|
|
m_elem->read(r);
|
2016-02-02 04:29:58 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void IntElementFactory::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
|
|
|
if (m_elem)
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = w.enterSubRecord(m_elem->ClassID()))
|
|
|
|
m_elem->write(w);
|
2016-02-02 04:29:58 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void IntElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
s += 4;
|
2016-02-02 04:29:58 +00:00
|
|
|
if (m_elem)
|
2018-02-22 07:24:51 +00:00
|
|
|
m_elem->binarySize(s);
|
2016-02-02 04:29:58 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void IntElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
switch (clsId)
|
|
|
|
{
|
|
|
|
case SBIG('KEYE'):
|
2016-02-02 08:22:01 +00:00
|
|
|
case SBIG('KEYP'):
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem.reset(new struct IEKeyframeEmitter);
|
|
|
|
break;
|
|
|
|
case SBIG('DETH'):
|
|
|
|
m_elem.reset(new struct IEDeath);
|
|
|
|
break;
|
|
|
|
case SBIG('CLMP'):
|
|
|
|
m_elem.reset(new struct IEClamp);
|
|
|
|
break;
|
|
|
|
case SBIG('CHAN'):
|
|
|
|
m_elem.reset(new struct IETimeChain);
|
|
|
|
break;
|
|
|
|
case SBIG('ADD_'):
|
|
|
|
m_elem.reset(new struct IEAdd);
|
|
|
|
break;
|
|
|
|
case SBIG('CNST'):
|
|
|
|
m_elem.reset(new struct IEConstant);
|
|
|
|
break;
|
|
|
|
case SBIG('IMPL'):
|
|
|
|
m_elem.reset(new struct IEImpulse);
|
|
|
|
break;
|
|
|
|
case SBIG('ILPT'):
|
|
|
|
m_elem.reset(new struct IELifetimePercent);
|
|
|
|
break;
|
|
|
|
case SBIG('IRND'):
|
|
|
|
m_elem.reset(new struct IEInitialRandom);
|
|
|
|
break;
|
|
|
|
case SBIG('PULS'):
|
|
|
|
m_elem.reset(new struct IEPulse);
|
|
|
|
break;
|
|
|
|
case SBIG('MULT'):
|
|
|
|
m_elem.reset(new struct IEMultiply);
|
|
|
|
break;
|
|
|
|
case SBIG('SPAH'):
|
|
|
|
m_elem.reset(new struct IESampleAndHold);
|
|
|
|
break;
|
|
|
|
case SBIG('RAND'):
|
|
|
|
m_elem.reset(new struct IERandom);
|
|
|
|
break;
|
|
|
|
case SBIG('TSCL'):
|
|
|
|
m_elem.reset(new struct IETimeScale);
|
|
|
|
break;
|
2016-02-04 00:55:39 +00:00
|
|
|
case SBIG('GTCP'):
|
|
|
|
m_elem.reset(new struct IEGTCP);
|
|
|
|
break;
|
|
|
|
case SBIG('MODU'):
|
|
|
|
m_elem.reset(new struct IEModulo);
|
|
|
|
break;
|
|
|
|
case SBIG('SUB_'):
|
|
|
|
m_elem.reset(new struct IESubtract);
|
|
|
|
break;
|
|
|
|
case SBIG('NONE'):
|
|
|
|
m_elem.reset();
|
|
|
|
return;
|
2016-02-02 04:29:58 +00:00
|
|
|
default:
|
|
|
|
m_elem.reset();
|
2016-03-04 23:04:53 +00:00
|
|
|
LogModule.report(logvisor::Fatal, "Unknown IntElement class %.4s @%" PRIi64, &clsId, r.position());
|
2016-02-02 04:29:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_elem->read(r);
|
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void IntElementFactory::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
2016-02-02 04:29:58 +00:00
|
|
|
{
|
|
|
|
if (m_elem)
|
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
w.writeBytes((atInt8*)m_elem->ClassID(), 4);
|
2016-02-02 04:29:58 +00:00
|
|
|
m_elem->write(w);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
w.writeBytes((atInt8*)"NONE", 4);
|
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void VectorElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
|
|
|
if (mapChildren.empty())
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
m_elem.reset();
|
|
|
|
return;
|
2016-02-02 08:22:01 +00:00
|
|
|
}
|
2016-02-02 23:41:55 +00:00
|
|
|
|
|
|
|
const auto& elem = mapChildren[0];
|
|
|
|
if (elem.first.size() < 4)
|
2016-03-04 23:04:53 +00:00
|
|
|
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
2016-02-02 23:41:55 +00:00
|
|
|
|
|
|
|
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
case SBIG('CONE'):
|
|
|
|
m_elem.reset(new struct VECone);
|
|
|
|
break;
|
|
|
|
case SBIG('CHAN'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct VETimeChain);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('ANGC'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct VEAngleCone);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('ADD_'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct VEAdd);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CCLU'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct VECircleCluster);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CNST'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct VEConstant);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CIRC'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct VECircle);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('KEYE'):
|
|
|
|
case SBIG('KEYP'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct VEKeyframeEmitter);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('MULT'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct VEMultiply);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('RTOV'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct VERealToVector);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PULS'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct VEPulse);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
2016-02-04 00:55:39 +00:00
|
|
|
case SBIG('PVEL'):
|
|
|
|
m_elem.reset(new struct VEParticleVelocity);
|
|
|
|
break;
|
|
|
|
case SBIG('SPOS'):
|
|
|
|
m_elem.reset(new struct VESPOS);
|
|
|
|
break;
|
|
|
|
case SBIG('PLCO'):
|
|
|
|
m_elem.reset(new struct VEPLCO);
|
|
|
|
break;
|
|
|
|
case SBIG('PLOC'):
|
|
|
|
m_elem.reset(new struct VEPLOC);
|
|
|
|
break;
|
|
|
|
case SBIG('PSOR'):
|
|
|
|
m_elem.reset(new struct VEPSOR);
|
|
|
|
break;
|
|
|
|
case SBIG('PSOF'):
|
|
|
|
m_elem.reset(new struct VEPSOF);
|
|
|
|
break;
|
2016-02-02 23:41:55 +00:00
|
|
|
default:
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset();
|
2016-02-02 23:41:55 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = r.enterSubRecord(elem.first.c_str()))
|
|
|
|
m_elem->read(r);
|
2016-02-02 08:22:01 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void VectorElementFactory::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
|
|
|
if (m_elem)
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = w.enterSubRecord(m_elem->ClassID()))
|
|
|
|
m_elem->write(w);
|
2016-02-02 08:22:01 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void VectorElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
s += 4;
|
2016-02-02 08:22:01 +00:00
|
|
|
if (m_elem)
|
2018-02-22 07:24:51 +00:00
|
|
|
m_elem->binarySize(s);
|
2016-02-02 08:22:01 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void VectorElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
switch (clsId)
|
|
|
|
{
|
|
|
|
case SBIG('CONE'):
|
|
|
|
m_elem.reset(new struct VECone);
|
|
|
|
break;
|
|
|
|
case SBIG('CHAN'):
|
|
|
|
m_elem.reset(new struct VETimeChain);
|
|
|
|
break;
|
|
|
|
case SBIG('ANGC'):
|
|
|
|
m_elem.reset(new struct VEAngleCone);
|
|
|
|
break;
|
|
|
|
case SBIG('ADD_'):
|
|
|
|
m_elem.reset(new struct VEAdd);
|
|
|
|
break;
|
|
|
|
case SBIG('CCLU'):
|
|
|
|
m_elem.reset(new struct VECircleCluster);
|
|
|
|
break;
|
|
|
|
case SBIG('CNST'):
|
|
|
|
m_elem.reset(new struct VEConstant);
|
|
|
|
break;
|
|
|
|
case SBIG('CIRC'):
|
|
|
|
m_elem.reset(new struct VECircle);
|
|
|
|
break;
|
|
|
|
case SBIG('KEYE'):
|
|
|
|
case SBIG('KEYP'):
|
|
|
|
m_elem.reset(new struct VEKeyframeEmitter);
|
|
|
|
break;
|
|
|
|
case SBIG('MULT'):
|
|
|
|
m_elem.reset(new struct VEMultiply);
|
|
|
|
break;
|
|
|
|
case SBIG('RTOV'):
|
|
|
|
m_elem.reset(new struct VERealToVector);
|
|
|
|
break;
|
|
|
|
case SBIG('PULS'):
|
|
|
|
m_elem.reset(new struct VEPulse);
|
|
|
|
break;
|
2016-02-04 00:55:39 +00:00
|
|
|
case SBIG('PVEL'):
|
|
|
|
m_elem.reset(new struct VEParticleVelocity);
|
|
|
|
break;
|
|
|
|
case SBIG('SPOS'):
|
|
|
|
m_elem.reset(new struct VESPOS);
|
|
|
|
break;
|
|
|
|
case SBIG('PLCO'):
|
|
|
|
m_elem.reset(new struct VEPLCO);
|
|
|
|
break;
|
|
|
|
case SBIG('PLOC'):
|
|
|
|
m_elem.reset(new struct VEPLOC);
|
|
|
|
break;
|
|
|
|
case SBIG('PSOR'):
|
|
|
|
m_elem.reset(new struct VEPSOR);
|
|
|
|
break;
|
|
|
|
case SBIG('PSOF'):
|
|
|
|
m_elem.reset(new struct VEPSOF);
|
|
|
|
break;
|
|
|
|
case SBIG('NONE'):
|
|
|
|
m_elem.reset();
|
|
|
|
return;
|
2016-02-02 08:22:01 +00:00
|
|
|
default:
|
|
|
|
m_elem.reset();
|
2016-03-04 23:04:53 +00:00
|
|
|
LogModule.report(logvisor::Fatal, "Unknown VectorElement class %.4s @%" PRIi64, &clsId, r.position());
|
2016-02-02 08:22:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_elem->read(r);
|
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void VectorElementFactory::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
|
|
|
if (m_elem)
|
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
w.writeBytes((atInt8*)m_elem->ClassID(), 4);
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem->write(w);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
w.writeBytes((atInt8*)"NONE", 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void ColorElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
|
|
|
if (mapChildren.empty())
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
m_elem.reset();
|
|
|
|
return;
|
2016-02-02 08:22:01 +00:00
|
|
|
}
|
2016-02-02 23:41:55 +00:00
|
|
|
|
|
|
|
const auto& elem = mapChildren[0];
|
|
|
|
if (elem.first.size() < 4)
|
2016-03-04 23:04:53 +00:00
|
|
|
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
2016-02-02 23:41:55 +00:00
|
|
|
|
|
|
|
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
case SBIG('KEYE'):
|
|
|
|
case SBIG('KEYP'):
|
|
|
|
m_elem.reset(new struct CEKeyframeEmitter);
|
|
|
|
break;
|
|
|
|
case SBIG('CNST'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct CEConstant);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CHAN'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct CETimeChain);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CFDE'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct CEFadeEnd);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('FADE'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct CEFade);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PULS'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct CEPulse);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
default:
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset();
|
2016-02-02 23:41:55 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = r.enterSubRecord(elem.first.c_str()))
|
|
|
|
m_elem->read(r);
|
2016-02-02 08:22:01 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void ColorElementFactory::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
|
|
|
if (m_elem)
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = w.enterSubRecord(m_elem->ClassID()))
|
|
|
|
m_elem->write(w);
|
2016-02-02 08:22:01 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void ColorElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
s += 4;
|
2016-02-02 08:22:01 +00:00
|
|
|
if (m_elem)
|
2018-02-22 07:24:51 +00:00
|
|
|
m_elem->binarySize(s);
|
2016-02-02 08:22:01 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void ColorElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
switch (clsId)
|
|
|
|
{
|
|
|
|
case SBIG('KEYE'):
|
|
|
|
case SBIG('KEYP'):
|
|
|
|
m_elem.reset(new struct CEKeyframeEmitter);
|
|
|
|
break;
|
|
|
|
case SBIG('CNST'):
|
|
|
|
m_elem.reset(new struct CEConstant);
|
|
|
|
break;
|
|
|
|
case SBIG('CHAN'):
|
|
|
|
m_elem.reset(new struct CETimeChain);
|
|
|
|
break;
|
|
|
|
case SBIG('CFDE'):
|
|
|
|
m_elem.reset(new struct CEFadeEnd);
|
|
|
|
break;
|
|
|
|
case SBIG('FADE'):
|
|
|
|
m_elem.reset(new struct CEFade);
|
|
|
|
break;
|
|
|
|
case SBIG('PULS'):
|
|
|
|
m_elem.reset(new struct CEPulse);
|
|
|
|
break;
|
2016-02-04 00:55:39 +00:00
|
|
|
case SBIG('NONE'):
|
|
|
|
m_elem.reset();
|
|
|
|
return;
|
2016-02-02 08:22:01 +00:00
|
|
|
default:
|
|
|
|
m_elem.reset();
|
2016-03-04 23:04:53 +00:00
|
|
|
LogModule.report(logvisor::Fatal, "Unknown ColorElement class %.4s @%" PRIi64, &clsId, r.position());
|
2016-02-02 08:22:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_elem->read(r);
|
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void ColorElementFactory::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
|
|
|
if (m_elem)
|
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
w.writeBytes((atInt8*)m_elem->ClassID(), 4);
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem->write(w);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
w.writeBytes((atInt8*)"NONE", 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void ModVectorElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
|
|
|
if (mapChildren.empty())
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
m_elem.reset();
|
|
|
|
return;
|
2016-02-02 08:22:01 +00:00
|
|
|
}
|
2016-02-02 23:41:55 +00:00
|
|
|
|
|
|
|
const auto& elem = mapChildren[0];
|
|
|
|
if (elem.first.size() < 4)
|
2016-03-04 23:04:53 +00:00
|
|
|
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
2016-02-02 23:41:55 +00:00
|
|
|
|
|
|
|
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
case SBIG('IMPL'):
|
|
|
|
m_elem.reset(new struct MVEImplosion);
|
|
|
|
break;
|
|
|
|
case SBIG('EMPL'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct MVEExponentialImplosion);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CHAN'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct MVETimeChain);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('BNCE'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct MVEBounce);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('CNST'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct MVEConstant);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('GRAV'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct MVEGravity);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('EXPL'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct MVEExplode);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('SPOS'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct MVESetPosition);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('LMPL'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct MVELinearImplosion);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('PULS'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct MVEPulse);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('WIND'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct MVEWind);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
case SBIG('SWRL'):
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset(new struct MVESwirl);
|
2016-02-02 23:41:55 +00:00
|
|
|
break;
|
|
|
|
default:
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem.reset();
|
2016-02-02 23:41:55 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = r.enterSubRecord(elem.first.c_str()))
|
|
|
|
m_elem->read(r);
|
2016-02-02 08:22:01 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void ModVectorElementFactory::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
|
|
|
if (m_elem)
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = w.enterSubRecord(m_elem->ClassID()))
|
|
|
|
m_elem->write(w);
|
2016-02-02 08:22:01 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void ModVectorElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
s += 4;
|
2016-02-02 08:22:01 +00:00
|
|
|
if (m_elem)
|
2018-02-22 07:24:51 +00:00
|
|
|
m_elem->binarySize(s);
|
2016-02-02 08:22:01 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void ModVectorElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
switch (clsId)
|
|
|
|
{
|
|
|
|
case SBIG('IMPL'):
|
|
|
|
m_elem.reset(new struct MVEImplosion);
|
|
|
|
break;
|
|
|
|
case SBIG('EMPL'):
|
|
|
|
m_elem.reset(new struct MVEExponentialImplosion);
|
|
|
|
break;
|
|
|
|
case SBIG('CHAN'):
|
|
|
|
m_elem.reset(new struct MVETimeChain);
|
|
|
|
break;
|
|
|
|
case SBIG('BNCE'):
|
|
|
|
m_elem.reset(new struct MVEBounce);
|
|
|
|
break;
|
|
|
|
case SBIG('CNST'):
|
|
|
|
m_elem.reset(new struct MVEConstant);
|
|
|
|
break;
|
|
|
|
case SBIG('GRAV'):
|
|
|
|
m_elem.reset(new struct MVEGravity);
|
|
|
|
break;
|
|
|
|
case SBIG('EXPL'):
|
|
|
|
m_elem.reset(new struct MVEExplode);
|
|
|
|
break;
|
|
|
|
case SBIG('SPOS'):
|
|
|
|
m_elem.reset(new struct MVESetPosition);
|
|
|
|
break;
|
|
|
|
case SBIG('LMPL'):
|
|
|
|
m_elem.reset(new struct MVELinearImplosion);
|
|
|
|
break;
|
|
|
|
case SBIG('PULS'):
|
|
|
|
m_elem.reset(new struct MVEPulse);
|
|
|
|
break;
|
|
|
|
case SBIG('WIND'):
|
|
|
|
m_elem.reset(new struct MVEWind);
|
|
|
|
break;
|
|
|
|
case SBIG('SWRL'):
|
|
|
|
m_elem.reset(new struct MVESwirl);
|
|
|
|
break;
|
2016-02-04 00:55:39 +00:00
|
|
|
case SBIG('NONE'):
|
|
|
|
m_elem.reset();
|
|
|
|
return;
|
2016-02-02 08:22:01 +00:00
|
|
|
default:
|
|
|
|
m_elem.reset();
|
2016-03-04 23:04:53 +00:00
|
|
|
LogModule.report(logvisor::Fatal, "Unknown ModVectorElement class %.4s @%" PRIi64, &clsId, r.position());
|
2016-02-02 08:22:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_elem->read(r);
|
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void ModVectorElementFactory::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
2016-02-02 08:22:01 +00:00
|
|
|
{
|
|
|
|
if (m_elem)
|
|
|
|
{
|
2016-02-02 23:41:55 +00:00
|
|
|
w.writeBytes((atInt8*)m_elem->ClassID(), 4);
|
2016-02-02 08:22:01 +00:00
|
|
|
m_elem->write(w);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
w.writeBytes((atInt8*)"NONE", 4);
|
|
|
|
}
|
|
|
|
|
2016-02-03 03:58:33 +00:00
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void EmitterElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
2016-02-03 03:58:33 +00:00
|
|
|
{
|
|
|
|
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
|
|
|
if (mapChildren.empty())
|
|
|
|
{
|
|
|
|
m_elem.reset();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto& elem = mapChildren[0];
|
|
|
|
if (elem.first.size() < 4)
|
2016-03-04 23:04:53 +00:00
|
|
|
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
2016-02-03 03:58:33 +00:00
|
|
|
|
|
|
|
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
|
|
|
{
|
|
|
|
case SBIG('SETR'):
|
|
|
|
m_elem.reset(new struct EESimpleEmitterTR);
|
|
|
|
break;
|
|
|
|
case SBIG('SEMR'):
|
|
|
|
m_elem.reset(new struct EESimpleEmitter);
|
|
|
|
break;
|
|
|
|
case SBIG('SPHE'):
|
|
|
|
m_elem.reset(new struct VESphere);
|
|
|
|
break;
|
2016-02-04 00:55:39 +00:00
|
|
|
case SBIG('ASPH'):
|
2016-02-06 00:34:40 +00:00
|
|
|
m_elem.reset(new struct VEAngleSphere);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
2016-02-03 03:58:33 +00:00
|
|
|
default:
|
|
|
|
m_elem.reset();
|
|
|
|
return;
|
|
|
|
}
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = r.enterSubRecord(elem.first.c_str()))
|
|
|
|
m_elem->read(r);
|
2016-02-03 03:58:33 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void EmitterElementFactory::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
2016-02-03 03:58:33 +00:00
|
|
|
{
|
|
|
|
if (m_elem)
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = w.enterSubRecord(m_elem->ClassID()))
|
|
|
|
m_elem->write(w);
|
2016-02-03 03:58:33 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void EmitterElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
2016-02-03 03:58:33 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
s += 4;
|
2016-02-03 03:58:33 +00:00
|
|
|
if (m_elem)
|
2018-02-22 07:24:51 +00:00
|
|
|
m_elem->binarySize(s);
|
2016-02-03 03:58:33 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void EmitterElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
2016-02-03 03:58:33 +00:00
|
|
|
{
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
switch (clsId)
|
|
|
|
{
|
|
|
|
case SBIG('SETR'):
|
|
|
|
m_elem.reset(new struct EESimpleEmitterTR);
|
|
|
|
break;
|
|
|
|
case SBIG('SEMR'):
|
|
|
|
m_elem.reset(new struct EESimpleEmitter);
|
|
|
|
break;
|
|
|
|
case SBIG('SPHE'):
|
|
|
|
m_elem.reset(new struct VESphere);
|
|
|
|
break;
|
2016-02-04 00:55:39 +00:00
|
|
|
case SBIG('ASPH'):
|
2016-02-06 00:34:40 +00:00
|
|
|
m_elem.reset(new struct VEAngleSphere);
|
2016-02-04 00:55:39 +00:00
|
|
|
break;
|
|
|
|
case SBIG('NONE'):
|
|
|
|
m_elem.reset();
|
|
|
|
return;
|
2016-02-03 03:58:33 +00:00
|
|
|
default:
|
|
|
|
m_elem.reset();
|
2016-03-04 23:04:53 +00:00
|
|
|
LogModule.report(logvisor::Fatal, "Unknown EmitterElement class %.4s @%" PRIi64, &clsId, r.position());
|
2016-02-03 03:58:33 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_elem->read(r);
|
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void EmitterElementFactory::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
2016-02-03 03:58:33 +00:00
|
|
|
{
|
|
|
|
if (m_elem)
|
|
|
|
{
|
|
|
|
w.writeBytes((atInt8*)m_elem->ClassID(), 4);
|
|
|
|
m_elem->write(w);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
w.writeBytes((atInt8*)"NONE", 4);
|
|
|
|
}
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
|
|
|
void BoolHelper::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
|
|
|
{
|
|
|
|
value = r.readBool(nullptr);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void BoolHelper::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
|
|
|
{
|
|
|
|
w.writeBool(nullptr, value);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void BoolHelper::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
|
|
|
{
|
|
|
|
s += 5;
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void BoolHelper::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
|
|
|
{
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
if (clsId == SBIG('CNST'))
|
|
|
|
value = r.readBool();
|
|
|
|
else
|
|
|
|
value = false;
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void BoolHelper::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
|
|
|
{
|
|
|
|
w.writeBytes((atInt8*)"CNST", 4);
|
|
|
|
w.writeBool(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void EESimpleEmitterTR::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
|
|
|
|
{
|
|
|
|
position.m_elem.reset();
|
|
|
|
velocity.m_elem.reset();
|
|
|
|
if (auto rec = r.enterSubRecord("ILOC"))
|
|
|
|
position.read(r);
|
|
|
|
if (auto rec = r.enterSubRecord("IVEC"))
|
|
|
|
velocity.read(r);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void EESimpleEmitterTR::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
|
|
|
|
{
|
|
|
|
if (auto rec = w.enterSubRecord("ILOC"))
|
|
|
|
position.write(w);
|
|
|
|
if (auto rec = w.enterSubRecord("IVEC"))
|
|
|
|
velocity.write(w);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void EESimpleEmitterTR::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
|
|
|
{
|
|
|
|
s += 8;
|
|
|
|
position.binarySize(s);
|
|
|
|
velocity.binarySize(s);
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void EESimpleEmitterTR::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
|
|
|
{
|
|
|
|
position.m_elem.reset();
|
|
|
|
velocity.m_elem.reset();
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
if (clsId == SBIG('ILOC'))
|
|
|
|
{
|
|
|
|
position.read(r);
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
if (clsId == SBIG('IVEC'))
|
|
|
|
velocity.read(r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
template <>
|
|
|
|
void EESimpleEmitterTR::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
|
|
|
|
{
|
|
|
|
w.writeBytes((atInt8*)"ILOC", 4);
|
|
|
|
position.write(w);
|
|
|
|
w.writeBytes((atInt8*)"IVEC", 4);
|
|
|
|
velocity.write(w);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void UVEConstant<IDType>::_read(typename ReadYaml::StreamT& r)
|
|
|
|
{
|
|
|
|
tex.clear();
|
|
|
|
if (auto rec = r.enterSubRecord("tex"))
|
|
|
|
tex.read(r);
|
|
|
|
}
|
|
|
|
template <class IDType>
|
|
|
|
void UVEConstant<IDType>::_write(typename WriteYaml::StreamT& w) const
|
|
|
|
{
|
|
|
|
if (auto rec = w.enterSubRecord("tex"))
|
|
|
|
tex.write(w);
|
|
|
|
}
|
|
|
|
template <class IDType>
|
|
|
|
void UVEConstant<IDType>::_binarySize(typename BinarySize::StreamT& _s) const
|
|
|
|
{
|
|
|
|
_s += 4;
|
|
|
|
tex.binarySize(_s);
|
|
|
|
}
|
|
|
|
template <class IDType>
|
|
|
|
void UVEConstant<IDType>::_read(typename Read::StreamT& r)
|
|
|
|
{
|
|
|
|
tex.clear();
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
if (clsId == SBIG('CNST'))
|
|
|
|
tex.read(r);
|
|
|
|
}
|
|
|
|
template <class IDType>
|
|
|
|
void UVEConstant<IDType>::_write(typename Write::StreamT& w) const
|
|
|
|
{
|
|
|
|
w.writeBytes((atInt8*)"CNST", 4);
|
|
|
|
tex.write(w);
|
|
|
|
}
|
|
|
|
|
|
|
|
AT_SUBSPECIALIZE_DNA_YAML(UVEConstant<UniqueID32>)
|
|
|
|
AT_SUBSPECIALIZE_DNA_YAML(UVEConstant<UniqueID64>)
|
|
|
|
|
|
|
|
template struct UVEConstant<UniqueID32>;
|
|
|
|
template struct UVEConstant<UniqueID64>;
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void UVEAnimTexture<IDType>::_read(typename ReadYaml::StreamT& r)
|
|
|
|
{
|
|
|
|
tex.clear();
|
|
|
|
if (auto rec = r.enterSubRecord("tex"))
|
|
|
|
tex.read(r);
|
|
|
|
if (auto rec = r.enterSubRecord("tileW"))
|
|
|
|
tileW.read(r);
|
|
|
|
if (auto rec = r.enterSubRecord("tileH"))
|
|
|
|
tileH.read(r);
|
|
|
|
if (auto rec = r.enterSubRecord("strideW"))
|
|
|
|
strideW.read(r);
|
|
|
|
if (auto rec = r.enterSubRecord("strideH"))
|
|
|
|
strideH.read(r);
|
|
|
|
if (auto rec = r.enterSubRecord("cycleFrames"))
|
|
|
|
cycleFrames.read(r);
|
|
|
|
if (auto rec = r.enterSubRecord("loop"))
|
|
|
|
loop = r.readBool(nullptr);
|
|
|
|
}
|
|
|
|
template <class IDType>
|
|
|
|
void UVEAnimTexture<IDType>::_write(typename WriteYaml::StreamT& w) const
|
|
|
|
{
|
|
|
|
if (auto rec = w.enterSubRecord("tex"))
|
|
|
|
tex.write(w);
|
|
|
|
if (auto rec = w.enterSubRecord("tileW"))
|
|
|
|
tileW.write(w);
|
|
|
|
if (auto rec = w.enterSubRecord("tileH"))
|
|
|
|
tileH.write(w);
|
|
|
|
if (auto rec = w.enterSubRecord("strideW"))
|
|
|
|
strideW.write(w);
|
|
|
|
if (auto rec = w.enterSubRecord("strideH"))
|
|
|
|
strideH.write(w);
|
|
|
|
if (auto rec = w.enterSubRecord("cycleFrames"))
|
|
|
|
cycleFrames.write(w);
|
|
|
|
w.writeBool("loop", loop);
|
|
|
|
}
|
|
|
|
template <class IDType>
|
|
|
|
void UVEAnimTexture<IDType>::_binarySize(typename BinarySize::StreamT& _s) const
|
|
|
|
{
|
|
|
|
_s += 9;
|
|
|
|
tex.binarySize(_s);
|
|
|
|
tileW.binarySize(_s);
|
|
|
|
tileH.binarySize(_s);
|
|
|
|
strideW.binarySize(_s);
|
|
|
|
strideH.binarySize(_s);
|
|
|
|
cycleFrames.binarySize(_s);
|
|
|
|
}
|
|
|
|
template <class IDType>
|
|
|
|
void UVEAnimTexture<IDType>::_read(typename Read::StreamT& r)
|
|
|
|
{
|
|
|
|
tex.clear();
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
if (clsId == SBIG('CNST'))
|
|
|
|
tex.read(r);
|
|
|
|
tileW.read(r);
|
|
|
|
tileH.read(r);
|
|
|
|
strideW.read(r);
|
|
|
|
strideH.read(r);
|
|
|
|
cycleFrames.read(r);
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
if (clsId == SBIG('CNST'))
|
|
|
|
loop = r.readBool();
|
|
|
|
}
|
|
|
|
template <class IDType>
|
|
|
|
void UVEAnimTexture<IDType>::_write(typename Write::StreamT& w) const
|
|
|
|
{
|
|
|
|
w.writeBytes((atInt8*)"CNST", 4);
|
|
|
|
tex.write(w);
|
|
|
|
tileW.write(w);
|
|
|
|
tileH.write(w);
|
|
|
|
strideW.write(w);
|
|
|
|
strideH.write(w);
|
|
|
|
cycleFrames.write(w);
|
|
|
|
w.writeBytes((atInt8*)"CNST", 4);
|
|
|
|
w.writeBool(loop);
|
|
|
|
}
|
|
|
|
|
|
|
|
AT_SUBSPECIALIZE_DNA_YAML(UVEAnimTexture<UniqueID32>)
|
|
|
|
AT_SUBSPECIALIZE_DNA_YAML(UVEAnimTexture<UniqueID64>)
|
|
|
|
|
|
|
|
template struct UVEAnimTexture<UniqueID32>;
|
|
|
|
template struct UVEAnimTexture<UniqueID64>;
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void UVElementFactory<IDType>::_read(typename Read::StreamT& r)
|
|
|
|
{
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
switch (clsId)
|
|
|
|
{
|
|
|
|
case SBIG('CNST'):
|
|
|
|
m_elem.reset(new struct UVEConstant<IDType>);
|
|
|
|
break;
|
|
|
|
case SBIG('ATEX'):
|
|
|
|
m_elem.reset(new struct UVEAnimTexture<IDType>);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
m_elem.reset();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_elem->read(r);
|
|
|
|
}
|
|
|
|
template <class IDType>
|
|
|
|
void UVElementFactory<IDType>::_write(typename Write::StreamT& w) const
|
|
|
|
{
|
|
|
|
if (m_elem)
|
|
|
|
{
|
|
|
|
w.writeBytes((atInt8*)m_elem->ClassID(), 4);
|
|
|
|
m_elem->write(w);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
w.writeBytes((atInt8*)"NONE", 4);
|
|
|
|
}
|
|
|
|
template <class IDType>
|
|
|
|
void UVElementFactory<IDType>::_read(typename ReadYaml::StreamT& r)
|
|
|
|
{
|
|
|
|
if (auto rec = r.enterSubRecord("CNST"))
|
|
|
|
{
|
|
|
|
m_elem.reset(new struct UVEConstant<IDType>);
|
|
|
|
m_elem->read(r);
|
|
|
|
}
|
|
|
|
else if (auto rec = r.enterSubRecord("ATEX"))
|
|
|
|
{
|
|
|
|
m_elem.reset(new struct UVEAnimTexture<IDType>);
|
|
|
|
m_elem->read(r);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
m_elem.reset();
|
|
|
|
}
|
|
|
|
template <class IDType>
|
|
|
|
void UVElementFactory<IDType>::_write(typename WriteYaml::StreamT& w) const
|
|
|
|
{
|
|
|
|
if (m_elem)
|
|
|
|
if (auto rec = w.enterSubRecord(m_elem->ClassID()))
|
|
|
|
m_elem->write(w);
|
|
|
|
}
|
|
|
|
template <class IDType>
|
|
|
|
void UVElementFactory<IDType>::_binarySize(typename BinarySize::StreamT& _s) const
|
|
|
|
{
|
|
|
|
if (m_elem)
|
|
|
|
m_elem->binarySize(_s);
|
|
|
|
_s += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
AT_SUBSPECIALIZE_DNA_YAML(UVElementFactory<UniqueID32>)
|
|
|
|
AT_SUBSPECIALIZE_DNA_YAML(UVElementFactory<UniqueID64>)
|
|
|
|
|
|
|
|
template struct UVElementFactory<UniqueID32>;
|
|
|
|
template struct UVElementFactory<UniqueID64>;
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
template <class Op>
|
|
|
|
void SpawnSystemKeyframeData<IDType>::SpawnSystemKeyframeInfo::Enumerate(typename Op::StreamT& s)
|
|
|
|
{
|
|
|
|
Do<Op>({"id"}, id, s);
|
|
|
|
Do<Op>({"a"}, a, s);
|
|
|
|
Do<Op>({"b"}, b, s);
|
|
|
|
Do<Op>({"c"}, c, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void SpawnSystemKeyframeData<IDType>::_read(typename ReadYaml::StreamT& r)
|
|
|
|
{
|
|
|
|
if (auto rec = r.enterSubRecord("a"))
|
|
|
|
a = r.readUint32(nullptr);
|
|
|
|
if (auto rec = r.enterSubRecord("b"))
|
|
|
|
b = r.readUint32(nullptr);
|
|
|
|
if (auto rec = r.enterSubRecord("endFrame"))
|
|
|
|
endFrame = r.readUint32(nullptr);
|
|
|
|
if (auto rec = r.enterSubRecord("d"))
|
|
|
|
d = r.readUint32(nullptr);
|
|
|
|
spawns.clear();
|
|
|
|
size_t spawnCount;
|
|
|
|
if (auto v = r.enterSubVector("spawns", spawnCount))
|
|
|
|
{
|
|
|
|
spawns.reserve(spawnCount);
|
|
|
|
for (const auto& child : r.getCurNode()->m_seqChildren)
|
|
|
|
{
|
|
|
|
if (auto rec = r.enterSubRecord(nullptr))
|
|
|
|
{
|
|
|
|
spawns.emplace_back();
|
|
|
|
spawns.back().first = r.readUint32("startFrame");
|
|
|
|
size_t systemCount;
|
|
|
|
if (auto v = r.enterSubVector("systems", systemCount))
|
|
|
|
{
|
|
|
|
spawns.back().second.reserve(systemCount);
|
|
|
|
for (const auto& in : r.getCurNode()->m_seqChildren)
|
|
|
|
{
|
|
|
|
spawns.back().second.emplace_back();
|
|
|
|
SpawnSystemKeyframeInfo& info = spawns.back().second.back();
|
|
|
|
if (auto rec = r.enterSubRecord(nullptr))
|
|
|
|
info.read(r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void SpawnSystemKeyframeData<IDType>::_write(typename WriteYaml::StreamT& w) const
|
|
|
|
{
|
|
|
|
if (spawns.empty())
|
|
|
|
return;
|
|
|
|
w.writeUint32("a", a);
|
|
|
|
w.writeUint32("b", b);
|
|
|
|
w.writeUint32("endFrame", endFrame);
|
|
|
|
w.writeUint32("d", d);
|
|
|
|
if (auto v = w.enterSubVector("spawns"))
|
|
|
|
{
|
|
|
|
for (const auto& spawn : spawns)
|
|
|
|
{
|
|
|
|
if (auto rec = w.enterSubRecord(nullptr))
|
|
|
|
{
|
|
|
|
w.writeUint32("startFrame", spawn.first);
|
|
|
|
if (auto v = w.enterSubVector("systems"))
|
|
|
|
for (const auto& info : spawn.second)
|
|
|
|
if (auto rec = w.enterSubRecord(nullptr))
|
|
|
|
info.write(w);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void SpawnSystemKeyframeData<IDType>::_binarySize(typename BinarySize::StreamT& s) const
|
|
|
|
{
|
|
|
|
s += 20;
|
|
|
|
for (const auto& spawn : spawns)
|
|
|
|
{
|
|
|
|
s += 8;
|
|
|
|
for (const auto& info : spawn.second)
|
|
|
|
info.binarySize(s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void SpawnSystemKeyframeData<IDType>::_read(typename Read::StreamT& r)
|
|
|
|
{
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
if (clsId != SBIG('CNST'))
|
|
|
|
return;
|
|
|
|
|
|
|
|
a = r.readUint32Big();
|
|
|
|
b = r.readUint32Big();
|
|
|
|
endFrame = r.readUint32Big();
|
|
|
|
d = r.readUint32Big();
|
|
|
|
uint32_t count = r.readUint32Big();
|
|
|
|
spawns.clear();
|
|
|
|
spawns.reserve(count);
|
|
|
|
for (size_t i=0 ; i<count ; ++i)
|
|
|
|
{
|
|
|
|
spawns.emplace_back();
|
|
|
|
spawns.back().first = r.readUint32Big();
|
|
|
|
uint32_t infoCount = r.readUint32Big();
|
|
|
|
spawns.back().second.reserve(infoCount);
|
|
|
|
for (size_t j=0 ; j<infoCount ; ++j)
|
|
|
|
{
|
|
|
|
spawns.back().second.emplace_back();
|
|
|
|
spawns.back().second.back().read(r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void SpawnSystemKeyframeData<IDType>::_write(typename Write::StreamT& w) const
|
|
|
|
{
|
|
|
|
if (spawns.empty())
|
|
|
|
{
|
|
|
|
w.writeBytes((atInt8*)"NONE", 4);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
w.writeBytes((atInt8*)"CNST", 4);
|
|
|
|
w.writeUint32Big(a);
|
|
|
|
w.writeUint32Big(b);
|
|
|
|
w.writeUint32Big(endFrame);
|
|
|
|
w.writeUint32Big(d);
|
|
|
|
w.writeUint32Big(spawns.size());
|
|
|
|
for (const auto& spawn : spawns)
|
|
|
|
{
|
|
|
|
w.writeUint32Big(spawn.first);
|
|
|
|
w.writeUint32Big(spawn.second.size());
|
|
|
|
for (const auto& info : spawn.second)
|
|
|
|
info.write(w);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AT_SUBSPECIALIZE_DNA_YAML(SpawnSystemKeyframeData<UniqueID32>)
|
|
|
|
AT_SUBSPECIALIZE_DNA_YAML(SpawnSystemKeyframeData<UniqueID64>)
|
|
|
|
|
|
|
|
template struct SpawnSystemKeyframeData<UniqueID32>;
|
|
|
|
template struct SpawnSystemKeyframeData<UniqueID64>;
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void ChildResourceFactory<IDType>::_read(typename ReadYaml::StreamT& r)
|
|
|
|
{
|
|
|
|
id.clear();
|
|
|
|
if (auto rec = r.enterSubRecord("CNST"))
|
|
|
|
id.read(r);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void ChildResourceFactory<IDType>::_write(typename WriteYaml::StreamT& w) const
|
|
|
|
{
|
|
|
|
if (id)
|
|
|
|
if (auto rec = w.enterSubRecord("CNST"))
|
|
|
|
id.write(w);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void ChildResourceFactory<IDType>::_binarySize(typename BinarySize::StreamT& s) const
|
|
|
|
{
|
|
|
|
if (id)
|
|
|
|
id.binarySize(s);
|
|
|
|
s += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void ChildResourceFactory<IDType>::_read(typename Read::StreamT& r)
|
|
|
|
{
|
|
|
|
id.clear();
|
|
|
|
uint32_t clsId;
|
|
|
|
r.readBytesToBuf(&clsId, 4);
|
|
|
|
if (clsId == SBIG('CNST'))
|
|
|
|
id.read(r);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
void ChildResourceFactory<IDType>::_write(typename Write::StreamT& w) const
|
|
|
|
{
|
|
|
|
if (id)
|
|
|
|
{
|
|
|
|
w.writeBytes((atInt8*)"CNST", 4);
|
|
|
|
id.write(w);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
w.writeBytes((atInt8*)"NONE", 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
AT_SUBSPECIALIZE_DNA_YAML(ChildResourceFactory<UniqueID32>)
|
|
|
|
AT_SUBSPECIALIZE_DNA_YAML(ChildResourceFactory<UniqueID64>)
|
|
|
|
|
|
|
|
template struct ChildResourceFactory<UniqueID32>;
|
|
|
|
template struct ChildResourceFactory<UniqueID64>;
|
|
|
|
|
2016-02-02 04:29:58 +00:00
|
|
|
}
|