#include <ddghemap.h>
Public Members | |||
ddgHeightMap ( void ) | |||
Create an image but don't allocate memory. | |||
ddgHeightMap ( unsigned short r, unsigned short c) | |||
Create an image and allocate memory. | |||
~ddgHeightMap () | |||
Destroy and image. | |||
short* | buffer (void) | ||
Return the data block. | |||
unsigned short | cols (void) | ||
Return the width of the image. | |||
unsigned short | rows (void) | ||
Return the height of the image. | |||
bool | allocate ( unsigned short r, unsigned short c) | ||
Allocate a image buffer to be filled by the user. | |||
void | set (unsigned short r, unsigned short c, short d1) | ||
Set a data entry in the image. | |||
short | get (unsigned short r, unsigned short c, short *d1 = 0) | ||
Get a data entry in the image. | |||
short | iconvert (float n) | ||
Inverse transform a value from real float in meters to short space. | |||
float | convert (short n) | ||
Transform a value from short space back to real float in meters space. | |||
float | getf (unsigned short r, unsigned short c, float *d1 = 0) | ||
Get a transformed value in meters in the image. | |||
bool | readMemory ( unsigned short *buf ) | ||
Load an heightmap buffer from a memory buffer. More... | |||
bool | loadTerrain (const char *filename) | ||
Try all ways to load height map from TGN/BT/DEM/DTED/GTOPO30 file. | |||
bool | readTGN (const void *buf, unsigned long size) | ||
Read an image buffer from a Terragen file image. More... | |||
bool | readRAW (const char *filename, int w, int h) | ||
Read an image buffer from a RAW floating point file. | |||
bool | readTGN (const char *filename) | ||
Read an image buffer from a Terragen file. More... | |||
bool | writeTGN (const char *filename) | ||
Write an image buffer to a Terragen file. More... | |||
bool | readPGM (const char* data, int desired_max) | ||
Load a PGM file as a height map. | |||
bool | generateHeights (unsigned int r, unsigned int c, float octaves) | ||
Generate a height map and fill this image with the contents. | |||
ddgHeightMap* | quadify ( void ) | ||
Take a heightmap and create a new one which has the same map repeated 2 times. | |||
void | canyonize (float strength ) | ||
Process the height map to produce rougher features. strength = 0-1. | |||
void | glaciate (float strength ) | ||
Process the height map to produce smoother features. strength = 0-1. | |||
void | setMinMax (float b = 0, float d = 1) | ||
Set scale and base based on the Min Max of the input values, call before loading pixbuffer. | |||
void | setScaleAndBase (float s, float b = 0) | ||
Set scale and base. | |||
float | scale (void) | ||
Return the scale of the height map. | |||
float | base (void) | ||
Return the base height of the map. | |||
void | scale (float s ) | ||
Scale the height map. | |||
void | translate (float t ) | ||
Translate the height map. | |||
int | mini (void) | ||
Find min value. | |||
int | maxi (void) | ||
Find max value. | |||
void | setmax ( int m) | ||
Set max value. | |||
void | setmin ( int m) | ||
Set min value. | |||
void | scalef (float s ) | ||
Scale the height map. | |||
void | translatef (float t ) | ||
Translate the height map. | |||
float | minf (void) | ||
Find min value. | |||
float | maxf (void) | ||
Find max value. | |||
void | setmaxf ( float m) | ||
Set max value. | |||
void | setminf ( float m) | ||
Set min value. | |||
void | closeEdge (float l) | ||
Pull the edge of the heightmap down to l. | |||
void | sin (void) | ||
Initialize with a sin curve. | |||
bool | saveAsTGA (const char *filename) | ||
Save height map as TGA image. | |||
bool | createSpectralMap (int level, float smoothness) | ||
Create height map from spectral wave generator. | |||
void | vertexNormal (ddgVector3& normal, long row, long col, float gridSpacing) | ||
Calculate the surface normal at a location on the map. | |||
Static Public Members | |||
float | sconvert (short n, float base, float scale) | ||
Transform a value from short space back to real float space. | |||
short | siconvert (float n, float base, float scale) | ||
Inverse transform a value from real float in meters to short space. |
Also includes the ability to generate noise based maps.
bool ddgHeightMap::readMemory (unsigned short * buf) |
Load an heightmap buffer from a memory buffer.
Return true on error.
bool ddgHeightMap::readTGN (const void * buf, unsigned long size) |
Read an image buffer from a Terragen file image.
Return true on error.
bool ddgHeightMap::readTGN (const char * filename) |
Read an image buffer from a Terragen file.
Return true on error.
bool ddgHeightMap::writeTGN (const char * filename) |
Write an image buffer to a Terragen file.
Return true on error.