예제 #1
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            _Camera._MinSamples = _Camera._MaxSamples = _SamplesPerPixel;
            BuildXML();

            int width  = 960;
            int height = 540;

            if (radioButton3.IsChecked.HasValue && radioButton3.IsChecked.Value)
            {
                width  = 480;
                height = 270;
            }
            if (radioButton5.IsChecked.HasValue && radioButton5.IsChecked.Value)
            {
                width  = 1920;
                height = 1080;
            }
            if (radioButton6.IsChecked.HasValue && radioButton6.IsChecked.Value)
            {
                width  = _ImageWidth;
                height = _ImageHeight;
            }
            _ImageRenderer  = new ImageRenderer(image1, _XML, width, height, true);
            _ImageRendering = true;

            _ImageRenderer.SetPostProcess(_PostProcess);
            _ImageRenderer.Render();

            // set up animation thread for the camera movement
            _Timer          = new DispatcherTimer();
            _Timer.Interval = TimeSpan.FromMilliseconds(100);
            _Timer.Tick    += this.timer_Tick;
            _Timer.Start();
        }
예제 #2
0
        public void RenderPreview()
        {
            _Camera             = new Camera(new Vector3(0, 0.4, -0.75), new Vector3(0, 0.5, 0), 40, 0, 0);
            _Camera._AAEnabled  = true;
            _Camera._DOFEnabled = false;

            string log = "", error = "";

            _BackgroundScript          = new WooScript();
            _BackgroundScript._Program = "rule main {pos.y -= 1 box}";
            _BackgroundScript.Parse(ref log, ref error);
            _PreviewScript          = new WooScript();
            _PreviewScript._Program = "rule main {diff=vec(" + _Material._DiffuseColour.ToString() + ")\r\n"
                                      + "spec=vec(" + _Material._SpecularColour.ToString() + ")\r\n"
                                      + "refl=vec(" + _Material._Reflectivity.ToString() + ")\r\n"
                                      + "emi=vec(" + _Material._EmissiveColour.ToString() + ")\r\n"
                                      + "power=" + _Material._SpecularPower.ToString() + "\r\n"
                                      + "gloss=" + _Material._Shininess.ToString() + "\r\n"
                                      + "sphere}";
            _PreviewScript.Parse(ref log, ref error);
            _LightingScript          = new WooScript();
            _LightingScript._Program = "rule main {directionalLight(vec(1.0, 1.0, 1.0), vec(-0.7, 1.0, -0.6), 0.02, 1) background(vec(0.0,0.0,0.0))}";
            _LightingScript.Parse(ref log, ref error);

            _Scene = new Scene(_Camera);
            _Scene.AddRenderObject(_BackgroundScript);
            _Scene.AddRenderObject(_PreviewScript);
            _Scene.AddRenderObject(_LightingScript);
            BuildXML();
            _ImageRenderer = new ImageRenderer(image1, _XML, (int)image1.Width, (int)image1.Height, false);
            _ImageRenderer.Render();
            _ImageRenderer.SetPostProcess(new PostProcess());
            _ImageRenderer.TransferLatest(false);
        }
예제 #3
0
        private void TriggerPreview()
        {
//            _Scale = getPreviewResolution();
            _Scene._Shadows = getShadowsEnabled();
            _SimpleLighting = getSimpleLighting();
            _Scale          = 1.0f;

            // reset the renderer
            if (_ImageRenderer != null)
            {
                _ImageRenderer.TransferLatest(false);
                _ImageRenderer.Stop();
            }

            _ImageRenderer = new ImageRenderer(image1, BuildXML(true), (int)image1.Width, (int)image1.Height, true);
            _ImageRenderer.SetFixedExposure(true);//!_WootracerOptions._AutoExposure);
            _ImageRenderer.SetExposureValue((float)_WootracerOptions._Exposure);
            _ImageRenderer.Render();
        }
예제 #4
0
        private void Preview(bool preview)
        {
//            _ImageRenderer.Stop();
            _ImageRenderer.SetFixedExposure(true);//!_WootracerOptions._AutoExposure);
            _ImageRenderer.SetExposureValue((float)_WootracerOptions._Exposure);
            if (!preview)
            {
                _ImageRenderer = new ImageRenderer(image1, BuildXML(false), 480, 270, false);
                _ImageRenderer.Render();
                _ImageRenderer = new ImageRenderer(image1, BuildXML(false), (int)((float)480 * _Scale), (int)((float)270 * _Scale), false);
            }
            else
            {
                _ImageRenderer.Render();
            }
            if (_WootracerOptions._AutoExposure)
            {
//                _WootracerOptions._Exposure = _ImageRenderer._MaxValue;
            }
        }
예제 #5
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            _Camera._MinSamples = _Camera._MaxSamples = _SamplesPerPixel;
            BuildXML();

            int width = 960;
            int height = 540;
            if (radioButton3.IsChecked.HasValue && radioButton3.IsChecked.Value)
            {
                width = 480;
                height = 270;
            }
            if (radioButton5.IsChecked.HasValue && radioButton5.IsChecked.Value)
            {
                width = 1920;
                height = 1080;
            }
            if (radioButton6.IsChecked.HasValue && radioButton6.IsChecked.Value)
            {
                width = _ImageWidth;
                height = _ImageHeight;
            }
            _ImageRenderer = new ImageRenderer(image1, _XML, width, height, true);
            _ImageRendering = true;

            _ImageRenderer.SetPostProcess(_PostProcess);
            _ImageRenderer.Render();

            // set up animation thread for the camera movement
            _Timer = new DispatcherTimer();
            _Timer.Interval = TimeSpan.FromMilliseconds(100);
            _Timer.Tick += this.timer_Tick;
            _Timer.Start();
        }
예제 #6
0
 public void StopPreview()
 {
     _Timer.Stop();
     _ImageRenderer.Stop();
     _ImageRenderer = null;
 }
예제 #7
0
        private void TriggerPreview()
        {
//            _Scale = getPreviewResolution();
            _Scene._Shadows = getShadowsEnabled();
            _SimpleLighting = getSimpleLighting();
            _Scale = 1.0f;

            // reset the renderer
            if (_ImageRenderer != null)
            {
                _ImageRenderer.TransferLatest(false);
                _ImageRenderer.Stop();
            }

            _ImageRenderer = new ImageRenderer(image1, BuildXML(true), (int)image1.Width, (int)image1.Height, true);
            _ImageRenderer.SetFixedExposure(true);//!_WootracerOptions._AutoExposure);
            _ImageRenderer.SetExposureValue((float)_WootracerOptions._Exposure);
            _ImageRenderer.Render();
        }
예제 #8
0
        private void Preview(bool preview)
        {
//            _ImageRenderer.Stop();
            _ImageRenderer.SetFixedExposure(true);//!_WootracerOptions._AutoExposure);
            _ImageRenderer.SetExposureValue((float)_WootracerOptions._Exposure);
            if (!preview)
            {
                _ImageRenderer = new ImageRenderer(image1, BuildXML(false), 480, 270, false);   
                _ImageRenderer.Render();
                _ImageRenderer = new ImageRenderer(image1, BuildXML(false), (int)((float)480 * _Scale), (int)((float)270 * _Scale), false);
            }
            else
            {
                _ImageRenderer.Render();
            }
            if (_WootracerOptions._AutoExposure)
            {
//                _WootracerOptions._Exposure = _ImageRenderer._MaxValue;
            }
        }
예제 #9
0
        public void RenderPreview()
        {
            _Camera = new Camera(new Vector3(0, 0.4, -0.75), new Vector3(0, 0.5, 0), 40, 0, 0);
            _Camera._AAEnabled = true;
            _Camera._DOFEnabled = false;

            string log = "", error = "";
            _BackgroundScript = new WooScript();
            _BackgroundScript._Program = "rule main {pos.y -= 1 box}";
            _BackgroundScript.Parse(ref log, ref error);
            _PreviewScript = new WooScript();
            _PreviewScript._Program = "rule main {diff=vec("+_Material._DiffuseColour.ToString()+")\r\n"
                + "spec=vec(" + _Material._SpecularColour.ToString() + ")\r\n"
                + "refl=vec(" + _Material._Reflectivity.ToString() + ")\r\n"
                + "emi=vec(" + _Material._EmissiveColour.ToString() + ")\r\n"
                + "power=" + _Material._SpecularPower.ToString() + "\r\n"
                + "gloss=" + _Material._Shininess.ToString() + "\r\n"
                + "sphere}";
            _PreviewScript.Parse(ref log, ref error);
            _LightingScript = new WooScript();
            _LightingScript._Program = "rule main {directionalLight(vec(1.0, 1.0, 1.0), vec(-0.7, 1.0, -0.6), 0.02, 1) background(vec(0.0,0.0,0.0))}";
            _LightingScript.Parse(ref log, ref error);

            _Scene = new Scene(_Camera);
            _Scene.AddRenderObject(_BackgroundScript);
            _Scene.AddRenderObject(_PreviewScript);
            _Scene.AddRenderObject(_LightingScript);
            BuildXML();
            _ImageRenderer = new ImageRenderer(image1, _XML, (int)image1.Width, (int)image1.Height, false);
            _ImageRenderer.Render();
            _ImageRenderer.SetPostProcess(new PostProcess());
            _ImageRenderer.TransferLatest(false);

        }
예제 #10
0
 public void StopPreview()
 {
     _Timer.Stop();
     _ImageRenderer.Stop();
     _ImageRenderer = null;
 }