From dd75a37b66c738d7ba0b1ee86f038a2d8a04d817 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 1 Feb 2016 18:29:58 -1000 Subject: [PATCH] Initial round of particle factories --- DataSpec/DNACommon/CMakeLists.txt | 7 +- DataSpec/DNACommon/ELSC.hpp | 6 + DataSpec/DNACommon/PART.hpp | 323 +++++++++++++++ DataSpec/DNACommon/ParticleCommon.cpp | 367 ++++++++++++++++++ DataSpec/DNACommon/ParticleCommon.hpp | 339 ++++++++++++++++ DataSpec/DNACommon/SWHC.hpp | 4 + Editor/CMakeLists.txt | 5 +- Editor/EffectEditor.cpp | 6 - Editor/ParticleEditor.cpp | 6 + .../{EffectEditor.hpp => ParticleEditor.hpp} | 12 +- Editor/Resource.cpp | 14 + Editor/Resource.hpp | 50 +++ Editor/Space.cpp | 2 +- hecl | 2 +- 14 files changed, 1129 insertions(+), 14 deletions(-) create mode 100644 DataSpec/DNACommon/ELSC.hpp create mode 100644 DataSpec/DNACommon/PART.hpp create mode 100644 DataSpec/DNACommon/ParticleCommon.cpp create mode 100644 DataSpec/DNACommon/ParticleCommon.hpp create mode 100644 DataSpec/DNACommon/SWHC.hpp delete mode 100644 Editor/EffectEditor.cpp create mode 100644 Editor/ParticleEditor.cpp rename Editor/{EffectEditor.hpp => ParticleEditor.hpp} (76%) create mode 100644 Editor/Resource.cpp create mode 100644 Editor/Resource.hpp diff --git a/DataSpec/DNACommon/CMakeLists.txt b/DataSpec/DNACommon/CMakeLists.txt index 0afec4e45..6ca52ff02 100644 --- a/DataSpec/DNACommon/CMakeLists.txt +++ b/DataSpec/DNACommon/CMakeLists.txt @@ -1,7 +1,8 @@ make_dnalist(liblist CMDL MAPA - EGMC) + EGMC + ParticleCommon) add_library(DNACommon DNACommon.hpp DNACommon.cpp @@ -14,6 +15,10 @@ add_library(DNACommon TXTR.hpp TXTR.cpp ANCS.hpp ANIM.hpp ANIM.cpp + PART.hpp + SWHC.hpp + ELSC.hpp + ParticleCommon.cpp DeafBabe.hpp BabeDead.hpp Tweaks/ITweakGame.hpp diff --git a/DataSpec/DNACommon/ELSC.hpp b/DataSpec/DNACommon/ELSC.hpp new file mode 100644 index 000000000..1ee2b859e --- /dev/null +++ b/DataSpec/DNACommon/ELSC.hpp @@ -0,0 +1,6 @@ +#ifndef __COMMON_ELSC_HPP__ +#define __COMMON_ELSC_HPP__ + +#include "ParticleCommon.hpp" + +#endif // __COMMON_ELSC_HPP__ diff --git a/DataSpec/DNACommon/PART.hpp b/DataSpec/DNACommon/PART.hpp new file mode 100644 index 000000000..f88299cb8 --- /dev/null +++ b/DataSpec/DNACommon/PART.hpp @@ -0,0 +1,323 @@ +#ifndef __COMMON_PART_HPP__ +#define __COMMON_PART_HPP__ + +#include "ParticleCommon.hpp" + +namespace Retro +{ +namespace DNAParticle +{ + +template +struct GPSM : BigYAML +{ + static const char* DNAType() {return "Retro::GPSM";} + const char* DNATypeV() const {return DNAType();} + + RealElement x118_LFOR; + ChildGeneratorDesc xa4_IDTS; + + void read(Athena::io::YAMLDocReader& r) + { + if (r.enterSubRecord("LFOR")) + { + x118_LFOR.read(r); + r.leaveSubRecord(); + } + if (r.enterSubRecord("IDTS")) + { + xa4_IDTS.read(r); + r.leaveSubRecord(); + } + if (r.enterSubRecord("EMTR")) + { + + r.leaveSubRecord(); + } + if (r.enterSubRecord("COLR")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("CIND")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("AAPH")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("CSSD")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("GRTE")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("COLR")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("FXLL")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("ICTS")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("KSSM")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("ILOC")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("IITS")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("IVEC")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("LDIR")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("COLR")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("LCLR")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("LENG")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("MAXP")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("LOFF")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("LINT")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("LINE")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("LFOT")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("LIT_")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("LTME")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("LSLA")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("LTYP")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("NDSY")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("MBSP")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("MBLR")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("NCSY")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PISY")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("OPTS")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PMAB")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("SESD")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PSLT")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PMSC")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PMOP")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PMDL")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PMOO")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PMRT")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("POFS")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PMUS")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PSIV")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("ROTA")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PSVM")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PSTS")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PSOV")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PSWT")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PMLC")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PMED")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("PMOO")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("VEL1")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("SSSD")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("SORT")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("SIZE")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("SISY")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("SSPO")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("TEXR")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("SSWH")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("TIND")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("VMD4")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("VMD1")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("VEL4")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("VEL3")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("VMD3")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("ZBUF")) + { + r.leaveSubRecord(); + } + if (r.enterSubRecord("WIDT")) + { + r.leaveSubRecord(); + } + } + void write(Athena::io::YAMLDocWriter& w) const + { + + } + size_t binarySize(size_t __isz) const + { + + } + void read(Athena::io::IStreamReader& r) + { + + } + void write(Athena::io::IStreamWriter& w) const + { + + } +}; + +} +} + +#endif // __COMMON_PART_HPP__ diff --git a/DataSpec/DNACommon/ParticleCommon.cpp b/DataSpec/DNACommon/ParticleCommon.cpp new file mode 100644 index 000000000..d32462c9f --- /dev/null +++ b/DataSpec/DNACommon/ParticleCommon.cpp @@ -0,0 +1,367 @@ +#include "ParticleCommon.hpp" + +namespace Retro +{ +namespace DNAParticle +{ + +void RealElementFactory::read(Athena::io::YAMLDocReader& r) +{ + if (r.enterSubRecord("LFTW")) + { + m_elem.reset(new struct RELifetimeTween); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("CNST")) + { + m_elem.reset(new struct REConstant); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("CHAN")) + { + m_elem.reset(new struct RETimeChain); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("ADD_")) + { + m_elem.reset(new struct REAdd); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("CLMP")) + { + m_elem.reset(new struct REClamp); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("KEYE")) + { + m_elem.reset(new struct REKeyframeEmitter); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("IRND")) + { + m_elem.reset(new struct REInitialRandom); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("KEYP")) + { + m_elem.reset(new struct REKeyframeEmitterP); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("RAND")) + { + m_elem.reset(new struct RERandom); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("MULT")) + { + m_elem.reset(new struct REMultiply); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("PULS")) + { + m_elem.reset(new struct REPulse); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("SCAL")) + { + m_elem.reset(new struct RETimeScale); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("RLPT")) + { + m_elem.reset(new struct RELifetimePercent); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("SINE")) + { + m_elem.reset(new struct RESineWave); + m_elem->read(r); + r.leaveSubRecord(); + } + else + m_elem.reset(); +} + +void RealElementFactory::write(Athena::io::YAMLDocWriter& w) const +{ + if (m_elem) + { + w.enterSubRecord(m_elem->ClassName()); + m_elem->write(w); + w.leaveSubRecord(); + } +} + +size_t RealElementFactory::binarySize(size_t __isz) const +{ + if (m_elem) + return m_elem->binarySize(__isz + 4); + else + return __isz + 4; +} + +void RealElementFactory::read(Athena::io::IStreamReader& r) +{ + 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'): + m_elem.reset(new struct REKeyframeEmitter); + break; + case SBIG('IRND'): + m_elem.reset(new struct REInitialRandom); + break; + case SBIG('KEYP'): + m_elem.reset(new struct REKeyframeEmitterP); + 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; + default: + m_elem.reset(); + return; + } + m_elem->read(r); +} + +void RealElementFactory::write(Athena::io::IStreamWriter& w) const +{ + if (m_elem) + { + w.writeBytes((atInt8*)m_elem->ClassName(), 4); + m_elem->write(w); + } + else + w.writeBytes((atInt8*)"NONE", 4); +} + + +void IntElementFactory::read(Athena::io::YAMLDocReader& r) +{ + if (r.enterSubRecord("KEYE")) + { + m_elem.reset(new struct IEKeyframeEmitter); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("DETH")) + { + m_elem.reset(new struct IEDeath); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("CLMP")) + { + m_elem.reset(new struct IEClamp); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("CHAN")) + { + m_elem.reset(new struct IETimeChain); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("ADD_")) + { + m_elem.reset(new struct IEAdd); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("CNST")) + { + m_elem.reset(new struct IEConstant); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("IMPL")) + { + m_elem.reset(new struct IEImpulse); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("ILPT")) + { + m_elem.reset(new struct IELifetimePercent); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("IRND")) + { + m_elem.reset(new struct IEInitialRandom); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("PULS")) + { + m_elem.reset(new struct IEPulse); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("MULT")) + { + m_elem.reset(new struct IEMultiply); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("KEYP")) + { + m_elem.reset(new struct IEKeyframeEmitterP); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("SPAH")) + { + m_elem.reset(new struct IESampleAndHold); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("RAND")) + { + m_elem.reset(new struct IERandom); + m_elem->read(r); + r.leaveSubRecord(); + } + else if (r.enterSubRecord("TSCL")) + { + m_elem.reset(new struct IETimeScale); + m_elem->read(r); + r.leaveSubRecord(); + } + else + m_elem.reset(); +} + +void IntElementFactory::write(Athena::io::YAMLDocWriter& w) const +{ + if (m_elem) + { + w.enterSubRecord(m_elem->ClassName()); + m_elem->write(w); + w.leaveSubRecord(); + } +} + +size_t IntElementFactory::binarySize(size_t __isz) const +{ + if (m_elem) + return m_elem->binarySize(__isz + 4); + else + return __isz + 4; +} + +void IntElementFactory::read(Athena::io::IStreamReader& r) +{ + uint32_t clsId; + r.readBytesToBuf(&clsId, 4); + switch (clsId) + { + case SBIG('KEYE'): + 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('KEYP'): + m_elem.reset(new struct IEKeyframeEmitterP); + 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; + default: + m_elem.reset(); + return; + } + m_elem->read(r); +} + +void IntElementFactory::write(Athena::io::IStreamWriter& w) const +{ + if (m_elem) + { + w.writeBytes((atInt8*)m_elem->ClassName(), 4); + m_elem->write(w); + } + else + w.writeBytes((atInt8*)"NONE", 4); +} + +} +} diff --git a/DataSpec/DNACommon/ParticleCommon.hpp b/DataSpec/DNACommon/ParticleCommon.hpp new file mode 100644 index 000000000..40b20213b --- /dev/null +++ b/DataSpec/DNACommon/ParticleCommon.hpp @@ -0,0 +1,339 @@ +#ifndef __COMMON_PARTICLECOMMON_HPP__ +#define __COMMON_PARTICLECOMMON_HPP__ + +#include "DNACommon.hpp" + +namespace Retro +{ +namespace DNAParticle +{ + +struct IElement : BigYAML +{ + Delete _d; + virtual ~IElement() = default; + virtual const char* ClassName() const=0; +}; + +struct IRealElement : IElement {Delete _d;}; +struct RealElementFactory : BigYAML +{ + Delete _d; + std::unique_ptr m_elem; + + void read(Athena::io::YAMLDocReader& r); + void write(Athena::io::YAMLDocWriter& w) const; + size_t binarySize(size_t __isz) const; + void read(Athena::io::IStreamReader& r); + void write(Athena::io::IStreamWriter& w) const; +}; + +struct IIntElement : IElement {Delete _d;}; +struct IntElementFactory : BigYAML +{ + Delete _d; + std::unique_ptr m_elem; + + void read(Athena::io::YAMLDocReader& r); + void write(Athena::io::YAMLDocWriter& w) const; + size_t binarySize(size_t __isz) const; + void read(Athena::io::IStreamReader& r); + void write(Athena::io::IStreamWriter& w) const; +}; + +struct RELifetimeTween : IRealElement +{ + DECL_YAML + RealElementFactory a; + RealElementFactory b; + const char* ClassName() const {return "LFTW";} +}; + +struct REConstant : IRealElement +{ + DECL_YAML + Value val; + const char* ClassName() const {return "CNST";} +}; + +struct RETimeChain : IRealElement +{ + DECL_YAML + RealElementFactory a; + RealElementFactory b; + IntElementFactory c; + const char* ClassName() const {return "CHAN";} +}; + +struct REAdd : IRealElement +{ + DECL_YAML + RealElementFactory a; + RealElementFactory b; + const char* ClassName() const {return "ADD_";} +}; + +struct REClamp : IRealElement +{ + DECL_YAML + RealElementFactory a; + RealElementFactory b; + RealElementFactory c; + const char* ClassName() const {return "CLMP";} +}; + +struct REKeyframeEmitter : IRealElement +{ + DECL_YAML + Value a; + Value b; + Value c; + Value d; + Value e; + Value f; + Value count; + Vector keys; + const char* ClassName() const {return "KEYE";} +}; + +struct REInitialRandom : IRealElement +{ + DECL_YAML + RealElementFactory a; + RealElementFactory b; + const char* ClassName() const {return "IRND";} +}; + +struct REKeyframeEmitterP : REKeyframeEmitter +{ + Delete _d; + const char* ClassName() const {return "KEYP";} +}; + +struct RERandom : IRealElement +{ + DECL_YAML + RealElementFactory a; + RealElementFactory b; + const char* ClassName() const {return "RAND";} +}; + +struct REMultiply : IRealElement +{ + DECL_YAML + RealElementFactory a; + RealElementFactory b; + const char* ClassName() const {return "MULT";} +}; + +struct REPulse : IRealElement +{ + DECL_YAML + IntElementFactory a; + IntElementFactory b; + RealElementFactory c; + RealElementFactory d; + const char* ClassName() const {return "PULS";} +}; + +struct RETimeScale : IRealElement +{ + DECL_YAML + RealElementFactory a; + const char* ClassName() const {return "SCAL";} +}; + +struct RELifetimePercent : IRealElement +{ + DECL_YAML + RealElementFactory a; + const char* ClassName() const {return "RLPT";} +}; + +struct RESineWave : IRealElement +{ + DECL_YAML + RealElementFactory a; + RealElementFactory b; + RealElementFactory c; + const char* ClassName() const {return "SINE";} +}; + +struct IEKeyframeEmitter : IIntElement +{ + DECL_YAML + Value a; + Value b; + Value c; + Value d; + Value e; + Value f; + Value count; + Vector keys; + const char* ClassName() const {return "KEYE";} +}; + +struct IEDeath : IIntElement +{ + DECL_YAML + IntElementFactory a; + IntElementFactory b; + const char* ClassName() const {return "DETH";} +}; + +struct IEClamp : IIntElement +{ + DECL_YAML + IntElementFactory a; + IntElementFactory b; + IntElementFactory c; + const char* ClassName() const {return "CLMP";} +}; + +struct IETimeChain : IIntElement +{ + DECL_YAML + IntElementFactory a; + IntElementFactory b; + IntElementFactory c; + const char* ClassName() const {return "CHAN";} +}; + +struct IEAdd : IIntElement +{ + DECL_YAML + IntElementFactory a; + IntElementFactory b; + const char* ClassName() const {return "ADD_";} +}; + +struct IEConstant : IIntElement +{ + DECL_YAML + Value val; + const char* ClassName() const {return "CNST";} +}; + +struct IEImpulse : IIntElement +{ + DECL_YAML + IntElementFactory a; + const char* ClassName() const {return "IMPL";} +}; + +struct IELifetimePercent : IIntElement +{ + DECL_YAML + IntElementFactory a; + const char* ClassName() const {return "ILPT";} +}; + +struct IEInitialRandom : IIntElement +{ + DECL_YAML + IntElementFactory a; + IntElementFactory b; + const char* ClassName() const {return "IRND";} +}; + +struct IEPulse : IIntElement +{ + DECL_YAML + IntElementFactory a; + IntElementFactory b; + IntElementFactory c; + IntElementFactory d; + const char* ClassName() const {return "PULS";} +}; + +struct IEMultiply : IIntElement +{ + DECL_YAML + IntElementFactory a; + IntElementFactory b; + const char* ClassName() const {return "MULT";} +}; + +struct IEKeyframeEmitterP : IEKeyframeEmitter +{ + Delete _d; + const char* ClassName() const {return "KEYP";} +}; + +struct IESampleAndHold : IIntElement +{ + DECL_YAML + IntElementFactory a; + IntElementFactory b; + IntElementFactory c; + const char* ClassName() const {return "SPAH";} +}; + +struct IERandom : IIntElement +{ + DECL_YAML + IntElementFactory a; + IntElementFactory b; + const char* ClassName() const {return "RAND";} +}; + +struct IETimeScale : IIntElement +{ + DECL_YAML + RealElementFactory a; + const char* ClassName() const {return "TSCL";} +}; + + +template +struct ChildGeneratorDesc : BigYAML +{ + Delete _d; + IDType id; + void read(Athena::io::YAMLDocReader& r) + { + id.clear(); + if (r.enterSubRecord("CNST")) + { + id.read(r); + r.leaveSubRecord(); + } + } + void write(Athena::io::YAMLDocWriter& w) const + { + if (id) + { + w.enterSubRecord("CNST"); + id.write(w); + w.leaveSubRecord(); + } + } + size_t binarySize(size_t __isz) const + { + if (id) + return __isz + 8; + else + return __isz + 4; + } + void read(Athena::io::IStreamReader& r) + { + id.clear(); + if (r.readUint32Big() == 'CNST') + id.read(r); + } + void write(Athena::io::IStreamWriter& w) const + { + if (id) + { + w.writeUint32Big('CNST'); + id.write(w); + } + else + w.writeUint32Big('NONE'); + } +}; + +} +} + +#endif // __COMMON_PARTICLECOMMON_HPP__ diff --git a/DataSpec/DNACommon/SWHC.hpp b/DataSpec/DNACommon/SWHC.hpp new file mode 100644 index 000000000..fc487a095 --- /dev/null +++ b/DataSpec/DNACommon/SWHC.hpp @@ -0,0 +1,4 @@ +#ifndef __COMMON_SWHC_HPP__ +#define __COMMON_SWHC_HPP__ + +#endif // __COMMON_SWHC_HPP__ diff --git a/Editor/CMakeLists.txt b/Editor/CMakeLists.txt index f6c2ed2ee..c289bafb9 100644 --- a/Editor/CMakeLists.txt +++ b/Editor/CMakeLists.txt @@ -19,7 +19,7 @@ endif() atdna(atdna_Space.cpp Space.hpp) atdna(atdna_ResourceBrowser.cpp ResourceBrowser.hpp) atdna(atdna_ModelViewer.cpp ModelViewer.hpp) -atdna(atdna_EffectEditor.cpp EffectEditor.hpp) +atdna(atdna_ParticleEditor.cpp ParticleEditor.hpp) if(WIN32) set(PLAT_SRCS platforms/win/urde.rc) @@ -39,9 +39,10 @@ add_executable(urde WIN32 MACOSX_BUNDLE SplashScreen.hpp SplashScreen.cpp ResourceBrowser.hpp ResourceBrowser.cpp atdna_ResourceBrowser.cpp ModelViewer.hpp ModelViewer.cpp atdna_ModelViewer.cpp - EffectEditor.hpp EffectEditor.cpp atdna_EffectEditor.cpp + ParticleEditor.hpp ParticleEditor.cpp atdna_ParticleEditor.cpp ProjectManager.hpp ProjectManager.cpp ViewManager.hpp ViewManager.cpp + Resource.hpp Resource.cpp Camera.hpp Camera.cpp) target_link_libraries(urde diff --git a/Editor/EffectEditor.cpp b/Editor/EffectEditor.cpp deleted file mode 100644 index 2f6e60a72..000000000 --- a/Editor/EffectEditor.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "EffectEditor.hpp" - -namespace URDE -{ - -} diff --git a/Editor/ParticleEditor.cpp b/Editor/ParticleEditor.cpp new file mode 100644 index 000000000..a13aa1464 --- /dev/null +++ b/Editor/ParticleEditor.cpp @@ -0,0 +1,6 @@ +#include "ParticleEditor.hpp" + +namespace URDE +{ + +} diff --git a/Editor/EffectEditor.hpp b/Editor/ParticleEditor.hpp similarity index 76% rename from Editor/EffectEditor.hpp rename to Editor/ParticleEditor.hpp index 159f6e86f..779f59ba6 100644 --- a/Editor/EffectEditor.hpp +++ b/Editor/ParticleEditor.hpp @@ -1,5 +1,5 @@ -#ifndef URDE_EFFECT_EDITOR_HPP -#define URDE_EFFECT_EDITOR_HPP +#ifndef URDE_PARTICLE_EDITOR_HPP +#define URDE_PARTICLE_EDITOR_HPP #include "Space.hpp" @@ -15,6 +15,12 @@ class EffectEditor : public EditorSpace } m_state; const Space::State& spaceState() const {return m_state;} + struct View : Specter::View + { + View(Specter::ViewResources& res, Specter::View& parent) + : Specter::View(res, parent) {} + }; + Specter::View* buildContentView(Specter::ViewResources& res) { return nullptr; @@ -36,4 +42,4 @@ public: } -#endif // URDE_EFFECT_EDITOR_HPP +#endif // URDE_PARTICLE_EDITOR_HPP diff --git a/Editor/Resource.cpp b/Editor/Resource.cpp new file mode 100644 index 000000000..186aa559e --- /dev/null +++ b/Editor/Resource.cpp @@ -0,0 +1,14 @@ +#include "Resource.hpp" + +namespace URDE +{ + +Space::Class Resource::DeduceDefaultSpaceClass(const HECL::ProjectPath& path) +{ + Athena::io::FileReader r(path.getAbsolutePath(), 32*1024, false); + if (r.hasError()) + return Space::Class::None; + return Space::Class::None; +} + +} diff --git a/Editor/Resource.hpp b/Editor/Resource.hpp new file mode 100644 index 000000000..fe85f8e2f --- /dev/null +++ b/Editor/Resource.hpp @@ -0,0 +1,50 @@ +#ifndef URDE_RESOURCE_HPP +#define URDE_RESOURCE_HPP + +#include +#include "Space.hpp" + +namespace URDE +{ + +/** Combines a ProjectPath with actively used Space references + * + * This class is intended to be heap-allocated in a hierarchical mapping, so the entire tree + * of resources is available in-memory to systems that need it. Refreshes of the index will + * continue to use existing allocations that haven't been deleted. + * + * The key purpose of this class is to centrally register observer-nodes for resources that + * are updated via editing, or external file changes. + */ +class Resource +{ +public: + using ProjectDataSpec = HECL::Database::Project::ProjectDataSpec; +private: + HECL::ProjectPath m_path; + Space::Class m_defaultClass = Space::Class::None; + EditorSpace* m_editingSpace = nullptr; + std::vector m_viewingSpaces; +public: + static Space::Class DeduceDefaultSpaceClass(const HECL::ProjectPath& path); + explicit Resource(HECL::ProjectPath&& path) + : m_path(std::move(path)), m_defaultClass(DeduceDefaultSpaceClass(m_path)) {} + const HECL::ProjectPath& path() const {return m_path;} +}; + +/** Provides centralized hierarchical lookup and ownership of Resource nodes */ +class ResourceTree +{ +public: + struct Node + { + std::map> m_subnodes; + std::map> m_resources; + }; +private: + std::unique_ptr m_rootNode; +}; + +} + +#endif // URDE_RESOURCE_HPP diff --git a/Editor/Space.cpp b/Editor/Space.cpp index 67cd1b265..f1d58f9f6 100644 --- a/Editor/Space.cpp +++ b/Editor/Space.cpp @@ -1,7 +1,7 @@ #include "Space.hpp" #include "ViewManager.hpp" #include "ResourceBrowser.hpp" -#include "EffectEditor.hpp" +#include "ParticleEditor.hpp" #include "icons/icons.hpp" namespace URDE diff --git a/hecl b/hecl index 3a8130b86..af0acd9fe 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 3a8130b8609cf91cd9f75a951f0eed16037d2618 +Subproject commit af0acd9fe8a7678e052697db2b7ff175d1f91abc