osg create shape
osg::ref_ptr<osg::Node> OSG_Qt_::createSimple()
{
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry; //申请顶点
osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array;
//申请颜色
osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array;
//申请法向量
osg::ref_ptr<osg::Vec3Array> norms = new osg::Vec3Array; //设置顶点关联方式
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::Mode::QUADS,,)); coords->push_back(osg::Vec3(-10.0,0.0,-10.0));
coords->push_back(osg::Vec3(10.0, 0.0, -10.0));
coords->push_back(osg::Vec3(10.0, 0.0, 10.0));
coords->push_back(osg::Vec3(-10.0, 0.0, 10.0)); //颜色赋值
colors->push_back(osg::Vec4f(1.0,0.0,0.0,1.0));
colors->push_back(osg::Vec4f(0.0, 1.0, 0.0, 1.0));
colors->push_back(osg::Vec4f(0.0, 0.0, 1.0, 1.0));
colors->push_back(osg::Vec4f(1.0, 1.0, 0.0, 1.0)); //法向量赋值
norms->push_back(osg::Vec3(0.0,-1.0,0.0)); //设置顶点
geometry->setVertexArray(coords.get());
//设置颜色
geometry->setColorArray(colors.get());
//颜色绑定方式
geometry->setColorBinding(osg::Geometry::AttributeBinding::BIND_PER_VERTEX);
//设置法向量
geometry->setNormalArray(norms.get());
//法向量绑定
geometry->setNormalBinding(osg::Geometry::AttributeBinding::BIND_OVERALL); geode->addDrawable(geometry.get());
return geode;
}
osg create shape的更多相关文章
- osg define shape(create box)
#ifdef _WIN32 #include <Windows.h> #endif // _WIN32 #include <osgViewer/Viewer> #include ...
- 使用Object.create 克隆对象以及实现单继承
var Plane = function () { this.blood = 100; this.attack = 1; this.defense = 1; }; var plane = new Pl ...
- 构造函数创建对象和Object.create()实现继承
第一个方法用构造函数创建对象,实现方法的继承 /*创建一个对象把所有公用的属性和方法,放进去*/ function Person() { this.name = "W3cplus" ...
- 前端开发者进阶之ECMAScript新特性【一】--Object.create
Object.create(prototype, descriptors) :创建一个具有指定原型且可选择性地包含指定属性的对象 参数:prototype 必需. 要用作原型的对象. 可以为 nul ...
- firefox-Developer开发者站点——关于Object.create()新方法的介绍
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/create Objec ...
- What Shape Layers Are-CAShapeLayer
矢量图.gpu直接使用.占用内存小 What Shape Layers Are Shape layers are layers capable of defining shapes as vector ...
- ECMAScript新特性【一】--Object.create
Object.create(prototype, descriptors) :创建一个具有指定原型且可选择性地包含指定属性的对象 参数: prototype 必需. 要用作原型的对象. 可以为 nu ...
- 转载:Object的create方法文档
源地址:https://developer.mozilla.org/zh-CN/docs/JavaScript/Reference/Global_Objects/Object/create#.E4.B ...
- OSG学习:转动的小汽车示例
由于只是简单的示例,所以小汽车的模型也比较简单,是由简单的几何体组成. 代码如下: #include <osg\ShapeDrawable> #include <osg\Animat ...
随机推荐
- Bootstrap 基本模板
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8& ...
- P1351 联合权值[鬼畜解法]
题目描述 无向连通图 G 有 n 个点,n−1 条边.点从 1 到 n 依次编号,编号为 i 的点的权值为 Wi,每条边的长度均为 1.图上两点 (u,v) 的距离定义为 u 点到 v 点的最短距离 ...
- VUE this.$http.post 与后端flask 数据交互
背景: 小鱼第一次前端用的VUE,然后前后端的交互调了几次,记录下来留给自己下次使用 前端 通过 form.XXX 获取数据,代码: <template> <el-form ref ...
- jquery头部高亮显示方法
做网站都有头部导航栏,但导航栏的高亮显示一般都是后台技术人员做传参判断来显示高亮样式,今天来教大家一个用jquery来显示 废话不多说,直接上代码 第一步,在需要的页面中写入 <input ty ...
- bootstrap Table 的使用方法
然后添加css 找到bootstrap-table.min.css 添加进去 再添加JS Js添加时 按照顺序添加 然后初始化bootstrap-table <script type=&qu ...
- MongoDB 分片管理(一)检查集群状态
一.检查集群状态 1.1 使用sh.status()查看集群摘要信息 1.使用sh.status()可以查看分片信息.数据库信息.集合信息 sh.status() 如果数据块较多时,使用sh.stat ...
- postgresql slow sql report 慢查询报告
其实也不完全算PostgreSQL的技巧,应该算是SHELL技巧. 首先要配置好postgresql.conf,让PG记录下慢查询,并且日志固定格式,如下: log_destination = 'cs ...
- Educational Codeforces Round 72
目录 Contest Info Solutions A. Creating a Character B. Zmei Gorynich C. The Number Of Good Substrings ...
- Django系列(四):多表操作
1.创建模型 例:我们来假定下面这些概念,字段和关系 作者模型:一个作者有姓名和年龄. 作者详细模型:把作者的详情放到详情表,包含生日,手机号,家庭住址等信息.作者详情模型和作者模型之间是一对一(on ...
- NetworkX系列教程(7)-对graph进行分析
小书匠Graph图论 graph构建完成后,对graph的连通等属性进行分析. 目录: 8.对图进行分析 8.1连通子图 8.2弱联通 8.3强连通 8.4子图 8.5条件过滤 注意:如果代码出现找不 ...