public FractalColourControl(FractalGradient fractalColours, MaterialSelection materialSelection)
        {
            InitializeComponent();

            _FractalColours    = fractalColours;
            _MaterialSelection = materialSelection;

            SetupGUI();
        }
Example #2
0
        public FractalSettings()
        {
            _FractalIterations = new List <WooFractalIteration>();
            _RenderOptions     = new RenderOptions();
            _FractalColours    = new List <FractalGradient>();
            FractalGradient fractalGradient = new FractalGradient();

            _FractalColours.Add(fractalGradient);
            _MaterialSelection = new MaterialSelection();
        }
Example #3
0
 public void LoadXML(XmlReader reader)
 {
     _FractalColours.Clear();
     _FractalIterations = new List <WooFractalIteration>();
     while (reader.NodeType != XmlNodeType.EndElement && reader.Read())
     {
         if (reader.NodeType == XmlNodeType.Element && reader.Name == "MATERIALSELECTION")
         {
             _MaterialSelection = new MaterialSelection();
             _MaterialSelection.LoadXML(reader);
         }
         if (reader.NodeType == XmlNodeType.Element && reader.Name == "RENDEROPTIONS")
         {
             _RenderOptions = new RenderOptions();
             _RenderOptions.LoadXML(reader);
         }
         if (reader.NodeType == XmlNodeType.Element && reader.Name == "FRACTALCOLOURS")
         {
             FractalGradient fractalColour = new FractalGradient();
             fractalColour.LoadXML(reader);
             _FractalColours.Add(fractalColour);
         }
         if (reader.NodeType == XmlNodeType.Element && reader.Name == "KIFSFRACTAL")
         {
             KIFSIteration fractalIteration = new KIFSIteration();
             fractalIteration.LoadXML(reader);
             _FractalIterations.Add(fractalIteration);
         }
         if (reader.NodeType == XmlNodeType.Element && reader.Name == "BULBFRACTAL")
         {
             MandelbulbIteration fractalIteration = new MandelbulbIteration();
             fractalIteration.LoadXML(reader);
             _FractalIterations.Add(fractalIteration);
         }
         if (reader.NodeType == XmlNodeType.Element && reader.Name == "BOXFRACTAL")
         {
             MandelboxIteration fractalIteration = new MandelboxIteration();
             fractalIteration.LoadXML(reader);
             _FractalIterations.Add(fractalIteration);
         }
         if (reader.NodeType == XmlNodeType.Element && reader.Name == "KLEINIANGROUP")
         {
             KleinianGroupIteration fractalIteration = new KleinianGroupIteration();
             fractalIteration.LoadXML(reader);
             _FractalIterations.Add(fractalIteration);
         }
         if (reader.NodeType == XmlNodeType.Element && reader.Name == "BOXFOLD")
         {
             BoxfoldIteration fractalIteration = new BoxfoldIteration();
             fractalIteration.LoadXML(reader);
             _FractalIterations.Add(fractalIteration);
         }
     }
     reader.Read();
 }
Example #4
0
        private void LoadColoursFile(string name)
        {
            string filename = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\WooFractal\\Colours\\" + name + ".wcd";

            if (System.IO.File.Exists(filename))
            {
                StreamReader sr = new StreamReader(filename);
                string       colourDescriptor = sr.ReadToEnd();
                _Scene._FractalSettings._FractalColours.Clear();

                using (XmlReader reader = XmlReader.Create(new StringReader(colourDescriptor)))
                {
                    try
                    {
                        while (reader.NodeType != XmlNodeType.EndElement && reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Element && reader.Name == "CONTEXT")
                            {
                                reader.Read();
                                while (reader.NodeType != XmlNodeType.EndElement && reader.Read())
                                {
                                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "FRACTALCOLOURS")
                                    {
                                        FractalGradient fractalColour = new FractalGradient();
                                        fractalColour.LoadXML(reader);
                                        _Scene._FractalSettings._FractalColours.Add(fractalColour);
                                    }
                                }
                                reader.Read();
                            }
                        }
                    }
                    catch (XmlException /*e*/)
                    {
                        _Scene = new Scene();
                    }
                }
                sr.Close();
            }

            BuildColourList();
        }
        private void InitialiseRenderer()
        {
            _RaytracerOptions                 = new RaytracerOptions();
            _RaytracerOptions._DoFEnabled     = false;
            _RaytracerOptions._ShadowsEnabled = true;
            _RaytracerOptions._Reflections    = 1;

            _Scene = new Scene();
            _Scene._FractalSettings._FractalIterations.Clear();
            _Scene._FractalSettings._FractalColours.Clear();
            _Scene._FractalSettings._RenderOptions._Background = 1;
            FractalGradient preview = new FractalGradient();

            preview._GradientSegments[0]._StartColour = _Material;
            preview._Multiplier = 0.0f;
            _Scene._FractalSettings._FractalColours.Add(preview);
            _Scene._Camera._Position = new Vector3(0, 1.5, 1.5);
            _Scene._Camera._Target   = new Vector3(0, 1, 0);

            _PostProcess = new PostProcess();
//            _PostProcess._ToneMappingMode = 3;
            _PostProcess.Initialise(_GL);

            //  Initialise the scene.
            string frag = "";

            _Scene.Compile(_RaytracerOptions, _Scene._FractalSettings._RenderOptions, ref frag);

            _ShaderRenderer = new ShaderRenderer();
            _ShaderRenderer.Compile(_GL, frag, 16);

            int width, height;

            width  = (int)openGlCtrl.ActualWidth;
            height = (int)openGlCtrl.ActualHeight;
            _ShaderRenderer.Initialise(_GL, width, height, _Scene._Camera.GetViewMatrix(), _Scene._Camera.GetPosition(), false);
            _ShaderRenderer.SetShaderVars(_Scene._Camera.GetViewMatrix(), _Scene._Camera.GetPosition(), _Scene._FractalSettings._RenderOptions.GetSunVec3(), _Scene._Camera, _Scene._FractalSettings);
            _ShaderRenderer.SetProgressive(_RaytracerOptions._Progressive);
            _ShaderRenderer.SetPostProcess(_PostProcess);
            _ShaderRenderer.Clean(_GL);
            _ShaderRenderer.Start();
        }
Example #6
0
 public void RemoveFractalColour(FractalGradient fractalGradient)
 {
     _Scene._FractalSettings._FractalColours.Remove(fractalGradient);
     BuildColourList();
 }