| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>CreateTerrain ( grid_size[,parent] )</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- grid_size - no of grid squares along each side of terrain, and must be a power of 2 value, e.g. 32, 64, 128, 256, 512, 1024.
<br />
- parent (optional) - parent entity of terrain
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- Creates a terrain entity and returns its handle.
<br />
-
<br />
- The terrain extends from 0,0,0 to grid_size,1,grid_size.
<br />
-
<br />
- A terrain is a special type of polygon object that uses real-time level of detail (LOD) to display landscapes which should theoretically consist of over a million polygons with only a few thousand. The way it does this is by constantly rearranging a certain amount of polygons to display high levels of detail close to the viewer and low levels further away.
<br />
-
<br />
- This constant rearrangement of polygons is occasionally noticeable however, and is a well-known side-effect of all LOD landscapes. This 'pop-in' effect can be reduced in lots of ways though, as the other terrain help files will go on to explain.
<br />
-
<br />
- The optional parent parameter allows you to specify a parent entity for the terrain so that when the parent is moved the child terrain will move with it. However, this relationship is one way; applying movement commands to the child will not affect the parent.
<br />
-
<br />
- Specifying a parent entity will still result in the terrain being created at position 0,0,0 rather than at the parent entity's position.
<br />
-
<br />
- See also: LoadTerrain.
- </td>
- </tr>
- </table>
- <h1><a href=../3d_examples/CreateTerrain.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; CreateTerrain Example
<br />
- ; ---------------------
<br />
-
<br />
- Graphics3D 640,480
<br />
- SetBuffer BackBuffer()
<br />
-
<br />
- camera=CreateCamera()
<br />
- PositionEntity camera,0,1,0
<br />
-
<br />
- light=CreateLight()
<br />
- RotateEntity light,90,0,0
<br />
-
<br />
- ; Create terrain
<br />
- terrain=CreateTerrain(128)
<br />
-
<br />
- ; Texture terrain
<br />
- grass_tex=LoadTexture( "media/mossyground.bmp" )
<br />
- EntityTexture terrain,grass_tex
<br />
-
<br />
- While Not KeyDown( 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.05
<br />
- If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.05
<br />
-
<br />
- RenderWorld
<br />
-
<br />
- Text 0,0,"Use cursor keys to move about the 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=CreateTerrain&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|