public void updateRender() { if (_ImageRenderer == null) { return; } if (_RefreshingRender == true) { return; } _RefreshingRender = true; if (radioButton2.IsChecked.Value) { _ImageRenderer._TransferType = ImageRenderer.Transfer.Exposure; } else if (radioButton8.IsChecked.Value) { _ImageRenderer._TransferType = ImageRenderer.Transfer.Gamma; } else if (radioButton9.IsChecked.Value) { _ImageRenderer._TransferType = ImageRenderer.Transfer.Tone; } else { _ImageRenderer._TransferType = ImageRenderer.Transfer.Ramp; } _ImageRenderer._RampValue = _MaxValue; _ImageRenderer._ExposureFactor = _Factor; _ImageRenderer._ToneFactor = (float)_ToneFactor; _ImageRenderer._GammaFactor = (float)_GammaFactor; _ImageRenderer._GammaContrast = (float)_GammaContrast; _ImageRenderer.SetPostProcess(_PostProcess); _ImageRenderer.TransferLatest(!_ImageRendering); Colour minColour = _ImageRenderer._MinColour; _Min = Math.Min(minColour._Red, Math.Min(minColour._Green, minColour._Blue)); Colour maxColour = _ImageRenderer._MaxColour; _Max = Math.Max(maxColour._Red, Math.Max(maxColour._Green, maxColour._Blue)); _RefreshingRender = false; }
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); }
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(); }
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); }