2012-01-23 23:45:33 +00:00
|
|
|
#ifndef _PAYSAGES_NOISE_H_
|
|
|
|
#define _PAYSAGES_NOISE_H_
|
|
|
|
|
2012-04-22 17:12:39 +00:00
|
|
|
#include "pack.h"
|
2012-01-23 23:45:33 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-08-27 20:40:35 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
NOISE_FUNCTION_SIMPLEX,
|
|
|
|
NOISE_FUNCTION_PERLIN,
|
|
|
|
NOISE_FUNCTION_NAIVE
|
|
|
|
} NoiseFunctionAlgorithm;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
NoiseFunctionAlgorithm algorithm;
|
|
|
|
double ridge_factor;
|
|
|
|
} NoiseFunction;
|
|
|
|
|
2012-01-23 23:45:33 +00:00
|
|
|
struct NoiseLevel
|
|
|
|
{
|
2012-06-17 09:40:40 +00:00
|
|
|
double scaling;
|
|
|
|
double height;
|
|
|
|
double xoffset;
|
|
|
|
double yoffset;
|
|
|
|
double zoffset;
|
2012-01-23 23:45:33 +00:00
|
|
|
};
|
|
|
|
typedef struct NoiseLevel NoiseLevel;
|
|
|
|
typedef struct NoiseGenerator NoiseGenerator;
|
|
|
|
|
2012-02-27 15:25:12 +00:00
|
|
|
void noiseInit();
|
|
|
|
void noiseQuit();
|
2012-04-22 17:12:39 +00:00
|
|
|
void noiseSave(PackStream* stream);
|
|
|
|
void noiseLoad(PackStream* stream);
|
2012-02-27 15:25:12 +00:00
|
|
|
|
2012-01-23 23:45:33 +00:00
|
|
|
NoiseGenerator* noiseCreateGenerator();
|
|
|
|
void noiseDeleteGenerator(NoiseGenerator* generator);
|
2012-08-26 20:02:10 +00:00
|
|
|
void noiseSaveGenerator(PackStream* stream, NoiseGenerator* generator);
|
|
|
|
void noiseLoadGenerator(PackStream* stream, NoiseGenerator* generator);
|
2012-01-23 23:45:33 +00:00
|
|
|
void noiseCopy(NoiseGenerator* source, NoiseGenerator* destination);
|
2012-06-17 16:46:30 +00:00
|
|
|
void noiseValidate(NoiseGenerator* generator);
|
2012-08-27 20:40:35 +00:00
|
|
|
NoiseFunction noiseGetFunction(NoiseGenerator* generator);
|
|
|
|
void noiseSetFunction(NoiseGenerator* generator, NoiseFunction* function);
|
|
|
|
void noiseSetFunctionParams(NoiseGenerator* generator, NoiseFunctionAlgorithm algorithm, double ridge_factor);
|
2012-07-01 13:27:57 +00:00
|
|
|
void noiseForceValue(NoiseGenerator* generator, double value);
|
2012-06-17 09:40:40 +00:00
|
|
|
double noiseGetMaxValue(NoiseGenerator* generator);
|
2012-01-23 23:45:33 +00:00
|
|
|
int noiseGetLevelCount(NoiseGenerator* generator);
|
|
|
|
void noiseClearLevels(NoiseGenerator* generator);
|
|
|
|
void noiseAddLevel(NoiseGenerator* generator, NoiseLevel level);
|
2012-06-17 09:40:40 +00:00
|
|
|
void noiseAddLevelSimple(NoiseGenerator* generator, double scaling, double height);
|
|
|
|
void noiseAddLevels(NoiseGenerator* generator, int level_count, NoiseLevel start_level, double scaling_factor, double height_factor, int randomize_offset);
|
|
|
|
void noiseAddLevelsSimple(NoiseGenerator* generator, int level_count, double scaling, double height);
|
2012-01-23 23:45:33 +00:00
|
|
|
void noiseRemoveLevel(NoiseGenerator* generator, int level);
|
|
|
|
int noiseGetLevel(NoiseGenerator* generator, int level, NoiseLevel* params);
|
|
|
|
void noiseSetLevel(NoiseGenerator* generator, int level, NoiseLevel params);
|
2012-06-17 09:40:40 +00:00
|
|
|
void noiseSetLevelSimple(NoiseGenerator* generator, int level, double scaling, double height);
|
|
|
|
void noiseNormalizeHeight(NoiseGenerator* generator, double min_height, double max_height, int adjust_scaling);
|
|
|
|
double noiseGet1DLevel(NoiseGenerator* generator, int level, double x);
|
|
|
|
double noiseGet1DTotal(NoiseGenerator* generator, double x);
|
|
|
|
double noiseGet1DDetail(NoiseGenerator* generator, double x, double detail);
|
|
|
|
double noiseGet2DLevel(NoiseGenerator* generator, int level, double x, double y);
|
|
|
|
double noiseGet2DTotal(NoiseGenerator* generator, double x, double y);
|
|
|
|
double noiseGet2DDetail(NoiseGenerator* generator, double x, double y, double detail);
|
|
|
|
double noiseGet3DLevel(NoiseGenerator* generator, int level, double x, double y, double z);
|
|
|
|
double noiseGet3DTotal(NoiseGenerator* generator, double x, double y, double z);
|
|
|
|
double noiseGet3DDetail(NoiseGenerator* generator, double x, double y, double z, double detail);
|
2012-01-23 23:45:33 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|