public GpuNoise2dMap(int width, int height, float seed = 0.0f) { myWidth = width; myHeight = height; mySeed = seed; texture = new Texture(myWidth, myHeight, PixelInternalFormat.R32f); myFractal = new Fractal2d(myWidth, myHeight); myAutoCorrect = new AutoCorrect(myWidth, myHeight); myAutoCorrect.source = myFractal; generateTexture(); }
public static void serialize(Module mm, LuaObject obj) { Fractal2d m = mm as Fractal2d; obj.set(m.myType.ToString(), "type"); obj.set(m.myName, "name"); obj.set(m.method.ToString(), "method"); obj.set(m.octaves, "octaves"); obj.set(m.frequency, "frequency"); obj.set(m.offset, "offset"); obj.set(m.lacunarity, "lacunarity"); obj.set(m.gain, "gain"); obj.set(m.H, "H"); }
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 static Module create(ModuleTree tree, LuaObject config) { Fractal2d m = new Fractal2d(tree.size.X, tree.size.Y); m.myName = config.get <String>("name"); Method func; Enum.TryParse(config.getOr <String>("method", "fBm"), out func); m.method = func; m.seed = config.getOr <float>("seed", 101475.0f); m.octaves = config.getOr <int>("octaves", 5); m.frequency = config.getOr <float>("frequency", 1.0f); m.offset = config.getOr <float>("offset", 0.0f); m.lacunarity = config.getOr <float>("lacunarity", 2.0f); m.gain = config.getOr <float>("gain", 1.0f); m.H = config.getOr <float>("H", 1.0f); tree.addModule(m); return(m); }