示例#1
0
        /// <summary>
        /// Setup the camera.
        /// </summary>
        /// <param name="position">World position</param>
        /// <param name="target">Target position</param>
        /// <param name="nearClip">Near vision</param>
        /// <param name="farClip">Far vision</param>
        public virtual void SetupCamera(Vector3 position, Vector3 target, float nearClip, float farClip)
        {
            _position  = position;
            _reference = new Vector3(0.0f, 0.0f, 10.0f);
            _target    = target;
            _yaw       = 0.0f;
            _pitch     = 0.0f;
            _roll      = 0.0f;
            _nearClip  = nearClip;
            _farClip   = farClip;

            _view  = Matrix.CreateLookAt(_position, _target, _vectorUp);
            _world = Matrix.Identity;

            UpdateProjection();

            _boundingFrustrum.BuildBoundingFrustum(this);
        }