Esempio n. 1
0
 public ConfigToken(ConfigToken toCopy)
 {
     this.mesh   = toCopy.mesh;
     this.grid   = toCopy.grid;
     this.width  = toCopy.width;
     this.height = toCopy.height;
 }
Esempio n. 2
0
        private void load_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = dialogFilter;
            if (ofd.ShowDialog(this) == DialogResult.OK)
            {
                if (grid != null)
                {
                    grid.Abort();
                }

                try
                {
                    FileStream fs = new FileStream(ofd.FileName, FileMode.Open);

                    DisplacementGrid g = new DisplacementGrid(fs, mesh);
                    GridWidth  = g.Width;
                    GridHeight = g.Height;
                    grid       = g;

                    InitializeRenderer();

                    grid.UpdateMesh();
                }
                catch (Exception exc)
                {
                    MessageBox.Show(this,
                                    "Error loading warp grid:\n\n" + exc.ToString(),
                                    "Error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 3
0
        private void OnGridChanged()
        {
            if (grid != null)
            {
                if (grid.Width != GridWidth || grid.Height != GridHeight)
                {
                    grid.Abort();
                    grid.SetSize(GridWidth, GridHeight);

                    if (mesh != null)
                    {
                        mesh.Clear();
                    }
                    if (surface != null)
                    {
                        surface.CopySurface(EnvironmentParameters.SourceSurface);
                    }
                }
            }
            else if (mesh != null)
            {
                grid = new DisplacementGrid(GridWidth, GridHeight, mesh, linearInterpolationBtn.Checked);
                InitializeRenderer();
            }

            canvas.InvalidateCanvas();
        }
Esempio n. 4
0
        private void OnGridChanged()
        {
            if (grid != null)
            {
                if (grid.Width != GridWidth || grid.Height != GridHeight)
                {
                    grid.Abort();
                    grid.SetSize(GridWidth, GridHeight);

                    if (mesh != null)
                    {
                        mesh.Clear();
                    }
                    if (surface != null)
                    {
                        surface.CopySurface(EffectSourceSurface);
                    }
                }
            }
            else if (mesh != null)
            {
                grid = new DisplacementGrid(GridWidth, GridHeight, mesh);
                InitializeRenderer();
            }

            canvas.InvalidateCanvas();
        }
Esempio n. 5
0
        public DisplacementGrid Clone()
        {
            DisplacementGrid n = new DisplacementGrid(width, height, mesh);

            n.points = (DisplacementVector[, ])points.Clone();
            return(n);
        }
Esempio n. 6
0
        public DisplacementGrid Clone()
        {
            DisplacementGrid n = new DisplacementGrid(width, height, mesh, useLinearInterpolation);

            n.points = (DisplacementVector[, ])points.Clone();
            return(n);
        }