Beispiel #1
0
 public ConfigToken(ConfigToken toCopy)
 {
     this.mesh   = toCopy.mesh;
     this.grid   = toCopy.grid;
     this.width  = toCopy.width;
     this.height = toCopy.height;
 }
Beispiel #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);
                }
            }
        }
Beispiel #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();
        }
Beispiel #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();
        }
        public DisplacementGrid Clone()
        {
            DisplacementGrid n = new DisplacementGrid(width, height, mesh);

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

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