Пример #1
0
        public static Module create(ModuleTree tree, LuaObject config)
        {
            Scale m = new Scale(tree.size.X, tree.size.Y);

            m.myName = config.get <String>("name");

            m.scale  = tree.findModule(config.get <String>("scale"));
            m.source = tree.findModule(config.get <String>("source"));

            tree.addModule(m);
            return(m);
        }
Пример #2
0
        public static Module create(ModuleTree tree, LuaObject config)
        {
            Translate m = new Translate(tree.size.X, tree.size.Y);

            m.myName = config.get <String>("name");

            m.source = tree.findModule(config.get <String>("source"));
            m.x      = tree.findModule(config.get <String>("x"));
            m.y      = tree.findModule(config.get <String>("y"));

            tree.addModule(m);
            return(m);
        }
Пример #3
0
        public static ModuleTree create(LuaObject treeConfig)
        {
            int x = treeConfig.get <int>("size[1]");
            int y = treeConfig.get <int>("size[2]");

            ModuleTree tree  = new ModuleTree(x, y);
            LuaObject  nodes = treeConfig["nodes"];

            for (int i = 1; i <= nodes.count(); i++)
            {
                LuaObject nodeConfig = nodes[i];
                string    type       = nodeConfig.get <String>("type");

                CreateModule creator = null;
                Module.Type  mType;
                Enum.TryParse(type, out mType);
                if (myCreators.TryGetValue(mType, out creator) == true)
                {
                    Module m = creator(tree, nodeConfig);
                }
                else
                {
                    throw new Exception(String.Format("Failed to find creator {0}", type));
                }
            }

            string outputName   = treeConfig.get <String>("output");
            Module outputModule = tree.findModule(outputName);

            tree.output = outputModule;

            return(tree);
        }
Пример #4
0
        public static Module create(ModuleTree tree, LuaObject config)
        {
            Select m = new Select(tree.size.X, tree.size.Y);

            m.myName = config.get <String>("name");

            m.low     = tree.findModule(config.get <String>("low"));
            m.high    = tree.findModule(config.get <String>("high"));
            m.control = tree.findModule(config.get <String>("control"));

            m.threshold = config.get <float>("threshold");
            m.falloff   = config.get <float>("falloff");

            tree.addModule(m);
            return(m);
        }
Пример #5
0
        public static Module create(ModuleTree tree, LuaObject config)
        {
            Pow m = new Pow(tree.size.X, tree.size.Y);

            m.myName = config.get <String>("name");

            m.source = tree.findModule(config.get <String>("source"));
            m.pow    = config.get <float>("pow");

            tree.addModule(m);
            return(m);
        }
Пример #6
0
        public static Module create(ModuleTree tree, LuaObject config)
        {
            Bias m = new Bias(tree.size.X, tree.size.Y);

            m.myName = config.get <String>("name");

            m.source = tree.findModule(config.get <String>("source"));
            m.bias   = config.get <float>("bias");

            tree.addModule(m);
            return(m);
        }
Пример #7
0
        public static Module create(ModuleTree tree, LuaObject config)
        {
            Function m = new Function(tree.size.X, tree.size.Y);

            m.myName = config.get <String>("name");

            m.source   = tree.findModule(config.get <String>("source"));
            m.function = config.get <string>("function");

            tree.addModule(m);
            return(m);
        }
Пример #8
0
        public static Module create(ModuleTree tree, LuaObject config)
        {
            ScaleDomain m = new ScaleDomain(tree.size.X, tree.size.Y);

            m.myName = config.get <String>("name");

            m.source = tree.findModule(config.get <String>("source"));
            m.x      = config.get <float>("x");
            m.y      = config.get <float>("y");

            tree.addModule(m);
            return(m);
        }
Пример #9
0
        public static Module create(ModuleTree tree, LuaObject config)
        {
            Combiner m = new Combiner(tree.size.X, tree.size.Y);

            m.myName = config.get <String>("name");

            LuaObject inputs = config["inputs"];

            for (int i = 1; i <= inputs.count(); i++)
            {
                m.inputs[i - 1] = tree.findModule(inputs[i]);
            }

            CombinerType action;

            Enum.TryParse(config.get <String>("action"), out action);
            m.action = action;

            tree.addModule(m);
            return(m);
        }