예제 #1
0
        public override void Update()
        {
            UpdatePosition();

            GroundOffset      = GameUtils.Lerp(GroundOffset, Radius, 0.1f);
            interpolatedPitch = GameUtils.Lerp(interpolatedPitch, Pitch, 0.1f);
            interpolatedYaw   = GameUtils.AngleLerp(interpolatedYaw, Yaw, 0.1f);
            eye.Y             = (float)Math.Sin(interpolatedPitch) * GroundOffset;
            eye.Z             = (float)Math.Cos(interpolatedYaw) * (float)Math.Cos(interpolatedPitch) * GroundOffset;
            eye.X             = (float)Math.Sin(interpolatedYaw) * (float)Math.Cos(interpolatedPitch) * GroundOffset;
            Vector3.Lerp(ref interpolatedTarget, ref target, 0.1f, out interpolatedTarget);
            eyePosition  = eye + interpolatedTarget;
            View         = Matrix.LookAtRH(eyePosition, interpolatedTarget, Vector3.UnitY);
            eyeDirection = eyePosition - interpolatedTarget;

            maxDepth = GroundOffset * 4;
            //Projection = Matrix.OrthoRH((int)Display.width * GroundOffset/1000,(int)Display.height * GroundOffset/1000, -50, maxDepth);
            Projection = Matrix.PerspectiveFovRH(GameUtils.PiOver4, CameraHelper.AspectRatio(), 1, maxDepth);
            //currentMatrix = Matrix.Lerp(currentMatrix, targetMatrix, 0.1f);
            //currentMatrix = LerpHelper.Slerp(currentMatrix, targetMatrix, 0.1f);
            //finalMatrix = currentMatrix;

            ViewProjection = View * Projection;

            Frustum = new BoundingFrustum(ViewProjection);
        }
예제 #2
0
        public EditorCamera()
        {
            Projection = Matrix.PerspectiveFovRH(GameUtils.PiOver4, CameraHelper.AspectRatio(), 1, 1000);

            Sensitivity = 0.04f;

            Yaw           = 0;
            Pitch         = Angle_Side;
            currentMatrix = Matrix.Identity;
            GroundOffset  = minZoom;
        }
예제 #3
0
        public override void Update()
        {
            GroundOffset       = GameUtils.Lerp(GroundOffset, Radius, 0.5f);
            interpolatedPitch  = GameUtils.Lerp(interpolatedPitch, Pitch, 0.5f);
            interpolatedYaw    = GameUtils.AngleLerp(interpolatedYaw, Yaw, 0.5f);
            eye.Y              = (float)Math.Sin(interpolatedPitch) * GroundOffset;
            eye.Z              = (float)Math.Cos(interpolatedYaw) * (float)Math.Cos(interpolatedPitch) * GroundOffset;
            eye.X              = (float)Math.Sin(interpolatedYaw) * (float)Math.Cos(interpolatedPitch) * GroundOffset;
            interpolatedTarget = target;
            //Vector3.Lerp(ref interpolatedTarget, ref target,0.1f, out interpolatedTarget);
            eyePosition = eye + interpolatedTarget;
            View        = Matrix.LookAtRH(eyePosition, interpolatedTarget, Vector3.UnitY);
            UpdatePosition();
            Projection = Matrix.PerspectiveFovRH(GameUtils.PiOver4, CameraHelper.AspectRatio(), 1, GroundOffset * (GameUtils.Max(1, GameUtils.PiOver2 - interpolatedPitch) * 10));

            //currentMatrix = Matrix.Lerp(currentMatrix, targetMatrix, 0.1f);
            //currentMatrix = LerpHelper.Slerp(currentMatrix, targetMatrix, 0.1f);
            //finalMatrix = currentMatrix;

            ViewProjection = View * Projection;

            Frustum = new BoundingFrustum(ViewProjection);
        }