ogre中摄像机函数汇总

上传人:飞*** 文档编号:2191126 上传时间:2017-07-21 格式:DOC 页数:55 大小:359KB
返回 下载 相关 举报
ogre中摄像机函数汇总_第1页
第1页 / 共55页
ogre中摄像机函数汇总_第2页
第2页 / 共55页
ogre中摄像机函数汇总_第3页
第3页 / 共55页
ogre中摄像机函数汇总_第4页
第4页 / 共55页
ogre中摄像机函数汇总_第5页
第5页 / 共55页
点击查看更多>>
资源描述

《ogre中摄像机函数汇总》由会员分享,可在线阅读,更多相关《ogre中摄像机函数汇总(55页珍藏版)》请在金锄头文库上搜索。

1、ogre 中摄像机的一些相关函数/创建摄像机/sceneManager 是一个已经存在的场景管理器实例的指针。/我们在这里构建名称为“MainCam”的摄像机。Camera *camera = sceneMgr-createCamera(“MainCam”);/并不需要计算什么,可以直接从视口中得到这个尺寸 这里现实视口比例是 4:3camera-setAspectRatio(1.333333f);/30 度角可以让我们看到一个长而远的视野 camera-setFOVy(30.0f); /图上 W 是这里的角度camera-setNearClipDistance(5.0f); /摄像机到平面

2、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,

3、 200);/也可以用一个三维向量来设置摄像机坐标,在我们得到场景坐标时候这么做会方便一些/camera-setPosition(Vector3(200, 10, 200);/假设摄像机还在我们之前设置的 200, 10, 200 空间位置上。camera-move(10, 0, 0); /摄像机移动到 210, 10, 200camera-moveRelative(0, 0, 10); /摄像机移动到 210, 10, 210/move ,moveRelative 与 setPosition 的区别 /setPosition 设置摄像机的绝对坐标 move 和 moveRelative 是把

4、摄像机移动到当前位置的相对位置上/moveRelative 与 move 的区别 前者是在摄像机的本地坐标移动 假设摄像机像右旋转 90度 在向前移动 10/个单位,那么本地坐标是向 Z 方向移动 10 而世界坐标是像 X 方向移动 10 个单位/指向,方向,LookAtvoid setDirection(Real x, Real y, Real z);void setDirection(const Vector3& vec);Vector3 getDirection(void) const; Vector3 getUp(void) const;Vector3 getRight(void) c

5、onst;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); /倾

6、斜绕 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 &

7、 getOrientation (void) const void setOrientation(const Quaternion& q);/自动跟踪/*方法中第一个参数确定是否打开自动跟踪,在任何一帧渲染之前都可以重新设置它。并且需要注意在关掉自动跟踪之前,要确保所被跟踪的节点没有被删除(否则系统会抛出异常)。方法的第二个参数是被跟踪节点得指针,除非你第一个参数是 false(这时候可以用 NULL),否则你必须确定调用的时候指针指向的节点必须有效。有时候你可能发现你所要跟踪的物体太大了,以至于你都不知道“看”哪里才好,这时候你可以设置第三个参数来定着眼点,它是一个本地空间中相对于场景节点的

8、定位点。*/void setAutoTracking(bool enabled,SceneNode *target=0,const Vector3 &offset=Vector3:ZERO);/得到摄像机相关信息const Quaternion& getDerivedOrientation(void) const;const Vector3& getDerivedPosition(void) const;Vector3 getDerivedDirection(void) const;Vector3 getDerivedUp(void) const;Vector3 getDerivedRight

9、(void) const;const Quaternion& getRealOrientation(void) const;const Vector3& getRealPosition(void) const;Vector3 getRealDirection(void) const;Vector3 getRealUp(void) const;Vector3 getRealRight(void) const; /* 其中有“Real”关键字的方法返回的是世界空间的坐标,而拥有“Derived”关键字的方法的返回值是在“轴绑定”的本地坐标系中(也就是说这个坐标系原点是摄像机所在的点,而它的轴向和世

10、界坐标系相同)。*/Ogre 摄像机 Camera 类 收藏 Camera 类对摄象机的抽象。成员函数说明如下:标准构造函数Camera(String name, SceneManager* sm);标准析构函数virtual Camera();返回渲染该摄像机的 scenemanager 的指针SceneManager* getSceneManager(void) const;取得摄像机的名字virtual const String& getName(void) const;设定投影模式(正射或透视) ,缺省为透视void setProjectionType(ProjectionType p

11、t);取得使用的投影模式的信息ProjectionType getProjectionType(void) const;设定该摄像机需要的渲染细节级别void setDetailLevel(SceneDetailLevel sd);取得该摄像机的渲染细节级别SceneDetailLevel getDetailLevel(void) const;设定摄像机的位置void setPosition(Real x, Real y, Real z);void setPosition(const Vector3& vec);取得摄像机的位置const Vector3& getPosition(void)

12、const;移动摄像机void move(const Vector3& vec);void moveRelative(const Vector3& vec);设定摄像机的方向向量void setDirection(Real x, Real y, Real z);void setDirection(const Vector3& vec);取得摄像机的方向Vector3 getDirection(void) const;这是一个辅助方法用来自动计算摄像机的方向向量,在当前位置和所看的点,参数targetPoint 是一个向量指明所看的点。void lookAt( const Vector3& ta

13、rgetPoint );void lookAt(Real x, Real y, Real z);将摄像机绕 z 轴逆时针旋转指定角度void roll(Real degrees);绕 y 轴逆时针旋转指定角度void yaw(Real degrees);绕 x 轴上下逆时针旋转void pitch(Real degrees);旋转任意角度void rotate(const Vector3& axis, Real degrees);使用四元组绕任意轴旋转void rotate(const Quaternion& q);指定摄像机是绕本地 y 轴还是指定的固定轴旋转void setFixedYaw

14、Axis( bool useFixed, const Vector3& fixedAxis = Vector3:UNIT_Y );设定 y 方向的视野域,水平方向的视野域将依此计算void setFOVy(Real fovy);取得 y 方向的视野域Real getFOVy(void) const;设定到近裁减面的距离void setNearClipDistance(Real nearDist);取得到近裁减面的距离Real getNearClipDistance(void) const;设定到远裁减面的距离void setAspectRatio(Real ratio);取得当前纵横比Real

15、 getAspectRatio(void) const;内部使用,取得该摄像机的投影矩阵const Matrix4& getProjectionMatrix(void);内部使用,取得该摄像机的观察矩阵const Matrix4& getViewMatrix(void);取得平截台体的特定面const Plane& getFrustumPlane( FrustumPlane plane );测试给定的包容器是否在平截台体中bool isVisible(const AxisAlignedBox& bound, FrustumPlane* culledBy = 0);bool isVisible(

16、const Sphere& bound, FrustumPlane* culledBy = 0);测试给定的顶点是否在平截台体中bool isVisible(const Vector3& vert, FrustumPlane* culledBy = 0);返回摄像机的当前方向const Quaternion& getOrientation(void) const;设定摄像机的方向void setOrientation(const Quaternion& q);输出流功能friend std:ostream& operatorcreateCamera(PlayerCam);/ 将该摄象机放到 0,0,500 位置上mCamera-setPosition(Vector3(0,0,500);/ 让摄象机“看”向 Z 轴负方向(从屏幕外向屏幕里)以模拟你的眼睛mCamera-lookAt(Vecto

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号