1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-03 17:37:18 +00:00
OpenMW/components/nif/base.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

69 lines
1.7 KiB
C++
Raw Normal View History

/// This file holds the main classes of NIF Records used by everything else.
#ifndef OPENMW_COMPONENTS_NIF_BASE_HPP
#define OPENMW_COMPONENTS_NIF_BASE_HPP
#include "recordptr.hpp"
namespace Nif
{
2022-07-21 11:51:34 +00:00
struct File;
struct Record;
struct Stream;
// An extra data record. All the extra data connected to an object form a linked list.
2020-12-15 22:06:05 +00:00
struct Extra : public Record
{
2023-08-31 21:58:23 +00:00
std::string mName;
ExtraPtr mNext; // Next extra data record in the list
uint32_t mRecordSize{ 0u };
2020-12-15 22:06:05 +00:00
void read(NIFStream* nif) override;
2023-08-31 21:58:23 +00:00
void post(Reader& nif) override { mNext.post(nif); }
2022-06-21 21:43:16 +00:00
};
struct NiTimeController : public Record
2022-06-21 21:43:16 +00:00
{
enum Flags
2022-09-22 18:26:05 +00:00
{
2022-06-21 21:43:16 +00:00
Flag_Active = 0x8
};
enum ExtrapolationMode
2022-09-22 18:26:05 +00:00
{
Cycle = 0,
Reverse = 2,
Constant = 4,
2022-09-22 18:26:05 +00:00
Mask = 6
};
NiTimeControllerPtr mNext;
uint16_t mFlags;
float mFrequency, mPhase;
float mTimeStart, mTimeStop;
NiObjectNETPtr mTarget;
2022-06-21 21:43:16 +00:00
void read(NIFStream* nif) override;
void post(Reader& nif) override;
bool isActive() const { return mFlags & Flag_Active; }
ExtrapolationMode extrapolationMode() const { return static_cast<ExtrapolationMode>(mFlags & Mask); }
};
/// Abstract object that has a name, extra data and controllers
struct NiObjectNET : public Record
2022-09-22 18:26:05 +00:00
{
std::string mName;
ExtraPtr mExtra;
ExtraList mExtraList;
NiTimeControllerPtr mController;
2022-09-22 18:26:05 +00:00
2022-07-21 11:51:34 +00:00
void read(NIFStream* nif) override;
void post(Reader& nif) override;
// Collect extra records attached to the object
ExtraList getExtraList() const;
};
}
#endif