(Yet another) Terrain Algorithm

I have updated the demo and source downloads. Main differences are:

  • Builing with a makefile now.
  • Accessing memory mapped files using either mmap (UNIX) or a wrapper for Win32.
  • All detail geometry stuff has been removed. So pure SOARX now.

Extension source code: (19k)
http://www.dachau.net/users/pfrogner/Source-SOARX.zip

Demo (win32 binaries, VC7.1): (1729k)
http://www.dachau.net/users/pfrogner/Demo-SOARX.zip

It should be possible to build this extension on UNIX, if you edit the makefile and exchange the compiler/linker and the options. The API has become more simple now:

import soarx

#setup
soarx.setMapBits( 10 )
soarx.setHorizontalResolution( 160.0 )
soarx.setVerticalResolution( 0.1 )
soarx.setVerticalBias( 0.0 ) 
soarx.setCameraNP( self.cameraNP )
soarx.setLens( self.lens )
soarx.setMagic( 60.0 )

soarx.init( self.terrainNP )
soarx.build( 'models/' ) # run only once
soarx.load( 'models/' )

# once a frame
soarx.update( )

# query
soarx.getElevation( x, y )

MapBits is the size of the terrain (10 = 2^10 = 1024x1024pixel)
Magic is a value for setting the refinement error. Play around until you are satisfied with the results. Smaller mean less quality, but faster. The effect is only very small.

It runs at about 120fps for the 1024x1024 demo terrain on my Nvidia 7800GTX.

enn0x