当前位置: 首页>>代码示例>>C#>>正文


C# Camera.SetPerspective方法代码示例

本文整理汇总了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);
        }
开发者ID:sbambach,项目名称:ATF,代码行数:17,代码来源:CanvasControl3D.cs

示例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);
            }
        }
开发者ID:jvlppm,项目名称:pucpr-dx-cube_mario,代码行数:40,代码来源:Level.cs


注:本文中的Camera.SetPerspective方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。