Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo de Greef <eeshlo@yahoo.com>2006-09-25 08:54:45 +0400
committerAlfredo de Greef <eeshlo@yahoo.com>2006-09-25 08:54:45 +0400
commitdb7c3d32717f5e12969fcb9951b7f5508faa7e0a (patch)
tree743af1cf9b2ef967f221e1f04704e00b8a97bf3f /source/blender/python/api2_2x/Noise.c
parent71284959d5afad06e1a5a2fdf0cd12f15e7319bd (diff)
A possible problem was noted by Cyril Brulebois regarding copyright issues
with regards to the noise functions in yafray based on Ken Musgrave's original code. I had left the 'Copyright' notice in the comments, and according to Cyril Brulebois this is a problem. In fact, from what I understand this makes it even impossible to use or modify the code in other software. But since it is not a verbatim copy of the code but rather based on Musgrave's work, he suggested I change it to explicitely state that it is in fact based on the code from the 'Texturing & Modeling' book. And since the yafray code is in turn based on the blender code, I better adapt the blender code too. This reminded me that I also have forgotten to include the copyright notice in the mersenne twister rng code I used for the Python Noise module. This does clearly state to include the original notice with any resdistributed code, in modified form or not. So I added that too. I hope that solves the problems.
Diffstat (limited to 'source/blender/python/api2_2x/Noise.c')
-rw-r--r--source/blender/python/api2_2x/Noise.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/Noise.c b/source/blender/python/api2_2x/Noise.c
index 060dedb9801..14a254ebcd0 100644
--- a/source/blender/python/api2_2x/Noise.c
+++ b/source/blender/python/api2_2x/Noise.c
@@ -45,6 +45,52 @@
/*-----------------------------------------*/
/* 'mersenne twister' random number generator */
+
+/*
+ A C-program for MT19937, with initialization improved 2002/2/10.
+ Coded by Takuji Nishimura and Makoto Matsumoto.
+ This is a faster version by taking Shawn Cokus's optimization,
+ Matthe Bellew's simplification, Isaku Wada's real version.
+
+ Before using, initialize the state by using init_genrand(seed)
+ or init_by_array(init_key, key_length).
+
+ Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. The names of its contributors may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ Any feedback is very welcome.
+ http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
+ email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
+*/
+
/* Period parameters */
#define N 624
#define M 397
@@ -112,7 +158,7 @@ static void setRndSeed( int seed )
init_genrand( seed );
}
-/* float number in range [0, 1) */
+/* float number in range [0, 1) using the mersenne twister rng */
static float frand( )
{
unsigned long y;
@@ -130,6 +176,8 @@ static float frand( )
return ( float ) y / 4294967296.f;
}
+/*------------------------------------------------------------*/
+
/* returns random unit vector */
static void randuvec( float v[3] )
{