Exemplo n.º 1
0
    private static Mesh GenerateMesh(float[,] noiseMap, Biome biome)
    {
        TerrainData terrainData = new TerrainData(biome, noiseMap);

        terrainData.Generate();

        Mesh mesh = new Mesh();

        mesh.name = "Terrain";

        mesh.vertices  = terrainData.vertices.ToArray();
        mesh.triangles = terrainData.triangles.ToArray();
        mesh.colors    = biome.GetColours(terrainData.vertices.ToArray());

        mesh.RecalculateBounds();
        mesh.RecalculateNormals();


        return(mesh);
    }