/// <summary> /// Default behavior - create scene selected in the combo-box. /// Can handle InitSceneDelegate, InitSceneParamDelegate or CSscript file-name /// </summary> public IRayScene SceneByComboBox( out IImageFunction imf, out IRenderer rend, ref int width, ref int height, ref int superSampling) { string sceneName = (string)ComboScene.Items[selectedScene]; if (sceneRepository.TryGetValue(sceneName, out object definition)) { // Try the CS-script file. if (ctx == null) { ctx = new ScriptContext(); // we need a new context object for each computing batch.. } if (Scripts.ContextInit( ctx, sceneName, width, height, superSampling)) { // Script needs to be called. Scripts.SceneFromObject( ctx, definition, TextParam.Text, (sc) => Scenes.DefaultScene(sc), SetText); } double minTime = 0.0; double maxTime = 10.0; double fps = 25.0; return(Scripts.ContextMining( ctx, out imf, out rend, out tooltip, ref width, ref height, ref superSampling, ref minTime, ref maxTime, ref fps)); } // Fallback to a default scene. imf = null; rend = null; return(Scenes.DefaultScene()); }
/// <summary> /// Default behavior - create scene selected in the combo-box. /// Can handle InitSceneDelegate, InitSceneParamDelegate or CSscript file-name /// </summary> public IRayScene SceneByComboBox() { string sceneName = (string)ComboScene.Items[selectedScene]; if (sceneRepository.TryGetValue(sceneName, out object definition)) { return(Scripts.SceneFromObject(new DefaultRayScene(), sceneName, definition, TextParam.Text, (sc) => Scenes.DefaultScene(sc), SetText)); } // fallback to a default scene; return(Scenes.DefaultScene()); }