x:-89.4588 y:-12.1245 z:-11.7807
x:-89.4588 y:-6.44823 z:-11.7807
x:-89.2164 y:-9.07239 z:-11.811
x:-89.4588 y:-12.1245 z:-11.7807
x:-89.2164 y:-9.07239 z:-11.811
x:-89.2164 y:-15.9458 z:-11.811
x:-89.4588 y:-6.44823 z:-11.7807
x:-89.2164 y:-2.19896 z:-11.811
x:-89.2164 y:-9.07239 z:-11.811
x:-89.4588 y:-6.44823 z:-11.7807
x:-89.4959 y:-2.57999 z:-11.7705
x:-89.2164 y:-2.19896 z:-11.811
x:-89.6451 y:-4.75968 z:-11.7127
x:-89.4959 y:-2.57999 z:-11.7705
x:-89.4588 y:-6.44823 z:-11.7807
x:-89.6451 y:-4.75968 z:-11.7127
x:-89.7325 y:1.15286 z:-11.6649
x:-89.4959 y:-2.57999 z:-11.7705
x:-89.7325 y:1.15286 z:-11.6649
x:-89.6451 y:-4.75968 z:-11.7127
x:-89.8026 y:-2.48957 z:-11.6174
x:-89.8026 y:-2.48957 z:-11.6174
x:-89.8883 y:1.02162 z:-11.5459

#ifdef _WIN32
#include <Windows.h>
#endif // _WIN32
#include<iostream> #include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/CompositeViewer>
#include <osgDB/ReadFile>
#include <osg/Geode>
#include <osg/Node>
#include <osg/Geometry>
#include <osgGA/TrackballManipulator>
#include <osg/GraphicsContext>
#include <osg/ShapeDrawable>
#include <osg/Material>
#include <osg/Image>
#include <osg/Texture2D>
#include <osg/TexEnv>
#include <osg/TexGen>
#include <osg/NodeVisitor>
#include <osg/MatrixTransform>
#include <osg/PositionAttitudeTransform>
#include <osg/AnimationPath>
#include <osg/Matrixd> #include <osgGA/GUIEventHandler>
#include <osgGA/CameraManipulator>
#include <osgGA/StandardManipulator>
#include <osgGA/OrbitManipulator>
#include <osgGA/TrackballManipulator>
#include <osgUtil/IntersectionVisitor>
#include <osgUtil/LineSegmentIntersector> class BoundVisitor :public osg::NodeVisitor
{
public:
BoundVisitor() :osg::NodeVisitor(TRAVERSE_ALL_CHILDREN), _indent()
{
std::cout << "--" << std::endl;
} virtual void apply(osg::Geode &geode)
{
//osg::Drawable *drawable1= geode.getDrawable(0);
unsigned int count = geode.getNumDrawables();
for (int i = ; i < count; i++)
{
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();
for (int j = ; j<vertexlNum; 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;
}
}
} protected:
int _indent;
}; int main()
{
osg::ref_ptr<osgViewer::Viewer> viewer1 = new osgViewer::Viewer;
osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("D:\\参考手册\\BIM\\osg\\build1.OSGB");
BoundVisitor bv; node1->accept(bv);
viewer1->setSceneData(node1); viewer1->setUpViewInWindow(, , , , ); return viewer1->run();
}

osg::NodeVisitor osg3.4.0的更多相关文章

  1. osg::NodeVisitor

    [1]osg::Group [2]osg::PositionAttitudeTransform [2]osg::MatrixTransform [3]osg::Geode [2]osg::Matrix ...

  2. osg::NodeVisitor中计算一个节点对应的世界变换矩阵、法向量、顶点坐标

    class MyNodeVisitor:public osg::NodeVisitor { pulic: MyNodeVisitor():osg::NodeVisitor(osg::NodeVisit ...

  3. win10 + VS2015 + 64位OSG3.4.0

    一.下载 1.osg源码 2.整理好的第三方库 3.cmake3.7.1绿色版 4.osg3.4.0数据包 二.编译前的准备工作 在D:\下新建一个OSG文件夹,在其下再新建4个文件夹 D:\OSG\ ...

  4. win10操作系统vs2010编译osg3.4.0问题解决记录

    参考博客:OSG3.4.0+VS2010+WIN10编译及二次开发环境搭建 链接:https://blog.csdn.net/hsc1239653453/article/details/7827856 ...

  5. osg::NodeVisitor example

    [0]osg::Group [1]osg::MatrixTransform [1] osg::MatrixTransform [1]osg::MatrixTransform [2] osg::Geod ...

  6. vs2016x64&&qt5.7.1编译osg3.4.0&&osgEarth2.7

    此文仅备忘: 1.安装VS2013_Cn_Ult 2.安装qt-opensource-windows-x86-msvc2013_64-5.7.1 设置环境变量QTDIR,并将其bin加入到path中. ...

  7. vs2013x64&&qt5.7.1编译osg3.4.0&&osgEarth2.7

    此文仅备忘: 1.安装VS2013_Cn_Ult 2.安装qt-opensource-windows-x86-msvc2013_64-5.7.1 设置环境变量QTDIR,并将其bin加入到path中. ...

  8. OSG程序设计之osg::NodeVisitor

    本文所有内容来自<OpenSceneGraph三维渲染引擎设计与实践>一书. 本文主要讨论的是OSG中节点的访问. 对于节点的访问是从节点接收一个访问器开始的,用户执行某个节点的accep ...

  9. VS2013环境下配置OSG(3.4.0版本)

    参考链接1: http://blog.csdn.net/lonsegdi/article/details/50579439 参考链接2: http://bbs.osgchina.org/forum.p ...

随机推荐

  1. ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded

    操作系统:Ubuntu 18.04 LTS 数据库:MySQL 5.7 执行了一次修改root用户密码的操作,修改完后退出了数据库,但是,当我在命令行中登录数据库(mysql -u root -p), ...

  2. python高级特性-filter

    python内建的函数filter用于过滤序列 和map()相同:filter()也接收一个函数的序列. 和map()不同:filter()把传入的函数依次依次作用于每个元素,然后根据返回值是True ...

  3. 命令检测站点是否使用CDN加速

    在CMD   输入   nslookup    域名 例如:nslookup www.baidu.com有CDN的示例Server:  cache3-gzAddress:  211.98.4.1Non ...

  4. python_面向对象——反射

    1.反射 四个方法:getattr() 获取 class Person(): def __init__(self,name,age): self.name = name self.age = age ...

  5. JavaScript 廖

    =============== JavaScript代码可以直接嵌在网页的任何地方,不过通常我们都把JavaScript代码放到<head>中 ======注释 // 以双斜杠开头直到行末 ...

  6. 深入理解JavaScript之实现继承的7种方式

    1.原型链继承 核心:将父类的实例作为子类的原型 首先,要知道构造函数.原型和实例之间的关系:构造函数都有一个原型对象,原型对象都包含一个指向构造函数的指针,而实例都包含一个原型对象的指针. func ...

  7. VFD 时钟(VFD Clock with STM8 v2.0)

    算是填了最先挖的VFD坑 最近pcb厂家神仙打架,为PCB普及做出了巨大贡献,到这事儿发生我也就开了两三次板,都赶上这个时间了,不开白不开! 不说了,上图! sch: pcb: 方案和之前的除了驱动电 ...

  8. ckeditor编辑器从word粘贴公式

    由于工作需要必须将word文档内容粘贴到编辑器中使用 但发现word中的图片粘贴后变成了file:///xxxx.jpg这种内容,如果上传到服务器后其他人也访问不了,网上找了很多编辑器发现没有一个能直 ...

  9. NetworkX系列教程(8)-Drawing Graph

    小书匠Graph图论 如果只是简单使用nx.draw,是无法定制出自己需要的graph,并且这样的graph内的点坐标的不定的,运行一次变一次,实际中一般是要求固定的位置,这就需要到布局的概念了.详细 ...

  10. 贾扬清牛人(zz)

    贾扬清加入阿里巴巴后,能否诞生出他的第三个世界级杰作? 文 / 华商韬略 张凌云  本文转载,著作权归原作者所有   贾扬清加入阿里巴巴后,能否诞生出他的第三个世界级杰作? 2017年1月11日,美国 ...