Example #1
0
        private void button2_Click_1(object sender, RoutedEventArgs e)
        {
            FractalSettings fractalSettings = new FractalSettings();

            // load fractal
            string store = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\WooScripter\\Scripts\\fractal";

            // Configure open file dialog box
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName         = "fractal";                  // Default file name
            dlg.DefaultExt       = ".wfd";                     // Default file extension
            dlg.Filter           = "Fractal Descriptor|*.wfd"; // Filter files by extension
            dlg.InitialDirectory = store;

            // Show open file dialog box
            Nullable <bool> result = dlg.ShowDialog();

            // get name of file
            if (result == true)
            {
                string       filename = dlg.FileName;
                StreamReader sr       = new StreamReader(filename);
                string       fractal  = sr.ReadToEnd();
                fractalSettings.Load(fractal);
                sr.Close();
                _RenderOptions     = fractalSettings._RenderOptions;
                _FractalColours    = fractalSettings._FractalColours;
                _FractalIterations = fractalSettings._FractalIterations;
            }
        }
Example #2
0
        private void SaveFractal(string name)
        {
            string store = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\WooFractal\\Scripts";

            if (!System.IO.Directory.Exists(store))
            {
                System.IO.Directory.CreateDirectory(store);
            }
            store = store + "\\" + "fractal";
            if (!System.IO.Directory.Exists(store))
            {
                System.IO.Directory.CreateDirectory(store);
            }
            string filename = store + "\\" + name + ".wfd";

            using (StreamWriter sw = new StreamWriter(filename))
            {
                try
                {
                    FractalSettings fractalSettings = new FractalSettings();
                    fractalSettings.Set(_RenderOptions, _FractalColours, _FractalIterations);
                    sw.Write(fractalSettings.BuildXML());
                    sw.Close();
                }
                catch (Exception /*e*/)
                {
                    // lets not get overexcited...
                }
            }
        }
Example #3
0
 public void SetShaderVars(mat4 viewMatrix, vec3 position, vec3 sunDirection, Camera camera, FractalSettings fractalSettings)
 {
     _ViewMatrix       = viewMatrix;
     _Position         = position;
     _SunDirection     = sunDirection;
     _Camera           = camera;
     _FramesRendered   = 0;
     _ProgressiveIndex = 0;
     _FractalSettings  = fractalSettings;
 }
Example #4
0
 public void LoadXML(XmlReader reader)
 {
     while (reader.NodeType != XmlNodeType.EndElement && reader.Read())
     {
         if (reader.NodeType == XmlNodeType.Element && reader.Name == "FRACTAL")
         {
             _FractalSettings = new FractalSettings();
             _FractalSettings.LoadXML(reader);
         }
         if (reader.NodeType == XmlNodeType.Element && reader.Name == "CAMERA")
         {
             _Camera = new Camera();
             _Camera.LoadXML(reader);
         }
     }
     reader.Read(); // finish off reading the scene
 }
Example #5
0
        private FractalSettings LoadFractal(string name)
        {
            FractalSettings fractalSettings = new FractalSettings();
            string          filename        = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\WooFractal\\Scripts\\fractal\\" + name + ".wfd";

            if (System.IO.File.Exists(filename))
            {
                StreamReader sr      = new StreamReader(filename);
                string       fractal = sr.ReadToEnd();
                fractalSettings.Load(fractal);
                sr.Close();
                _RenderOptions     = fractalSettings._RenderOptions;
                _FractalColours    = fractalSettings._FractalColours;
                _FractalIterations = fractalSettings._FractalIterations;
            }
            return(fractalSettings);
        }
Example #6
0
        private void button1_Click_1(object sender, RoutedEventArgs e)
        {
            // save fractal
            string store = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\WooFractal\\Scripts";

            if (!System.IO.Directory.Exists(store))
            {
                System.IO.Directory.CreateDirectory(store);
            }
            store = store + "\\" + "fractal";
            if (!System.IO.Directory.Exists(store))
            {
                System.IO.Directory.CreateDirectory(store);
            }

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.InitialDirectory = store;
            saveFileDialog1.Filter           = "Fractal Descriptor (*.wfd)|*.wfd";
            saveFileDialog1.FilterIndex      = 1;

            if (saveFileDialog1.ShowDialog() == true)
            {
                // Save document
                string filename = saveFileDialog1.FileName;
                using (StreamWriter sw = new StreamWriter(filename))
                {
                    try
                    {
                        FractalSettings fractalSettings = new FractalSettings();
                        fractalSettings.Set(_RenderOptions, _FractalColours, _FractalIterations);
                        sw.Write(fractalSettings.BuildXML());
                        sw.Close();
                    }
                    catch (Exception /*e*/)
                    {
                        // lets not get overexcited...
                    }
                }
            }
        }
Example #7
0
 public Scene()
 {
     _Camera          = new Camera();
     _FractalSettings = new FractalSettings();
     _GPULight        = new GPULight();
 }