osg fbx 绘制坐标轴、控制模型影藏与显示

复制代码
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, 4));
    group2->addChild(group1.get());

    //viewer1->setSceneData(group1.get());
    viewer1->setSceneData(group2.get());
    viewer1->setUpViewInWindow(200, 200, 800, 600, 0);

    //遍历节点
    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(0);
//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

 

 

posted @   西北逍遥  阅读(1097)  评论(0编辑  收藏  举报
编辑推荐:
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
· 一次Java后端服务间歇性响应慢的问题排查记录
· dotnet 源代码生成器分析器入门
阅读排行:
· ThreeJs-16智慧城市项目(重磅以及未来发展ai)
· .NET 原生驾驭 AI 新基建实战系列(一):向量数据库的应用与畅想
· Ai满嘴顺口溜,想考研?浪费我几个小时
· Browser-use 详细介绍&使用文档
· 软件产品开发中常见的10个问题及处理方法
点击右上角即可分享
微信分享提示