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 bool CompileSingle(ref WooScript script) { string log = ""; string error = ""; bool success = script.Parse(ref log, ref error); if (!success) { MessageBox.Show(error); return(false); } return(true); }