xmountains
xmountains copied to clipboard
This is my ancient X-windows sideways scrolling fractal landscape code
Xmountains is a X11 based fractal landscape generator. It generates random fractal surfaces and displays them in a window. While the program is running the fractal is continuously extended on the right and the image is scrolled from right to left to expose the newly generated area.
This is a very old piece of code but the algorithms https://spbooth.github.io/xmountains/about_xmountains.html are still quite interesting
This distribution contains an Imakefile. If your X-window software has been correctly installed a Makefile appropriate to your system can be generated from this using the command "xmkmf". Once this has been done the program is compiled with the command "make".
== Commandline options ==
./xmountains: version 2.9 usage: ./xmountains -[bqgdPEmMrBZIASFTCapcevfRltxsXYH] -b [false] use root window -q [false] reset root window on exit -g string window geometry -d string display -P filename write PID to file -E [false] toggle explicit expose events -m [false] print map -M [false] disable reflections -r int [20] # columns before scrolling -B int [80] # shades in a colour band -n int [245] # number of colours -Z int [10] time to sleep before scrolling -I float [40.000000] vertical angle of light -A float [0.000000] horizontal angle of light -S float [0.600000] vertical stretch -T float [0.500000] vertical shift -W float [0.000000] sealevel -F int [1] reduce variation in the foreground -G float [-1.000000] average foreground height -C float [0.300000] contour parameter -a float [2.500000] altitude of viewpoint -p float [4.000000] distance of viewpoint -c float [1.000000] contrast -e float [0.300000] ambient light level -v float [0.600000] vertical light level Fractal options: -f float [0.650000] fractal dimension -R int [0] rng seed, read clock if 0 -l int [10] # levels of recursion -t int [2] # non fractal iterations -x [true] cross update -s [1] smoothing (0-7) -X float [0.000000] fraction of old value for rg2 & rg3 -Y float [0.000000] fraction of old value for rg1 -H print short description of algorithm.
This program works best on a colour display. It will work on monochrome displays but the default parameter values are not optimal for this.
The program breaks down into three sections
- Fractal generation (calcalt.c random.c crinkle.h) This code should be fairly solid, It also contains some algorithmic tricks I had to invent (though it is not inconceivable that somebody else has also thought of them)
- Image rendering & main program (artist.c global.c scroll.c global.h paint.h) This code is a bit more sloppy but seems to work OK.
- The X interface (X_graphics.c) The X interface was retro-fitted to an earlier version of the program that was designed to use memory mapped video hardware. As a result this code is a little crude. A more experienced X hacker could do better but ...
== PROBLEMS ==
- All parameters are set on the command line.
- The choice of colours looks strange on some hardware.
- The program will not work with Xscreensaver or virtual window managers. This can be fixed by including vroot.h in X_graphics.c (define VROOT to cpp to do this) but I was a little wary of putting this in by default.
== Contact == If you have any comments/fixes etc for this program, Email me at: [email protected] or send pull request.
Copyright 1994 Stephen Booth, see copyright.h