TerrainSize.htm 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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>TerrainSize ( terrain )</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. terrain - terrain handle
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. Returns the grid size used to create a terrain.
  21. </td>
  22. </tr>
  23. </table>
  24. <h1><a href=../3d_examples/TerrainSize.bb>Example</a></h1>
  25. <table>
  26. <tr>
  27. <td>
  28. ; TerrainSize Example <br />
  29. ; ------------------- <br />
  30. <br />
  31. Graphics3D 640,480 <br />
  32. SetBuffer BackBuffer() <br />
  33. <br />
  34. camera=CreateCamera() <br />
  35. PositionEntity camera,1,1,1 <br />
  36. <br />
  37. light=CreateLight() <br />
  38. RotateEntity light,90,0,0 <br />
  39. <br />
  40. ; Load terrain <br />
  41. terrain=LoadTerrain( "media/height_map.bmp" ) <br />
  42. <br />
  43. ; Set terrain detail, enable vertex morphing <br />
  44. TerrainDetail terrain,4000,True <br />
  45. <br />
  46. ; Scale terrain <br />
  47. ScaleEntity terrain,1,50,1 <br />
  48. <br />
  49. ; Texture terrain <br />
  50. grass_tex=LoadTexture( "media/mossyground.bmp" ) <br />
  51. EntityTexture terrain,grass_tex,0,1 <br />
  52. <br />
  53. While Not KeyDown( 1 ) <br />
  54. <br />
  55. If KeyDown( 203 )=True Then x#=x#-0.1 <br />
  56. If KeyDown( 205 )=True Then x#=x#+0.1 <br />
  57. If KeyDown( 208 )=True Then y#=y#-0.1 <br />
  58. If KeyDown( 200 )=True Then y#=y#+0.1 <br />
  59. If KeyDown( 44 )=True Then z#=z#-0.1 <br />
  60. If KeyDown( 30 )=True Then z#=z#+0.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.1 <br />
  65. If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.1 <br />
  66. <br />
  67. x#=EntityX(camera) <br />
  68. y#=EntityY(camera) <br />
  69. z#=EntityZ(camera) <br />
  70. <br />
  71. terra_y#=TerrainY(terrain,x#,y#,z#)+5 <br />
  72. <br />
  73. PositionEntity camera,x#,terra_y#,z# <br />
  74. <br />
  75. RenderWorld <br />
  76. <br />
  77. Text 0,0,"Use cursor keys to move about the terrain" <br />
  78. <br />
  79. ; Output terrain size to screen <br />
  80. Text 0,20,"Terrain Size: "+TerrainSize(terrain) <br />
  81. <br />
  82. Flip <br />
  83. <br />
  84. Wend <br />
  85. <br />
  86. End
  87. </td>
  88. </tr>
  89. </table>
  90. <br>
  91. <a target=_top href=../index.htm>Index</a><br>
  92. <br>
  93. 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>
  94. </html>