|
|
|
@ -434,8 +434,23 @@ namespace NifOsg
|
|
|
|
|
osg::ref_ptr<osg::Group> node;
|
|
|
|
|
osg::Object::DataVariance dataVariance = osg::Object::UNSPECIFIED;
|
|
|
|
|
|
|
|
|
|
// TODO: it is unclear how to handle transformations of LOD and Switch nodes and controllers for them.
|
|
|
|
|
switch (nifNode->recType)
|
|
|
|
|
{
|
|
|
|
|
case Nif::RC_NiLODNode:
|
|
|
|
|
{
|
|
|
|
|
const Nif::NiLODNode* niLodNode = static_cast<const Nif::NiLODNode*>(nifNode);
|
|
|
|
|
node = handleLodNode(niLodNode);
|
|
|
|
|
dataVariance = osg::Object::STATIC;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Nif::RC_NiSwitchNode:
|
|
|
|
|
{
|
|
|
|
|
const Nif::NiSwitchNode* niSwitchNode = static_cast<const Nif::NiSwitchNode*>(nifNode);
|
|
|
|
|
node = handleSwitchNode(niSwitchNode);
|
|
|
|
|
dataVariance = osg::Object::STATIC;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Nif::RC_NiTriShape:
|
|
|
|
|
case Nif::RC_NiAutoNormalParticles:
|
|
|
|
|
case Nif::RC_NiRotatingParticles:
|
|
|
|
@ -597,35 +612,6 @@ namespace NifOsg
|
|
|
|
|
if (nifNode->recType != Nif::RC_NiTriShape && !nifNode->controller.empty() && node->getDataVariance() == osg::Object::DYNAMIC)
|
|
|
|
|
handleNodeControllers(nifNode, static_cast<osg::MatrixTransform*>(node.get()), animflags);
|
|
|
|
|
|
|
|
|
|
if (nifNode->recType == Nif::RC_NiLODNode)
|
|
|
|
|
{
|
|
|
|
|
const Nif::NiLODNode* niLodNode = static_cast<const Nif::NiLODNode*>(nifNode);
|
|
|
|
|
osg::ref_ptr<osg::LOD> lod = handleLodNode(niLodNode);
|
|
|
|
|
node->addChild(lod); // unsure if LOD should be above or below this node's transform
|
|
|
|
|
node = lod;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nifNode->recType == Nif::RC_NiSwitchNode)
|
|
|
|
|
{
|
|
|
|
|
const Nif::NiSwitchNode* niSwitchNode = static_cast<const Nif::NiSwitchNode*>(nifNode);
|
|
|
|
|
osg::ref_ptr<osg::Switch> switchNode = handleSwitchNode(niSwitchNode);
|
|
|
|
|
node->addChild(switchNode);
|
|
|
|
|
|
|
|
|
|
if (niSwitchNode->name == Constants::NightDayLabel && !SceneUtil::hasUserDescription(rootNode, Constants::NightDayLabel))
|
|
|
|
|
rootNode->getOrCreateUserDataContainer()->addDescription(Constants::NightDayLabel);
|
|
|
|
|
|
|
|
|
|
const Nif::NodeList &children = niSwitchNode->children;
|
|
|
|
|
for(size_t i = 0;i < children.length();++i)
|
|
|
|
|
{
|
|
|
|
|
if(!children[i].empty())
|
|
|
|
|
handleNode(children[i].getPtr(), switchNode, imageManager, boundTextures, animflags, skipMeshes, hasMarkers, isAnimated, textKeys, rootNode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// show only first child by default
|
|
|
|
|
switchNode->setSingleChildOn(0);
|
|
|
|
|
return switchNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Nif::NiNode *ninode = dynamic_cast<const Nif::NiNode*>(nifNode);
|
|
|
|
|
if(ninode)
|
|
|
|
|
{
|
|
|
|
@ -644,6 +630,16 @@ namespace NifOsg
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nifNode->recType == Nif::RC_NiSwitchNode)
|
|
|
|
|
{
|
|
|
|
|
// show only first child by default
|
|
|
|
|
node->asSwitch()->setSingleChildOn(0);
|
|
|
|
|
|
|
|
|
|
const Nif::NiSwitchNode* niSwitchNode = static_cast<const Nif::NiSwitchNode*>(nifNode);
|
|
|
|
|
if (niSwitchNode->name == Constants::NightDayLabel && !SceneUtil::hasUserDescription(rootNode, Constants::NightDayLabel))
|
|
|
|
|
rootNode->getOrCreateUserDataContainer()->addDescription(Constants::NightDayLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|