2012-01-23 23:45:33 +00:00
|
|
|
#ifndef _PAYSAGES_NOISE_H_
|
|
|
|
#define _PAYSAGES_NOISE_H_
|
|
|
|
|
2013-01-19 22:42:50 +00:00
|
|
|
#include "tools/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;
|
2013-01-27 19:57:43 +00:00
|
|
|
double ridge_factor; /* -0.5;0.5 */
|
|
|
|
double curve_factor; /* -1.0;1.0 */
|
2012-08-27 20:40:35 +00:00
|
|
|
} NoiseFunction;
|
2013-01-19 22:42:50 +00:00
|
|
|
|
2013-01-27 19:57:43 +00:00
|
|
|
typedef struct
|
2012-01-23 23:45:33 +00:00
|
|
|
{
|
2013-01-27 19:57:43 +00:00
|
|
|
double wavelength;
|
|
|
|
double amplitude;
|
|
|
|
double minvalue;
|
2012-06-17 09:40:40 +00:00
|
|
|
double xoffset;
|
|
|
|
double yoffset;
|
|
|
|
double zoffset;
|
2013-01-27 19:57:43 +00:00
|
|
|
} NoiseLevel;
|
|
|
|
|
2012-01-23 23:45:33 +00:00
|
|
|
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);
|
2013-01-30 14:11:59 +00:00
|
|
|
void noiseRandomizeOffsets(NoiseGenerator* generator);
|
2012-08-27 20:40:35 +00:00
|
|
|
NoiseFunction noiseGetFunction(NoiseGenerator* generator);
|
|
|
|
void noiseSetFunction(NoiseGenerator* generator, NoiseFunction* function);
|
2013-01-27 19:57:43 +00:00
|
|
|
void noiseSetFunctionParams(NoiseGenerator* generator, NoiseFunctionAlgorithm algorithm, double ridge_factor, double curve_factor);
|
2012-07-01 13:27:57 +00:00
|
|
|
void noiseForceValue(NoiseGenerator* generator, double value);
|
2013-01-27 19:57:43 +00:00
|
|
|
void noiseGetRange(NoiseGenerator* generator, double* minvalue, double* maxvalue);
|
2012-01-23 23:45:33 +00:00
|
|
|
int noiseGetLevelCount(NoiseGenerator* generator);
|
|
|
|
void noiseClearLevels(NoiseGenerator* generator);
|
2013-01-30 14:11:59 +00:00
|
|
|
void noiseAddLevel(NoiseGenerator* generator, NoiseLevel level, int protect_offsets);
|
2013-01-27 19:57:43 +00:00
|
|
|
void noiseAddLevelSimple(NoiseGenerator* generator, double scaling, double minvalue, double maxvalue);
|
2013-01-30 14:11:59 +00:00
|
|
|
void noiseAddLevels(NoiseGenerator* generator, int level_count, NoiseLevel start_level, double scaling_factor, double amplitude_factor, double center_factor);
|
2013-01-30 21:36:49 +00:00
|
|
|
void noiseAddLevelsSimple(NoiseGenerator* generator, int level_count, double scaling, double minvalue, double maxvalue, double center_factor);
|
2012-01-23 23:45:33 +00:00
|
|
|
void noiseRemoveLevel(NoiseGenerator* generator, int level);
|
|
|
|
int noiseGetLevel(NoiseGenerator* generator, int level, NoiseLevel* params);
|
2013-01-30 14:11:59 +00:00
|
|
|
void noiseSetLevel(NoiseGenerator* generator, int index, NoiseLevel level, int protect_offsets);
|
|
|
|
void noiseSetLevelSimple(NoiseGenerator* generator, int index, double scaling, double minvalue, double maxvalue);
|
2013-01-27 19:57:43 +00:00
|
|
|
void noiseNormalizeAmplitude(NoiseGenerator* generator, double minvalue, double maxvalue, int adjust_scaling);
|
2012-06-17 09:40:40 +00:00
|
|
|
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
|