Beispiel #1
0
        protected virtual void OnMouseMove(object sender, MouseMoveEventArgs e)
        {
            if (Camera == null)
            {
                return;
            }

            float deltaX = (e.X - mPrevMouse.X) / (float)Width;
            float deltaY = (e.Y - mPrevMouse.Y) / (float)Height;

            deltaX *= mTimeDelta;
            deltaY *= mTimeDelta;

            float deltaT = deltaX;

            if (Math.Abs(deltaX) < Math.Abs(deltaY))
            {
                deltaT = deltaY;
            }

            if (e.Mouse.LeftButton == ButtonState.Pressed)
            {
                Camera.Rotate(-deltaX, -deltaY);
                CameraUpdate();
            }

            if (e.Mouse.RightButton == ButtonState.Pressed)
            {
                Camera.Dolly(-deltaT);
                CameraUpdate();
            }

            if (e.Mouse.MiddleButton == ButtonState.Pressed)
            {
                Camera.Pan(deltaX, -deltaY);
                CameraUpdate();
            }

            mPrevMouse = e;
        }
Beispiel #2
0
 public void UpdateCamera(ICamera cam) {
     float pstep = currentFrame * plength;
     float dstep = currentFrame * dlength;
     cam.Dolly(pstep);
 }