资源描述:
《silverlight.xna(c#)跨平台3d游戏研发手记:(十)3d 场景与控制设计①.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、模型和骨骼动画仅仅是开启3D游戏的敲门砖,置入基于摄像机的场景设计方能呈现最完美的3D游戏。本节,我们依旧从简单着手,一步步创建基于模型的3D游戏场景。《XNA4.0学习指南(中文)》是一本绝对值得一看的好书,对于3D游戏的基础知识、概念以及简单应用讲解非常全面。比如书中提到关于XNA内置了创建摄像机的方案代码,根据该提示我们便可轻松实现一个名为Camera3D的类:3D摄像机 /// /// 3D摄像机 /// public sealed class
2、 Camera3D : Object3D { public Matrix View { get; set; } public Matrix Projection { get; set; } public Vector3 Target { get; set; } public Vector3 Up { get; set; } public float Near { get; set; } public float Far { get;
3、set; }http://www.0791wang.cn /// /// 获取或设置视角模式 /// public ViewModes ViewMode { get; set; } public Camera3D(ContentManager content, GraphicsDevice device, Vector3 position, Vector3 target, Vector3 up, float
4、 near, float far) : base(content, device) { this.Position = position; this.Target = target; this.Up = up; this.Near = near; this.Far = far; } /// /// 更新以3D角色为中心的视口
5、 /// /// public void UpdateViewPort(Role3D role3D) { if (role3D != null) { Vector3 center = role3D.Position; switch (ViewMode) { case ViewMo
6、des.FirstPerson: SetViewPort(center, -5, -10, role3D.Eye - 10, role3D.Eye - 10); break; case ViewModes.ThirdPersonHeadlook: SetViewPort(center, 30, -410, role3D.Eye, role3D.Eye - 130); break;
7、 case ViewModes.ThirdPersonOverlook: SetViewPort(center, role3D.Eye + 80, 0, role3D.Eye + 100, 0); break; } } }http://yy.ttplay8.cn /// /// 从(0,y1,a)向(0,y2,b)方向看,其中a,b
8、调节远近,y1,y2调节高度,Scale伸缩摄像机 /// /// 参照物中心位置 /// Position的Z位置 /// Ta