cloudy-raytracer/common/noise/noise.h

34 lines
809 B
C
Raw Normal View History

#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
2023-01-24 06:26:24 +01:00
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]
2023-01-24 06:26:24 +01:00
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