Panda3D

Loading...
Searching...
No Matches
stackedPerlinNoise3.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 stackedPerlinNoise3.h
10 * @author drose
11 * @date 2005-10-05
12 */
13
14#ifndef STACKEDPERLINNOISE3_H
15#define STACKEDPERLINNOISE3_H
16
17#include "pandabase.h"
18#include "perlinNoise3.h"
19#include "epvector.h"
20
21/**
22 * Implements a multi-layer PerlinNoise, with one or more high-frequency noise
23 * functions added to a lower-frequency base noise function.
24 */
25 class EXPCL_PANDA_MATHUTIL StackedPerlinNoise3 {
26PUBLISHED:
27 INLINE StackedPerlinNoise3();
28 explicit StackedPerlinNoise3(double sx, double sy, double sz, int num_levels = 3,
29 double scale_factor = 4.0f, double amp_scale = 0.5f,
30 int table_size = 256, unsigned long seed = 0);
31 StackedPerlinNoise3(const StackedPerlinNoise3 &copy);
32 void operator = (const StackedPerlinNoise3 &copy);
33
34 void add_level(const PerlinNoise3 &level, double amp = 1.0);
35 void clear();
36
37 INLINE double noise(double x, double y, double z);
38 INLINE float noise(const LVecBase3f &value);
39 double noise(const LVecBase3d &value);
40
41 INLINE double operator ()(double x, double y, double z);
42 INLINE float operator ()(const LVecBase3f &value);
43 INLINE double operator ()(const LVecBase3d &value);
44
45 private:
46 class Noise {
47 public:
48 PerlinNoise3 _noise;
49 double _amp;
50 };
51
52 typedef epvector<Noise> Noises;
53 Noises _noises;
54};
55
56#include "stackedPerlinNoise3.I"
57
58#endif
PerlinNoise3
This class provides an implementation of Perlin noise for 3 variables.
Definition perlinNoise3.h:25
StackedPerlinNoise3::StackedPerlinNoise3
StackedPerlinNoise3()
Creates a StackedPerlinNoise3 object with no levels.
Definition stackedPerlinNoise3.I:19
StackedPerlinNoise3::clear
void clear()
Removes all levels from the stack.
Definition stackedPerlinNoise3.cxx:76
StackedPerlinNoise3::add_level
void add_level(const PerlinNoise3 &level, double amp=1.0)
Adds an arbitrary PerlinNoise3 object, and an associated amplitude, to the stack.
Definition stackedPerlinNoise3.cxx:64
StackedPerlinNoise3::noise
double noise(double x, double y, double z)
Returns the noise function of the three inputs.
Definition stackedPerlinNoise3.I:26
epvector.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
perlinNoise3.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
stackedPerlinNoise3.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.