root/OpenSceneGraph/trunk/examples/osgshaders/Noise.h @ 6941

Revision 6941, 2.1 kB (checked in by robert, 8 years ago)

From Martin Lavery and Robert Osfield, Updated examples to use a variation of the MIT License

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*-
2*
3*  OpenSceneGraph example, osgshaders.
4*
5*  Permission is hereby granted, free of charge, to any person obtaining a copy
6*  of this software and associated documentation files (the "Software"), to deal
7*  in the Software without restriction, including without limitation the rights
8*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9*  copies of the Software, and to permit persons to whom the Software is
10*  furnished to do so, subject to the following conditions:
11*
12*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15*  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17*  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
18*  THE SOFTWARE.
19*/
20
21
22/************************************************************************
23 *                                                                      *
24 *                   Copyright (C) 2002  3Dlabs Inc. Ltd.               *
25 *                                                                      *
26 ***********************************************************************/
27
28#ifndef __ogl2_demo_h__
29#define __ogl2_demo_h__
30
31
32extern void SetNoiseFrequency(int frequency);
33
34extern double noise1(double arg);
35extern double noise2(double vec[2]);
36extern double noise3(double vec[3]);
37extern void normalize2(double vec[2]);
38extern void normalize3(double vec[3]);
39
40/*
41   In what follows "alpha" is the weight when the sum is formed.
42   Typically it is 2, As this approaches 1 the function is noisier.
43   "beta" is the harmonic scaling/spacing, typically 2.
44*/
45
46extern double PerlinNoise1D(double x,double alpha, double beta, int n);
47extern double PerlinNoise2D(double x,double y,double alpha, double beta, int n);
48extern double PerlinNoise3D(double x,double y,double z,double alpha, double beta, int n);
49
50
51#endif // __ogl2_demo_h__
Note: See TracBrowser for help on using the browser.