Examples osggeometry
1.访问顶点索引
void printPrimitiveIndices(const std::string& name, osg::Drawable& drawable)
{std::cout<<name<<std::endl;osg::TemplatePrimitiveIndexFunctor<PrimitiveIndexPrint> pf;drawable.accept(pf);std::cout<<std::endl;
}
2.访问顶点
void printPrimitiveIndices(const std::string& name, osg::Drawable& drawable)
{std::cout<<name<<std::endl;osg::TemplatePrimitiveIndexFunctor<PrimitiveIndexPrint> pf;drawable.accept(pf);std::cout<<std::endl;
}
3. osg::Geode 为叶子节点
osg::Geometry 为几何体
setVertexArray 设置顶点数组
setColorArray 设置颜色数组
setNormalArray 设置法向量数组
addPrimitiveSet 设置几何图形形状模式,开始顶点,顶点数量
addDrawable 叶子节点添加几何图形
4.通过共享指针指向一份内存,达到共用目的节省内存
osg::ref_ptr<osg::Vec4Array> shared_colors = new osg::Vec4Array;shared_colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
5.直接设置共享指针指向的地址
polyGeom->setColorArray(shared_colors.get(), osg::Array::BIND_OVERALL);
6.几何体中可设置多个几何图形
polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,0,6));
polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_STRIP,6,6));
polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_FAN,12,5));
7.状态集设置属性
stateSet>setAttributeAndModes(polygonStipple,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
8.设置节点灯光开关
geode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED);
9.设置节点回调函数
transform->setUpdateCallback(new MyTransformCallback(1.0f));
10.纹理坐标顺序开始我看的对不上几何体的顶点坐标,后来才明白绘制方式是osg::PrimitiveSet::TRIANGLE_STRIP
//顶点坐标
osg::Vec3 myCoords[] =
{osg::Vec3(-1.22908f,0.0f,1.0f),osg::Vec3(-1.22908f,0.0f,-1.0f),osg::Vec3(1.22908f,0.0f,-1.0f),osg::Vec3(1.22908f,0.0f,1.0f)
};//纹理坐标
osg::Vec2 myTexCoords[] ={osg::Vec2(0,1),osg::Vec2(0,0),osg::Vec2(1,0),osg::Vec2(1,1)
};//几何体绘制顶点顺序unsigned short myIndices[] ={0,1,3,2};
还是用osg::TexGen自动生成纹理坐标吧
Examples osggeometry相关推荐
- Tomcat V6 Examples移植到Apusic V5.1
目标:将Tomcat V6的的例子Examples移植到Apusic V5.1上 术语:Tomcat:只提供了WEB容器的开源服务器: Apusic:提供了完整的J2EE支持的商用服务器: %TOMC ...
- ChaLearn Gesture Challenge_2:examples体验
前言: 在上一篇博文ChaLearn Gesture Challenge_1:CGD数据库简单介绍中已经简单介绍过CGD2011数据库,了解到该数据库可以作为公开的数据库来测试在深度信息和RGB信息上 ...
- iPhone SDK Examples
2019独角兽企业重金招聘Python工程师标准>>> iPhone SDK Examples "Just show me how to do it!" 转载于: ...
- UserWarning: Label not :NUMBER: is present in all training examples
UserWarning: Label not :NUMBER: is present in all training examples 目录 UserWarning: Label not :NUMBE ...
- 如何编译ReactNative示例程序Examples
通过示例程序可以看到一些基本组件的使用,对于学习ReactNative是很有帮助的. 编译示例程序需要将整个项目导入到androidStudio中,androidStudio导入项目时选择react- ...
- How to use tcpdump with examples
为什么80%的码农都做不了架构师?>>> tcpdump 1.What is tcpdump? Tcpdump prints out a description ofthe c ...
- 用ORBSLAM2运行TUM Dataset数据集Monocular Examples
参照https://github.com/raulmur/ORB_SLAM2/blob/master/README.md 运行 4. Monocular Examples TUM Dataset 数据 ...
- 使用Android Studio build tensorflow/examples/android——直接用android studio即可
使用Android Studio 可以在Android Studio中直接打开tensorflow/examples/android,但是需要配置好你的gradle.sdk.ndk gradle必须要 ...
- Examples osgparticleshader例子学习
Examples osgparticleshader 粒子与shader的使用 参考文档 http://blog.csdn.net/csxiaoshui/article/details/234345 ...
最新文章
- sql 存储过程学习
- numpy vsplit
- PAT甲级1023 Have Fun with Numbers:[C++题解]高精度加法和两个vector大小比较
- 周围的餐馆有哪些?GeoHash算法
- 移动开发平台性能比较
- 前端必看 | 2D游戏化互动入门基础知识
- Shell循环与结构化命令
- linux删除文件_Linux中删除特殊名称文件的多种方式
- 双层优化模型【简述】
- PHP 微信小程序 WebSocket MySQL Redis实现聊天功能
- c语言中用数学库函数求绝对值,c语言中求绝对值数学函数.doc
- vue中带参数的请求路径
- 生成图片带有随机码的验证码
- 使用anaconda安装opencv包
- ps4仁王服务器不稳定,仁王运行流畅图文教学 卡顿解决方法指南 怎样运行流畅 流畅运行方法-游侠网...
- IntelliJ inspection gives “Cannot resolve symbol“ but still compiles code
- idea无法正常显示配置文件图标
- 深度模型从研者 眼里的 似然估计 Hessain 海森矩阵 Fisher Information (费雪信息)...
- 判断内存条参数信息 版本 频率,以及主板最大支持内存
- linux 系统安全以及应用