TopoToucher is a heightmap sandbox program for linux written in C++ with OpenGL. This was written using OpenGL, FreeGLUT, GLM, and helper libraries written by Mike Bailey. I have a writeup about this project on my website
g++
make
OpenGL
GLEW
make
./TopoToucher [VERT_RESOLUTION]
VERT_RESOLUTION
: Number of vertexes across the square in each direction. Default 100.
Note that even numbers will not have a center vertex and the start position will be rounded down and appear off-center towards (0,0)
All keyboard controls are caps-agnostic.
Q : Quit Program
E : Cycle Rolloff Functions
W : Push Vertex(es) Up
S : Push Vertex(es) Down
A : Decrease Influence Radius
D : Increase Influence Radius
H : Move Cursor Left
J : Move Cursor Forward
K : Move Cursor Backward
L : Move Cursor Right
L-CLK : Hold to Orbit
Scroll : Zoom in/out
R-CLK : Context Menu
- Axis : Enable/Disable center context axis
- Axis Colors : Change color of center context axis
- Depth Cue : Add additional depth-based darkening
- Projection : Change between Orthographic and Perspective views
- Reset : Reset all values including the heightmap, camera position, and all values above
- Debug : Enables debug logging to console
- Quit : Close the program. Same as Q
An image of the currently implemented falloff equations is shown above. You can go to the interactive Desmos graph by clicking on the image or clicking here. The x value represents the distance from the currently selected vertex, and the y value represents the value to be added/subtracted from that vertex. In TopoToucher, the currently selected rolloff function can be found in white in the bottom left corner of the screen.
TopoToucher uses a small ambient light, and an orbiting sun lamp to show
variation in topography. No user input is required to utilize these lights, and
the sun orbits automatically.
There is the option of enabling Depth Cue, using the right click context menu.
Turning on Depth Cue enables some OpenGL Fog (whose parameters are defined as
constants at the start of main.cpp
) which darkens the scene a bit, but will
make your angles a bit more prominent. Below are two images showing a map with
depth cue turned off (left, default) and turned on (right).
The base code for this program is stored in /main.cpp
. Global variables are
defined at the top of the file. Functions of note include:
Display
: Builds the heightmap mesh from the global arrayHeights
, then draws everything to the screenMoveVert
: Modifies theHeights
array to influence vertexes on and aroundCurrentIndex
, based on the variableRolloff
, which is an index ofRolloffs
enumeratorKeyboard
: Handles keyboard interruptsInitMenus
: Configures the right click context menu