Exemplo n.º 1
0
        /// <summary>
        /// Rotates camera up & down with @angle
        /// </summary>
        public void FlyCameraUpDown(double angle)
        {
            Matrix rotateMatrix = ModificationMatrix.NewMoveMatrix(-Target.X, -Target.Y, -Target.Z);

            rotateMatrix = rotateMatrix.Multiply(Position.GetProjectiveCoordinates());
            Position.Set(rotateMatrix[0, 0], rotateMatrix[1, 0], rotateMatrix[2, 0]);

            angle += MathHelpers.FromRadiansToDegrees(Position.Theta);
            angle  = Math.Min(Math.Max(angle, MIN_THETA), MAX_THETA);
            Position.SetTheta(MathHelpers.FromDegreesToRadians(angle));
            AngleTheta = 180 - (int)angle;

            rotateMatrix = ModificationMatrix.NewMoveMatrix(Target.X, Target.Y, Target.Z);
            rotateMatrix = rotateMatrix.Multiply(Position.GetProjectiveCoordinates());
            Position.Set(rotateMatrix[0, 0], rotateMatrix[1, 0], rotateMatrix[2, 0]);
        }
Exemplo n.º 2
0
        // do you really need any comments here?
        public void HeadCameraLeftRight(double angle)
        {
            Matrix rotateMatrix = ModificationMatrix.NewMoveMatrix(-Position.X, -Position.Y, -Position.Z);

            rotateMatrix = rotateMatrix.Multiply(Target.GetProjectiveCoordinates());
            Target.Set(rotateMatrix[0, 0], rotateMatrix[1, 0], rotateMatrix[2, 0]);

            angle += MathHelpers.FromRadiansToDegrees(Target.Phi);
            angle %= 360;
            angle  = angle < 0 ? 360 + angle : angle;

            Target.SetPhi(MathHelpers.FromDegreesToRadians(angle));
            AnglePhi = (int)angle;

            rotateMatrix = ModificationMatrix.NewMoveMatrix(Position.X, Position.Y, Position.Z);
            rotateMatrix = rotateMatrix.Multiply(Target.GetProjectiveCoordinates());
            Target.Set(rotateMatrix[0, 0], rotateMatrix[1, 0], rotateMatrix[2, 0]);
        }