コード例 #1
0
        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            switch (_mouseMode)
            {
            case MouseMode.RotateLight:
                Draw(WorldStateChange.ChangeLightPosition(e.X, e.Y));
                break;

            case MouseMode.RotateModel:
                var x = ((float)ViewportWidth / 2 - e.X) / ((float)ViewportWidth / 2) * (float)Math.PI / 2;
                var y = ((float)ViewportHeight / 2 - e.Y) / ((float)ViewportHeight / 2) * (float)Math.PI / 2;

                Draw(WorldStateChange.ChangeModelRotation(x, y));
                break;
            }
        }