updateTerrain()
Purpose
Update a 3D terrain
Description
Update a 3D terrain from arrays of heights and colours
Syntax
updateTerrain( terrain, heights, colours )
Arguments
terrain identifer of the terrain from createterrain
heights array containing height of each point on the grid
colour array containing colour of each point on the grid
Example
gsize = 8
landscape = createTerrain( gsize, 1 )
colours = []
heights = []
palette = []
palette[0] = black
palette[1] = white
j = 0
for i = 0 to 64 loop
j = j + 1
if i % 8 == 0 then
j = j + 1
endIf
colours[i] = palette[ j % 2 ]
heights[i] = float( j % 2 )
repeat
updateTerrain( landscape, heights, colours )
setCamera( { gsize / 2, 10, gsize / 2 }, { gsize / 2, 0, gsize / 2 - 1 } )
setAmbientLight( { 0.5, 0.5, 0.5 } )
island = placeObject( landscape, { gsize / 2, 0, gsize / 2 }, { 1, 1, 1 } )
loop
c = controls( 0 ) // rotate using joysticks
rotateObject( island, { 1, 0, 0 }, c.ly )
rotateObject( island, { 0, 0, 1 }, c.lx )
rotateObject( island, { 0, 1, 0 }, c.rx )
drawObjects()
update()
repeat
Associated Commands