SynthTerrainD.dpr 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {: Synthetic terrain demo.
  2. This demo covers use of TGLCustomHDS to supply custome elevation info
  3. to the terrain engine as well as per-tile texturing. It also showcases
  4. use of simple 1D texturing as an alternative to per-vertex coloring.
  5. If you're after "nice" terrain rendering, check the "terrain" demo instead,
  6. this one is more about understanding "what goes inside" than obtaining a
  7. beautiful output - though obtaining beautiful output without understanding
  8. may not be that easy ;)
  9. All you need to understand to use TGLCustomHDS is what goes on in the
  10. OnStartPreparingData. You can have a quick look at the FormCreate, but there
  11. is nothing special: it setups initial camera position and prepares 3 1D
  12. textures for use in the terrain rendering.
  13. When implementing OnStartPreparingData, keep in mind that this event is a
  14. request from the terrain rendering engine, it asks for elevation and texture
  15. data for a new tile that comes in visibility range (or was marked directy
  16. and rhas new data, f.i. in the case of dynamic terrain). The engine requires
  17. its data in a specific format, the code revolving around DataType is there
  18. for that purpose If you are in an application specific context, this phase
  19. may be unnecessary (just prepare the data in the format you were asked).
  20. The TGLHeightData you receive is empty, meaning you've got to allocate it first
  21. (with the Allocate method), and then fill it using one of the various properties
  22. (see TGLHeightData).
  23. The material is specified by the MaterialName property (the material library
  24. being linked at the TGLTerrainRenderer level). Materials used can be dynamic
  25. between frames, but must remain coherent throughout a frame, and for as long
  26. as the TGLHeightData where you specified the material remains alive.
  27. }
  28. program SynthTerrainD;
  29. uses
  30. Forms,
  31. fSynthTerrainD in 'fSynthTerrainD.pas' {FormSynthTerrain};
  32. {$R *.RES}
  33. begin
  34. Application.Initialize;
  35. Application.CreateForm(TFormSynthTerrain, FormSynthTerrain);
  36. Application.Run;
  37. end.