XNA中的摄像机
来源:互联网 发布:php 7 编程实战 pdf 编辑:程序博客网 时间:2024/05/16 01:00
XNA中摄像机是通过View和Projection来体现的,其中View矩阵用于实现世界坐标到摄像机坐标的转换。Projection是投影矩阵,用于完成摄像机坐标系到屏幕坐标系的转换。根据面向对象的思想及程序重用性和可维护性的需要可以将有关摄像机的操作封装到一个摄像机类中,同时提供第一人称、第三人称摄像机。
1、 View的创建
public static Matrix CreateLookAt (
Vector3 cameraPosition, /* The position of the camera */
Vector3 cameraTarget, /* The direction that the camera is pointing */
Vector3 cameraUpVector
)
Vector3 cameraUpVector: The direction that is "up" from the camera's point of view
view = Matrix.CreateLookAt(cameraPosition, cameraLookat, cameraLookUp);
2、 Projection的创建
public static Matrix CreatePerspectiveFieldOfView (
float fieldOfView, /*Field of view in radians*/
float aspectRatio, /*宽高比*/
float nearPlaneDistance, /*Distance to the near view plane*/
float farPlaneDistance /*Distance to the far view plane*/
)
float aspectRatio:Aspect ratio, defined as view space width divided by height
proj = Matrix.CreatePerspectiveFieldOfView(viewAngle, aspectRatio, nearClip, farClip);
在编程过程中我们需要改变摄像机的位置和摄像机所观察的指向来跟踪物体或者完成第一人称摄像机与第三人称摄像机的切换。
- XNA中的摄像机
- xna 摄像机的旋转!
- XNA那些事(八)-WINDOWS PHONE游戏中的摄像机全总结
- XNA那些事(六)--WINDOWS PHONE 游戏开发中的3D摄像机
- XNA中的显示
- XNA中的RenderTarget
- XNA中的骨骼动画
- XNA中的骨骼动画
- XNA中的Matrix结构
- XNA中的Alpha混合
- XNA在Silverlight 中的应用
- XNA数学库中的XMVECTOR
- ogre中的摄像机
- Viewport3D中的摄像机
- Ogre中的摄像机
- Ogre中的摄像机
- Three.js中的摄像机
- 摄像机中的基础矩阵
- silverlight是什么?
- 完成端口
- JavaScript将成Silverlight的最大对手
- .NET中的虚函数
- XNA中的显示
- XNA中的摄像机
- 微软借奥运与Adobe争夺富互联网应用统治地位
- XNA中的拾取与碰撞检测
- 我们一起快乐,一起流泪以后......
- 解决Ubuntu 8.0在vmware中不能上网问题
- 一个高效率算法
- Tweening过度缓动效果
- mvc设计模式
- 软件测试新手误区-追求最新版本的测试工具