Beispiel #1
0
    void Start()
    {
        // Here we can get away with a lower resolution for the render texture as it doesn't need the full float
        flowMap  = RTUtility.CreateRenderTextures(TEX_SIZE, RenderTextureFormat.ARGBHalf);
        waterMap = RTUtility.CreateRenderTextures(TEX_SIZE, RenderTextureFormat.RFloat);

        terrainMap = new RenderTexture(TEX_SIZE, TEX_SIZE, 0, RenderTextureFormat.RFloat)
        {
            wrapMode   = TextureWrapMode.Clamp,
            filterMode = FilterMode.Point
        };

        GenerateWorld();

        // Clear all the render textures and generate the heightmap
        RTUtility.ClearColor(terrainMap);
        RTUtility.ClearColor(flowMap);
        RTUtility.ClearColor(waterMap);

        terrainMap = HeightmapGenerator.GenerateHeightMap(terrainMap, TERRAIN_HEIGHT, 8, 0.3f, 3f);
    }