Commit 5dd72b97 authored by Jack Andersen's avatar Jack Andersen

Less resource-intensive particle metaclass system

parent 8e33cb82
......@@ -8,8 +8,8 @@
namespace DataSpec::DNAParticle {
template struct CPImpl<_CRSM<UniqueID32>>;
template struct CPImpl<_CRSM<UniqueID64>>;
template struct PPImpl<_CRSM<UniqueID32>>;
template struct PPImpl<_CRSM<UniqueID64>>;
AT_SUBSPECIALIZE_DNA_YAML(PPImpl<_CRSM<UniqueID32>>)
AT_SUBSPECIALIZE_DNA_YAML(PPImpl<_CRSM<UniqueID64>>)
......
This diff is collapsed.
......@@ -7,8 +7,8 @@
namespace DataSpec::DNAParticle {
template struct DPImpl<_DPSM<UniqueID32>>;
template struct DPImpl<_DPSM<UniqueID64>>;
template struct PPImpl<_DPSM<UniqueID32>>;
template struct PPImpl<_DPSM<UniqueID64>>;
AT_SUBSPECIALIZE_DNA_YAML(PPImpl<_DPSM<UniqueID32>>)
AT_SUBSPECIALIZE_DNA_YAML(PPImpl<_DPSM<UniqueID64>>)
......
......@@ -19,169 +19,89 @@ class ProjectPath;
namespace DataSpec::DNAParticle {
class DPUtils {
template<std::size_t _Idx, typename _Key, typename _Tuple>
struct _Match;
template<std::size_t _Idx, typename _Key, typename _First, typename... _Rest>
struct _Match<_Idx, _Key, std::tuple<_First, _Rest...>>
: _Match<_Idx + 1, _Key, std::tuple<_Rest...>> {};
template<std::size_t _Idx, typename _First, typename... _Rest>
struct _Match<_Idx, typename _First::FourCC, std::tuple<_First, _Rest...>>
{ using Type = _First; static constexpr bool IsDP = _First::IsDP; };
template<bool _IsCP, std::size_t _Idx, typename _Element, typename _ExistingTuple>
struct _AppendElement;
template<std::size_t _Idx, typename _Element, typename... _Existing>
struct _AppendElement<true, _Idx, _Element, std::tuple<_Existing...>> {
using Tuple = typename _Element::template Expand<_Idx, _Existing...>::Tuple;
};
template<std::size_t _Idx, typename _Element, typename... _Existing>
struct _AppendElement<false, _Idx, _Element, std::tuple<_Existing...>> {
using Tuple = std::tuple<_Existing..., _Element>;
template <class IDType>
struct _DPSM {
static constexpr ParticleType Type = ParticleType::DPSM;
struct SQuadDescr {
IntElementFactory x0_LFT;
RealElementFactory x4_SZE;
RealElementFactory x8_ROT;
VectorElementFactory xc_OFF;
ColorElementFactory x10_CLR;
UVElementFactory<IDType> x14_TEX;
bool x18_ADD = false;
};
template<std::size_t _Idx, typename _OutTuple, typename _Tuple>
struct _ExpandTuple { using Tuple = _OutTuple; };
template<std::size_t _Idx, typename _OutTuple, typename _First, typename... _Rest>
struct _ExpandTuple<_Idx, _OutTuple, std::tuple<_First, _Rest...>>
: _ExpandTuple<_Idx + 1, typename _AppendElement<_First::IsDP, _Idx, _First, _OutTuple>::Tuple,
std::tuple<_Rest...>> {};
public:
template<auto _Key, typename _Props>
using GetElement = _Match<0, std::integral_constant<decltype(_Key), _Key>, typename _Props::PropsTuple>;
template<typename _PropsTuple>
using ExpandTuple = _ExpandTuple<0, std::tuple<>, _PropsTuple>;
template<auto _Key, typename _Props>
static constexpr decltype(auto) GetQuad(_Props& p, std::size_t idx) {
using Elem = typename GetElement<_Key, _Props>::Type;
static_assert(Elem::IsDP, "GetQuad may only be used to look up quad properties");
if constexpr (Elem::IsDP) {
if (idx)
return PPUtils::Get<Elem::Type::FCC2::value>(p);
else
return PPUtils::Get<Elem::Type::FCC1::value>(p);
}
SQuadDescr x0_quad;
SQuadDescr x1c_quad;
ChildResourceFactory<IDType> x38_DMDL;
IntElementFactory x48_DLFT;
VectorElementFactory x4c_DMOP;
VectorElementFactory x50_DMRT;
VectorElementFactory x54_DMSC;
ColorElementFactory x58_DMCL;
bool x5c_24_DMAB = false;
bool x5c_25_DMOO = false;
template<typename _Func>
void constexpr Enumerate(_Func f) {
f(FOURCC('1LFT'), x0_quad.x0_LFT);
f(FOURCC('1SZE'), x0_quad.x4_SZE);
f(FOURCC('1ROT'), x0_quad.x8_ROT);
f(FOURCC('1OFF'), x0_quad.xc_OFF);
f(FOURCC('1CLR'), x0_quad.x10_CLR);
f(FOURCC('1TEX'), x0_quad.x14_TEX);
f(FOURCC('1ADD'), x0_quad.x18_ADD);
f(FOURCC('2LFT'), x1c_quad.x0_LFT);
f(FOURCC('2SZE'), x1c_quad.x4_SZE);
f(FOURCC('2ROT'), x1c_quad.x8_ROT);
f(FOURCC('2OFF'), x1c_quad.xc_OFF);
f(FOURCC('2CLR'), x1c_quad.x10_CLR);
f(FOURCC('2TEX'), x1c_quad.x14_TEX);
f(FOURCC('2ADD'), x1c_quad.x18_ADD);
f(FOURCC('DMDL'), x38_DMDL);
f(FOURCC('DLFT'), x48_DLFT);
f(FOURCC('DMOP'), x4c_DMOP);
f(FOURCC('DMRT'), x50_DMRT);
f(FOURCC('DMSC'), x54_DMSC);
f(FOURCC('DMCL'), x58_DMCL);
f(FOURCC('DMAB'), x5c_24_DMAB);
f(FOURCC('DMOO'), x5c_25_DMOO);
}
};
template <auto _FCC, auto _FCC1, auto _FCC2, typename _Type>
struct DPS {
static constexpr bool IsBool = false;
static constexpr bool IsDP = true;
using FourCC = std::integral_constant<decltype(_FCC), _FCC>;
using FCC1 = std::integral_constant<decltype(_FCC1), _FCC1>;
using FCC2 = std::integral_constant<decltype(_FCC2), _FCC2>;
struct _ExpandDone {
template<std::size_t Index, typename... Existing>
using Tuple = std::tuple<Existing...>;
};
template<typename FCC, typename Next>
struct _Expand {
template<std::size_t Index, typename... Existing>
using Tuple =
std::conditional_t<FCC::value != typename FCC::value_type(0),
typename Next::template Tuple<Index, Existing..., PP<FCC::value, _Type>>,
typename Next::template Tuple<Index, Existing...>>;
};
template<std::size_t Index, typename... Existing>
struct Expand {
using Tuple = typename _Expand<FCC1, _Expand<FCC2, _ExpandDone>>::template Tuple<Index, Existing...>;
};
};
template <ParticleType _Type, typename _PropsTuple, auto... _SortedTypes>
struct DPSet : _PPSet<typename DPUtils::ExpandTuple<_PropsTuple>::Tuple, _SortedTypes...> {
static constexpr ParticleType Type = _Type;
using Self = DPSet<_Type, _PropsTuple, _SortedTypes...>;
using Base = _PPSet<typename DPUtils::ExpandTuple<_PropsTuple>::Tuple, _SortedTypes...>;
using RawPropsTuple = _PropsTuple;
typename Base::PropsTuple m_props;
typename Base::PropsBitset m_boolProps;
DPSet() {
std::apply([&](auto&&... p) {
([&](auto&& p) {
using Tp = std::decay_t<decltype(p)>;
if constexpr (Tp::IsBool)
if constexpr (Tp::DefaultBool::value)
m_boolProps[PPUtils::GetStoreIndex<Tp, Base>::Index] = true;
}(p), ...);
}, m_props);
template<typename _Func>
bool constexpr Lookup(FourCC fcc, _Func f) {
switch (fcc.toUint32()) {
case SBIG('1LFT'): f(x0_quad.x0_LFT); return true;
case SBIG('1SZE'): f(x0_quad.x4_SZE); return true;
case SBIG('1ROT'): f(x0_quad.x8_ROT); return true;
case SBIG('1OFF'): f(x0_quad.xc_OFF); return true;
case SBIG('1CLR'): f(x0_quad.x10_CLR); return true;
case SBIG('1TEX'): f(x0_quad.x14_TEX); return true;
case SBIG('1ADD'): f(x0_quad.x18_ADD); return true;
case SBIG('2LFT'): f(x1c_quad.x0_LFT); return true;
case SBIG('2SZE'): f(x1c_quad.x4_SZE); return true;
case SBIG('2ROT'): f(x1c_quad.x8_ROT); return true;
case SBIG('2OFF'): f(x1c_quad.xc_OFF); return true;
case SBIG('2CLR'): f(x1c_quad.x10_CLR); return true;
case SBIG('2TEX'): f(x1c_quad.x14_TEX); return true;
case SBIG('2ADD'): f(x1c_quad.x18_ADD); return true;
case SBIG('DMDL'): f(x38_DMDL); return true;
case SBIG('DLFT'): f(x48_DLFT); return true;
case SBIG('DMOP'): f(x4c_DMOP); return true;
case SBIG('DMRT'): f(x50_DMRT); return true;
case SBIG('DMSC'): f(x54_DMSC); return true;
case SBIG('DMCL'): f(x58_DMCL); return true;
default: return false;
}
}
};
template <typename _Basis>
struct DPImpl : PPImpl<_Basis> {
using Base = PPImpl<_Basis>;
using EDP = typename _Basis::EDP;
template<EDP _Key>
decltype(auto) getQuad(std::size_t idx) { return DPUtils::GetQuad<_Key>(Base::m_props, idx); }
};
template <class IDType>
struct _DPSM {
enum EPP : uint32_t {
_1LFT = SBIG('1LFT'), // x0
_1SZE = SBIG('1SZE'), // x4
_1ROT = SBIG('1ROT'), // x8
_1OFF = SBIG('1OFF'), // xc
_1CLR = SBIG('1CLR'), // x10
_1TEX = SBIG('1TEX'), // x14
_1ADD = SBIG('1ADD'), // x18
_2LFT = SBIG('2LFT'), // x1c
_2SZE = SBIG('2SZE'), // x20
_2ROT = SBIG('2ROT'), // x24
_2OFF = SBIG('2OFF'), // x28
_2CLR = SBIG('2CLR'), // x2c
_2TEX = SBIG('2TEX'), // x30
_2ADD = SBIG('2ADD'), // x34
DMDL = SBIG('DMDL'), // x38
DLFT = SBIG('DLFT'), // x48
DMOP = SBIG('DMOP'), // x4c
DMRT = SBIG('DMRT'), // x50
DMSC = SBIG('DMSC'), // x54
DMCL = SBIG('DMCL'), // x58
DMAB = SBIG('DMAB'), // x5c_24
DMOO = SBIG('DMOO'), // x5c_25
};
enum EDP : uint32_t {
LFT = SBIG(' LFT'), // x0
SZE = SBIG(' SZE'), // x4
ROT = SBIG(' ROT'), // x8
OFF = SBIG(' OFF'), // xc
CLR = SBIG(' CLR'), // x10
TEX = SBIG(' TEX'), // x14
ADD = SBIG(' ADD'), // x18
};
using Properties = DPSet<
ParticleType::DPSM,
std::tuple<
DPS<LFT, _1LFT, _2LFT, IntElementFactory>,
DPS<SZE, _1SZE, _2SZE, RealElementFactory>,
DPS<ROT, _1ROT, _2ROT, RealElementFactory>,
DPS<OFF, _1OFF, _2OFF, VectorElementFactory>,
DPS<CLR, _1CLR, _2CLR, ColorElementFactory>,
DPS<TEX, _1TEX, _2TEX, UVElementFactory<IDType>>,
DPS<ADD, _1ADD, _2ADD, bool>,
PP<DMDL, ChildResourceFactory<IDType>>,
PP<DLFT, IntElementFactory>,
PP<DMOP, VectorElementFactory>,
PP<DMRT, VectorElementFactory>,
PP<DMSC, VectorElementFactory>,
PP<DMCL, ColorElementFactory>,
PP<DMAB, bool>,
PP<DMOO, bool>>,
_1ADD, _1CLR, _1LFT, _1OFF, _1ROT, _1SZE, _1TEX, _2ADD, _2CLR, _2LFT, _2OFF, _2ROT, _2SZE, _2TEX, DLFT,
DMAB, DMCL, DMDL, DMOO, DMOP, DMRT, DMSC>;
};
extern template struct PPImpl<_DPSM<UniqueID32>>;
extern template struct PPImpl<_DPSM<UniqueID64>>;
template <class IDType>
using DPSM = DPImpl<_DPSM<IDType>>;
using DPSM = PPImpl<_DPSM<IDType>>;
template <class IDType>
bool ExtractDPSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
......
......@@ -15,55 +15,82 @@ namespace DataSpec::DNAParticle {
template <class IDType>
struct _ELSM {
enum EPP : uint32_t {
LIFE = SBIG('LIFE'), // x0
SLIF = SBIG('SLIF'), // x4
GRAT = SBIG('GRAT'), // x8
SCNT = SBIG('SCNT'), // xc
SSEG = SBIG('SSEG'), // x10
COLR = SBIG('COLR'), // x14
IEMT = SBIG('IEMT'), // x18
FEMT = SBIG('FEMT'), // x1c
AMPL = SBIG('AMPL'), // x20
AMPD = SBIG('AMPD'), // x24
LWD1 = SBIG('LWD1'), // x28
LWD2 = SBIG('LWD2'), // x2c
LWD3 = SBIG('LWD3'), // x30
LCL1 = SBIG('LCL1'), // x34
LCL2 = SBIG('LCL2'), // x38
LCL3 = SBIG('LCL3'), // x3c
SSWH = SBIG('SSWH'), // x40
GPSM = SBIG('GPSM'), // x50
EPSM = SBIG('EPSM'), // x60
ZERY = SBIG('ZERY'), // x70
};
using Properties = PPSet<
ParticleType::ELSM,
std::tuple<
PP<LIFE, IntElementFactory>,
PP<SLIF, IntElementFactory>,
PP<GRAT, RealElementFactory>,
PP<SCNT, IntElementFactory>,
PP<SSEG, IntElementFactory>,
PP<COLR, ColorElementFactory>,
PP<IEMT, EmitterElementFactory>,
PP<FEMT, EmitterElementFactory>,
PP<AMPL, RealElementFactory>,
PP<AMPD, RealElementFactory>,
PP<LWD1, RealElementFactory>,
PP<LWD2, RealElementFactory>,
PP<LWD3, RealElementFactory>,
PP<LCL1, ColorElementFactory>,
PP<LCL2, ColorElementFactory>,
PP<LCL3, ColorElementFactory>,
PP<SSWH, ChildResourceFactory<IDType>>,
PP<GPSM, ChildResourceFactory<IDType>>,
PP<EPSM, ChildResourceFactory<IDType>>,
PP<ZERY, bool>>,
AMPD, AMPL, COLR, EPSM, FEMT, GPSM, GRAT, IEMT, LCL1, LCL2, LCL3, LIFE, LWD1, LWD2, LWD3, SCNT, SLIF, SSEG,
SSWH, ZERY>;
};
static constexpr ParticleType Type = ParticleType::ELSM;
IntElementFactory x0_LIFE;
IntElementFactory x4_SLIF;
RealElementFactory x8_GRAT;
IntElementFactory xc_SCNT;
IntElementFactory x10_SSEG;
ColorElementFactory x14_COLR;
EmitterElementFactory x18_IEMT;
EmitterElementFactory x1c_FEMT;
RealElementFactory x20_AMPL;
RealElementFactory x24_AMPD;
RealElementFactory x28_LWD1;
RealElementFactory x2c_LWD2;
RealElementFactory x30_LWD3;
ColorElementFactory x34_LCL1;
ColorElementFactory x38_LCL2;
ColorElementFactory x3c_LCL3;
ChildResourceFactory<IDType> x40_SSWH;
ChildResourceFactory<IDType> x50_GPSM;
ChildResourceFactory<IDType> x60_EPSM;
bool x70_ZERY = false;
template<typename _Func>
void constexpr Enumerate(_Func f) {
f(FOURCC('LIFE'), x0_LIFE);
f(FOURCC('SLIF'), x4_SLIF);
f(FOURCC('GRAT'), x8_GRAT);
f(FOURCC('SCNT'), xc_SCNT);
f(FOURCC('SSEG'), x10_SSEG);
f(FOURCC('COLR'), x14_COLR);
f(FOURCC('IEMT'), x18_IEMT);
f(FOURCC('FEMT'), x1c_FEMT);
f(FOURCC('AMPL'), x20_AMPL);
f(FOURCC('AMPD'), x24_AMPD);
f(FOURCC('LWD1'), x28_LWD1);
f(FOURCC('LWD2'), x2c_LWD2);
f(FOURCC('LWD3'), x30_LWD3);
f(FOURCC('LCL1'), x34_LCL1);
f(FOURCC('LCL2'), x38_LCL2);
f(FOURCC('LCL3'), x3c_LCL3);
f(FOURCC('SSWH'), x40_SSWH);
f(FOURCC('GPSM'), x50_GPSM);
f(FOURCC('EPSM'), x60_EPSM);
f(FOURCC('ZERY'), x70_ZERY);
}
template<typename _Func>
bool constexpr Lookup(FourCC fcc, _Func f) {
switch (fcc.toUint32()) {
case SBIG('LIFE'): f(x0_LIFE); return true;
case SBIG('SLIF'): f(x4_SLIF); return true;
case SBIG('GRAT'): f(x8_GRAT); return true;
case SBIG('SCNT'): f(xc_SCNT); return true;
case SBIG('SSEG'): f(x10_SSEG); return true;
case SBIG('COLR'): f(x14_COLR); return true;
case SBIG('IEMT'): f(x18_IEMT); return true;
case SBIG('FEMT'): f(x1c_FEMT); return true;
case SBIG('AMPL'): f(x20_AMPL); return true;
case SBIG('AMPD'): f(x24_AMPD); return true;
case SBIG('LWD1'): f(x28_LWD1); return true;
case SBIG('LWD2'): f(x2c_LWD2); return true;
case SBIG('LWD3'): f(x30_LWD3); return true;
case SBIG('LCL1'): f(x34_LCL1); return true;
case SBIG('LCL2'): f(x38_LCL2); return true;
case SBIG('LCL3'): f(x3c_LCL3); return true;
case SBIG('SSWH'): f(x40_SSWH); return true;
case SBIG('GPSM'): f(x50_GPSM); return true;
case SBIG('EPSM'): f(x60_EPSM); return true;
case SBIG('ZERY'): f(x70_ZERY); return true;
default: return false;
}
}
};
extern template struct PPImpl<_ELSM<UniqueID32>>;
extern template struct PPImpl<_ELSM<UniqueID64>>;
template <class IDType>
using ELSM = PPImpl<_ELSM<IDType>>;
......
This diff is collapsed.
This diff is collapsed.
......@@ -17,71 +17,106 @@ namespace DataSpec::DNAParticle {
template <class IDType>
struct _SWSH {
enum EPP : uint32_t {
PSLT = SBIG('PSLT'), // x0
TIME = SBIG('TIME'), // x4
LRAD = SBIG('LRAD'), // x8
RRAD = SBIG('RRAD'), // xc
LENG = SBIG('LENG'), // x10
COLR = SBIG('COLR'), // x14
SIDE = SBIG('SIDE'), // x18
IROT = SBIG('IROT'), // x1c
ROTM = SBIG('ROTM'), // x20
POFS = SBIG('POFS'), // x24
IVEL = SBIG('IVEL'), // x28
NPOS = SBIG('NPOS'), // x2c
VELM = SBIG('VELM'), // x30
VLM2 = SBIG('VLM2'), // x34
SPLN = SBIG('SPLN'), // x38
TEXR = SBIG('TEXR'), // x3c
TSPN = SBIG('TSPN'), // x40
LLRD = SBIG('LLRD'), // x44_24
CROS = SBIG('CROS'), // x44_25
VLS1 = SBIG('VLS1'), // x44_26
VLS2 = SBIG('VLS2'), // x44_27
SROT = SBIG('SROT'), // x44_28
WIRE = SBIG('WIRE'), // x44_29
TEXW = SBIG('TEXW'), // x44_30
AALP = SBIG('AALP'), // x44_31
ZBUF = SBIG('ZBUF'), // x45_24
ORNT = SBIG('ORNT'), // x45_25
CRND = SBIG('CRND'), // x45_26
};
using Properties = PPSet<
ParticleType::SWSH,
std::tuple<
PP<PSLT, IntElementFactory>,
PP<TIME, RealElementFactory>,
PP<LRAD, RealElementFactory>,
PP<RRAD, RealElementFactory>,
PP<LENG, IntElementFactory>,
PP<COLR, ColorElementFactory>,
PP<SIDE, IntElementFactory>,
PP<IROT, RealElementFactory>,
PP<ROTM, RealElementFactory>,
PP<POFS, VectorElementFactory>,
PP<IVEL, VectorElementFactory>,
PP<NPOS, VectorElementFactory>,
PP<VELM, ModVectorElementFactory>,
PP<VLM2, ModVectorElementFactory>,
PP<SPLN, IntElementFactory>,
PP<TEXR, UVElementFactory<IDType>>,
PP<TSPN, IntElementFactory>,
PP<LLRD, bool>,
PP<CROS, bool, true>,
PP<VLS1, bool>,
PP<VLS2, bool>,
PP<SROT, bool>,
PP<WIRE, bool>,
PP<TEXW, bool>,
PP<AALP, bool>,
PP<ZBUF, bool>,
PP<ORNT, bool>,
PP<CRND, bool>>,
AALP, COLR, CRND, CROS, IROT, IVEL, LENG, LLRD, LRAD, NPOS, ORNT, POFS, PSLT, ROTM, RRAD, SIDE, SPLN, SROT,
TEXR, TEXW, TIME, TSPN, VELM, VLM2, VLS1, VLS2, WIRE, ZBUF>;
};
static constexpr ParticleType Type = ParticleType::SWSH;
IntElementFactory x0_PSLT;
RealElementFactory x4_TIME;
RealElementFactory x8_LRAD;
RealElementFactory xc_RRAD;
IntElementFactory x10_LENG;
ColorElementFactory x14_COLR;
IntElementFactory x18_SIDE;
RealElementFactory x1c_IROT;
RealElementFactory x20_ROTM;
VectorElementFactory x24_POFS;
VectorElementFactory x28_IVEL;
VectorElementFactory x2c_NPOS;
ModVectorElementFactory x30_VELM;
ModVectorElementFactory x34_VLM2;
IntElementFactory x38_SPLN;
UVElementFactory<IDType> x3c_TEXR;
IntElementFactory x40_TSPN;
bool x44_24_LLRD = false;
bool x44_25_CROS = true;
bool x44_26_VLS1 = false;
bool x44_27_VLS2 = false;
bool x44_28_SROT = false;
bool x44_29_WIRE = false;
bool x44_30_TEXW = false;
bool x44_31_AALP = false;
bool x45_24_ZBUF = false;
bool x45_25_ORNT = false;
bool x45_26_CRND = false;
template<typename _Func>
void constexpr Enumerate(_Func f) {
f(FOURCC('PSLT'), x0_PSLT);
f(FOURCC('TIME'), x4_TIME);
f(FOURCC('LRAD'), x8_LRAD);
f(FOURCC('RRAD'), xc_RRAD);
f(FOURCC('LENG'), x10_LENG);
f(FOURCC('COLR'), x14_COLR);
f(FOURCC('SIDE'), x18_SIDE);
f(FOURCC('IROT'), x1c_IROT);
f(FOURCC('ROTM'), x20_ROTM);
f(FOURCC('POFS'), x24_POFS);
f(FOURCC('IVEL'), x28_IVEL);
f(FOURCC('NPOS'), x2c_NPOS);
f(FOURCC('VELM'), x30_VELM);
f(FOURCC('VLM2'), x34_VLM2);
f(FOURCC('SPLN'), x38_SPLN);
f(FOURCC('TEXR'), x3c_TEXR);
f(FOURCC('TSPN'), x40_TSPN);
f(FOURCC('LLRD'), x44_24_LLRD);
f(FOURCC('CROS'), x44_25_CROS, true);
f(FOURCC('VLS1'), x44_26_VLS1);
f(FOURCC('VLS2'), x44_27_VLS2);
f(FOURCC('SROT'), x44_28_SROT);
f(FOURCC('WIRE'), x44_29_WIRE);
f(FOURCC('TEXW'), x44_30_TEXW);
f(FOURCC('AALP'), x44_31_AALP);
f(FOURCC('ZBUF'), x45_24_ZBUF);
f(FOURCC('ORNT'), x45_25_ORNT);
f(FOURCC('CRND'), x45_26_CRND);
}
template<typename _Func>
bool constexpr Lookup(FourCC fcc, _Func f) {
switch (fcc.toUint32()) {
case SBIG('PSLT'): f(x0_PSLT); return true;
case SBIG('TIME'): f(x4_TIME); return true;
case SBIG('LRAD'): f(x8_LRAD); return true;
case SBIG('RRAD'): f(xc_RRAD); return true;
case SBIG('LENG'): f(x10_LENG); return true;
case SBIG('COLR'): f(x14_COLR); return true;
case SBIG('SIDE'): f(x18_SIDE); return true;
case SBIG('IROT'): f(x1c_IROT); return true;
case SBIG('ROTM'): f(x20_ROTM); return true;
case SBIG('POFS'): f(x24_POFS); return true;
case SBIG('IVEL'): f(x28_IVEL); return true;
case SBIG('NPOS'): f(x2c_NPOS); return true;
case SBIG('VELM'): f(x30_VELM); return true;
case SBIG('VLM2'): f(x34_VLM2); return true;
case SBIG('SPLN'): f(x38_SPLN); return true;
case SBIG('TEXR'): f(x3c_TEXR); return true;
case SBIG('TSPN'): f(x40_TSPN); return true;
case SBIG('LLRD'): f(x44_24_LLRD); return true;
case SBIG('CROS'): f(x44_25_CROS); return true;
case SBIG('VLS1'): f(x44_26_VLS1); return true;
case SBIG('VLS2'): f(x44_27_VLS2); return true;
case SBIG('SROT'): f(x44_28_SROT); return true;
case SBIG('WIRE'): f(x44_29_WIRE); return true;
case SBIG('TEXW'): f(x44_30_TEXW); return true;
case SBIG('AALP'): f(x44_31_AALP); return true;
case SBIG('ZBUF'): f(x45_24_ZBUF); return true;
case SBIG('ORNT'): f(x45_25_ORNT); return true;
case SBIG('CRND'): f(x45_26_CRND); return true;
default: return false;
}
}
};
extern template struct PPImpl<_SWSH<UniqueID32>>;
extern template struct PPImpl<_SWSH<UniqueID64>>;
template <class IDType>
using SWSH = PPImpl<_SWSH<IDType>>;
......
......@@ -15,83 +15,126 @@ namespace DataSpec::DNAParticle {
template <class IDType>
struct _WPSM {
enum EPP : uint32_t {
IORN = SBIG('IORN'), // x0
IVEC = SBIG('IVEC'), // x4
PSOV = SBIG('PSOV'), // x8
PSVM = SBIG('PSVM'), // xc
VMD2 = SBIG('VMD2'), // x10
PSLT = SBIG('PSLT'), // x14
PSCL = SBIG('PSCL'), // x18
PCOL = SBIG('PCOL'), // x1c
POFS = SBIG('POFS'), // x20
OFST = SBIG('OFST'), // x24
APSO = SBIG('APSO'), // x28
HOMG = SBIG('HOMG'), // x29
AP11 = SBIG('AP11'), // x2a
AP21 = SBIG('AP21'), // x2b
AS11 = SBIG('AS11'), // x2c
AS12 = SBIG('AS12'), // x2d
AS13 = SBIG('AS13'), // x2e
TRAT = SBIG('TRAT'), // x30
APSM = SBIG('APSM'), // x34
APS2 = SBIG('APS2'), // x44
ASW1 = SBIG('ASW1'), // x54
ASW2 = SBIG('ASW2'), // x64
ASW3 = SBIG('ASW3'), // x74
OHEF = SBIG('OHEF'), // x84
COLR = SBIG('COLR'), // x94
EWTR = SBIG('EWTR'), // xa4
LWTR = SBIG('LWTR'), // xa5
SWTR = SBIG('SWTR'), // xa6
PJFX = SBIG('PJFX'), // xa8
RNGE = SBIG('RNGE'), // xac
FOFF = SBIG('FOFF'), // xb0
FC60 = SBIG('FC60'), // xunk
SPS1 = SBIG('SPS1'), // xunk
SPS2 = SBIG('SPS2'), // xunk
};
using Properties = PPSet<
ParticleType::WPSM,
std::tuple<
PP<IORN, VectorElementFactory>,
PP<IVEC, VectorElementFactory>,
PP<PSOV, VectorElementFactory>,
PP<PSVM, ModVectorElementFactory>,
PP<VMD2, bool>,
PP<PSLT, IntElementFactory>,
PP<PSCL, VectorElementFactory>,
PP<PCOL, ColorElementFactory>,
PP<POFS, VectorElementFactory>,
PP<OFST, VectorElementFactory>,
PP<APSO, bool>,
PP<HOMG, bool>,
PP<AP11, bool>,
PP<AP21, bool>,
PP<AS11, bool>,
PP<AS12, bool>,
PP<AS13, bool>,
PP<TRAT, RealElementFactory>,
PP<APSM, ChildResourceFactory<IDType>>,
PP<APS2, ChildResourceFactory<IDType>>,
PP<ASW1, ChildResourceFactory<IDType>>,
PP<ASW2, ChildResourceFactory<IDType>>,
PP<ASW3, ChildResourceFactory<IDType>>,
PP<OHEF, ChildResourceFactory<IDType>>,
PP<COLR, ChildResourceFactory<IDType>>,
PP<EWTR, bool, true>,
PP<LWTR, bool, true>,
PP<SWTR, bool, true>,
PP<PJFX, ValueHelper<uint32_t>>,
PP<RNGE, RealElementFactory>,
PP<FOFF, RealElementFactory>,
PP<FC60, bool>,
PP<SPS1, bool>,
PP<SPS2, bool>>,
AP11, AP21, APS2, APSM, APSO, AS11, AS12, AS13, ASW1, ASW2, ASW3, COLR, EWTR, FC60, FOFF, HOMG, IORN, IVEC,
LWTR, OFST, OHEF, PCOL, PJFX, POFS, PSCL, PSLT, PSOV, PSVM, RNGE, SPS1, SPS2, SWTR, TRAT, VMD2>;
};
static constexpr ParticleType Type = ParticleType::WPSM;
VectorElementFactory x0_IORN;
VectorElementFactory x4_IVEC;
VectorElementFactory x8_PSOV;
ModVectorElementFactory xc_PSVM;
IntElementFactory x14_PSLT;
VectorElementFactory x18_PSCL;
ColorElementFactory x1c_PCOL;
VectorElementFactory x20_POFS;
VectorElementFactory x24_OFST;
RealElementFactory x30_TRAT;
ChildResourceFactory<IDType> x34_APSM;
ChildResourceFactory<IDType> x44_APS2;
ChildResourceFactory<IDType> x54_ASW1;
ChildResourceFactory<IDType> x64_ASW2;
ChildResourceFactory<IDType> x74_ASW3;
ChildResourceFactory<IDType> x84_OHEF;
ChildResourceFactory<IDType> x94_COLR;
uint32_t xa8_PJFX = ~0;
RealElementFactory xac_RNGE;
RealElementFactory xb0_FOFF;
bool x10_VMD2 = fa