setTerrainPoint()
Purpose
Set a point on a 3D terrain
Description
Set the height and colour of a point on a terrain grid
Syntax
setTerrainPoint( terrain, xpos, ypos, height, colour )
Arguments
terrain handle of the terrain from createterrain
xpos horizontal position in the grid
ypos vertical position in the grid
height height of the point
colour colour name or RGB values { red, green, blue, opacity } between 0 and 1
Example
gsize = 64
landscape = createTerrain( gsize, 1 )
height = 0
colour = white
for x = 0 to gsize loop
for y = 0 to gsize loop
d = distance ( { x, y }, { gsize / 2, gsize / 2 } )
if d > 24 then // sea level
height = 0
colour = blue
else
if d > 18 then // beach
height = 1
colour = yellow
else // hills
height = rnd( 2 ) + 1
colour = green
endIf
endIf
setTerrainPoint( landscape, x, y, height, colour )
repeat
repeat
setCamera( { gsize / 2, 50, 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
printAt( 0, 0, "rotate using joysticks" )
c = controls( 0 )
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