Panda3D

Loading...
Searching...
No Matches
perlinNoise2.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 perlinNoise2.h
10 * @author drose
11 * @date 2005-10-05
12 */
13
14#ifndef PERLINNOISE2_H
15#define PERLINNOISE2_H
16
17#include "pandabase.h"
18#include "perlinNoise.h"
19
20/**
21 * This class provides an implementation of Perlin noise for 2 variables.
22 * This code is loosely based on the reference implementation at
23 * https://mrl.nyu.edu/~perlin/noise/ .
24 */
25 class EXPCL_PANDA_MATHUTIL PerlinNoise2 : public PerlinNoise {
26PUBLISHED:
27 INLINE PerlinNoise2();
28 INLINE explicit PerlinNoise2(double sx, double sy,
29 int table_size = 256,
30 unsigned long seed = 0);
31 INLINE PerlinNoise2(const PerlinNoise2 &copy);
32 INLINE void operator = (const PerlinNoise2 &copy);
33
34 INLINE void set_scale(double scale);
35 INLINE void set_scale(double sx, double sy);
36 INLINE void set_scale(const LVecBase2f &scale);
37 INLINE void set_scale(const LVecBase2d &scale);
38
39 INLINE double noise(double x, double y) const;
40 INLINE float noise(const LVecBase2f &value) const;
41 double noise(const LVecBase2d &value) const;
42
43 INLINE double operator ()(double x, double y) const;
44 INLINE float operator ()(const LVecBase2f &value) const;
45 INLINE double operator ()(const LVecBase2d &value) const;
46
47 private:
48 void init_unscaled_xform();
49 INLINE static double grad(int hash, double x, double y);
50
51 private:
52 LMatrix3d _unscaled_xform;
53 LMatrix3d _input_xform;
54};
55
56#include "perlinNoise2.I"
57
58#endif
PerlinNoise2::noise
double noise(double x, double y) const
Returns the noise function of the three inputs.
Definition perlinNoise2.I:100
PerlinNoise2::PerlinNoise2
PerlinNoise2()
Randomizes the tables to make a unique noise function.
Definition perlinNoise2.I:19
PerlinNoise2::set_scale
void set_scale(double scale)
Changes the scale (frequency) of the noise.
Definition perlinNoise2.I:68
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
perlinNoise2.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
perlinNoise.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.