2023-01-24 05:22:40 +01:00
|
|
|
#ifndef CG1_TRACER_NOISE_H
|
|
|
|
#define CG1_TRACER_NOISE_H
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include "common/vector3d.h"
|
|
|
|
|
|
|
|
class Vector3d;
|
|
|
|
|
|
|
|
class Noise
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Noise(int size);
|
|
|
|
|
|
|
|
float getNoise(Vector3d point) const;
|
|
|
|
float getNoise(float x, float y, float z) const;
|
|
|
|
|
|
|
|
bool invert = false;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::vector<float> noiseMap; // Noise map
|
2023-01-24 06:26:24 +01:00
|
|
|
int size; // Size of the cloudNoise map
|
2023-01-24 05:22:40 +01:00
|
|
|
|
|
|
|
void generateNoiseMap(int size);
|
|
|
|
void setNoise(int x, int y, int z, float value);
|
2023-01-24 06:26:24 +01:00
|
|
|
|
|
|
|
float getCalculatedNoise(int x, int y, int z) const;
|
|
|
|
|
|
|
|
float fitToNoise(float point) const;
|
|
|
|
|
|
|
|
float interpolate(float a0, float a1, float w) const;
|
2023-01-24 05:22:40 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //CG1_TRACER_NOISE_H
|