Turned into a lib.

This commit is contained in:
2014-02-28 13:26:55 -04:30
parent cea1003804
commit 3a92d73887
5 changed files with 61 additions and 17 deletions

58
island.h Normal file
View File

@@ -0,0 +1,58 @@
#ifndef ISLAND_H
#define ISLAND_H
#ifdef __cplusplus
extern "C" {
#endif
typedef enum TERRAIN_TYPE { DEEP_WATER,
SHALLOW_WATER,
SAND,
GRASS,
FOREST,
HILL,
MOUNTAIN
} terrain_t;
/**
* Generate a diamond-square fractal map.
*/
extern void ds ( float ***, const unsigned int );
/**
* Generate a mask using particle deposition.
*/
extern void island ( int ***, unsigned int );
/**
* Normalize a float matrix between 0 and 1.
*/
extern void norm ( float ***, unsigned int );
/**
* Normalize an int matrix between 0 and 255.
*/
extern void normInt ( int ***, unsigned int );
/**
* Perform a 3x3 average blur.
*/
extern void smooth ( int ***, unsigned int );
/**
* Multiply the diamond square map with the island mask.
* Both matrices must have been normalized before.
*/
extern void mult ( float ***, int ***, unsigned int );
/**
* Given a sample from a heightmap, return the terrain
* type that correspond it.
*/
terrain_t terrainType( int );
#ifdef __cplusplus
}
#endif
#endif