33 lines
809 B
C++
33 lines
809 B
C++
#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; // Parameters in [0,1], Output in [0,1]
|
|
float getNoise(float x, float y, float z) const; // Parameters in [0,1], Output in [0,1]
|
|
|
|
bool invert = false;
|
|
|
|
protected:
|
|
std::vector<float> noiseMap; // Noise map
|
|
int size; // Size of the cloudNoise map
|
|
|
|
void generateNoiseMap(int size);
|
|
void setNoise(int x, int y, int z, float value); // Parameters in [0,size]
|
|
|
|
float getCalculatedNoise(int x, int y, int z) const;
|
|
|
|
float interpolate(float a0, float a1, float w) const;
|
|
|
|
float fitToNoise(float point) const;
|
|
};
|
|
|
|
#endif //CG1_TRACER_NOISE_H
|