OSG场景漫游实验四
天津理工大学
计算机科学与技术学院
实验报告
2015 至 2016 学年 第 二 学期
课程名称 计算机图形学 学号 学生姓名 年级 专业 课程号 实验地点 实验时间 主讲教师 辅导教师
实验( 四 ) 实验名称 场景漫游 软件环境 Visual Studio 2010
OSG-3.1.0
Windows 7 硬件环境 2G内存
显卡GT610
CPU奔腾双核
硬盘320G 实验目的 掌握透视投影与平行投影的基本原理。
掌握投影变换的操作方法。
实验内容(应包括实验题目、实验要求、实验任务等) 实验题目:
构建地形场景。
构建人物模型
交互式方式浏览场景各部分
交互式人的运动操作
设计视点运动轨迹
实验要求:
采用OpenSceneGraph创建图形窗口和实现人机交互功能,采用方向键控制对场景的浏览。
要求漫游操作方便,视点运动自然流畅。
提交电子版实验报告及工程代码,试验报告模板可参考计算机学院统一模板
提交的工程代码必须删除其中的Debug或Release文件夹
实验过程与实验结果(可包括实验实施的步骤、算法描述、流程、结论等) 节点模型:
实验步骤:
用Node节点去放置加载的地形数据,并加载之前设定的机器人,将其放入同一个场景之中;
建立类并使其继承osgGA::CameraManipulator,处理鼠标键盘事件,对各种操作进行处理,实现场景漫游,对不同的按键处理不同的操作,主要为机器人前进、后退,转身,以及通过方向键控制漫游,实现相机视点的旋转,通过w/s/a/d键实现视点的前进后踢,通过i/k/j/l键实现机器人的运动;
通过单机F键实现窗口视图和全屏视图;
将程序各模块接入主程序,实现场景的自由漫步。
实验效果:
附录(可包括源程序清单或其它说明)
源程序:
#include osgViewer/Viewer
#include osg/LineSegment
#include osg/Point
#include osg/Geometry
#include osgGA/CameraManipulator
#include osgUtil/IntersectVisitor
#include vector
#include iostream
#include osg/Node
#include osg/Geode
#include osg/Group
#include osgDB/ReadFile
#include osgDB/WriteFile
#include osgUtil/Optimizer
#include osg/MatrixTransform
#include osgViewer/ViewerEventHandlers
#include osgGA/StateSetManipulator
#include osg/ShapeDrawable
#include osgViewer/ViewerEventHandlers
#include osgUtil/LineSegmentIntersector
#include osgGA/GUIEventHandler
#include osg/Matrixd
#include osg/MatrixTransform
using namespace std;
osg::ref_ptrosg::MatrixTransform root_Tr = new osg::MatrixTransform;
osg::ref_ptrosg::MatrixTransform head_Tr = new osg::MatrixTransform;
osg::ref_ptrosg::MatrixTransform body_Tr = new osg::MatrixTransform;
osg::ref_ptrosg::MatrixTransform left_arm_Tr =new osg::MatrixTransform;
osg::ref_ptrosg::MatrixTransform right_arm_Tr =new osg::MatrixTransform;
osg::ref_ptrosg::MatrixTransform left_leg_Tr =new osg::MatrixTransform;
osg::ref_ptrosg::MatrixTransform righ
您可能关注的文档
最近下载
- 平凡的世界读书分享.ppt VIP
- 药物化学习题仉文升主编).pdf VIP
- 2025年山东济南高三一模数学试卷及答案.pdf VIP
- 2025年辽宁省委党校在职研究生招生考试(政治理论)历年参考题库含答案详解.docx VIP
- 保险双录标准话术.pptx
- 2025年辽宁省委党校在职研究生招生考试(法学)历年参考题库含答案详解.docx VIP
- 江苏省南通市2025年中考语文试卷(附答案解析).doc VIP
- 《人工智能在机械设计制造及其自动化中的实践》8900字.docx VIP
- 普传(POWTRAN)变频器PI500变频器使用说明书.pdf
- 最新部编版一年级数学下册教案(全册)表格式二次备课.doc VIP
原创力文档

文档评论(0)