Perlin Noise Terrain Generator
A Program to Generate Terrain from Perlin Noise with Exponentially Distributed Gradient Magnitude
 All Files Functions Variables Macros Pages
Functions | Variables
main.cpp File Reference

Main. More...

#include <stdio.h>
#include <stdlib.h>
#include "defines.h"
#include "perlin.h"

Functions

void GenerateAndSave (const unsigned int x, const unsigned int y, const char *filename)
 Generate and save a cell of terrain elevations.
 
int main (int argc, char *argv[])
 Main.
 

Variables

const int CELLSIZE = 4096
 Number of vertices on side of square cell.
 
int g_nNumOctaves = 8
 Number of octaves.
 
float g_fAltitude = 5000.0f
 Altitude cap.
 
float g_fMu = 1.02f
 Mu, the gradient magnitude exponent.
 

Function Documentation

void GenerateAndSave ( const unsigned int  x,
const unsigned int  y,
const char *  filename 
)

Generate and save a cell of noise as a DEM file. The output file will have a ".asc" file expension, which is standard for DEM files.

Parameters
xX coordinate of corner of cell.
yY coordinate of corner of cell.
filenameName of DEM file for output, without extension.
int main ( int  argc,
char *  argv[] 
)

Prompts the user for a random number seed, number of octaves, mu, and an elevation cap, saves a DEM file output.asc of terrain elevations generated using Perlin noise with an exponentially distributed gradient magnitude.

Parameters
argcArgument count
argvArguments.
Returns
0 for success, 1 for failure.