protected override void GenerateTerrainData(CubicTerrainData terrainDataObject, Vector3 worldspace) { for (int x = 0; x < terrainDataObject.width; x++) { for (int y = 0; y < terrainDataObject.height; y++) { for (int z = 0; z < terrainDataObject.depth; z++) { // Get absolute positions for noise generation float absX = (float)x + worldspace.x; float absZ = (float)z + worldspace.z; float absY = (float)y + worldspace.y; //float perlin = Mathf.PerlinNoise(absX * frequency, absZ * frequency); //int toY = (int)(perlin * ((float)terrainDataObject.height-1)); float noise = Simplex.Generate(absX * this.frequency, absY * this.frequency, absZ * this.frequency); /*for (int y = 0; y < toY-3; y++) * { * terrainDataObject.SetVoxel(x,y,z,stoneId); * } * * for (int y = toY-3; y < toY-1; y++) * { * terrainDataObject.SetVoxel(x,y,z,dirtId); * } * terrainDataObject.SetVoxel(x,toY-1,z,grassId);*/ if (noise < 0.5f && noise > 0.25f) { terrainDataObject.SetVoxel(x, y, z, 2); } } } } }
public float Generate3D(float x, float y, float z) { return(Simplex.Generate(x, y, z)); }
public float Generate2D(float x, float y) { return(Simplex.Generate(x, y)); }
public float Generate1D(float x) { return(Simplex.Generate(x)); }