public void Modify(SpotSceneObjectModification modification)
 {
     foreach (var t in _Triangles)
     {
         t.Modify(modification);
     }
 }
        // ------------------------------------------------
        // Модификации.
        // ------------------------------------------------

        public override void Modify(SpotSceneObjectModification modification)
        {
            if (modification is ICameraModification)
            {
                modification.ApplyTo(this);
            }
            else
            {
                throw new IllegalModificationException();
            }
        }
Exemplo n.º 3
0
        private void ModifyModel(object sender, EventArgs e)
        {
            try
            {
                var mi = (ToolStripMenuItem)sender;
                SpotSceneObjectModification m = null;

                switch (mi.Name)
                {
                case "_ModelRotationOXMI":
                    m = new VertexRotationOX(Constants.ROTATION_ANGLE);
                    break;

                case "_ModelRotationOYMI":
                    m = new VertexRotationOY(Constants.ROTATION_ANGLE);
                    break;

                case "_ModelRotationOZMI":
                    m = new VertexRotationOZ(Constants.ROTATION_ANGLE);
                    break;

                case "_ModelScalingInMI":
                    m = new VertexScaling(Constants.SCALING_COEFFICIENT_IN,
                                          Constants.SCALING_COEFFICIENT_IN, Constants.SCALING_COEFFICIENT_IN);
                    break;

                case "_ModelScalingOutMI":
                    m = new VertexScaling(Constants.SCALING_COEFFICIENT_OUT,
                                          Constants.SCALING_COEFFICIENT_OUT, Constants.SCALING_COEFFICIENT_OUT);
                    break;

                default:
                    return;
                }

                _Model1.Modify(m);
                _Model2.Modify(m);
                _Scene.Model.Modify(m);
                ShowScene();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.ToString(), "Ошибка!");
            }
        }
Exemplo n.º 4
0
        private void ModifyLight(object sender, EventArgs e)
        {
            try
            {
                var mi = (ToolStripMenuItem)sender;
                SpotSceneObjectModification m = null;

                switch (mi.Name)
                {
                case "_LightMovementRightMI":
                    m = new LightMovement(Constants.MOVEMENT_DISTANCE, 0, 0);
                    break;

                case "_LightMovementLeftMI":
                    m = new LightMovement(-Constants.MOVEMENT_DISTANCE, 0, 0);
                    break;

                case "_LightMovementUpMI":
                    m = new LightMovement(0, -Constants.MOVEMENT_DISTANCE, 0);
                    break;

                case "_LightMovementDownMI":
                    m = new LightMovement(0, Constants.MOVEMENT_DISTANCE, 0);
                    break;

                case "_LightMovementForwardMI":
                    m = new LightMovement(0, 0, Constants.MOVEMENT_DISTANCE);
                    break;

                case "_LightMovementBackMI":
                    m = new LightMovement(0, 0, -Constants.MOVEMENT_DISTANCE);
                    break;

                default:
                    return;
                }

                _Scene.Light.Modify(m);
                ShowScene();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.ToString(), "Ошибка!");
            }
        }