00001 /* -*-c++-*- 00002 * 00003 * OpenSceneGraph example, osgshaders. 00004 * 00005 * Permission is hereby granted, free of charge, to any person obtaining a copy 00006 * of this software and associated documentation files (the "Software"), to deal 00007 * in the Software without restriction, including without limitation the rights 00008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00009 * copies of the Software, and to permit persons to whom the Software is 00010 * furnished to do so, subject to the following conditions: 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00013 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00014 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00015 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00016 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00017 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00018 * THE SOFTWARE. 00019 */ 00020 00021 00022 /************************************************************************ 00023 * * 00024 * Copyright (C) 2002 3Dlabs Inc. Ltd. * 00025 * * 00026 ***********************************************************************/ 00027 00028 #ifndef __ogl2_demo_h__ 00029 #define __ogl2_demo_h__ 00030 00031 00032 extern void SetNoiseFrequency(int frequency); 00033 00034 extern double noise1(double arg); 00035 extern double noise2(double vec[2]); 00036 extern double noise3(double vec[3]); 00037 extern void normalize2(double vec[2]); 00038 extern void normalize3(double vec[3]); 00039 00040 /* 00041 In what follows "alpha" is the weight when the sum is formed. 00042 Typically it is 2, As this approaches 1 the function is noisier. 00043 "beta" is the harmonic scaling/spacing, typically 2. 00044 */ 00045 00046 extern double PerlinNoise1D(double x,double alpha, double beta, int n); 00047 extern double PerlinNoise2D(double x,double y,double alpha, double beta, int n); 00048 extern double PerlinNoise3D(double x,double y,double z,double alpha, double beta, int n); 00049 00050 00051 #endif // __ogl2_demo_h__