#include "noise.h" float Noise::getNoise(Vector3d point) const { return getNoise(point.x, point.y, point.z); } void Noise::generateNoiseMap(int size) { noiseMap.clear(); noiseMap.resize(size * size * size); } void Noise::setNoise(int x, int y, int z, float value) { long int index = x + y * (long int) size + z * size * (long int) size; noiseMap[index] = value; } float Noise::getNoise(float x, float y, float z) const { long int index = x + y * (long int) size + z * size * (long int) size; float noise = noiseMap[index]; if (invert) { noise = 1.0f - noise; } return noise; } Noise::Noise(int size) { this->size = size; generateNoiseMap(size); }