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
path: root/source
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
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')
-rw-r--r--source/blender/blenlib/intern/noise.c24
-rw-r--r--source/blender/python/api2_2x/Noise.c50
2 files changed, 53 insertions, 21 deletions
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index 3a2dd12a804..4fa2d1fdd48 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -946,20 +946,14 @@ float BLI_gTurbulence(float noisesize, float x, float y, float z, int oct, int h
}
-/*************************************/
-/* NOISE FUNCTIONS BY KEN MUSGRAVE */
-/* Copyright 1994 F. Kenton Musgrave */
-/*************************************/
-
-/* All of these are modified to be able to use them with different noisebasis.
- In some cases the original code seemed to contain errors, so it is not exactly
- the same now as the orginal code (from "Texturing and Modelling: A procedural approach") */
+/*
+ * The following code is based on Ken Musgrave's explanations and sample
+ * source code in the book "Texturing and Modelling: A procedural approach"
+ */
/*
* Procedural fBm evaluated at "point"; returns value stored in "value".
*
- * Copyright 1994 F. Kenton Musgrave
- *
* Parameters:
* ``H'' is the fractal increment parameter
* ``lacunarity'' is the gap between successive frequencies
@@ -1025,8 +1019,6 @@ float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves
* Procedural multifractal evaluated at "point";
* returns value stored in "value".
*
- * Copyright 1994 F. Kenton Musgrave
- *
* Parameters:
* ``H'' determines the highest fractal dimension
* ``lacunarity'' is gap between successive frequencies
@@ -1094,8 +1086,6 @@ float mg_MultiFractal(float x, float y, float z, float H, float lacunarity, floa
* Heterogeneous procedural terrain function: stats by altitude method.
* Evaluated at "point"; returns value stored in "value".
*
- * Copyright 1994 F. Kenton Musgrave
- *
* Parameters:
* ``H'' determines the fractal dimension of the roughest areas
* ``lacunarity'' is the gap between successive frequencies
@@ -1170,8 +1160,6 @@ float mg_HeteroTerrain(float x, float y, float z, float H, float lacunarity, flo
/* Hybrid additive/multiplicative multifractal terrain model.
*
- * Copyright 1994 F. Kenton Musgrave
- *
* Some good parameter values to start with:
*
* H: 0.25
@@ -1246,8 +1234,6 @@ float mg_HybridMultiFractal(float x, float y, float z, float H, float lacunarity
/* Ridged multifractal terrain model.
*
- * Copyright 1994 F. Kenton Musgrave
- *
* Some good parameter values to start with:
*
* H: 1.0
@@ -1319,8 +1305,6 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity
/* "Variable Lacunarity Noise"
* A distorted variety of Perlin noise.
- *
- * Copyright 1994 F. Kenton Musgrave
*/
float mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nbas2)
{
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] )
{