int main()
{
osg::ref_ptr<osgViewer::Viewer> viewer1 = new osgViewer::Viewer;
osg::ref_ptr<osg::Group> group1 = new osg::Group;
osg::ref_ptr<osg::Group> group2 = new osg::Group;
//osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("I:\\BIM\\fbx\\jiaoxuelou20190304.fbx");
//osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("I:\\BIM\\fbx\\Worker201907.fbx");
//osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("I:\\BIM\\fbx\\buildings6.fbx");
//osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("I:\\BIM\\fbx\\wdq.fbx");
osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("I:\\BIM\\fbx\\wall20190707.fbx"); group1->addChild(node1.get());
group2->addChild(makeCoordinate(10.0, 10.0, 10.0, ));
group2->addChild(group1.get()); //viewer1->setSceneData(group1.get());
viewer1->setSceneData(group2.get());
viewer1->setUpViewInWindow(, , , , ); //遍历节点
std::cout << "--------------------------------" << std::endl;
printOsgGroup(group1); //BoundVisitor boundVisitor1;
//group1->accept(boundVisitor1); //int nodeChildCount = node1->getNumChildrenRequiringEventTraversal();
//std::cout << "----count:" <<nodeChildCount<< std::endl; viewer1->addEventHandler(new CPickHandler(viewer1));
return viewer1->run();
}
模型节点控制隐藏于显示,只需要调用 节点的 setNodeMask(1);即可,0:隐藏 1:显示
node->setNodeMask();
//node->setNodeMask(1);
export root node
Node : RootNode
Node : 三维视图: {三维}
eCamera : 涓夌淮瑙嗗浘: {涓夌淮}
Node : 基本墙 wall_240 [361750]
eMesh : 基本墙 wall_240 [361750] Geometry
Node : 基本墙 wall_240 [361813]
eMesh : 基本墙 wall_240 [361813] Geometry
Node : 基本墙 wall_240 [361889]
eMesh : 基本墙 wall_240 [361889] Geometry
Node : 基本墙 wall_240 [361993]
eMesh : 基本墙 wall_240 [361993] Geometry
Node : 基本墙 wall_240 [362170]
eMesh : 基本墙 wall_240 [362170] Geometry
Node : 基本墙 wall_240 [362246]
eMesh : 基本墙 wall_240 [362246] Geometry
Node : 基本墙 wall_240 [362332]
eMesh : 基本墙 wall_240 [362332] Geometry
Node : 基本墙 wall_240 [362620]
eMesh : 基本墙 wall_240 [362620] Geometry
Node : 基本墙 wall_240 [362719]
eMesh : 基本墙 wall_240 [362719] Geometry
Node : 基本墙 wall_240 [362785]
eMesh : 基本墙 wall_240 [362785] Geometry
Node : 基本墙 wall_240 [362853]
eMesh : 基本墙 wall_240 [362853] Geometry
Node : 基本墙 wall_240 [362938]
eMesh : 基本墙 wall_240 [362938] Geometry
Node : 基本墙 wall_240 [363048]
eMesh : 基本墙 wall_240 [363048] Geometry
Node : 基本墙 wall_240 [363150]
eMesh : 基本墙 wall_240 [363150] Geometry
Node : 基本墙 wall_240 [363257]
eMesh : 基本墙 wall_240 [363257] Geometry
Node : 基本墙 wall_240 [363370]
eMesh : 基本墙 wall_240 [363370] Geometry
export root node done
done
--------------------------------
0=三维视图: {三维}
1=基本墙 wall_240 [361750]
2=基本墙 wall_240 [361813]
3=基本墙 wall_240 [361889]
4=基本墙 wall_240 [361993]
5=基本墙 wall_240 [362170]
6=基本墙 wall_240 [362246]
7=基本墙 wall_240 [362332]
8=基本墙 wall_240 [362620]
9=基本墙 wall_240 [362719]
10=基本墙 wall_240 [362785]
11=基本墙 wall_240 [362853]
12=基本墙 wall_240 [362938]
13=基本墙 wall_240 [363048]
14=基本墙 wall_240 [363150]
15=基本墙 wall_240 [363257]
16=基本墙 wall_240 [363370]
0=RootNode