Ok, but there are some caveats. First, all this prog does is load a .ter file and let you fly around. Well it does some other things but it is primarally a testbed for fooling around with the terrain. Second, it is not perfect, you can occaisionally see updates at the edges of the screen especially when you are travelling diagonally (prog has to update two edges of matrix and things get visible). Third, there are some limitations, some arbitrary, some because I'm lazy, none I think are insurmountable, but heh!
As far as the Terragen terrain is concerned:
1. it must be square (i.e. I only look at the SIZE chunk and ignore the XPTS and YPTS chunks)
2. I ignore the SCAL chunk and assume a scaling of 30m per sample (the Terragen default, and coincidentally a convenient scaling for a 50x50 matrix)
3. I have hard-coded a ceiling of 300m for flying around to keep from flying through the skydome. Your terrain should probably have a max altitude of somewhere around 300m. In the terrain I included there are some peaks to the SE that barely exceed 300m. If you cruise over them you'll get temporarily popped above 300m.
4. At this time I have only tested with the one terrain. Should work (or at least be workable) with other terrains (esp. other sizes) but I don't know yet.
5. The download is big - you are getting a snapshot of what I have been working with and currently all my bitmaps are .bmp and not .jpg. The zip weighs in a cool megabyte.
6. The system I am using to texture the matrix could best be described as goofy. It is actually quite simple in practice and I suspect a holy terror to descibe to some one else. Any ideas on how to improve this would be greatly appreciated.
7. The texturing system relies on a bitmap called texture_map.bmp. If you load it into a paint program it will look totally black. It is actually a 16-color image with pallet entries like rgb(1,1,1), rgb(2,2,2), rgb(3,3,3)... rgb(16,16,16). It was created by taking the texture_256.bmp (which was created by rendering the terrain in Terragen) and converting it to a 16-color image. Then the pallet was edited and the first pallet entry was changed to rgb(1,1,1), etc. Then by loading this image (actually I load the image and keep only the red channel to save memory) I can use this information to index my terrain texture (texture.bmp). Get it?
8. Because of the texture_map.bmp load, the program HAS to run in a 32-bit display mode. DB doesn't load a bmp as stored, but converts it to the current display mode. If the display mode is 16 bits then the color information get screwed. I can think of at least one way around this, but this whole system has gotten goofy enough.
Ok, now to the fun stuff...
Controls are kinda goofy as well, come from bolting on stuff as I thought of it.
The cursor keys are move forward, back, sidestep right and left.
Right-clicking the mouse turns on and off mouselook. Mouselook is the only way to turn. Probably no reason not to leave mouselook on all the time except occaisionally I like to turn it off so don't have to worry about joggling the mouse.
The scrollwheel will run up forward or backward velocity. Clicking the scrollwheel stops you dead in the water.
Left-click will level the camera
A and Z (or a and z) will lift and lower the camera.
Holding the shiftkey while using the arrow keys will double your speed.
I started out using relatively arbitrary values for speed, but I wanted some values that were at least somewhat realistic. 25m/s works out to about 55mph and that is the base 'walking' speed (yeah, I know, realistic eh?). Pressing the shift key doubles that to 50m/s. Pressing the 's' key brings up a very crude throttle. Everything stops and waits for you to press a number key (1-0 where 0=10). This number divided by 10 is a modifier to the whole speed thing, which is defaulted around 5, so if you press 0 (10) then every thing doubles and your max speed is 100m/s. This is what I envision as maximum safe speed. However, this is supposed to be fun, so hitting the spacebar toggles a 'turbo' boost.
When you start the program, you'll be looking at an axis jack which marks the center of the terrain and has x and z coords of zero (y is 2m above terrain). Pressing 'L' for 'look' will point the camera at the axis jack so you don't get lost. The default is to just point the camera. This is fast and accurate, but it can be disorienting if you are not sure what direction you are facing to begin with. Pressing 'm' will toggle a different method that uses curveangle to spin the camera around. It is not always totally accurate and shouldn't be used when you are zooming around close to the jack, but it gives you a better feel for where you were headed.
'P' will page through some text overlays of info. I find that text is a real hog to put on the page, so try to do without it. The controls get pretty jerky when text is being displayed.
A note about the velocity shown on the first info page. It is only accurate for the scroll wheel. When you are at rest, what is displayed is the potential velocity if you pressed the up arrow. It doesn't recognize the shift key.
'W' displays the frame rate in the lower right corner.
'K' controls the dome - the states are dome & fog, no dome & fog, no dome & no fog.
'F' toggles a freeze of the matrix. You can then move off the matrix, and press 'f' again and watch a whole bunch of updates happen.
That's about it...
You can download it at:
http://space-available.com/terra/terra2.zip
Have fun,
Anthony