OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreVolumeSimplexNoise.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __Ogre_Simplex_Noise_H__
29 #define __Ogre_Simplex_Noise_H__
30 
31 #include "OgreVector3.h"
32 
34 
35 namespace Ogre {
36 namespace 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 
92  SimplexNoise(void);
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
static Real F3
Skewing and unskewing factor for 3 dimensions.
float Real
Software floating point type.
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.
Simplex Noise ported from public domain Java Implementation http://webstaff.itn.liu.se/~stegu/simplexnoise/SimplexNoise.java Thanks Stefan Gustavson!
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
#define _OgreVolumeExport