The CTerran object is made to create height maps and draw it, It's a very useful object and using it is very easy. To use it, you have to load a grey-scale bitmap file that will be a topographical data to generate the height map, and then you will give a terrain and water texture. There is also a little and easy tide effect on the water to make it more realistic.
See the public part of the CTerran object :
| void | SetSizeOfCase(float size); |
| void | SetLandLevel(float level); |
| int | GenTerran(char *terran_file, char *land_texture, char *water_texture); |
| void | DrawTerran(); |
SetSizeOfCase()
is used to modify the magnifying value of the map.
(default value : 4.0f).
SetLandLevel() serve to set the land level, just
like its name tell it :) well, it's because of the
topographical bitmap you'll give won't be always the
same, sometimes you'll need to adjust the terrain
height, like that, you'll also be able to make an
island which sinks. (default value : 0.0f).
GenTerran() is probably the most significant
function of the CTerran class, it'll generate the
height map from the terran_file (a grey-scale 24bits
bitmap file) and will load the land and water
textures.
DrawTerran() will draw the height map into your
OpenGL viewport.



I implemented the pine-trees into the CTerran tester code