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 ...
随机推荐
- 运输层3——传输控制协议TCP概述
目录 1. TCP最主要的特点 2. TCP的连接 3. socket在不同场景中的含义 写在前面:本文章是针对<计算机网络第七版>的学习笔记 运输层1--运输层协议概述 运输层2--用户 ...
- 进程、requests模块的简单使用
一.进程 1.进程间数据不共享 import multiprocessing data_list = [] def task(arg): data_list.append(arg) print(dat ...
- 1203 forms组件
目录 昨日内容 多对多三种创建方式 1.全自动 好处 缺点 2.纯手动 好处 缺点 3.半自动through='',through_fields=(外键字段) 好处 缺点 forms组件 1.简单引入 ...
- 《hello--world团队》第五次作业:项目需求分析改进与系统设计
项目 内容 这个作业属于哪个课程 2016级计算机科学与工程学院软件工程(西北师范大学) 这个作业的要求在哪里 实验九 团队作业5-团队项目需求改进与系统设计 团队名称 <hello--worl ...
- DTcmsV4.0分析学习——(2)系统框架
2.1物理结构 共8个项目,Web为启动项 项目间相互依赖关系图: 2.2逻辑结构 DTcms V4.0轻量级CMS系统框架采用的是典型的三层架构(项目与三层架构并非直接对应关系,至于什么是三层架构这 ...
- prometheus-alertmanager告警推送到钉钉
1. Prometheus告警简介 告警能力在Prometheus的架构中被划分成两个独立的部分.如下所示,通过在Prometheus中定义AlertRule(告警规则),Prometheus会周期性 ...
- plsql工具使用
作者:lhrbest 作者:张冲andy 作者:jack_孟
- MySql更改用户密码
1. use mysql show tables;查看mysql数据库中的表,会看到一个user表. select * from user;查看一下这个表中是否有root用户,如果有: update ...
- QCheckBox 使用本地图片的QSS样式
setStyleSheet 为以下字符串,选中,未选中,有焦点,无焦点时显示不一样的图片 QString("QCheckBox::indicator:unchecked{image:url( ...
- CSP模拟赛 number (二分+数位DP)
题面 给定整数m,km,km,k,求出最小和最大的正整数 nnn 使得 n+1,n+2,-,2nn+1,n+2,-,2nn+1,n+2,-,2n 中恰好有 mmm 个数 在二进制下恰好有 kkk 个 ...