CreateTerrain.htm 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>CreateTerrain ( grid_size[,parent] )</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. 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 />
  13. parent (optional) - parent entity of terrain
  14. </td>
  15. </tr>
  16. </table>
  17. <h1>Description</h1>
  18. <table>
  19. <tr>
  20. <td>
  21. Creates a terrain entity and returns its handle. <br />
  22. <br />
  23. The terrain extends from 0,0,0 to grid_size,1,grid_size. <br />
  24. <br />
  25. 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 />
  26. <br />
  27. 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 />
  28. <br />
  29. 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 />
  30. <br />
  31. 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 />
  32. <br />
  33. See also: LoadTerrain.
  34. </td>
  35. </tr>
  36. </table>
  37. <h1><a href=../3d_examples/CreateTerrain.bb>Example</a></h1>
  38. <table>
  39. <tr>
  40. <td>
  41. ; CreateTerrain Example <br />
  42. ; --------------------- <br />
  43. <br />
  44. Graphics3D 640,480 <br />
  45. SetBuffer BackBuffer() <br />
  46. <br />
  47. camera=CreateCamera() <br />
  48. PositionEntity camera,0,1,0 <br />
  49. <br />
  50. light=CreateLight() <br />
  51. RotateEntity light,90,0,0 <br />
  52. <br />
  53. ; Create terrain <br />
  54. terrain=CreateTerrain(128) <br />
  55. <br />
  56. ; Texture terrain <br />
  57. grass_tex=LoadTexture( "media/mossyground.bmp" ) <br />
  58. EntityTexture terrain,grass_tex <br />
  59. <br />
  60. While Not KeyDown( 1 ) <br />
  61. <br />
  62. If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0 <br />
  63. If KeyDown( 203 )=True Then TurnEntity camera,0,1,0 <br />
  64. If KeyDown( 208 )=True Then MoveEntity camera,0,0,-0.05 <br />
  65. If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.05 <br />
  66. <br />
  67. RenderWorld <br />
  68. <br />
  69. Text 0,0,"Use cursor keys to move about the terrain" <br />
  70. <br />
  71. Flip <br />
  72. <br />
  73. Wend <br />
  74. <br />
  75. End
  76. </td>
  77. </tr>
  78. </table>
  79. <br>
  80. <a target=_top href=../index.htm>Index</a><br>
  81. <br>
  82. 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>
  83. </html>