コード例 #1
0
    public void GenerateMap()
    {
        float[,] noiseMap = WaterNoise.GenerateNoiseMap(mapWidth, mapHeight, seed, noiseScale, octaves, persistance, lacunarity, offset);

        WaterMapDisplay display = FindObjectOfType <WaterMapDisplay>();

        if (drawMode == DrawMode.Mesh)
        {
            display.DrawMesh(WaterMeshGenerator.GenerateTerrainMesh(noiseMap, heightmultiplier), texture);
        }
    }
コード例 #2
0
    private void UpdateMesh()
    {
        if (Application.isPlaying)
        {
            return;
        }

        MeshFilter meshFilter = GetComponent <MeshFilter>();

        Mesh newMesh = WaterMeshGenerator.GenerateMesh(rows, columns, quadSegmentSize);

        newMesh.name = "Water Mesh Instance";

        meshFilter.sharedMesh = newMesh;
    }
    private void UpdateMesh(int rows, int columns, float quadSegmentSize)
    {
        if (Application.isPlaying)
        {
            return;
        }

        MeshFilter meshFilter = this.waterVolumeTarget.GetComponent <MeshFilter>();

        Mesh newMesh = WaterMeshGenerator.GenerateMesh(rows, columns, quadSegmentSize);

        newMesh.name = "Water Mesh Instance";

        meshFilter.sharedMesh = newMesh;

        EditorUtility.SetDirty(meshFilter);
    }