void ObserverNodePath::setNodePathTo(osg::Node* node) { if (node) { NodePathList nodePathList = node->getParentalNodePaths(); if (nodePathList.empty()) { NodePath nodePath; nodePath.push_back(node); setNodePath(nodePath); } else { if (nodePathList[0].empty()) { nodePathList[0].push_back(node); } setNodePath(nodePathList[0]); } } else { clearNodePath(); } }
osg::Matrixd CameraViewSwitchManipulator::getInverseMatrix() const { osg::Matrix mat; if (_currentView < _cameraViews.size()) { NodePathList parentNodePaths = _cameraViews[_currentView]->getParentalNodePaths(); if (!parentNodePaths.empty()) { mat = osg::computeWorldToLocal(parentNodePaths[0]); // TODO take into account the position and attitude of the CameraView } else { OSG_NOTICE<<"CameraViewSwitchManipulator::getInverseMatrix(): Unable to calculate matrix due to empty parental path."<<std::endl; } } return mat; }