1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00
OpenMW/components/nif/base.hpp

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

67 lines
1.6 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
{
std::string name;
ExtraPtr next; // Next extra data record in the list
2021-07-27 04:58:57 +00:00
unsigned int recordSize{ 0u };
2020-12-15 22:06:05 +00:00
void read(NIFStream* nif) override;
void post(Reader& nif) override { next.post(nif); }
2022-06-21 21:43:16 +00:00
};
struct Controller : public Record
{
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
};
ControllerPtr next;
int flags;
float frequency, phase;
float timeStart, timeStop;
NamedPtr target;
2022-06-21 21:43:16 +00:00
void read(NIFStream* nif) override;
void post(Reader& nif) override;
2020-12-15 22:06:05 +00:00
bool isActive() const { return flags & Flag_Active; }
ExtrapolationMode extrapolationMode() const { return static_cast<ExtrapolationMode>(flags & Mask); }
};
/// Has name, extra-data and controller
2020-12-15 22:06:05 +00:00
struct Named : public Record
2022-09-22 18:26:05 +00:00
{
std::string name;
ExtraPtr extra;
2022-06-21 21:43:16 +00:00
ExtraList extralist;
ControllerPtr controller;
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;
};
2020-02-02 14:08:17 +00:00
using NiSequenceStreamHelper = Named;
} // Namespace
#endif