Panda3D
Loading...
Searching...
No Matches
perlinNoise3.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file perlinNoise3.h
10 * @author drose
11 * @date 2005-10-05
12 */
13
14#ifndef PERLINNOISE3_H
15#define PERLINNOISE3_H
16
17#include "pandabase.h"
18#include "perlinNoise.h"
19
20/**
21 * This class provides an implementation of Perlin noise for 3 variables.
22 * This code is loosely based on the reference implementation at
23 * http://mrl.nyu.edu/~perlin/noise/ .
24 */
25class EXPCL_PANDA_MATHUTIL PerlinNoise3 : public PerlinNoise {
26PUBLISHED:
27 INLINE PerlinNoise3();
28 INLINE explicit PerlinNoise3(double sx, double sy, double sz,
29 int table_size = 256,
30 unsigned long seed = 0);
31 INLINE PerlinNoise3(const PerlinNoise3 &copy);
32 INLINE void operator = (const PerlinNoise3 &copy);
33
34 INLINE void set_scale(double scale);
35 INLINE void set_scale(double sx, double sy, double sz);
36 INLINE void set_scale(const LVecBase3f &scale);
37 INLINE void set_scale(const LVecBase3d &scale);
38
39 INLINE double noise(double x, double y, double z) const;
40 INLINE float noise(const LVecBase3f &value) const;
41 double noise(const LVecBase3d &value) const;
42
43 INLINE double operator ()(double x, double y, double z) const;
44 INLINE float operator ()(const LVecBase3f &value) const;
45 INLINE double operator ()(const LVecBase3d &value) const;
46
47private:
48 void init_unscaled_xform();
49 INLINE static double grad(int hash, double x, double y, double z);
50
51private:
52 LMatrix4d _unscaled_xform;
53 LMatrix4d _input_xform;
54};
55
56#include "perlinNoise3.I"
57
58#endif
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.
void set_scale(double scale)
Changes the scale (frequency) of the noise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.