public static void serialize(Module mm, LuaObject obj) { Bias m = mm as Bias; obj.set(m.myType.ToString(), "type"); obj.set(m.myName, "name"); obj.set(m.source.myName, "source"); obj.set(m.bias, "bias"); }
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); }
public Module createModule(Module.Type moduleType, string name = "") { Module m = null; switch (moduleType) { case Module.Type.AutoCorrect: m = new AutoCorrect(size.X, size.Y); break; case Module.Type.Bias: m = new Bias(size.X, size.Y); break; case Module.Type.Pow: m = new Pow(size.X, size.Y); break; case Module.Type.Combiner: m = new Combiner(size.X, size.Y); break; case Module.Type.Constant: m = new Constant(size.X, size.Y); break; case Module.Type.Fractal2d: m = new Fractal2d(size.X, size.Y); break; case Module.Type.Fractal3d: m = new Fractal3d(size.X, size.Y); break; case Module.Type.Gradient: m = new Gradient(size.X, size.Y); break; case Module.Type.Scale: m = new Scale(size.X, size.Y); break; case Module.Type.ScaleDomain: m = new ScaleDomain(size.X, size.Y); break; case Module.Type.Select: m = new Select(size.X, size.Y); break; case Module.Type.Translate: m = new Translate(size.X, size.Y); break; case Module.Type.Function: m = new Function(size.X, size.Y); break; } if (name == "") { name = nextName(String.Format("{0}", m.myType)); } m.myName = name; addModule(m); return(m); }
public Module addModule(Module.Type moduleType, string name = "") { Module m = null; switch (moduleType) { case Module.Type.AutoCorect: m = new AutoCorrect(myX, myY); break; case Module.Type.Bias: m = new Bias(myX, myY); break; case Module.Type.Combiner: m = new Combiner(myX, myY); break; case Module.Type.Constant: m = new Constant(myX, myY); break; case Module.Type.Fractal: m = new Fractal(myX, myY); break; case Module.Type.Gradient: m = new Gradient(myX, myY); break; case Module.Type.Output: m = new Output(myX, myY); break; case Module.Type.Scale: m = new Scale(myX, myY); break; case Module.Type.ScaleDomain: m = new ScaleDomain(myX, myY); break; case Module.Type.Select: m = new Select(myX, myY); break; case Module.Type.Translate: m = new Translate(myX, myY); break; } if (name == "") { name = nextName(String.Format("{0}", m.myType)); } m.myName = name; myModules.Add(name, m); return(m); }