Turn all NIF records into structs

pull/593/head
Alexei Dobrohotov 4 years ago
parent 4490f89a3d
commit 1e6156e04a

@ -11,9 +11,8 @@
namespace Nif
{
// An extra data record. All the extra data connected to an object form a linked list.
class Extra : public Record
struct Extra : public Record
{
public:
std::string name;
ExtraPtr next; // Next extra data record in the list
@ -31,9 +30,8 @@ public:
void post(NIFFile *nif) override { next.post(nif); }
};
class Controller : public Record
struct Controller : public Record
{
public:
ControllerPtr next;
int flags;
float frequency, phase;
@ -45,9 +43,8 @@ public:
};
/// Has name, extra-data and controller
class Named : public Record
struct Named : public Record
{
public:
std::string name;
ExtraPtr extra;
ExtraList extralist;

@ -29,9 +29,8 @@
namespace Nif
{
class NiSourceTexture : public Named
struct NiSourceTexture : public Named
{
public:
// Is this an external (references a separate texture file) or
// internal (data is inside the nif itself) texture?
bool external;
@ -93,27 +92,24 @@ struct NiParticleModifier : public Record
void post(NIFFile *nif) override;
};
class NiParticleGrowFade : public NiParticleModifier
struct NiParticleGrowFade : public NiParticleModifier
{
public:
float growTime;
float fadeTime;
void read(NIFStream *nif) override;
};
class NiParticleColorModifier : public NiParticleModifier
struct NiParticleColorModifier : public NiParticleModifier
{
public:
NiColorDataPtr data;
void read(NIFStream *nif) override;
void post(NIFFile *nif) override;
};
class NiGravity : public NiParticleModifier
struct NiGravity : public NiParticleModifier
{
public:
float mForce;
/* 0 - Wind (fixed direction)
* 1 - Point (fixed origin)
@ -133,27 +129,24 @@ struct NiParticleCollider : public NiParticleModifier
};
// NiPinaColada
class NiPlanarCollider : public NiParticleCollider
struct NiPlanarCollider : public NiParticleCollider
{
public:
void read(NIFStream *nif) override;
osg::Vec3f mPlaneNormal;
float mPlaneDistance;
};
class NiSphericalCollider : public NiParticleCollider
struct NiSphericalCollider : public NiParticleCollider
{
public:
float mRadius;
osg::Vec3f mCenter;
void read(NIFStream *nif) override;
};
class NiParticleRotation : public NiParticleModifier
struct NiParticleRotation : public NiParticleModifier
{
public:
void read(NIFStream *nif) override;
};

@ -29,9 +29,8 @@
namespace Nif
{
class NiParticleSystemController : public Controller
struct NiParticleSystemController : public Controller
{
public:
struct Particle {
osg::Vec3f velocity;
float lifetime;
@ -80,9 +79,8 @@ public:
};
using NiBSPArrayController = NiParticleSystemController;
class NiMaterialColorController : public Controller
struct NiMaterialColorController : public Controller
{
public:
NiPoint3InterpolatorPtr interpolator;
NiPosDataPtr data;
unsigned int targetColor;
@ -91,9 +89,8 @@ public:
void post(NIFFile *nif) override;
};
class NiPathController : public Controller
struct NiPathController : public Controller
{
public:
NiPosDataPtr posData;
NiFloatDataPtr floatData;
@ -115,9 +112,8 @@ public:
void post(NIFFile *nif) override;
};
class NiLookAtController : public Controller
struct NiLookAtController : public Controller
{
public:
NodePtr target;
unsigned short lookAtFlags{0};
@ -125,9 +121,8 @@ public:
void post(NIFFile *nif) override;
};
class NiUVController : public Controller
struct NiUVController : public Controller
{
public:
NiUVDataPtr data;
unsigned int uvSet;
@ -135,9 +130,8 @@ public:
void post(NIFFile *nif) override;
};
class NiKeyframeController : public Controller
struct NiKeyframeController : public Controller
{
public:
NiKeyframeDataPtr data;
NiTransformInterpolatorPtr interpolator;
@ -154,12 +148,11 @@ struct NiFloatInterpController : public Controller
void post(NIFFile *nif) override;
};
class NiAlphaController : public NiFloatInterpController { };
class NiRollController : public NiFloatInterpController { };
struct NiAlphaController : public NiFloatInterpController { };
struct NiRollController : public NiFloatInterpController { };
class NiGeomMorpherController : public Controller
struct NiGeomMorpherController : public Controller
{
public:
NiMorphDataPtr data;
NiFloatInterpolatorList interpolators;
@ -167,18 +160,16 @@ public:
void post(NIFFile *nif) override;
};
class NiVisController : public Controller
struct NiVisController : public Controller
{
public:
NiVisDataPtr data;
void read(NIFStream *nif) override;
void post(NIFFile *nif) override;
};
class NiFlipController : public Controller
struct NiFlipController : public Controller
{
public:
NiFloatInterpolatorPtr mInterpolator;
int mTexSlot; // NiTexturingProperty::TextureType
float mDelta; // Time between two flips. delta = (start_time - stop_time) / num_sources

@ -32,9 +32,8 @@ namespace Nif
{
// Common ancestor for several data classes
class NiGeometryData : public Record
struct NiGeometryData : public Record
{
public:
std::vector<osg::Vec3f> vertices, normals, tangents, bitangents;
std::vector<osg::Vec4f> colors;
std::vector< std::vector<osg::Vec2f> > uvlist;
@ -44,18 +43,16 @@ public:
void read(NIFStream *nif) override;
};
class NiTriShapeData : public NiGeometryData
struct NiTriShapeData : public NiGeometryData
{
public:
// Triangles, three vertex indices per triangle
std::vector<unsigned short> triangles;
void read(NIFStream *nif) override;
};
class NiTriStripsData : public NiGeometryData
struct NiTriStripsData : public NiGeometryData
{
public:
// Triangle strips, series of vertex indices.
std::vector<std::vector<unsigned short>> strips;
@ -70,9 +67,8 @@ struct NiLinesData : public NiGeometryData
void read(NIFStream *nif) override;
};
class NiParticlesData : public NiGeometryData
struct NiParticlesData : public NiGeometryData
{
public:
int numParticles{0};
int activeCount;
@ -84,39 +80,34 @@ public:
void read(NIFStream *nif) override;
};
class NiRotatingParticlesData : public NiParticlesData
struct NiRotatingParticlesData : public NiParticlesData
{
public:
void read(NIFStream *nif) override;
};
class NiPosData : public Record
struct NiPosData : public Record
{
public:
Vector3KeyMapPtr mKeyList;
void read(NIFStream *nif) override;
};
class NiUVData : public Record
struct NiUVData : public Record
{
public:
FloatKeyMapPtr mKeyList[4];
void read(NIFStream *nif) override;
};
class NiFloatData : public Record
struct NiFloatData : public Record
{
public:
FloatKeyMapPtr mKeyList;
void read(NIFStream *nif) override;
};
class NiPixelData : public Record
struct NiPixelData : public Record
{
public:
enum Format
{
NIPXFMT_RGB8,
@ -150,17 +141,15 @@ public:
void post(NIFFile *nif) override;
};
class NiColorData : public Record
struct NiColorData : public Record
{
public:
Vector4KeyMapPtr mKeyMap;
void read(NIFStream *nif) override;
};
class NiVisData : public Record
struct NiVisData : public Record
{
public:
struct VisData {
float time;
bool isSet;
@ -170,9 +159,8 @@ public:
void read(NIFStream *nif) override;
};
class NiSkinInstance : public Record
struct NiSkinInstance : public Record
{
public:
NiSkinDataPtr data;
NiSkinPartitionPtr partitions;
NodePtr root;
@ -182,9 +170,8 @@ public:
void post(NIFFile *nif) override;
};
class NiSkinData : public Record
struct NiSkinData : public Record
{
public:
struct VertWeight
{
unsigned short vertex;
@ -251,9 +238,8 @@ struct NiKeyframeData : public Record
void read(NIFStream *nif) override;
};
class NiPalette : public Record
struct NiPalette : public Record
{
public:
// 32-bit RGBA colors that correspond to 8-bit indices
std::vector<unsigned int> colors;

@ -29,15 +29,13 @@
namespace Nif
{
class NiVertWeightsExtraData : public Extra
struct NiVertWeightsExtraData : public Extra
{
public:
void read(NIFStream *nif) override;
};
class NiTextKeyExtraData : public Extra
struct NiTextKeyExtraData : public Extra
{
public:
struct TextKey
{
float time;
@ -48,9 +46,8 @@ public:
void read(NIFStream *nif) override;
};
class NiStringExtraData : public Extra
struct NiStringExtraData : public Extra
{
public:
/* Two known meanings:
"MRK" - marker, only visible in the editor, not rendered in-game
"NCO" - no collision

@ -131,9 +131,8 @@ struct NiBoundingVolume
parent node (unless it's the root), and transformation (location
and rotation) relative to it's parent.
*/
class Node : public Named
struct Node : public Named
{
public:
// Node flags. Interpretation depends somewhat on the type of node.
unsigned int flags;
Transformation trafo;

@ -29,11 +29,10 @@
namespace Nif
{
class Property : public Named { };
struct Property : public Named { };
class NiTexturingProperty : public Property
struct NiTexturingProperty : public Property
{
public:
unsigned short flags{0u};
// A sub-texture
@ -96,9 +95,8 @@ public:
void post(NIFFile *nif) override;
};
class NiFogProperty : public Property
struct NiFogProperty : public Property
{
public:
unsigned short mFlags;
float mFogDepth;
osg::Vec3f mColour;
@ -307,8 +305,8 @@ struct S_StencilProperty
void read(NIFStream *nif);
};
class NiAlphaProperty : public StructPropT<S_AlphaProperty> { };
class NiVertexColorProperty : public StructPropT<S_VertexColorProperty> { };
struct NiAlphaProperty : public StructPropT<S_AlphaProperty> { };
struct NiVertexColorProperty : public StructPropT<S_VertexColorProperty> { };
struct NiStencilProperty : public Property
{
S_StencilProperty data;

@ -120,24 +120,24 @@ public:
};
class Node;
class Extra;
class Property;
class NiUVData;
class NiPosData;
class NiVisData;
class Controller;
class Named;
class NiSkinData;
class NiFloatData;
struct Node;
struct Extra;
struct Property;
struct NiUVData;
struct NiPosData;
struct NiVisData;
struct Controller;
struct Named;
struct NiSkinData;
struct NiFloatData;
struct NiMorphData;
class NiPixelData;
class NiColorData;
struct NiPixelData;
struct NiColorData;
struct NiKeyframeData;
class NiTriStripsData;
class NiSkinInstance;
class NiSourceTexture;
class NiPalette;
struct NiTriStripsData;
struct NiSkinInstance;
struct NiSourceTexture;
struct NiPalette;
struct NiParticleModifier;
struct NiBoolData;
struct NiSkinPartition;
@ -147,7 +147,7 @@ struct NiTransformInterpolator;
struct BSShaderTextureSet;
struct NiGeometryData;
struct BSShaderProperty;
class NiAlphaProperty;
struct NiAlphaProperty;
using NodePtr = RecordPtrT<Node>;
using ExtraPtr = RecordPtrT<Extra>;

@ -14,10 +14,10 @@
namespace Nif
{
class NiGravity;
class NiPlanarCollider;
class NiSphericalCollider;
class NiColorData;
struct NiGravity;
struct NiPlanarCollider;
struct NiSphericalCollider;
struct NiColorData;
}
namespace NifOsg

Loading…
Cancel
Save