[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx demo/texlab.py libpaper/texcoords.py li...
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx demo/texlab.py libpaper/texcoords.py li... |
Date: |
Fri, 25 Oct 2002 10:20:16 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/10/25 10:20:16
Modified files:
gfx/demo : texlab.py
gfx/libpaper : texcoords.py
gfx/libtexture : fnoise.texture
Log message:
Add higher frequency components to libpaper papers
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/texlab.py.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/texcoords.py.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libtexture/fnoise.texture.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/texlab.py
diff -u gzz/gfx/demo/texlab.py:1.12 gzz/gfx/demo/texlab.py:1.13
--- gzz/gfx/demo/texlab.py:1.12 Sun Oct 20 07:08:52 2002
+++ gzz/gfx/demo/texlab.py Fri Oct 25 10:20:15 2002
@@ -11,6 +11,16 @@
tres = 128
args = [
+
+ #[128, 128, 0, 4, "RGBA", "RGBA", "noise",
+ # ["bias", "0.5", "scale", "0.15",
+ # "fbm", "1", "freq", "1", "freq2", "16", "df", "1"]],
+
+ [128, 128, 0, 4, "RGBA", "RGBA", "fnoise",
+ ["bias", "0.5", "scale", "0.15",
+ "freq", "10", "df", "4"]],
+
+
[128, 128, 0, 4, "RGBA", "RGBA", "sawnoise",
["bias", "0.5",
"scale", "0.15", "freq", "1", "df", "2",
Index: gzz/gfx/libpaper/texcoords.py
diff -u gzz/gfx/libpaper/texcoords.py:1.16 gzz/gfx/libpaper/texcoords.py:1.17
--- gzz/gfx/libpaper/texcoords.py:1.16 Wed Oct 23 09:45:37 2002
+++ gzz/gfx/libpaper/texcoords.py Fri Oct 25 10:20:15 2002
@@ -1,6 +1,7 @@
# Texture coordinates
from __future__ import nested_scopes
import math
+from math import sqrt
def smallIntegerG0(rnd):
"""Return a small integer greater than 0.
@@ -146,10 +147,18 @@
"""
def chooseInts(rnd):
- a,b,c,d = 0,0,0,0
- while a*d-b*c == 0:
- a,b,c,d = [int(0.5*rnd.nextGaussian()) for i in range(0,4)]
+ while 1:
+ a,b,c,d = [int(2*rnd.nextGaussian()**3) for i in range(0,4)]
+ l1 = sqrt(a*a + b*b)
+ l2 = sqrt(c*c + d*d)
+ det = a*d-b*c
+ if det == 0: continue
+ if l1 * l2 / det > 2: continue
+ if abs(math.log(l1 / l2)) > .7: continue
+ break
+
return (a,b,c,d)
+
a,b,c,d = chooseInts(rnd)
# 1 / determinant
f = 1.0 / (a * d - b * c)
Index: gzz/gfx/libtexture/fnoise.texture
diff -u gzz/gfx/libtexture/fnoise.texture:1.6
gzz/gfx/libtexture/fnoise.texture:1.7
--- gzz/gfx/libtexture/fnoise.texture:1.6 Wed Oct 9 10:48:20 2002
+++ gzz/gfx/libtexture/fnoise.texture Fri Oct 25 10:20:16 2002
@@ -74,6 +74,8 @@
}
}
+double identity(double x) { return x; }
+
void GENERATE(TextureParam *params, int width, int height, int depth, int
components, float *data) {
FPARAM(bias, 0);
FPARAM(scale, 1);
@@ -82,8 +84,12 @@
FPARAM(df, 2);
FPARAM(seed, 0);
FPARAM(turb, 0);
+ FPARAM(fbm, 0);
FPARAM(freq2, 20);
+ double (*func)(double) = identity;
+ if (turb) func = fabs, fbm = 1;
+
if (seed) srandom((long)seed);
int d = (depth==0 ? 1 : depth);
@@ -93,7 +99,7 @@
data[i] = 0;
- if (turb) {
+ if (fbm) {
float *tmp = new float[n];
for (float f = freq; f <= freq2; f += f) {
@@ -104,7 +110,7 @@
float m = 1.0 / (log(f)/log(2) + 1);
for(int i = 0; i<n; i++)
- data[i] += m * fabs(tmp[i]);
+ data[i] += m * func(tmp[i]);
}
for(int i = 0; i<n; i++)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gfx demo/texlab.py libpaper/texcoords.py li...,
Janne V. Kujala <=