private void Texturize(SS_Texture texture, Color targetColor, Color tint, bool highlights, bool shading) { Perlin perlin = new Perlin(ColorDetail, 2, 0.5, 8, Seed, QualityMode.High); Voronoi hightlightVoronoi = new Voronoi(ColorDetail, 2, Seed, true); SS_Texture BaseTexture = SS_StellarSprite.GenerateBaseTexture(Seed, Size, Size, 16); for (int y = Size / 2; y < Size; y++) { for (int x = 0; x < Size; x++) { if (texture.GetPixel(x, y) == targetColor) { Color hullShade = BaseTexture.GetPixel(x, y); //Pixel shade float pixelNoise = (float)perlin.GetValue(x, y, 0); pixelNoise = (pixelNoise + 3.0f) * 0.25f; // 0.5 to 1.0 pixelNoise = Mathf.Clamp(pixelNoise, 0.5f, 1f); hullShade *= tint * pixelNoise; if (highlights) { // Pixel shade float hightlightNoise = (float)hightlightVoronoi.GetValue(x, y, 0); hightlightNoise = (hightlightNoise + 1.0f) * 0.5f; // 0.0 to 1.0 hightlightNoise = Mathf.Clamp(hightlightNoise, 0.0f, 1f); if (hightlightNoise <= 0.75f) { hullShade = ColorBase * pixelNoise; } else { hullShade = ColorHighlight * pixelNoise; } } // Check the current pixel and find when it hits a solid black outline. if it does // Make the current pixel a bit darker - do for all 4 dirtections if (shading) { SS_StellarSprite.PixelLighting(texture, x, y, ref hullShade); } hullShade.a = 1.0f; texture.SetPixel(x, y, hullShade); } } } // Mirror SS_StellarSprite.Mirror(texture, SS_Mirror.Vertical); }
protected override Vector3 _ModifyOffset(VertexData vertexData) { if (!noiseModule.IsDisposed) { noiseModule.Dispose(); } var value = 0.5f + (float)noiseModule.GetValue(GetSampleCoordinate(vertexData.position)); return(FormatValue(value, vertexData)); }
public double GetVoronoiNoise(double x, double y) { /* double result = 0; * * for (int i = 0; i < octaves.Length; i++) * { * result = result + octaves[i].Evaluate(x / frequencys[i], y / frequencys[i]) * amplitudes[i]; * } * * return result;*/ return((voronoi.GetValue(x, y, 10) + 1) / 2.0); }
protected override void GenerateColumn(int wX, int wZ, int offset) { int terrainHeight = Mathf.Max(GetTerrainHeight(wX, wZ) - offset, 1); int islandHeight = Mathf.Max(GetIslandHeight(wX, wZ) - offset, 1); bool forest = Voronoi.GetValue(wX, wZ, 0.005f, 1.0f) <= 0.0f; for (int y = 0; y < Map.Height; y++) { if (y <= Map.SeaLevel) { Map.SetBlock(wX, y, wZ, new Block(BlockID.Water, FluidSimulator.MaxFluidLevel)); } if (y <= terrainHeight) { GenerateBase(wX, y, wZ); continue; } if (y <= islandHeight) { GenerateIsland(wX, y, wZ, islandHeight - y, islandHeight); continue; } } double val = rand.NextDouble(); if (forest) { if (val <= 0.05) { TreeGenerator.BoxyTreeTerrain(wX, islandHeight, wZ); } } else { if (Map.GetBlock(wX, islandHeight, wZ).ID == BlockID.Grass && !Map.GetBlock(wX, islandHeight + 1, wZ).IsFluid()) { if (val <= 0.2) { Map.SetBlock(wX, islandHeight + 1, wZ, new Block(BlockID.TallGrass)); } } } }
public float Get(int x, int y) { float v = 0; if (generator == Generator.Vonoroi) { v = (float)vonoroi.GetValue((x + offset) / scale, 0, (y + offset) / scale) * power; } else if (generator == Generator.Perlin) { v = (float)perlin.GetValue((x + offset) / scale, 0, (y + offset) / scale) * power; } else if (generator == Generator.Billow) { v = (float)billow.GetValue((x + offset) / scale, 0, (y + offset) / scale) * power; } return(v); }
public unsafe static void Generate(Level lvl, string type, int seed, bool useSeed) { int index = 0, width = lvl.Width, height = lvl.Height, length = lvl.Length; byte[] blocks = lvl.blocks; int half = height / 2; RealisticMapGen generator = new RealisticMapGen(); IModule module2D = null, module3D = null; switch (type) { case "flat": int grassHeight = height / 2; if (useSeed && seed >= 0 && seed < height) { lvl.EdgeLevel = (short)seed; grassHeight = seed; } fixed(byte *ptr = blocks) { if (grassHeight > 0) { MapSet(lvl.Width, lvl.Length, ptr, 0, grassHeight - 1, Block.dirt); } if (grassHeight < lvl.Height) { MapSet(lvl.Width, lvl.Length, ptr, grassHeight, grassHeight, Block.grass); } } return; case "pixel": for (int y = 0; y < height; ++y) { for (int z = 0; z < length; ++z) { for (int x = 0; x < width; ++x) { if (y == 0) { blocks[index] = Block.blackrock; } else if (x == 0 || x == width - 1 || z == 0 || z == length - 1) { blocks[index] = Block.white; } index++; } } } return; case "empty": for (int z = 0; z < length; ++z) { for (int x = 0; x < width; ++x) { blocks[index++] = Block.blackrock; } } return; case "space": Random random = useSeed ? new Random(seed) : new Random(); for (int y = 0; y < height; ++y) { for (int z = 0; z < length; ++z) { for (int x = 0; x < width; ++x) { if (y == 0) { blocks[index] = Block.blackrock; } else if (x == 0 || x == width - 1 || z == 0 || z == length - 1 || y == 1 || y == height - 1) { blocks[index] = random.Next(100) == 0 ? Block.iron : Block.obsidian; } index++; } } } break; case "rainbow": Random random2 = useSeed ? new Random(seed) : new Random(); for (int y = 0; y < height; ++y) { for (int z = 0; z < length; ++z) { for (int x = 0; x < width; ++x) { if (y == 0 || y == height - 1 || x == 0 || x == width - 1 || z == 0 || z == length - 1) { blocks[index] = (byte)random2.Next(Block.red, Block.white); } index++; } } } return; case "hell": Random random3 = useSeed ? new Random(seed) : new Random(); for (int y = 0; y < height; ++y) { for (int z = 0; z < length; ++z) { for (int x = 0; x < width; ++x) { if (y == 0) { blocks[index] = Block.blackrock; } else if (x == 0 || x == width - 1 || z == 0 || z == length - 1 || y == 0 || y == height - 1) { blocks[index] = Block.obsidian; } else if (x == 1 || x == width - 2 || z == 1 || z == length - 2) { if (random3.Next(1000) != 7) { index++; continue; } int colIndex = z * width + x; for (int i = 1; i < (height - y); ++i) { int yy = height - i; blocks[colIndex + yy * width * length] = Block.lava; } } index++; } } } generator.GenerateMap(lvl, type, seed, useSeed); return; case "billow": module2D = new Billow(); ((Billow)module2D).Seed = useSeed ? seed : new Random().Next(); break; case "ridgedmultifractal": module2D = new RidgedMultifractal(); ((RidgedMultifractal)module2D).Seed = useSeed ? seed : new Random().Next(); break; case "perlin": module2D = new Perlin(); ((Perlin)module2D).Seed = useSeed ? seed : new Random().Next(); break; case "checkerboard": module2D = new Checkerboard(); break; case "spheres": module2D = new Spheres(); break; case "cylinders": module2D = new Cylinders(); break; case "voronoi": module2D = new Voronoi(); ((Voronoi)module2D).Seed = useSeed ? seed : new Random().Next(); break; case "perlin3d": module3D = new Perlin(); ((Perlin)module3D).Seed = useSeed ? seed : new Random().Next(); break; case "perlin3dyadjust": Perlin adjNoise = new Perlin(); adjNoise.Seed = useSeed ? seed : new Random().Next(); for (int y = 0; y < height; y++) { for (int z = 0; z < length; ++z) { for (int x = 0; x < width; ++x) { double value = System.Math.Floor((adjNoise.GetValue(x / 100.0, y / 100.0, z / 100.0) + 2) * 10); if (value > 30 * y / height) { lvl.SetTile((ushort)x, (ushort)y, (ushort)z, Block.grass); } } } } break; case "billow3d": module3D = new Billow(); ((Billow)module3D).Seed = useSeed ? seed : new Random().Next(); break; case "island": case "mountains": case "ocean": case "forest": case "desert": generator.GenerateMap(lvl, type, seed, useSeed); return; } if (module2D != null) { int waterlvl = half - 1; for (int z = 0; z < length; ++z) { for (int x = 0; x < width; ++x) { double noise = module2D.GetValue(x / 100.0, 0.1, z / 100.0); int height2D = (int)System.Math.Floor((noise + 2) * 10) + (half - 20); int height2Dtex01 = (int)System.Math.Floor((noise + 2) * 15) + (half - 30); byte topBlock = height2D < height2Dtex01 ? Block.grass : Block.sand; lvl.SetTile((ushort)x, (ushort)height2D, (ushort)z, topBlock); if (height2D < waterlvl) { for (int y = waterlvl; y >= height2D; y--) { lvl.SetTile((ushort)x, (ushort)y, (ushort)z, Block.water); } } for (int y = height2D - 1; y >= 0; y--) { byte block = (y > height2D * 3 / 4) ? Block.dirt : Block.rock; lvl.SetTile((ushort)x, (ushort)y, (ushort)z, block); } } } } if (module3D != null) { for (int y = 0; y < height; y++) { for (int z = 0; z < length; ++z) { for (int x = 0; x < width; ++x) { double value = System.Math.Floor((module3D.GetValue(x / 100.0, y / 100.0, z / 100.0) + 2) * 10); if (value > 20) { lvl.SetTile((ushort)x, (ushort)y, (ushort)z, Block.grass); } } } } } }
public SS_Asteroid(int seed, int size, Color[] colors, bool minerals, Color mineralColor, float lightAngle) { // Set Seed and Size Seed = seed; Size = size; // Create sprite texture Sprite = new SS_Texture(Size, Size, Color.clear); // Generate a color gradient Color[] gradientColors = SS_Utilities.CreateGradient(colors, 4, 8); // Initialize noise with parameters Perlin perlin = new Perlin(0.01, 2, 0.5, 8, Seed, QualityMode.Low); Voronoi mineralNoise = new Voronoi(0.1, 0.25, Seed + 1, true); // Set the light position based on the angle parameter Vector2 lightPosition = new Vector2( Sprite.Center.x + (Mathf.Cos(lightAngle * Mathf.Deg2Rad) * (Size / 4)), Sprite.Center.y + (Mathf.Sin(lightAngle * Mathf.Deg2Rad) * (Size / 4))); // Begin generating color data for (int y = 0; y < Size; y++) { for (int x = 0; x < Size; x++) { // Distance of current pixel to the center of the sprite float dist = Vector2.Distance(new Vector2(x, y), new Vector2(Sprite.Center.x, Sprite.Center.y)); // Get a noise value for the edge of the asteroid - adds roughness instead of a perfect circle float edgeNoise = (float)perlin.GetValue(x, y, 0); edgeNoise = (edgeNoise + 1.0f) * 0.5f; edgeNoise = Mathf.Clamp(edgeNoise, 0f, 1f); edgeNoise *= 16; if (dist < (Size / 2) - edgeNoise) { float pixelNoise = (float)perlin.GetValue(x, y, 0); pixelNoise = (pixelNoise + 1.0f) * 0.5f; pixelNoise = Mathf.Clamp(pixelNoise, 0f, 1f); float n = pixelNoise * (gradientColors.Length - 1); // Generate color and noise so land doesn't look to smooth Color pixelColor = gradientColors[(int)n]; pixelColor.a = 1.0f; // Minerals if (minerals) { float mineralAlpha = (float)mineralNoise.GetValue(x, y, 0); mineralAlpha = (1.0f + mineralAlpha) * 0.5f; mineralAlpha = Mathf.Clamp(mineralAlpha, 0.0f, 1.0f); if (mineralAlpha > 0.65f) { pixelColor.r = mineralAlpha * mineralColor.r + (1 - mineralAlpha) * pixelColor.r; pixelColor.g = mineralAlpha * mineralColor.g + (1 - mineralAlpha) * pixelColor.g; pixelColor.b = mineralAlpha * mineralColor.b + (1 - mineralAlpha) * pixelColor.b; pixelColor.a = 1f; } } // Shadow float lightDistance = Vector2.Distance(new Vector2(x, y), lightPosition); lightDistance = 1.25f - (lightDistance / (Size / 2)); if (lightDistance < 0.025f) { lightDistance = 0.025f; } pixelColor.r *= lightDistance; pixelColor.g *= lightDistance; pixelColor.b *= lightDistance; Sprite.SetPixel(x, y, pixelColor); } } } }
public override void OnVertexBuildHeight(PQS.VertexBuildData data) { //Activate OCD mode. switch (command) { case Command.Addition: #region Addition if (modMode3 == 1.1) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) + (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 1.2) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) + (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 1.3) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) + (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 1.4) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) + (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 1.5) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) + (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 1.6) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) + (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.1) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) + (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.2) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) + (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.3) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) + (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.4) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) + (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.5) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) + (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 2.6) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) + (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.1) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) + (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.2) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) + (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.3) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) + (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.4) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) + (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.5) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) + (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 3.6) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) + (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.1) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) + (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.2) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) + (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.3) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) + (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.4) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) + (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.5) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) + (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 4.6) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) + (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.1) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) + (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.2) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) + (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.3) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) + (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.4) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) + (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.5) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) + (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 5.6) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) + (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.1) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) + (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.2) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) + (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.3) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) + (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.4) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) + (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.5) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) + (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 6.6) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) + (vor2.GetValue(data.directionFromCenter) * deformity); } #endregion break; case Command.Subtract: #region Subtract if (modMode3 == 1.1) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) - (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 1.2) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) - (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 1.3) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) - (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 1.4) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) - (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 1.5) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) - (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 1.6) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) - (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.1) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) - (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.2) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) - (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.3) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) - (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.4) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) - (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.5) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) - (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 2.6) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) - (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.1) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) - (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.2) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) - (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.3) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) - (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.4) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) - (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.5) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) - (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 3.6) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) - (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.1) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) - (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.2) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) - (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.3) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) - (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.4) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) - (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.5) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) - (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 4.6) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) - (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.1) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) - (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.2) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) - (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.3) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) - (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.4) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) - (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.5) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) - (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 5.6) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) - (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.1) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) - (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.2) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) - (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.3) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) - (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.4) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) - (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.5) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) - (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 6.6) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) - (vor2.GetValue(data.directionFromCenter) * deformity); } #endregion break; case Command.Multiply: #region Multiply if (modMode3 == 1.1) { data.vertHeight += bill1.GetValue(data.directionFromCenter) * deformity * bill2.GetValue(data.directionFromCenter); } if (modMode3 == 1.2) { data.vertHeight += bill1.GetValue(data.directionFromCenter) * deformity * hyb2.GetValue(data.directionFromCenter); } if (modMode3 == 1.3) { data.vertHeight += bill1.GetValue(data.directionFromCenter) * deformity * perlin2.GetValue(data.directionFromCenter); } if (modMode3 == 1.4) { data.vertHeight += bill1.GetValue(data.directionFromCenter) * deformity * rig2.GetValue(data.directionFromCenter); } if (modMode3 == 1.5) { data.vertHeight += bill1.GetValue(data.directionFromCenter) * deformity * simplex2.noise(data.directionFromCenter); } if (modMode3 == 1.6) { data.vertHeight += bill1.GetValue(data.directionFromCenter) * deformity * vor2.GetValue(data.directionFromCenter); } if (modMode3 == 2.1) { data.vertHeight += hyb1.GetValue(data.directionFromCenter) * deformity * bill2.GetValue(data.directionFromCenter); } if (modMode3 == 2.2) { data.vertHeight += hyb1.GetValue(data.directionFromCenter) * deformity * hyb2.GetValue(data.directionFromCenter); } if (modMode3 == 2.3) { data.vertHeight += hyb1.GetValue(data.directionFromCenter) * deformity * perlin2.GetValue(data.directionFromCenter); } if (modMode3 == 2.4) { data.vertHeight += hyb1.GetValue(data.directionFromCenter) * deformity * rig2.GetValue(data.directionFromCenter); } if (modMode3 == 2.5) { data.vertHeight += hyb1.GetValue(data.directionFromCenter) * deformity * simplex2.noise(data.directionFromCenter); } if (modMode3 == 2.6) { data.vertHeight += hyb1.GetValue(data.directionFromCenter) * deformity * vor2.GetValue(data.directionFromCenter); } if (modMode3 == 3.1) { data.vertHeight += perlin1.GetValue(data.directionFromCenter) * deformity * bill2.GetValue(data.directionFromCenter); } if (modMode3 == 3.2) { data.vertHeight += perlin1.GetValue(data.directionFromCenter) * deformity * hyb2.GetValue(data.directionFromCenter); } if (modMode3 == 3.3) { data.vertHeight += perlin1.GetValue(data.directionFromCenter) * deformity * perlin2.GetValue(data.directionFromCenter); } if (modMode3 == 3.4) { data.vertHeight += perlin1.GetValue(data.directionFromCenter) * deformity * rig2.GetValue(data.directionFromCenter); } if (modMode3 == 3.5) { data.vertHeight += perlin1.GetValue(data.directionFromCenter) * deformity * simplex2.noise(data.directionFromCenter); } if (modMode3 == 3.6) { data.vertHeight += perlin1.GetValue(data.directionFromCenter) * deformity * vor2.GetValue(data.directionFromCenter); } if (modMode3 == 4.1) { data.vertHeight += rig1.GetValue(data.directionFromCenter) * deformity * bill2.GetValue(data.directionFromCenter); } if (modMode3 == 4.2) { data.vertHeight += rig1.GetValue(data.directionFromCenter) * deformity * hyb2.GetValue(data.directionFromCenter); } if (modMode3 == 4.3) { data.vertHeight += rig1.GetValue(data.directionFromCenter) * deformity * perlin2.GetValue(data.directionFromCenter); } if (modMode3 == 4.4) { data.vertHeight += rig1.GetValue(data.directionFromCenter) * deformity * rig2.GetValue(data.directionFromCenter); } if (modMode3 == 4.5) { data.vertHeight += rig1.GetValue(data.directionFromCenter) * deformity * simplex2.noise(data.directionFromCenter); } if (modMode3 == 4.6) { data.vertHeight += rig1.GetValue(data.directionFromCenter) * deformity * vor2.GetValue(data.directionFromCenter); } if (modMode3 == 5.1) { data.vertHeight += simplex1.noise(data.directionFromCenter) * deformity * bill2.GetValue(data.directionFromCenter); } if (modMode3 == 5.2) { data.vertHeight += simplex1.noise(data.directionFromCenter) * deformity * hyb2.GetValue(data.directionFromCenter); } if (modMode3 == 5.3) { data.vertHeight += simplex1.noise(data.directionFromCenter) * deformity * perlin2.GetValue(data.directionFromCenter); } if (modMode3 == 5.4) { data.vertHeight += simplex1.noise(data.directionFromCenter) * deformity * rig2.GetValue(data.directionFromCenter); } if (modMode3 == 5.5) { data.vertHeight += simplex1.noise(data.directionFromCenter) * deformity * simplex2.noise(data.directionFromCenter); } if (modMode3 == 5.6) { data.vertHeight += simplex1.noise(data.directionFromCenter) * deformity * vor2.GetValue(data.directionFromCenter); } if (modMode3 == 6.1) { data.vertHeight += vor1.GetValue(data.directionFromCenter) * deformity * bill2.GetValue(data.directionFromCenter); } if (modMode3 == 6.2) { data.vertHeight += vor1.GetValue(data.directionFromCenter) * deformity * hyb2.GetValue(data.directionFromCenter); } if (modMode3 == 6.3) { data.vertHeight += vor1.GetValue(data.directionFromCenter) * deformity * perlin2.GetValue(data.directionFromCenter); } if (modMode3 == 6.4) { data.vertHeight += vor1.GetValue(data.directionFromCenter) * deformity * rig2.GetValue(data.directionFromCenter); } if (modMode3 == 6.5) { data.vertHeight += vor1.GetValue(data.directionFromCenter) * deformity * simplex2.noise(data.directionFromCenter); } if (modMode3 == 6.6) { data.vertHeight += vor1.GetValue(data.directionFromCenter) * deformity * vor2.GetValue(data.directionFromCenter); } #endregion break; case Command.Divide: #region Divide if (modMode3 == 1.1) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) / (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 1.2) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) / (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 1.3) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) / (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 1.4) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) / (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 1.5) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) / (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 1.6) { data.vertHeight += (bill1.GetValue(data.directionFromCenter) * deformity) / (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.1) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) / (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.2) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) / (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.3) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) / (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.4) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) / (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 2.5) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) / (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 2.6) { data.vertHeight += (hyb1.GetValue(data.directionFromCenter) * deformity) / (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.1) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) / (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.2) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) / (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.3) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) / (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.4) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) / (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 3.5) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) / (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 3.6) { data.vertHeight += (perlin1.GetValue(data.directionFromCenter) * deformity) / (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.1) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) / (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.2) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) / (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.3) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) / (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.4) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) / (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 4.5) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) / (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 4.6) { data.vertHeight += (rig1.GetValue(data.directionFromCenter) * deformity) / (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.1) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) / (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.2) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) / (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.3) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) / (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.4) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) / (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 5.5) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) / (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 5.6) { data.vertHeight += (simplex1.noise(data.directionFromCenter) * deformity) / (vor2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.1) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) / (bill2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.2) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) / (hyb2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.3) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) / (perlin2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.4) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) / (rig2.GetValue(data.directionFromCenter) * deformity); } if (modMode3 == 6.5) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) / (simplex2.noise(data.directionFromCenter) * deformity); } if (modMode3 == 6.6) { data.vertHeight += (vor1.GetValue(data.directionFromCenter) * deformity) / (vor2.GetValue(data.directionFromCenter) * deformity); } #endregion break; } //Ded. }
/// <summary> /// Called when the parent sphere builds it's height /// </summary> public override void OnVertexBuildHeight(VertexBuildData data) { data.vertHeight += voronoi.GetValue(data.directionFromCenter) * deformation; }