CreateTerrain()

Syntax

Result = CreateTerrain(#Terrain, Size, WorldSize, Scale, NbLayers, Filename$, Extension$)
Description
Creates a new terrain. SetupTerrains() has to be called before to set the default parameter for the new terrain. After the terrain creation, new tiles can be defined with DefineTerrainTile() and textures applied with AddTerrainTexture(). Once the terrain definition is finished, BuildTerrain() needs to be called to build the final terrain.

Parameters

#Terrain The number to identify the new terrain. #PB_Any can be used to auto-generate this number.
Size The size of the new terrain down one edge in vertices.
WorldSize The world size of the new terrain.
Scale The scale factor to apply to the new terrain.
NbLayers The number of texture layers the new terrain will have. To add a texture layer, use AddTerrainTexture().
Filename$ The filename (without the extension) to store the precomputed terrain data. As the terrain can be complex and take a lot of time to create, a cache will be written to disk and reloaded automatically if present (and not outdated).
Extension$ The extension used by the data files.

Return value

Returns zero if the #Terrain can't be created. If #PB_Any is used as '#Terrain' parameter, the new terrain number is returned.

See Also

FreeTerrain(), SetupTerrains(), BuildTerrain(), DefineTerrainTile(), AddTerrainTexture()

Supported OS

All

<- BuildTerrain() - Terrain Index - CreateTerrainBody() ->