LoadTerrain.bb 926 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. LoadTerrain Example
  2. -------------------
  3. Graphics3D 640,480
  4. SetBuffer BackBuffer()
  5. camera=CreateCamera()
  6. PositionEntity camera,1,1,1
  7. light=CreateLight()
  8. RotateEntity light,90,0,0
  9. ; Load terrain
  10. terrain=LoadTerrain( "media/height_map.bmp" )
  11. ; Set terrain detail, enable vertex morphing
  12. TerrainDetail terrain,4000,True
  13. ; Scale terrain
  14. ScaleEntity terrain,1,50,1
  15. ; Texture terrain
  16. grass_tex=LoadTexture( "media/mossyground.bmp" )
  17. EntityTexture terrain,grass_tex,0,1
  18. While Not KeyDown( 1 )
  19. If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0
  20. If KeyDown( 203 )=True Then TurnEntity camera,0,1,0
  21. If KeyDown( 208 )=True Then MoveEntity camera,0,0,-0.1
  22. If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.1
  23. x#=EntityX(camera)
  24. y#=EntityY(camera)
  25. z#=EntityZ(camera)
  26. terra_y#=TerrainY(terrain,x#,y#,z#)+5
  27. PositionEntity camera,x#,terra_y#,z#
  28. RenderWorld
  29. Text 0,0,"Use cursor keys to move about the terrain"
  30. Flip
  31. Wend
  32. End