Load BSFurnitureMarker

macos-builds-only-for-openmw
Alexei Dobrohotov 3 years ago
parent d914cda347
commit 9500afaa5a

@ -94,4 +94,38 @@ void BSBound::read(NIFStream *nif)
halfExtents = nif->getVector3();
}
void BSFurnitureMarker::LegacyFurniturePosition::read(NIFStream *nif)
{
offset = nif->getVector3();
orientation = nif->getUShort();
positionRef = nif->getChar();
nif->skip(1); // Position ref 2
}
void BSFurnitureMarker::FurniturePosition::read(NIFStream *nif)
{
offset = nif->getVector3();
heading = nif->getFloat();
type = nif->getUShort();
entryPoint = nif->getUShort();
}
void BSFurnitureMarker::read(NIFStream *nif)
{
Extra::read(nif);
unsigned int num = nif->getUInt();
if (nif->getBethVersion() <= NIFFile::BethVersion::BETHVER_FO3)
{
legacyMarkers.resize(num);
for (auto& marker : legacyMarkers)
marker.read(nif);
}
else
{
markers.resize(num);
for (auto& marker : markers)
marker.read(nif);
}
}
}

@ -120,5 +120,29 @@ struct BSBound : public Extra
void read(NIFStream *nif) override;
};
struct BSFurnitureMarker : public Extra
{
struct LegacyFurniturePosition
{
osg::Vec3f offset;
uint16_t orientation;
uint8_t positionRef;
void read(NIFStream *nif);
};
struct FurniturePosition
{
osg::Vec3f offset;
float heading;
uint16_t type, entryPoint;
void read(NIFStream *nif);
};
std::vector<LegacyFurniturePosition> legacyMarkers;
std::vector<FurniturePosition> markers;
void read(NIFStream *nif) override;
};
} // Namespace
#endif

@ -136,6 +136,7 @@ static std::map<std::string,RecordFactoryEntry> makeFactory()
factory["BSShaderProperty"] = {&construct <BSShaderProperty> , RC_BSShaderProperty };
factory["BSShaderPPLightingProperty"] = {&construct <BSShaderPPLightingProperty> , RC_BSShaderPPLightingProperty };
factory["BSShaderNoLightingProperty"] = {&construct <BSShaderNoLightingProperty> , RC_BSShaderNoLightingProperty };
factory["BSFurnitureMarker"] = {&construct <BSFurnitureMarker> , RC_BSFurnitureMarker };
return factory;
}

@ -125,7 +125,8 @@ enum RecordType
RC_BSLODTriShape,
RC_BSShaderProperty,
RC_BSShaderPPLightingProperty,
RC_BSShaderNoLightingProperty
RC_BSShaderNoLightingProperty,
RC_BSFurnitureMarker
};
/// Base class for all records

Loading…
Cancel
Save