- 2
- 0
- 约6.02万字
- 约 55页
- 2021-08-25 发布于上海
- 举报
ogre 中摄像机的一些相关函数
//创建摄像机
//sceneManager 是一个已经存在的场景管理器实例的指针。
//我们在这里构建名称为 “MainCam”的摄像机。
Camera *camera = sceneMgr-createCamera(“MainCam”);
//并不需要计算什么,可以直接从视口中得到这个尺寸 这里现实视口比例是 4:3
camera-setAspectRatio(1.333333f);
//30 度角可以让我们看到一个长而远的视野
camera-setFOVy(30.0f); //图上W 是这里的角度
camera-setNearClipDistance(5.0f); //摄像机到平面 xy 的距离
camera-setFarClipDistance(1000.0f);//摄像机到平面 xy的距离
//设置渲染模式 下面分别对应点线 点 实体渲染
camera-setPolygonMode(PM_WIREFRAME);
camera-setPolygonMode(PM_POINTS);
camera-setPolygonMode(PM_SOLOD);
PolygonMode mode = camera-getPolygonMode(); //这个不用讲了
//摄像机的位置变换
//确认我们已经有一个指向 “Camera”类型实例的指针 camera。
camera-setPosition(200, 10, 200);
//也可以用一个三维向量来设置摄像机坐标,在我们得到场景坐标时候这么做会方便一些
//camera-setPosition(Vector3(200, 10, 200));
//假设摄像机还在我们之前设置的 200, 10, 200 空间位置上。
camera-move(10, 0, 0); //摄像机移动到 210, 10, 200
camera-moveRelative(0, 0, 10); //摄像机移动到 210, 10, 210
//move ,moveRelative 与 setPosition 的区别
//setPosition 设置摄像机的绝对坐标 move 和 moveRelative 是把摄像机移动到当前位置的
相对位置上
//moveRelative 与 move 的区别前者是在摄像机的本地坐标移动假设摄像机像右旋转 90 度
在向前移动 10
//个单位,那么本地坐标是向 Z 方向移动 10 而世界坐标是像 X 方向移动 10 个单位
//指向,方向,LookAt
void setDirection(Real x, Real y, Real z);
void setDirection(const Vector3 vec);
Vector3 getDirection(void) const;
Vector3 getUp(void) const;
Vector3 getRight(void) const;
void lookAt( const Vector3 angle);
void lookAt(Real x, Real y, Real z);
void roll(const Radian angle); //滚动绕 Z 轴 右手法则 旋转 即逆时针
void roll (Real degrees){roll (Angle ( degrees ) );}
void yaw(const Radian angle); //偏航绕 Y 轴
void yaw(Real degrees){yaw (Angle ( degrees ) );}
void pitch(const Radian angle); //倾斜绕 X 轴
void pitch(Real degrees){yaw (Angle ( degrees ) );}
void rotate(const Vector3 axis, const Radian angle);
void rotate(const Vector3 axis, Real degrees){
rotate(axis, Angle(degrees));}
void setFixedYawAxis (bool useFixed, const Vector3 fixedAxis=Vector3::UNIT_Y)
//设置 Y 轴自由度 不能绕 Y 轴旋转
const Quaternion getOrientation (void) const
void setOrientation(const Quaternion q);
您可能关注的文档
最近下载
- 2025年河北省中考数学真题.docx VIP
- 6.3.2 世界上最大的黄土堆积区—黄土高原(第2课时2023-2024学年八年级下册地理精品教学课件(人教版)+.pptx VIP
- 安源光伏特玻璃厂带式输送机投标书.doc VIP
- 压缩热再生吸附式干燥机.ppt VIP
- 中医执业医师中医基础试题(一)(中医执业医师中医基础考试卷).doc VIP
- 中医执业医师考试中医基础模拟试题(2)(中医执业医师中医基础考试卷).doc VIP
- 吊耳计算对照表.pdf VIP
- 香港中医执业医师考试试题题库.pdf
- 高中语文选择性必修上课本原文、翻译.pdf VIP
- SY_T6592-2016固井质量评价方法.docx VIP
原创力文档

文档评论(0)