本文整理汇总了C#中Camera.SetPerspective方法的典型用法代码示例。如果您正苦于以下问题:C# Camera.SetPerspective方法的具体用法?C# Camera.SetPerspective怎么用?C# Camera.SetPerspective使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera
的用法示例。
在下文中一共展示了Camera.SetPerspective方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanvasControl3D
/// <summary>
/// Constructor</summary>
/// <param name="yFOV">Y field of view, in radians</param>
/// <param name="nearZ">Near z plane constant</param>
/// <param name="farZ">Far z plane constant</param>
public CanvasControl3D(float yFOV, float nearZ, float farZ)
{
m_camera = new Camera();
m_camera.SetPerspective(yFOV, 1.0f, nearZ, farZ);
m_cameraController = new TrackBallCameraController();
m_cameraController.Camera = m_camera;
m_camera.CameraChanged += CameraChanged;
Sphere3F sphere = new Sphere3F(new Vec3F(0, 0, 0), 25.0f);
m_camera.ZoomOnSphere(sphere);
}
示例2: Level
public Level(GameWindow window, Device device, int number)
: base(device)
{
ClearColor = new Color(0x51, 0xa9, 0xf0);
#if DEBUG
_mapFile = "../../Assets/Maps/Level" + number + ".txt";
#else
_mapFile = "Assets/Maps/Level" + number + ".txt";
#endif
DisabledSet = new HashSet<GameObject>();
ReloadScene(device);
if (_player != null)
{
_camera = new Camera
{
new LookAtObject(_player),
new Follow(_player)
{
Speed = 40,
SlowingDist = 5,
Offset = new Vector3(0, 4, 0),
Mask = new Vector3(1, 1, 0)
},
new RigidBody
{
Friction = new Vector3(8, 20, 8),
//MaxSpeed = new Vector3(5f)
}
};
_camera.Viewport = new SharpDX.Viewport(0, 0, window.Width, window.Height);
_camera.SetPerspective(60, window.Width / (float)window.Height, 1, 5000);
//camera.SetOrthographic(20, 20 * (window.Height / (float)window.Width), 1, 5000);
MoveCameraToPlayer();
Add(_camera);
}
}