Ocular Engine
WaveletNoise.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_MATH_WAVELET_NOISE__H__
19 #define __H__OCULAR_MATH_WAVELET_NOISE__H__
20 
21 #include "ANoise.hpp"
22 #include "Math/Vector3.hpp"
23 #include <vector>
24 
25 //------------------------------------------------------------------------------------------
26 
31 namespace Ocular
32 {
37  namespace Math
38  {
43  namespace Noise
44  {
59  class WaveletNoise : public ANoise
60  {
61  public:
62 
66  WaveletNoise(int32_t dimensions = 64);
67  ~WaveletNoise();
68 
76  virtual float getValue(float const x);
77 
86  virtual float getValue(float const x, float const y);
87 
97  virtual float getValue(float const x, float const y, float const z);
98 
111  float getValue(float const pX, float const pY, float const pZ, float const nX, float const nY, float const nZ);
112 
121  void setBandWeights(std::vector<float> const& weights);
122 
127  void setScale(float const scale);
128 
129  protected:
130 
131  void generate();
132  void downsample(float* from, float* to, int32_t n, int32_t stride);
133  void upsample(float* from, float* to, int32_t n, int32_t stride);
134 
135  float getRawNoise(Vector3f const& position);
136  float getRawProjectedNoise(Vector3f const& position, Vector3f const& normals);
137 
138  private:
139 
140  int32_t m_Dimensions;
141  int32_t m_NoiseSize;
142 
143  float m_Scale;
144  std::vector<float> m_BandWeights;
145 
146  float* m_Noise;
147  };
148  }
152  }
156 }
161 //------------------------------------------------------------------------------------------
162 
163 #endif
WaveletNoise(int32_t dimensions=64)
Definition: WaveletNoise.cpp:43
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
void setBandWeights(std::vector< float > const &weights)
Definition: WaveletNoise.cpp:121
Definition: WaveletNoise.hpp:59
Definition: ANoise.hpp:48
virtual float getValue(float const x)
Definition: WaveletNoise.cpp:71
void setScale(float const scale)
Definition: WaveletNoise.cpp:126