예제 #1
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            double delta = 0.3;

            switch (keyData)
            {
            case Keys.W: camera.Position *= Transformations.Translate(0.1 * camera.Forward); break;

            case Keys.A: camera.Position *= Transformations.Translate(0.1 * camera.Left); break;

            case Keys.S: camera.Position *= Transformations.Translate(0.1 * camera.Backward); break;

            case Keys.D: camera.Position *= Transformations.Translate(0.1 * camera.Right); break;

            case Keys.Left: camera.Fi += delta; break;

            case Keys.Right: camera.Fi -= delta; break;

            case Keys.Up: camera.Theta += delta; break;

            case Keys.Down: camera.Theta -= delta; break;
            }
            pictureBox1.Refresh();
            return(base.ProcessCmdKey(ref msg, keyData));
        }
예제 #2
0
        private void Translate()
        {
            double translatingX = (double)numericUpDown7.Value;
            double translatingY = (double)numericUpDown8.Value;
            double translatingZ = (double)numericUpDown9.Value;

            current_primitive.Apply(Transformations.Translate(translatingX, translatingY, translatingZ));
            pictureBox1.Refresh();
        }
예제 #3
0
 private void DrawSceneBtn_Click(object sender, EventArgs e)
 {
     without_colors    = false;
     moreThanOneObj    = true;
     current_primitive = new Icosahedron(1);
     current_primitive.Apply(Transformations.Translate(0, 0.20, -0.40));
     objects.Add(current_primitive);
     current_primitive = new Tetrahedron(1);
     current_primitive.Apply(Transformations.Translate(0, 0, 0.80));
     objects.Add(current_primitive);
     pictureBox1.Invalidate();
 }