OpenSceneGraph
文章平均质量分 95
小胖七少爷
不积硅步无以至千里
不积小流无以成江海
展开
-
OutCircleMotion外扩圆动画
#include <osg/Geode>#include <osg/Geometry>#include <osg/Material>#include <osg/Vec3>#include <osg/MatrixTransform>#include <osg/Texture2D>#include <osg/T...原创 2020-03-18 10:30:48 · 420 阅读 · 0 评论 -
GLSL 色彩特效
1、碧绿效果使色彩呈暗绿色fragmentShader代码 varying vec2 texture_coor; uniform sampler2D texture; void main() { vec3 col = texture2D(texture,texture_coor).rgb; gl_FragColor.r = pow(c...转载 2020-03-10 15:03:20 · 869 阅读 · 0 评论 -
osg 60Hz帧率限制
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 ...转载 2019-10-20 10:11:16 · 1012 阅读 · 0 评论 -
细数OSG中的“神来之剪”
“裁剪”就是从大量的事务中进行挑选、删除。对一个庞大的三维体而言,往往存在着大量无助于最终渲染结果的对象;将它们从场景中剔除后,将剩余的场景对象发送到OpenGL管线中,即可完成一帧的绘制工作。这类型的裁剪工作通常称为“可见性裁剪”,即只有真正能够被终端用户看到的对象才会被发送到渲染管线中。常见de裁剪技术一、背面裁剪当我们观察一个不透明物体时,通常大约有一半的物体表面是看不到...转载 2019-09-27 13:44:10 · 538 阅读 · 0 评论 -
解析OCC(TopoDS_Edge、Geom_Surface、TopoDS_Shape),生成OSG节点
//解析TopoDS_Edge,生成OSG节点osg::Node* BuildPolylineMesh(const TopoDS_Edge& edge, double deflection = 0.1){ osg::ref_ptr<osg::Geode> geode = new osg::Geode(); osg::ref_ptr<osg::Geometry&g...原创 2019-09-18 10:01:23 · 4660 阅读 · 6 评论 -
解析OCC几何体,并在OSG中渲染显示
osg::Node* BuildShapeMesh(const TopoDS_Shape& aShape){ { osg::ref_ptr<osg::Group> root = new osg::Group(); osg::ref_ptr<osg::Geode> geode = new osg::Geode(); ////////////////...原创 2019-09-18 09:44:14 · 3266 阅读 · 4 评论 -
自定义OFF文件的读与写
1.文件格式后缀为.off,格式为,OFF 8 12 0 0.5 -0.5 -0.5 0.5 0.5 -0.5 -0.5 0.5 -0.5 -0.5 -0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 0.5 -0.5 0.5 0.5 -0.5 -0.5 0.5 3 0 1 3 3 1 2 3 3 4 6 5 3 7...原创 2019-09-18 09:39:15 · 478 阅读 · 0 评论 -
计算几何体顶点索引与顶点法线
传入顶点,计算顶点索引/**输入:vertexArray三角面片的顶点数组*返回:顶点索引数组*/osg::DrawElementsUInt* CalcVertexIndexs(const osg::Vec3Array* vertexArray){ //顶点去重 osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3...原创 2019-09-18 09:32:25 · 989 阅读 · 0 评论 -
求空间向量夹角
//以下计算需要换算成局部坐标系下/*假设球机摄像头坐标为pos1(x1, y1, z1),枪机上拾取的点坐标为pos2(x2, y2, z2);如果换算成局部坐标系,把球机摄像头作为原点O的话,那么球机摄像头pos1(0,0,0),枪机pos2(x2-x1, y2-y1, z2-z1);再传入TwoPointsAngle函数中,计算出球机的转向*/#ifndef _VEC3D#...原创 2019-08-21 17:15:52 · 2118 阅读 · 0 评论 -
通过OSG实现对模型的日照模拟
目录1. 加载模型 2. 光照 1) 环境反射 2) 漫反射 3) 日照方向 (1) 太阳高度角和太阳方位角 (2) 计算过程 4) 改进实现 3. 阴影 4. 太阳高度角与太阳方位角的计算 1) 太阳高度角计算公式 2) 太阳方位角计算公式 3) 太阳赤纬计算公式 4) 时角计算公式 5) 真太阳时 5. 参考文献1. 加载模...转载 2019-07-31 16:21:20 · 393 阅读 · 0 评论 -
osg 中鼠标拾取线段的端点和中点
//NeartestPointNodeVisitor.h#pragma once#include <osg\Matrix>#include <vector>#include <osg\Node>#include <osg\NodeVisitor>#include <osg\Camera>#include <osg\V...转载 2019-04-09 16:53:32 · 1122 阅读 · 0 评论 -
OSG中的智能指针
OSG中的智能指针智能指针对于C++程序员来说并不是一个陌生的东西,它在c++的内存管理中有着很广泛的应用(在最开始的时候,由于对智能指针不了解,还天真的以为智能指针就是osg的独创,想起来还正是有点太傻了,当然这也和自己的C++基础有关,毕竟那会儿也才刚刚接触c++)。说到内存管理,简单来说就是内存的创建和回收...转载 2019-04-09 16:16:59 · 256 阅读 · 0 评论 -
osg使用shader动态修改纹理坐标
#include <osg/Node>#include <osg/Geometry>#include <osg/Notify>#include <osg/MatrixTransform>#include <osg/Texture2D>#include <osg/DrawPixels>#include <osg...转载 2019-04-11 16:02:10 · 1073 阅读 · 0 评论 -
OSG 天空穹实现
#include <osg/io_utils>#include <osgDB/WriteFile>#include <osgDB/ReadFile>#include <osgUtil/Optimizer>#include <osgViewer/Viewer>#include <osg/Projection>#inc...转载 2019-04-04 10:51:22 · 437 阅读 · 0 评论 -
OSG中的示例程序简介
1.example_osganimate一)演示了路径动画的使用(AnimationPath、AnimationPathCallback),路径动画回调可以作用在Camera、CameraView、MatrixTransform、PositionAttitudeTransform等四种类型的节点上。二)演示了osgSim::OverlayNode的使用2.example_osganimat...转载 2019-03-18 10:43:51 · 577 阅读 · 0 评论 -
OSG的相关扩展
参考:osg官网http://www.osgchina.org/index.php?view=article&id=176http://trac.openscenegraph.org/projects/osg//wiki/Community/NodeKitshttps://github.com/xarray/osgRecipes/wikiOSG的相关扩展,OSG针对每个特定应...转载 2019-03-15 09:08:14 · 1083 阅读 · 0 评论