Read NiLODNode (Bug #3008)

openmw-38
scrawl 9 years ago
parent 9897400d97
commit 626281977e

@ -48,6 +48,8 @@ static std::map<std::string,RecordFactoryEntry> makeFactory()
{ {
std::map<std::string,RecordFactoryEntry> newFactory; std::map<std::string,RecordFactoryEntry> newFactory;
newFactory.insert(makeEntry("NiNode", &construct <NiNode> , RC_NiNode )); newFactory.insert(makeEntry("NiNode", &construct <NiNode> , RC_NiNode ));
newFactory.insert(makeEntry("NiSwitchNode", &construct <NiSwitchNode> , RC_NiSwitchNode ));
newFactory.insert(makeEntry("NiLODNode", &construct <NiLODNode> , RC_NiLODNode ));
newFactory.insert(makeEntry("AvoidNode", &construct <NiNode> , RC_AvoidNode )); newFactory.insert(makeEntry("AvoidNode", &construct <NiNode> , RC_AvoidNode ));
newFactory.insert(makeEntry("NiBSParticleNode", &construct <NiNode> , RC_NiBSParticleNode )); newFactory.insert(makeEntry("NiBSParticleNode", &construct <NiNode> , RC_NiBSParticleNode ));
newFactory.insert(makeEntry("NiBSAnimationNode", &construct <NiNode> , RC_NiBSAnimationNode )); newFactory.insert(makeEntry("NiBSAnimationNode", &construct <NiNode> , RC_NiBSAnimationNode ));

@ -250,5 +250,41 @@ struct NiRotatingParticles : Node
} }
}; };
// A node used as the base to switch between child nodes, such as for LOD levels.
struct NiSwitchNode : public NiNode
{
void read(NIFStream *nif)
{
NiNode::read(nif);
nif->getInt(); // unknown
}
};
struct NiLODNode : public NiSwitchNode
{
osg::Vec3f lodCenter;
struct LODRange
{
float minRange;
float maxRange;
};
std::vector<LODRange> lodLevels;
void read(NIFStream *nif)
{
NiSwitchNode::read(nif);
lodCenter = nif->getVector3();
unsigned int numLodLevels = nif->getUInt();
for (unsigned int i=0; i<numLodLevels; ++i)
{
LODRange r;
r.minRange = nif->getFloat();
r.maxRange = nif->getFloat();
lodLevels.push_back(r);
}
}
};
} // Namespace } // Namespace
#endif #endif

@ -36,6 +36,8 @@ enum RecordType
{ {
RC_MISSING = 0, RC_MISSING = 0,
RC_NiNode, RC_NiNode,
RC_NiSwitchNode,
RC_NiLODNode,
RC_NiBillboardNode, RC_NiBillboardNode,
RC_AvoidNode, RC_AvoidNode,
RC_NiTriShape, RC_NiTriShape,

Loading…
Cancel
Save