Example #1
0
        public void Move(float dx, float dy)
        {
            // normalize dist
            float factor = Vector3d.length(m_eye - m_lookat) / 500.0f;

            Move(dx, dy, factor);
        }
Example #2
0
        public void MoveForward(float dist, float factor)
        {
            if (factor < 0.3)
            {
                factor = 0.3f;
            }
            dist = dist * factor;
            Vector3d diff = (m_eye - m_lookat);
            float    len  = Vector3d.length(diff) - dist;

            if ((len <= 0) || (len >= 1000))
            {
                return;
            }
            diff.Normalize();
            diff  = diff * (float)dist;
            m_eye = m_eye - diff;
            UpdateView();
        }
Example #3
0
        public void ResetViewAnim(float x, float y, float z, float updeg, float lookz)
        {
            m_animcnt = 10;
            // move
            m_animstep  = AnimStep.StepMove;
            m_animmovex = -m_dx / m_animcnt;
            m_animmovey = -m_dy / m_animcnt;
            m_animmovez = (lookz - m_dz) / m_animcnt;

            // zoom
            Vector3d diff = (m_eye - m_lookat);
            float    len  = Vector3d.length(diff) - Vector3d.length(new Vector3d(x, y, z));

            m_animzoom = len / m_animcnt;

            // down
            len = (float)Math.Sqrt(m_eye.x * m_eye.x + m_eye.y * m_eye.y);
            float deg = (float)Math.Atan2(m_eye.z, len) / deg2rad;

            if (m_up.z < 0)
            {
                deg = 180 - deg;
            }
            if (((deg > 85) && (deg < 95)) || ((deg < -85) && (deg > -95)))
            {
                RotateUp(-deg / 10);
                deg -= deg / 10;
            }
            m_animdown = (updeg - deg) / m_animcnt;

            // rotate
            deg = (float)Math.Atan2(m_eye.x, -m_eye.y) / deg2rad;
            if (m_up.z < 0)
            {
                deg += 180;
            }
            if (deg > 360)
            {
                deg -= 360;
            }
            m_animrot = deg / m_animcnt;
        }
Example #4
0
        public void MoveForward(float dist)
        {
            float factor = Vector3d.length(m_eye - m_lookat) / 200.0f;

            MoveForward(dist, factor);
        }