OGRE  1.9.0
OgreVolumeSimplexNoise.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __Ogre_Simplex_Noise_H__
29#define __Ogre_Simplex_Noise_H__
30
31#include "OgreVector3.h"
32
34
35namespace Ogre {
36namespace Volume {
37
43 {
44 private:
45
47 static Real F3;
48
50 static Real G3;
51
53 long mSeed;
54
56 short perm[512];
57
59 short permMod12[512];
60
61 /* Gets a random long.
62 @return
63 A random long.
64 */
65 unsigned long random(void);
66
79 inline Real dot(const Vector3 &g, Real x, Real y, Real z) const
80 {
81 return g.x * x + g.y * y + g.z * z;
82 }
83
86 void init(unsigned long definedSeed);
87
88 public:
89
93
98 SimplexNoise(unsigned long definedSeed);
99
110 Real noise(Real xIn, Real yIn, Real zIn) const;
111
116 long getSeed(void) const;
117
118 };
119
120}
121}
122
123#endif
#define _OgreVolumeExport
Standard 3-dimensional vector.
Definition: OgreVector3.h:52
Simplex Noise ported from public domain Java Implementation http://webstaff.itn.liu....
unsigned long random(void)
Real noise(Real xIn, Real yIn, Real zIn) const
3D noise function.
long getSeed(void) const
Gets the current seed.
SimplexNoise(void)
Constructor with a random permutation table.
static Real F3
Skewing and unskewing factor for 3 dimensions.
SimplexNoise(unsigned long definedSeed)
Constructor with a by seed defined permutation table.
Real dot(const Vector3 &g, Real x, Real y, Real z) const
Dot product of a gradient with the given values.
static Real G3
Skewing and unskewing factor for 3 dimensions.
void init(unsigned long definedSeed)
Initializes the SimplexNoise instance.
float Real
Software floating point type.