| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>TerrainSize ( terrain )</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- terrain - terrain handle
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- Returns the grid size used to create a terrain.
- </td>
- </tr>
- </table>
- <h1><a href=../3d_examples/TerrainSize.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; TerrainSize Example
<br />
- ; -------------------
<br />
-
<br />
- Graphics3D 640,480
<br />
- SetBuffer BackBuffer()
<br />
-
<br />
- camera=CreateCamera()
<br />
- PositionEntity camera,1,1,1
<br />
-
<br />
- light=CreateLight()
<br />
- RotateEntity light,90,0,0
<br />
-
<br />
- ; Load terrain
<br />
- terrain=LoadTerrain( "media/height_map.bmp" )
<br />
-
<br />
- ; Set terrain detail, enable vertex morphing
<br />
- TerrainDetail terrain,4000,True
<br />
-
<br />
- ; Scale terrain
<br />
- ScaleEntity terrain,1,50,1
<br />
-
<br />
- ; Texture terrain
<br />
- grass_tex=LoadTexture( "media/mossyground.bmp" )
<br />
- EntityTexture terrain,grass_tex,0,1
<br />
-
<br />
- While Not KeyDown( 1 )
<br />
-
<br />
- If KeyDown( 203 )=True Then x#=x#-0.1
<br />
- If KeyDown( 205 )=True Then x#=x#+0.1
<br />
- If KeyDown( 208 )=True Then y#=y#-0.1
<br />
- If KeyDown( 200 )=True Then y#=y#+0.1
<br />
- If KeyDown( 44 )=True Then z#=z#-0.1
<br />
- If KeyDown( 30 )=True Then z#=z#+0.1
<br />
-
<br />
- If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0
<br />
- If KeyDown( 203 )=True Then TurnEntity camera,0,1,0
<br />
- If KeyDown( 208 )=True Then MoveEntity camera,0,0,-0.1
<br />
- If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.1
<br />
-
<br />
- x#=EntityX(camera)
<br />
- y#=EntityY(camera)
<br />
- z#=EntityZ(camera)
<br />
-
<br />
- terra_y#=TerrainY(terrain,x#,y#,z#)+5
<br />
-
<br />
- PositionEntity camera,x#,terra_y#,z#
<br />
-
<br />
- RenderWorld
<br />
-
<br />
- Text 0,0,"Use cursor keys to move about the terrain"
<br />
-
<br />
- ; Output terrain size to screen
<br />
- Text 0,20,"Terrain Size: "+TerrainSize(terrain)
<br />
-
<br />
- Flip
<br />
-
<br />
- Wend
<br />
-
<br />
- End
- </td>
- </tr>
- </table>
- <br>
- <a target=_top href=../index.htm>Index</a><br>
- <br>
- Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=TerrainSize&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|