zoukankan      html  css  js  c++  java
  • osg::NodeVisitor example

    [0]osg::Group
        [1]osg::MatrixTransform
        [1] osg::MatrixTransform
        [1]osg::MatrixTransform
            [2] osg::Geode
                [3]osg::Geometry
                [3]osg::Geometry
                [3] osg::Geometry
            [2]osg::Geode
        [1] osg::MatrixTransform
        [1]osg::MatrixTransform
            [2]osg::MatrixTransform
                [3] osg::Geode
                    [4]osg::Geometry
                    [4]osg::Geometry
                    [4] osg::Geometry
                [3]osg::Geode
            [2] osg::MatrixTransform
        [1] osg::MatrixTransform
        [1]osg::MatrixTransform
            [2] osg::Geode
                [3]osg::Geometry
                [3]osg::Geometry
                [3]osg::Geometry
                [3] osg::Geometry
                [3]osg::Geometry
                [3] osg::Geometry
            [2]osg::Geode
        [1] osg::MatrixTransform
        [1]osg::MatrixTransform
            [2] osg::Geode
                [3]osg::Geometry
                [3]osg::Geometry
                [3] osg::Geometry
            [2]osg::Geode
        [1] osg::MatrixTransform
        [1]osg::MatrixTransform
            [2] osg::Geode
                [3]osg::Geometry
                [3]osg::Geometry
                [3] osg::Geometry
            [2]osg::Geode
        [1] osg::MatrixTransform
        [1]osg::MatrixTransform
            [2] osg::Geode
                [3]osg::Geometry
                [3]osg::Geometry
                [3]osg::Geometry
                [3] osg::Geometry
                [3]osg::Geometry
                [3] osg::Geometry
            [2]osg::Geode
        [1] osg::MatrixTransform
        [1]osg::MatrixTransform
            [2]osg::MatrixTransform
                [3] osg::Geode
                    [4]osg::Geometry
                    [4]osg::Geometry
                    [4]osg::Geometry
                    [4]osg::Geometry
                    [4] osg::Geometry
                    [4]osg::Geometry
                    [4] osg::Geometry
                    [4]osg::Geometry
                    [4] osg::Geometry
                [3]osg::Geode
            [2] osg::MatrixTransform
        [1] osg::MatrixTransform
        [1]osg::MatrixTransform
            [2] osg::Geode
                [3]osg::Geometry
                [3]osg::Geometry
                [3] osg::Geometry
            [2]osg::Geode
        [1] osg::MatrixTransform
    [0] osg::Group

    class InfoVisitor : public osg::NodeVisitor
    {
    public:
        InfoVisitor()
            :osg::NodeVisitor(TRAVERSE_ALL_CHILDREN), _indent(0)
        {}
    
        virtual void apply(osg::Node& node)
        {
            for (int i = 0; i < _indent; i++)  std::cout << "    ";
            std::cout << "[" << _indent << "]" << node.libraryName()
                << "::" << node.className() << std::endl;
    
            _indent++;
            traverse(node);
            _indent--;
    
            for (int i = 0; i < _indent; i++)  std::cout << "    ";
            std::cout << "[" << _indent << "] " << node.libraryName()
                << "::" << node.className() << std::endl;
        }
    
        virtual void apply(osg::Geode& node)
        {
            for (int i = 0; i < _indent; i++)  std::cout << "    ";
            std::cout << "[" << _indent << "] " << node.libraryName()
                << "::" << node.className() << std::endl;
    
            _indent++;
    
            for (unsigned int n = 0; n < node.getNumDrawables(); n++)
            {
                osg::Drawable* draw = node.getDrawable(n);
                if (!draw)
                    continue;
                for (int i = 0; i < _indent; i++)  std::cout << "    ";
                std::cout << "[" << _indent << "]" << draw->libraryName() << "::"
                    << draw->className() << std::endl;
            }
    
            traverse(node);
            _indent--;
    
            for (int i = 0; i < _indent; i++)  std::cout << "    ";
            std::cout << "[" << _indent << "]" << node.libraryName()
                << "::" << node.className() << std::endl;
        }
    private:
        int _indent;
    };

     

    该模型在unity3d中结构

    该模型在3dmax中结构

  • 相关阅读:
    Linux查看日志常用命令
    linux(centos)下安装PHP的PDO扩展
    TP thinkphp 权限管理 权限认证 功能
    mysql优化(三)–explain分析sql语句执行效率
    阿里云服务器Centos7成为挖矿肉鸡被挖矿imWBR1耗尽CPU
    Asp.net导入Excel并读取数据
    定义显式类型转换和隐式类型转换
    C# 对象与引用变量
    C# ref参数
    C# 字段与属性的区别
  • 原文地址:https://www.cnblogs.com/herd/p/11099518.html
Copyright © 2011-2022 走看看