Fixed some unit tests issues

This commit is contained in:
Michaël Lemaire 2014-05-20 10:39:02 +02:00
parent c57c5f45d4
commit 69fba0fc69
3 changed files with 9 additions and 4 deletions

View file

@ -112,6 +112,8 @@ void NoiseGenerator::validate()
_func_noise_2d = noiseSimplexGet2DValue; _func_noise_2d = noiseSimplexGet2DValue;
_func_noise_3d = noiseSimplexGet3DValue; _func_noise_3d = noiseSimplexGet3DValue;
break; break;
case NOISE_FUNCTION_CUSTOM:
break;
} }
if (function.ridge_factor > 0.5) if (function.ridge_factor > 0.5)
@ -163,9 +165,10 @@ void NoiseGenerator::setFunction(NoiseFunction* function)
void NoiseGenerator::setCustomFunction(double (*func1d)(double x), double (*func2d)(double x, double y), double (*func3d)(double x, double y, double z)) void NoiseGenerator::setCustomFunction(double (*func1d)(double x), double (*func2d)(double x, double y), double (*func3d)(double x, double y, double z))
{ {
this->_func_noise_1d = func1d; _func_noise_1d = func1d;
this->_func_noise_2d = func2d; _func_noise_2d = func2d;
this->_func_noise_3d = func3d; _func_noise_3d = func3d;
function.algorithm = NOISE_FUNCTION_CUSTOM;
} }
void NoiseGenerator::setFunctionParams(NoiseFunctionAlgorithm algorithm, double ridge_factor, double curve_factor) void NoiseGenerator::setFunctionParams(NoiseFunctionAlgorithm algorithm, double ridge_factor, double curve_factor)

View file

@ -15,7 +15,8 @@ public:
typedef enum typedef enum
{ {
NOISE_FUNCTION_PERLIN, NOISE_FUNCTION_PERLIN,
NOISE_FUNCTION_SIMPLEX NOISE_FUNCTION_SIMPLEX,
NOISE_FUNCTION_CUSTOM
} NoiseFunctionAlgorithm; } NoiseFunctionAlgorithm;
typedef struct typedef struct

View file

@ -31,6 +31,7 @@ protected:
terrain->height = 3.0; terrain->height = 3.0;
terrain->scaling = 1.0; terrain->scaling = 1.0;
terrain->_height_noise->clearLevels(); terrain->_height_noise->clearLevels();
terrain->water_height = 0.0;
NoiseGenerator::NoiseLevel level = {1.0, 2.0, -1.0}; NoiseGenerator::NoiseLevel level = {1.0, 2.0, -1.0};
terrain->_height_noise->addLevel(level); terrain->_height_noise->addLevel(level);
noise_state.resetOffsets(); noise_state.resetOffsets();