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 ...
随机推荐
- centos7 修改内核文件 网卡名称为标准名称eth0
在开机安装系统之前按TAB键后输入标记信息后安装系统就可以变成标准网卡接口eth0 或eth1
- TAITherm — 专业热管理工具
TAITherm 是美国ThermoAnalytics 公司开发的专业三维热仿真分析工具RadTherm 的升级产品,在继承RadTherm特征的基础上,开发了新型高效求解器Multigrid Sol ...
- RxJava 以及 Android 中的通用线程解决方案、并发与线程安全
关于RxJava如今是熟到发紫了,所以对于它底层的动作机制的了解是迫在眉睫了,费话不多说,直接开始. 这里还是以之前获取个人github仓库列表为例,用retrofit+rxjava,也是实际项目中用 ...
- 1205 CSRF跨站请求与django中的auth模块使用
目录 今日内容 昨日回顾 基于配置文件的编程思想 importlib模块 简单代码实现 跨站请求伪造csrf 1. 钓鱼网站 如何实现 模拟该现象的产生 2. 解决问题 解决 {% csrf_toke ...
- 转: java 双向map
package tools; import java.util.HashMap; public class DuplexMap<K,V> { class Entry{ K k; V v; ...
- javaScript基础及初始面向对象
对象是什么?对象是包含相关属性和方法的集合体属性方法什么是面向对象面向对象仅仅是一个概念或者编程思想通过一种叫做原型的方式来实现面向对象编程 创建对象自定义对象内置对象 自定义对象2-1基于Objec ...
- Mac 升级 Python2.7 到 Python3.5
1.去 Python 官网下载一个版本的包 https://www.python.org/downloads/mac-osx/ 2.安装之后,去 /Library/Frameworks/Python ...
- PostgreSQL 使用PG_Rman进行物理备份
背景 在Oracle下我们可以使用rman进行物理备份,支持数据库的全量.增量.归档的备份模式而PostgreSQL作为开源数据库,近些时间来也一直向商业版数据库看齐,也推出了开源功工具pg_rman ...
- Web前端-JavaScript基础教程下
Web前端-JavaScript基础教程下 <script>有6个属性: async对外部脚本有效,可以用来异步操作,下载东西,不妨碍其他操作. charset为src属性指定字符集. d ...
- Codeforces 1182D Complete Mirror [树哈希]
Codeforces 中考考完之后第一个AC,纪念一下qwq 思路 简单理解一下题之后就可以发现其实就是要求一个点,使得把它提为根之后整棵树显得非常对称. 很容易想到树哈希来判结构是否相同,而且由于只 ...