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 ...
随机推荐
- 云计算---openstack创建虚拟机过程
虚拟机创建过程: (1)界面或命令行通过RESTful API向keystone获取认证信息.(2)keystone通过用户请求认证信息,并生成auth-token返回给对应的认证请求.(3)界面或 ...
- jQuery 中的 Ajax 方法(节选)
$.ajax() 基本用法: $.ajax({ url: url, // 地址 data: data, // 参数 type: 'POST', // 提交方式 可以选择 post/get 推荐 pos ...
- 【转】用 Consul 来做服务注册与服务发现
原文:https://segmentfault.com/a/1190000018731395?utm_source=tag-newest ------------------------------- ...
- pandas 4
参考资料:https://mp.weixin.qq.com/s/QnxaOrvlWJn6Dr42Ic1CcQ 1 #只选取housing,loan,contac和poutcometest_data[ ...
- 【MySQL】explicit_defaults_for_timestamp 参数详解
简介:explicit_defaults_for_timestamp 系统变量决定MySQL服务端对timestamp列中的默认值和NULL值的不同处理方法. 此变量自MySQL 5.6.6 版本引入 ...
- PHP流程控制之嵌套if...else...elseif结构
还记得本章开篇我们讲了一个王思总同学的例子: 王同学是生活极度充满娱乐化和享受生活的人.他抵达北京或者大连的时候做的事,他抵达后做的事情,如下:直线电机参数 半夜到达,先去夜店参加假面舞会 早上抵达, ...
- hive优化,开启压缩功能
1.开启hive作业mapreduce任务中间压缩功能: 对于数据进行压缩可以减少job中map和reduce task间的数据传输量.对于中间数据压缩,选择一个低cpu开销编/解码器要不选择一个压缩 ...
- 三十六.MHA集群概述 、 部署MHA集群 测试配置
1.准备MHA集群环境 准备6台虚拟机,并按照本节规划配置好IP参数 在这些虚拟机之间实现SSH免密登录 在相应节点上安装好MHA相关的软件包 使用6台RHEL 7虚拟机,如图-1所示.准备集群环 ...
- STL备忘
STL备忘 lower_bound 查找第一个大于或等于的数,返回该数字的地址,地址减去首地址即得到数组下标(首地址下标为0) upper_bound 查找第一个大于的数 unique 去重,常用于离 ...
- 微信小程序环境下将文件上传到 OSS
步骤 1: 配置 Bucket 跨域 客户端进行表单直传到 OSS 时,会从浏览器向 OSS 发送带有 Origin 的请求消息.OSS 对带有 Origin 头的请求消息会进行跨域规则(CORS)的 ...