OSG使用模板缓存
参考帖子:
https://blog.csdn.net/csxiaoshui/article/details/23457273
osg::Geometry *lineStripGeometry = new osg::Geometry;
osg::Vec3Array *lineVertexArray = new osg::Vec3Array;
double dRadius = 0.1;
for (float angle = 0.0; angle < 400.0; angle += 0.1)
{
lineVertexArray->push_back(osg::Vec3(dRadius * cos(angle), dRadius * sin(angle), ));
dRadius *= 1.002;
}
osg::Vec4Array *lineColorArray = new osg::Vec4Array;
lineColorArray->push_back(osg::Vec4(1.0, 1.0, 1.0, 1.0));
lineStripGeometry->setVertexArray(lineVertexArray);
lineStripGeometry->setColorArray(lineColorArray);
//OSG 3.2之后的版本在setColorArray中设置绑定方式
lineStripGeometry->setColorBinding(osg::Geometry::BIND_OVERALL);
lineStripGeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, , lineVertexArray->size()));
lineStripGeometry->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF); //添加模板测试
osg::Stencil *lineStripStencil = new osg::Stencil;
lineStripStencil->setFunction(osg::Stencil::NEVER, 0x0, 0x0);
lineStripStencil->setOperation(osg::Stencil::INCR, osg::Stencil::INCR, osg::Stencil::INCR);
lineStripGeometry->getOrCreateStateSet()->setAttributeAndModes(lineStripStencil);
////////////////////////////////////////////////////////////////////////// osg::Geometry *quadGeometry = new osg::Geometry; osg::Vec3Array *quadVertexArray = new osg::Vec3Array;
quadVertexArray->push_back(osg::Vec3(, , ));
quadVertexArray->push_back(osg::Vec3(, , ));
quadVertexArray->push_back(osg::Vec3(, , ));
quadVertexArray->push_back(osg::Vec3(, , )); osg::Vec4Array *quadColorArray = new osg::Vec4Array;
quadColorArray->push_back(osg::Vec4(0.0, 1.0, 1.0, 1.0)); quadGeometry->setVertexArray(quadVertexArray);
quadGeometry->setColorArray(quadColorArray);
quadGeometry->setColorBinding(osg::Geometry::BIND_OVERALL);
quadGeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, , ));
quadGeometry->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF); osg::Stencil *quadStencil = new osg::Stencil;
quadStencil->setFunction(osg::Stencil::NOTEQUAL, 0x1, 0x1);
quadStencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::KEEP);
quadGeometry->getOrCreateStateSet()->setAttributeAndModes(quadStencil); osg::Geode *geode = new osg::Geode;
geode->addDrawable(lineStripGeometry);
geode->addDrawable(quadGeometry);
---------------------
作者:csxiaoshui
来源:CSDN
原文:https://blog.csdn.net/csxiaoshui/article/details/23457273
版权声明:本文为博主原创文章,转载请附上博文链接!
OSG使用模板缓存的更多相关文章
- AngularJs $templateCache 和 $templateRequest 模板缓存
$templateCache 第一次使用模板,它被加载到模板缓存中,以便快速检索.你可以直接将模板标签加载到缓存中,或者通过$templateCache服务. 通过script标签: <scri ...
- [ZZ] D3D中的模板缓存(3)
http://www.cppblog.com/lovedday/archive/2008/03/25/45334.html http://www.cppblog.com/lovedday/ D3D中的 ...
- D3D 模板缓存的创建过程
下面是我对模板缓存创建的理解: 1. 模板缓存是和深度缓存一起被创建的,将深度缓存的一部分作为模板缓存使用. 深度缓存和模板缓存是在Direct3D初始化时创建的,D3DPRESENT_PARAMET ...
- Jquery 模板插件 jquery.tmpl.js 的使用方法(2):嵌套each循环,temp调用(使用预编译的模板缓存)
直接上代码吧 一:主窗口 /*#region SendChooseTargetTemplate 发送候选人主窗口模板*/ var SendChooseTargetTemplate = ''; Send ...
- AngularJS ngTemplate寄宿方式 模板缓存 $templateCache
AngularJS的指令中经常定义模板(template或templateUrl),可以选择将Html模板直接寄宿在WEB容器中,如Tomcat.IIS.Nginx.NodeJs Express,也可 ...
- [Java] Spring boot2 整合 Thymeleaf 后 去除模板缓存
Spring boot2 整合 Thymeleaf 后 去除模板缓存 网上好多文章只是简单粗暴的说,在 application.properties 做如下配置即可: #Thymeleaf cach ...
- AngularJs 禁止模板缓存
因为AngularJs的特性(or 浏览器本身的缓存?),angular默认的HTML模板加载都会被缓存起来.导致每次修改完模板之后都得经常需要清除浏览器的缓存来保证浏览器去获得最新的html模板,自 ...
- windows+linux开发环境 解决laravel blade模板缓存问题
编码环境windows10 编码IDE:phpstorm 2016.2 PHP框架:laravel5.3 + 代码运行环境:centos7 + nginx 在开发过程中,上传blade模板文件到lin ...
- $smary模板缓存
<?php //引入配置文件 $fillname="../cache/testhuancun.html"; //设置一个缓存时间 $time=; //判断如果缓存文件不存在的 ...
随机推荐
- 461.汉明距离(c++实现)
问题描述: 两个整数之间的汉明距离指的是这两个数字对应二进制位不同的位置的数目. 给出两个整数 x 和 y,计算它们之间的汉明距离. 注意:0 ≤ x, y < 231. 示例: 输入: x = ...
- 使用Python登录Github网站
在下面的代码中, 展示了使用Python脚本登录Github的方法. 如果需要登录别的网站,那么请使用Chrome的Inspect的功能寻找到目标的object,对代码进行替换. 代码先登录了gith ...
- python3下载图片
import urllib.request import socket import re import sys import os targetDir = r"E:\\DATA\常用py脚 ...
- Retrofit 2.0 使用详细教程
文章来自:https://blog.csdn.net/carson_ho/article/details/73732076 前言 在Andrroid开发中,网络请求十分常用 而在Android网络请求 ...
- Swift ARC 自动引用计数
1.ARC 引用类型在堆上的内存分配过程中有 8 字节的地址长度用来保存对象的引用计数,堆上的内存并不像栈上那样立即进行回收,系统会定时对堆上的内存进行检查,当某个实例不再被使用时,引用计数会变为 0 ...
- linux下无法执行PHP命令,错误 php: command not found
在linux下执行php时无法执行,报错:php: command not found 解决方法: export PATH=$PATH:/usr/local/php7/bin 可以输入echo $PA ...
- SNF快速开发平台MVC-各种级联绑定方式,演示样例程序(包含表单和表格控件)
做了这么多项目,经常会使用到级联.联动的情况. 如:省.市.县.区.一级分类.二级分类.三级分类.仓库.货位. 方式:有表单需要做级联的,还是表格行上需要做级联操作的. 实现:实现方法也有很多种方式. ...
- JS模块化:CommonJS和AMD(Require.js)
早期的JS中,是没有模块化的概念的,这一情况直到09年的Node.js横空出世时有了好转,Node.js将JS作为服务端的编程语言,使得JS不得不寻求模块化的解决方案. 模块化概念 在JS中的模块是针 ...
- golang channel select
尝试多个channel同时触发时,select的表现: package main import ( "fmt" "time" ) func loop(ch ch ...
- Approx Analytic Arealight
试着实现的基于分析方法的近似面积光源.