Ejemplo n.º 1
0
        /// <summary>
        /// Create a scene from the defined CS-script file-name.
        /// Returns null if failed.
        /// </summary>
        public IRayScene SceneFromScript()
        {
            if (string.IsNullOrEmpty(sceneFileName))
            {
                return(null);
            }

            Dictionary <string, object> outParam = new Dictionary <string, object>();

            outParam["Start"] = 0.0;
            outParam["End"]   = 20.0;
            IRayScene scene = Scripts.SceneFromObject(new AnimatedRayScene(), Path.GetFileName(sceneFileName), sceneFileName, textParam.Text,
                                                      (sc) => AnimatedScene.Init(sc, textParam.Text), str => SetText(str), outParam);
            object to;
            double td;

            if (outParam.TryGetValue("Start", out to) &&
                to is Double)
            {
                td            = (double)to;
                numFrom.Value = (decimal)td;
            }

            if (outParam.TryGetValue("End", out to) &&
                to is Double)
            {
                td          = (double)to;
                numTo.Value = (decimal)td;
            }

            return(scene);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a scene from the defined CS-script file-name.
        /// Returns null if failed.
        /// </summary>
        /// <param name="preprocessing">Invoke the script in the "preprocessing" mode?</param>
        public IRayScene SceneFromScript(
            bool preprocessing,
            out IImageFunction imf,
            out IRenderer rend,
            ref int width,
            ref int height,
            ref int superSampling,
            ref double minTime,
            ref double maxTime,
            ref double fps)
        {
            if (string.IsNullOrEmpty(sceneFileName))
            {
                imf     = null;
                rend    = null;
                tooltip = "";
                return(null);
            }

            if (preprocessing)
            {
                ctx = new ScriptContext(); // we need a new context object for each computing batch..
            }
            Scripts.ContextInit(
                ctx,
                preprocessing ? new AnimatedRayScene() : null,
                width,
                height,
                superSampling,
                minTime,
                maxTime,
                fps);

            Scripts.SceneFromObject(
                ctx,
                Path.GetFileName(sceneFileName),
                sceneFileName,
                textParam.Text,
                (sc) => AnimatedScene.Init(sc, textParam.Text),
                SetText);

            DefaultRayScene scene = Scripts.ContextMining(
                ctx,
                out imf,
                out rend,
                out tooltip,
                ref width,
                ref height,
                ref superSampling,
                ref minTime,
                ref maxTime,
                ref fps);

            return(scene);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initialize the ray-scene.
        /// </summary>
        public static IRayScene getScene(string param)
        {
            IRayScene sc = Form1.singleton.SceneFromScript();

            if (sc != null)
            {
                return(sc);
            }

            sc = new AnimatedRayScene();
            return(AnimatedScene.Init(sc, param));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initialize the ray-scene.
        /// </summary>
        public static IRayScene getScene(string param)
        {
            IRayScene sc = new AnimatedRayScene();

            return(AnimatedScene.Init(sc, param));
        }