Esempio n. 1
0
        public TopViewCamera(Frame3D loc, double aspectRatio) : base(aspectRatio)
        {
            Vector3 vec = loc.ToDirectXVector();

            _topViewTransform = Matrix.LookAtLH(new Vector3(0, 0, vec.Z),
                                                new Vector3(), Vector3.UnitY);
        }
Esempio n. 2
0
        /// <summary>
        /// Создает камеру, которую можно крутить движением мышки
        /// </summary>
        /// <param name="eventSource">Control,с которого обрабатываются события </param>
        /// <param name="cameraLocation">Исходное положение камеры</param>
        public TrackballCamera(Control eventSource, Frame3D cameraLocation)
            : base(eventSource.ClientSize.Width / (double)eventSource.ClientSize.Height)
        {
            EventSource = eventSource;
            Vector3 tempLoc = cameraLocation.ToDirectXVector();

            _cameraLocation = new Vector3(Math.Abs(tempLoc.X), 0, tempLoc.Z);
            Angle ang = Geometry.Atan2(tempLoc.Y, tempLoc.X);

            _rotationMatrix = Matrix.RotationZ(-(float)ang.Radian);
            _radius         = _cameraLocation.Length();
            Scale           = 1;
        }