コード例 #1
0
    public void DrawMapInEditor()
    {
        textureData.ApplyToMaterial(terrainMaterial);
        textureData.UpdateMeshHeights(terrainMaterial, heightMapSettings.MinHeight, heightMapSettings.MaxHeight);
        HeightMap data = HeightMapGenerator.GenerateHeightMap(meshSettings.NumVertsPerLine, meshSettings.NumVertsPerLine, heightMapSettings, Vector2.zero);

        if (drawMode == DrawMode.Noise)
        {
            DrawTexture(TextureGenerator.GenerateTextureFromHeightMap(data));
        }
        else if (drawMode == DrawMode.Mesh)
        {
            DrawMesh(MeshGenerator.GenerateTerrainMesh(data.Values, meshSettings, editorPreviewLOD));
        }
        else if (drawMode == DrawMode.Falloff)
        {
            DrawTexture(TextureGenerator.GenerateTextureFromHeightMap(new HeightMap(FalloffGenerator.GenerateFalloffMap(meshSettings.NumVertsPerLine), 0, 1)));
        }
    }
コード例 #2
0
    public void DrawMapInEditor()
    {
        textureData.UpdateMeshHeight(terrainMaterial, terrainData.minHeight, terrainData.maxHeight);

        MapData    mapData    = GenerateMapData(Vector2.zero);
        MapDisplay mapDisplay = FindObjectOfType <MapDisplay>();

        if (drawMode == DrawMode.NoiseMap)
        {
            mapDisplay.DrawTexture(TextureGenerator.GenerateTextureFromHeightMap(mapData.heightMap));
        }
        else if (drawMode == DrawMode.Mesh)
        {
            mapDisplay.DrawMesh(MeshGenerator.GenerateTerrainMesh(mapData.heightMap, terrainData.meshHeightMultiplier, terrainData.meshHeightCurve, editorPreviewLOD, terrainData.useFlatShading, water));
        }
        else if (drawMode == DrawMode.FalloffMap)
        {
            mapDisplay.DrawTexture(TextureGenerator.GenerateTextureFromHeightMap(FalloffGenerator.GenerateFalloffMap(mapChunkSize)));
        }
    }
コード例 #3
0
    public void DrawMapInEditor()
    {
        MapData mapData = GenerateMapData(Vector2.zero);

        MapDisplay display = FindObjectOfType <MapDisplay>();

        switch (drawMode)
        {
        case DrawMode.NoiseMap:
            display.DrawTexture(TextureGenerator.GenerateTextureFromHeightMap(mapData.heightMap));
            break;

        case DrawMode.ColorMap:
            display.DrawTexture(TextureGenerator.GenerateTextureFromColorMap(mapData.colorMap, mapChunkSize, mapChunkSize));
            break;

        case DrawMode.Mesh:
            Texture2D texture = TextureGenerator.GenerateTextureFromColorMap(mapData.colorMap, mapChunkSize, mapChunkSize);
            display.DrawMesh(MeshGenerator.GenerateTerrainMesh(mapData.heightMap, terrainData.heightMultiplier, terrainData.heighMultiplierCurve, editorPreviewLevelOfDetail), texture);
            break;
        }
    }