metaforce/DataSpec/DNAMP1/FRME.hpp

321 lines
9.2 KiB
C++
Raw Normal View History

2016-01-19 05:32:34 +00:00
#ifndef _DNAMP1_FRME_HPP_
#define _DNAMP1_FRME_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
2016-03-04 23:04:53 +00:00
#include <athena/FileWriter.hpp>
2018-02-22 07:24:51 +00:00
#include "athena/DNAOp.hpp"
2016-01-19 05:32:34 +00:00
2017-12-29 08:08:12 +00:00
namespace DataSpec::DNAMP1
2016-01-19 05:32:34 +00:00
{
struct FRME : BigDNA
{
2018-02-22 07:24:51 +00:00
AT_DECL_EXPLICIT_DNA
2016-01-19 05:32:34 +00:00
Value<atUint32> version;
Value<atUint32> unk1;
Value<atUint32> modelCount; // Matches MODL widgets
Value<atUint32> unk3;
Value<atUint32> widgetCount;
struct Widget : BigDNA
{
2018-02-22 07:24:51 +00:00
AT_DECL_EXPLICIT_DNA
2016-01-19 05:32:34 +00:00
FRME* owner;
DNAFourCC type;
struct WidgetHeader : BigDNA
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2016-01-19 05:32:34 +00:00
String<-1> name;
String<-1> parent;
2016-03-16 03:37:51 +00:00
Value<bool> useAnimController;
2016-03-15 23:23:45 +00:00
Value<bool> defaultVisible;
Value<bool> defaultActive;
2016-03-17 02:18:01 +00:00
Value<bool> cullFaces;
2016-01-19 05:32:34 +00:00
Value<atVec4f> color;
Value<atUint32> modelDrawFlags;
} header;
2018-02-22 07:24:51 +00:00
struct IWidgetInfo : BigDNAV
2016-01-19 05:32:34 +00:00
{
2018-02-22 07:24:51 +00:00
Delete _dBase;
virtual FourCC fourcc() const=0;
2016-01-19 05:32:34 +00:00
};
std::unique_ptr<IWidgetInfo> widgetInfo;
2016-03-14 00:58:19 +00:00
Value<bool> isWorker;
Value<atUint16> workerId = 0;
2016-01-19 05:32:34 +00:00
Value<atVec3f> origin;
Value<atVec3f> basis[3];
Value<atVec3f> rotationCenter;
Value<atInt32> unk1;
Value<atInt16> unk2;
2016-01-19 05:32:34 +00:00
struct BWIGInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::BWIG"; }
FourCC fourcc() const { return FOURCC('BWIG'); }
};
2016-01-19 05:32:34 +00:00
struct HWIGInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::HWIG"; }
FourCC fourcc() const { return FOURCC('HWIG'); }
};
2016-01-19 05:32:34 +00:00
struct CAMRInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
AT_DECL_EXPLICIT_DNA
const char* DNATypeV() const { return "FRME::CAMR"; }
2016-01-19 05:32:34 +00:00
enum class ProjectionType
{
Perspective,
Orthographic
};
Value<ProjectionType> projectionType;
2018-02-22 07:24:51 +00:00
struct IProjection : BigDNAV
2016-01-19 05:32:34 +00:00
{
Delete _d;
const ProjectionType type;
IProjection(ProjectionType t) : type(t) {}
};
struct PerspectiveProjection : IProjection
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
AT_DECL_DNAV
2016-01-19 05:32:34 +00:00
PerspectiveProjection() : IProjection(ProjectionType::Perspective) {}
Value<float> fov;
Value<float> aspect;
2016-01-19 12:35:55 +00:00
Value<float> znear;
Value<float> zfar;
2016-01-19 05:32:34 +00:00
};
struct OrthographicProjection : IProjection
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
AT_DECL_DNAV
2016-01-19 05:32:34 +00:00
OrthographicProjection() : IProjection(ProjectionType::Orthographic) {}
Value<float> left;
Value<float> right;
Value<float> top;
Value<float> bottom;
2016-01-19 12:35:55 +00:00
Value<float> znear;
Value<float> zfar;
2016-01-19 05:32:34 +00:00
};
std::unique_ptr<IProjection> projection;
FourCC fourcc() const { return FOURCC('CAMR'); }
2016-01-19 05:32:34 +00:00
};
struct MODLInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::MODL"; }
2016-01-19 05:32:34 +00:00
UniqueID32 model;
2016-02-02 04:34:46 +00:00
enum class BlendMode
{
Unknown0,
Unknown1,
Unknown2,
Additive
};
2016-01-19 05:32:34 +00:00
Value<atUint32> blendMode;
2016-03-17 02:18:01 +00:00
Value<atUint32> lightMask;
FourCC fourcc() const { return FOURCC('MODL'); }
2016-01-19 05:32:34 +00:00
};
struct LITEInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
AT_DECL_EXPLICIT_DNA
const char* DNATypeV() const { return "FRME::LITE"; }
2016-03-16 20:49:35 +00:00
enum class ELightType : atUint32
{
Spot = 0,
Point = 1,
Directional = 2,
LocalAmbient = 3,
Custom = 4,
};
Value<ELightType> type;
Value<float> distC;
Value<float> distL;
Value<float> distQ;
Value<float> angC;
Value<float> angL;
Value<float> angQ;
Value<atUint32> loadedIdx;
Value<float> cutoff; /* Spot only */
FourCC fourcc() const { return FOURCC('LITE'); }
2016-01-19 05:32:34 +00:00
};
struct ENRGInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::ENRG"; }
2016-01-19 05:32:34 +00:00
UniqueID32 texture;
FourCC fourcc() const { return FOURCC('ENRG'); }
2016-01-19 05:32:34 +00:00
};
struct METRInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::METR"; }
Value<bool> unk1;
Value<bool> noRoundUp;
Value<atUint32> maxCapacity;
Value<atUint32> workerCount;
FourCC fourcc() const { return FOURCC('METR'); }
2016-01-19 05:32:34 +00:00
};
struct GRUPInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::GRUP"; }
2016-03-17 22:19:25 +00:00
Value<atInt16> defaultWorker;
2016-01-19 05:32:34 +00:00
Value<bool> unk3;
FourCC fourcc() const { return FOURCC('GRUP'); }
2016-01-19 05:32:34 +00:00
};
struct TBGPInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::TBGP"; }
2016-12-16 04:35:49 +00:00
Value<atUint16> elementCount;
2016-01-19 05:32:34 +00:00
Value<atUint16> unk2;
Value<atUint32> unkEnum;
2016-12-16 04:35:49 +00:00
Value<atUint16> defaultSelection;
2016-01-19 05:32:34 +00:00
Value<atUint16> un4;
2016-12-16 04:35:49 +00:00
Value<bool> selectWraparound;
2016-01-19 05:32:34 +00:00
Value<bool> unk6;
Value<float> unkFloat1;
Value<float> unkFloat2;
Value<bool> unk7;
Value<float> unkFloat3;
Value<atUint16> unk8;
Value<atUint16> unk9;
Value<atUint16> unk10;
Value<atUint16> unk11;
FourCC fourcc() const { return FOURCC('TBGP'); }
2016-01-19 05:32:34 +00:00
};
struct SLGPInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::SLGP"; }
2016-01-19 05:32:34 +00:00
Value<float> min;
Value<float> max;
2016-03-17 22:19:25 +00:00
Value<float> cur;
Value<float> increment;
FourCC fourcc() const { return FOURCC('SLGP'); }
};
struct PANEInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::PANE"; }
Value<float> xDim;
Value<float> zDim;
Value<atVec3f> scaleCenter;
FourCC fourcc() const { return FOURCC('PANE'); }
2016-01-19 05:32:34 +00:00
};
struct TXPNInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
const char* DNATypeV() const { return "FRME::TXPN"; }
2016-03-16 03:37:51 +00:00
enum class Justification : atUint32
{
2016-03-22 02:27:46 +00:00
Left = 0,
Center,
Right,
Full,
NLeft,
NCenter,
NRight,
LeftMono,
CenterMono,
RightMono
};
2016-03-16 03:37:51 +00:00
enum class VerticalJustification : atUint32
{
2016-03-22 02:27:46 +00:00
Top = 0,
Center,
Bottom,
Full,
NTop,
NCenter,
NBottom,
LeftMono,
CenterMono,
RightMono
};
2018-02-22 07:24:51 +00:00
AT_DECL_EXPLICIT_DNA
2016-01-19 05:32:34 +00:00
atUint32 version = 0;
TXPNInfo() {}
TXPNInfo(atUint32 version)
: version(version)
{}
2016-03-17 22:19:25 +00:00
Value<float> xDim;
Value<float> zDim;
Value<atVec3f> scaleCenter;
2016-01-19 05:32:34 +00:00
UniqueID32 font;
2016-03-22 02:27:46 +00:00
Value<bool> wordWrap;
2017-01-30 04:16:20 +00:00
Value<bool> horizontal;
Value<Justification> justification;
Value<VerticalJustification> verticalJustification;
2016-01-19 05:32:34 +00:00
Value<atVec4f> fillColor;
Value<atVec4f> outlineColor;
2016-03-22 02:27:46 +00:00
Value<atVec2f> blockExtent; /* In points; converted to int by loader */
2016-01-19 05:32:34 +00:00
/* The following is only found in V1 */
UniqueID32 jpnFont;
Value<atInt32> jpnPointScale[2] = {};
FourCC fourcc() const { return FOURCC('TXPN'); }
2016-01-19 05:32:34 +00:00
};
struct IMGPInfo : IWidgetInfo
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::IMGP"; }
2016-01-19 05:32:34 +00:00
UniqueID32 texture;
Value<atUint32> unk1;
Value<atUint32> unk2;
Value<atUint32> quadCoordCount;
2018-02-25 08:23:27 +00:00
Vector<atVec3f, AT_DNA_COUNT(quadCoordCount)> quadCoords;
2016-01-19 05:32:34 +00:00
Value<atUint32> uvCoordCount;
2018-02-25 08:23:27 +00:00
Vector<atVec2f, AT_DNA_COUNT(uvCoordCount)> uvCoords;
FourCC fourcc() const { return FOURCC('IMGP'); }
2016-01-19 05:32:34 +00:00
};
};
2018-02-25 08:23:27 +00:00
Vector<Widget, AT_DNA_COUNT(widgetCount)> widgets;
2016-01-19 05:32:34 +00:00
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
2016-03-04 23:04:53 +00:00
const hecl::ProjectPath& outPath,
2016-01-19 05:32:34 +00:00
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
2017-12-29 08:08:12 +00:00
hecl::blender::Token& btok,
2016-03-04 23:04:53 +00:00
std::function<void(const hecl::SystemChar*)> fileChanged);
2016-01-19 05:32:34 +00:00
};
}
#endif // _DNAMP1_FRME_HPP_