osg::NodeVisitor
[1]osg::Group
[2]osg::PositionAttitudeTransform
[2]osg::MatrixTransform
[3]osg::Geode
[2]osg::MatrixTransform
[2]osg::MatrixTransform
[2]osg::MatrixTransform
[2]osg::MatrixTransform
[3]osg::Geode
osg::Geometry
[4]osg::Geometry
class BoundVisitor :public osg::NodeVisitor
{
public:
//BoundVisitor():osg::NodeVisitor(TRAVERSE_ALL_CHILDREN), _indent(0)
//{ //} BoundVisitor() :osg::NodeVisitor(TRAVERSE_ALL_CHILDREN), _indent()
{
std::cout << "--" << std::endl;
} virtual void apply(osg::Node &node)
{
for (int i = ; i < _indent; ++i)
{
std::cout << "\t";
}
std::cout << "[" << _indent + << "]" << node.libraryName()<< "::" << node.className() << std::endl; _indent++;
traverse(node);
_indent--;
} virtual void apply(osg::Geode &geode)
{
for (int i = ; i < _indent; ++i)
{
std::cout << "\t";
}
std::cout << "[" << _indent + << "]" << geode.libraryName()<< "::" << geode.className() << std::endl; //osg::Drawable *drawable1= geode.getDrawable(0);
unsigned int count = geode.getNumDrawables();
for (int i = ; i < count; i++)
{
osg::Drawable *drawable = geode.getDrawable(i);
if (!drawable)
{
continue;
} osg::Geometry *geometry = geode.getDrawable(i)->asGeometry();
if (!geometry)
{
continue;
} // 顶点数据
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geometry->getVertexArray());
//osg::Vec3Array vertices = geometry->getVertexArray();
int vertexlNum = vertices->size();
//std::cout << "size:"<<vertexlNum <<" "<< geometry->libraryName() <<" "<< geometry->getNumChildrenRequiringEventTraversal() << std::endl;
//geometry->libraryName(); //for (int j = 0; j<100; j++) {
//dstSubset.vertexs.push_back(vertices->at(j).x());
//dstSubset.vertexs.push_back(vertices->at(j).y());
//dstSubset.vertexs.push_back(vertices->at(j).z());
//std::cout << "x:" << vertices->at(j).x() << " y:" << vertices->at(j).y() << " z:" << vertices->at(j).z() << std::endl;
//} for (int i = ; i < _indent; ++i)
{
std::cout << "\t";
}
std::cout << drawable->libraryName()
<< "::" << drawable->className() << std::endl;
} _indent++;
traverse(geode);
_indent--;
} protected:
int _indent;
};
osg::NodeVisitor的更多相关文章
- osg::NodeVisitor中计算一个节点对应的世界变换矩阵、法向量、顶点坐标
class MyNodeVisitor:public osg::NodeVisitor { pulic: MyNodeVisitor():osg::NodeVisitor(osg::NodeVisit ...
- osg::NodeVisitor example
[0]osg::Group [1]osg::MatrixTransform [1] osg::MatrixTransform [1]osg::MatrixTransform [2] osg::Geod ...
- osg::NodeVisitor osg3.4.0
x:-89.4588 y:-12.1245 z:-11.7807x:-89.4588 y:-6.44823 z:-11.7807x:-89.2164 y:-9.07239 z:-11.811x:-89 ...
- OSG程序设计之osg::NodeVisitor
本文所有内容来自<OpenSceneGraph三维渲染引擎设计与实践>一书. 本文主要讨论的是OSG中节点的访问. 对于节点的访问是从节点接收一个访问器开始的,用户执行某个节点的accep ...
- OSG计时器与时间戳
static osg::Timer* sendMsgTimer = new osg::Timer; if (sendMsgTimer->time_m()>100)//100ms {// d ...
- OSG消息机制之事件处理概述
OSG的消息机制包括好多个头文件预定义及多个类. 首先,消息接收相关的类当属osgGA::GUIEventHandler和osgGA::GUIEventAdapter这两个类了.前者处理OSG程序与用 ...
- OSG中找到特定节点的方法
OSG中找到特定节点的方法 转自:http://38288890.blog.163.com/blog/static/19612845320072721549504/ 为了在OSG中找到需要的节点并对节 ...
- NodeVisitor的使用-遍历Geode节点下的Geometry并获取顶点、法向量等数据
struct Subset { std::vector<float> vertexs;//位置 std::vector<float> normals;//法向 std::vec ...
- NodeVisitor的使用-遍历Geode节点并在它与父节点之间添加一个LOD节点
#include <osg\NodeVisitor>#include <osg\MatrixTransform>#include <osg\PagedLOD>#in ...
随机推荐
- 一款免费监控aix与Linux的软件--nmon
性能介绍 nmon 工具可以为 AIX 和 Linux 性能专家提供监视和分析性能数据的功能,其中包括: CPU 使用率 内存使用情况 内核统计信息和运行队列信息 磁盘 I/O 速度.传输和读/写比率 ...
- zstu月赛 招生
题目 浙江理工大学招生,一开始有0名学生报考,现在有如下几种情况: 1.增加一名报考学生,报考学生成绩为x: 2.一名成绩为x的学生放弃报考. 3.从现在报考的学生来看,老师想知道如果要招生至少x名学 ...
- ASP.NET MVC 入门5、View与ViewData
View建立时有MVC View Page 和 MVC View Content Page两种类型, 前者为标准View, 后者为可继承Master母版页的View. Asp.Net MVC 默认使用 ...
- Java eclipse等常见问题汇总
1.Eclipse 注释模板设置 2.eclipse注释字体大小显示不一样大
- pygame游戏图像绘制及精灵用法
1精灵文件 plane_sprites.py import pygame class GameSprite(pygame.sprite.Sprite): """飞机大战游 ...
- 50、[源码]-Spring容器创建-Bean创建完成
50.[源码]-Spring容器创建-Bean创建完成 11.finishBeanFactoryInitialization(beanFactory);初始化所有剩下的单实例bean: beanFac ...
- 学到了林海峰,武沛齐讲的Day20 装饰器
import time def timmer(func): #func=test 装饰器架构 def wrapper(): start_time=time.time() func() #就是在运行te ...
- Oracle 11g 禁用 SQL Tuning Advisor 与 auto space advisor
生产上有一套11g数据库alert.log报错ORA-16957: SQL Analyze time limit interrupt. 查询MOS相关文档Troubleshooting: ORA-1 ...
- jQuery相关方法1
一.设置某个元素的标签内容------.html()方法 <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js& ...
- leetcode解题报告(16):Move Zeroes
描述 Given an array nums, write a function to move all 0's to the end of it while maintaining the rela ...