Terrain.dpr 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. {: Basic terrain rendering demo.
  2. This demo showcases the TerrainRenderer, some of the SkyDome features
  3. and bits of 3D sound 'cause I got carried over ;)
  4. The terrain HeightData is provided by a TGLBitmapHDS (HDS stands for
  5. "Height Data Source"), and displayed by a TGLTerrainRenderer.
  6. The base terrain renderer uses a hybrid ROAM/brute-force approach to
  7. rendering terrain, by requesting height data tiles, then rendering them
  8. using either triangle strips (for those below "QualityDistance") or ROAM
  9. tessellation.
  10. Note that if the terrain is wrapping in this sample (to reduce the required
  11. datasets size), the engine is *not* aware of it and does not exploit this
  12. fact in any way: it considers just an infinite terrain.
  13. Controls:<ul>
  14. <li>Direction keys move the came nora (shift to speedup)
  15. <li>PageUp/PageDown move the camera up and down
  16. <li>Orient the camera freely by holding down the left button
  17. <li>Toggle wireframe mode with 'w'
  18. <li>Increase/decrease the viewing distance with '+'/'-'.
  19. <li>Increase/decrease CLOD precision with '*' and '/'.
  20. <li>Increase/decrease QualityDistance with '9' and '8'.
  21. <li>'n' turns on 'night' mode, 'd' turns back to 'day' mode.
  22. <li>Toggle star twinkle with 't' (night mode only)
  23. <li>'l' turns on/off the lens flares
  24. </ul>
  25. When increasing the range, or moving after having increased the range you
  26. may notice a one-time slowdown, this originates in the base height data
  27. being duplicated to create the illusion of an "infinite" terrain (at max
  28. range the visible area covers 1024x1024 height samples, and with tiles of
  29. size 16 or less, this is a lot of tiles to prepare).
  30. Misc. note: since the whole viewer is fully repainted at each frame,
  31. it was possible to set roNoColorBufferClear in the Viewer.Buffer.ContextOptions,
  32. which allows to gain a few more frames per second (try unsetting it).
  33. }
  34. program Terrain;
  35. uses
  36. Forms,
  37. fTerrain in 'fTerrain.pas' {FormTerrain};
  38. {$R *.RES}
  39. begin
  40. Application.Initialize;
  41. Application.CreateForm(TFormTerrain, FormTerrain);
  42. Application.Run;
  43. end.