查看: 744|回复: 0

OSG新手求助!!

[复制链接]

该用户从未签到

发表于 2015-1-5 00:53:38 | 显示全部楼层 |阅读模式
初学OSG几乎没有C语言基础,老师布置了一篇期末作业还有10天就要交了。
我们作业的第一步是要 Print out a list of all the nodes in the console window,
我看同学写的代码
class nodePrinter : public osg::NodeVisitor
{
public:
nodePrinter() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {};

virtual void apply(osg::Node &node)
{
int numberOfParentNodes = node.getParentalNodePaths()[0].size();

for ( int counter =0; numberOfParentNodes > counter; counter++)
{
std::cout << "---";
}
std::cout << node.getName() << "-" << node.className() << "-" << node.libraryName()  << std::endl;
traverse(node);
}

protected:
};

他说从官网reference上直接找的,我也在reference里面找到了 virtual void apply(osg::Node &node),但是往下我完全不会引用,还想知道这两句
int numberOfParentNodes = node.getParentalNodePaths()[0].size();

for ( int counter =0; numberOfParentNodes > counter; counter++)
怎么来的,还有后面这几个也是大概能读懂,要让我直接写完全不知道怎么写
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表