dxTerrainSize%(terrain%)

Parameters

terrain - terrain handle

Description

Returns the grid size used to create a terrain.

Example

; dxTerrainSize Example
; -------------------

dxGraphics3D 640,480
dxSetBuffer dxBackBuffer()

camera=dxCreateCamera()
dxPositionEntity camera,1,1,1

light=dxCreateLight()
dxRotateEntity light,90,0,0

; Load terrain
terrain=dxLoadTerrain( "media/height_map.bmp" )

; Set terrain detail, enable vertex morphing
TerrainDetail terrain,4000,True

; Scale terrain
dxScaleEntity terrain,1,50,1

; Texture terrain
grass_tex=dxLoadTexture( "media/mossyground.bmp" )
dxEntityTexture terrain,grass_tex,0,1

While Not dxKeyDown( 1 )

If dxKeyDown( 203 )=True Then x#=x#-0.1
If dxKeyDown( 205 )=True Then x#=x#+0.1
If dxKeyDown( 208 )=True Then y#=y#-0.1
If dxKeyDown( 200 )=True Then y#=y#+0.1
If dxKeyDown( 44 )=True Then z#=z#-0.1
If dxKeyDown( 30 )=True Then z#=z#+0.1

If dxKeyDown( 205 )=True Then dxTurnEntity camera,0,-1,0
If dxKeyDown( 203 )=True Then dxTurnEntity camera,0,1,0
If dxKeyDown( 208 )=True Then dxMoveEntity camera,0,0,-0.1
If dxKeyDown( 200 )=True Then dxMoveEntity camera,0,0,0.1

x#=dxEntityX(camera)
y#=dxEntityY(camera)
z#=dxEntityZ(camera)

terra_y#=TerrainY(terrain,x#,y#,z#)+5

dxPositionEntity camera,x#,terra_y#,z#

dxRenderWorld

dxText 0,0,"Use cursor keys to move about the terrain"

; Output terrain size to screen
dxText 0,20,"Terrain Size: "+dxTerrainSize(terrain)

dxFlip

Wend

End

Index