1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:53:53 +00:00
openmw/components/nif/extra.cpp

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

98 lines
2.2 KiB
C++
Raw Normal View History

#include "extra.hpp"
namespace Nif
{
2021-07-27 04:58:57 +00:00
void NiExtraData::read(NIFStream* nif)
{
Extra::read(nif);
2023-08-31 21:58:23 +00:00
nif->readVector(mData, mRecordSize);
}
void NiTextKeyExtraData::read(NIFStream* nif)
{
Extra::read(nif);
2022-09-22 18:26:05 +00:00
2023-08-31 21:58:23 +00:00
uint32_t numKeys;
nif->read(numKeys);
mList.resize(numKeys);
for (TextKey& key : mList)
2022-09-22 18:26:05 +00:00
{
2023-08-31 21:58:23 +00:00
nif->read(key.mTime);
nif->read(key.mText);
2022-09-22 18:26:05 +00:00
}
}
void NiVertWeightsExtraData::read(NIFStream* nif)
2022-09-22 18:26:05 +00:00
{
Extra::read(nif);
2023-08-31 21:58:23 +00:00
nif->skip(nif->get<uint16_t>() * sizeof(float)); // vertex weights I guess
}
2021-11-10 16:21:07 +00:00
void BSBound::read(NIFStream* nif)
2022-09-22 18:26:05 +00:00
{
2021-11-10 16:21:07 +00:00
Extra::read(nif);
2023-08-31 21:58:23 +00:00
nif->read(mCenter);
nif->read(mExtents);
2021-11-10 16:21:07 +00:00
}
void BSFurnitureMarker::LegacyFurniturePosition::read(NIFStream* nif)
{
2023-08-31 21:58:23 +00:00
nif->read(mOffset);
nif->read(mOrientation);
nif->read(mPositionRef);
nif->skip(1); // Position ref 2
2021-11-10 16:21:07 +00:00
}
void BSFurnitureMarker::FurniturePosition::read(NIFStream* nif)
{
2023-08-31 21:58:23 +00:00
nif->read(mOffset);
nif->read(mHeading);
nif->read(mType);
nif->read(mEntryPoint);
2021-11-10 16:21:07 +00:00
}
2022-09-22 18:26:05 +00:00
void BSFurnitureMarker::read(NIFStream* nif)
2021-11-10 16:21:07 +00:00
{
Extra::read(nif);
2023-08-31 21:58:23 +00:00
uint32_t num;
nif->read(num);
2021-11-10 16:21:07 +00:00
if (nif->getBethVersion() <= NIFFile::BethVersion::BETHVER_FO3)
2022-09-22 18:26:05 +00:00
{
mLegacyMarkers.resize(num);
for (auto& marker : mLegacyMarkers)
2021-11-10 16:21:07 +00:00
marker.read(nif);
2022-09-22 18:26:05 +00:00
}
else
{
mMarkers.resize(num);
for (auto& marker : mMarkers)
2021-11-10 16:21:07 +00:00
marker.read(nif);
2022-09-22 18:26:05 +00:00
}
2021-11-10 16:21:07 +00:00
}
2023-06-01 20:27:42 +00:00
void BSInvMarker::read(NIFStream* nif)
{
Extra::read(nif);
2023-08-31 21:58:23 +00:00
float rotX = nif->get<uint16_t>() / 1000.f;
float rotY = nif->get<uint16_t>() / 1000.f;
float rotZ = nif->get<uint16_t>() / 1000.f;
2023-06-01 20:27:42 +00:00
mRotation = osg::Quat(rotX, osg::X_AXIS, rotY, osg::Y_AXIS, rotZ, osg::Z_AXIS);
2023-08-31 21:58:23 +00:00
nif->read(mScale);
2023-06-01 20:27:42 +00:00
}
2023-07-20 00:38:15 +00:00
void BSBehaviorGraphExtraData::read(NIFStream* nif)
{
Extra::read(nif);
2023-08-31 21:58:23 +00:00
nif->read(mFile);
nif->read(mControlsBaseSkeleton);
2023-07-20 00:38:15 +00:00
}
}