Fuze Arena Logo
  • Forum
  • Creations
    Catalogue Showcase
  • Help

createTerrain()

Purpose

Create a 3D terrain

Description

Create a 3D terrain by setting the height and colour of points on a grid

Syntax

handle = createTerrain( gridsize, filter )

Arguments

handle identifer of the created terrain

gridsize size of the grid (length of one side)

filter Smoothing filter (0 = no filter)

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
    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

setTerrainPoint(), updateTerrain()

logo

©2019 FUZE Technologies Ltd. FUZE is a registered trademark of FUZE Technologies Ltd. All rights reserved.

Useful links

  • Fuze Main Site
  • Fuze Arena on Twitter
  • Fuze Arena on Youtube
  • Download Buyer

Contact Information

  • FUZE Technologies Ltd
    15 Clearfields Farm
    Wotton Underwood
    Aylesbury, Buckinghamshire
    ​England, HP18 0RS

  • +44 (0) 1844 239 432

  • contact@fuze.co.uk

© Copyright FUZE Technologies Ltd. All rights reserved.