22 init_unscaled_xform();
23 _input_xform = _unscaled_xform;
34 int table_size,
unsigned long seed) :
37 init_unscaled_xform();
48 _unscaled_xform(copy._unscaled_xform),
49 _input_xform(copy._input_xform)
59 PerlinNoise::operator = (copy);
60 _unscaled_xform = copy._unscaled_xform;
61 _input_xform = copy._input_xform;
93 _input_xform = LMatrix4d::scale_mat(1.0f / value[0], 1.0f / value[1], 1.0f / value[2]) * _unscaled_xform;
100noise(
double x,
double y,
double z)
const {
101 return noise(LVecBase3d(x, y, z));
108noise(
const LVecBase3f &value)
const {
109 return (
float)
noise(value[0], value[1], value[2]);
117 return noise(x, y, z);
140INLINE
double PerlinNoise3::
141grad(
int hash,
double x,
double y,
double z) {
153 case 0:
return x + y;
154 case 1:
return -x + y;
155 case 2:
return x - y;
156 case 3:
return -x - y;
158 case 4:
return x + z;
159 case 5:
return -x + z;
160 case 6:
return x - z;
161 case 7:
return -x - z;
163 case 8:
return y + z;
164 case 9:
return -y + z;
165 case 10:
return y - z;
166 case 11:
return -y - z;
168 case 12:
return x + y;
169 case 13:
return -y + z;
170 case 14:
return -x + y;
171 case 15:
return -y - z;
This class provides an implementation of Perlin noise for 3 variables.
double noise(double x, double y, double z) const
Returns the noise function of the three inputs.
PerlinNoise3()
Randomizes the tables to make a unique noise function.
double operator()(double x, double y, double z) const
Returns the noise function of the three inputs.
void set_scale(double scale)
Changes the scale (frequency) of the noise.
void operator=(const PerlinNoise3 ©)
Makes an exact copy of the existing PerlinNoise object, including its random seed.
This is the base class for PerlinNoise2 and PerlinNoise3, different dimensions of Perlin noise implem...