Refactor NiSwitchNode and NiLODNode

macos_ci_fix
Alexei Kotov 1 year ago
parent c9300cac31
commit 5b0bc97db0

@ -234,8 +234,8 @@ namespace Nif
NiNode::read(nif);
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
nif->read(switchFlags);
nif->read(initialIndex);
nif->read(mSwitchFlags);
nif->read(mInitialIndex);
}
void NiLODNode::read(NIFStream* nif)
@ -249,13 +249,13 @@ namespace Nif
}
if (nif->getVersion() >= NIFFile::NIFVersion::VER_MW)
nif->read(lodCenter);
nif->read(mLODCenter);
lodLevels.resize(nif->get<uint32_t>());
for (LODRange& level : lodLevels)
mLODLevels.resize(nif->get<uint32_t>());
for (LODRange& level : mLODLevels)
{
nif->read(level.minRange);
nif->read(level.maxRange);
nif->read(level.mMinRange);
nif->read(level.mMaxRange);
}
}

@ -189,8 +189,8 @@ namespace Nif
// A node used as the base to switch between child nodes, such as for LOD levels.
struct NiSwitchNode : NiNode
{
uint16_t switchFlags;
uint32_t initialIndex;
uint16_t mSwitchFlags;
uint32_t mInitialIndex;
void read(NIFStream* nif) override;
};
@ -199,12 +199,12 @@ namespace Nif
{
struct LODRange
{
float minRange;
float maxRange;
float mMinRange;
float mMaxRange;
};
osg::Vec3f lodCenter;
std::vector<LODRange> lodLevels;
osg::Vec3f mLODCenter;
std::vector<LODRange> mLODLevels;
void read(NIFStream* nif) override;
};

@ -463,11 +463,11 @@ namespace NifOsg
osg::ref_ptr<osg::LOD> lod(new osg::LOD);
lod->setName(niLodNode->mName);
lod->setCenterMode(osg::LOD::USER_DEFINED_CENTER);
lod->setCenter(niLodNode->lodCenter);
for (unsigned int i = 0; i < niLodNode->lodLevels.size(); ++i)
lod->setCenter(niLodNode->mLODCenter);
for (unsigned int i = 0; i < niLodNode->mLODLevels.size(); ++i)
{
const Nif::NiLODNode::LODRange& range = niLodNode->lodLevels[i];
lod->setRange(i, range.minRange, range.maxRange);
const Nif::NiLODNode::LODRange& range = niLodNode->mLODLevels[i];
lod->setRange(i, range.mMinRange, range.mMaxRange);
}
lod->setRangeMode(osg::LOD::DISTANCE_FROM_EYE_POINT);
return lod;
@ -478,7 +478,7 @@ namespace NifOsg
osg::ref_ptr<osg::Switch> switchNode(new osg::Switch);
switchNode->setName(niSwitchNode->mName);
switchNode->setNewChildDefaultValue(false);
switchNode->setSingleChildOn(niSwitchNode->initialIndex);
switchNode->setSingleChildOn(niSwitchNode->mInitialIndex);
return switchNode;
}

Loading…
Cancel
Save