PinkNoise.h
1 #pragma once
2 
3 namespace VoxelFarm
4 {
5  class CPinkNoise
6  {
7  public:
8  static double noise3D(double px, double py, double pz);
9  static double fractal3D(double px, double py, double pz, double step, double lacunarity, int octaves);
10  protected:
11  static const int DIM_SAMPLES = 16;
12  static const int MAX_SAMPLES = DIM_SAMPLES*DIM_SAMPLES*DIM_SAMPLES;
13  static const double samples[MAX_SAMPLES];
14  static double getPointInSample(int x, int y, int z)
15  {
16  x = (x < DIM_SAMPLES)? x : (x - DIM_SAMPLES);
17  y = (y < DIM_SAMPLES)? y : (y - DIM_SAMPLES);
18  z = (z < DIM_SAMPLES)? z : (z - DIM_SAMPLES);
19  int sampleIndex = z*DIM_SAMPLES*DIM_SAMPLES + y*DIM_SAMPLES + x;
20  return samples[sampleIndex];
21  }
22  };
23 }
Contains all classes and functions for the VoxelFarm engine.