[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture |
Date: |
Sat, 02 Nov 2002 06:42:43 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/11/02 06:42:42
Modified files:
gfx/demo : irregu3.py
gfx/libtexture : irregu.texture
Log message:
Start sqrt scaling; currently only works for mipmaps
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregu3.py.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libtexture/irregu.texture.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/irregu3.py
diff -u gzz/gfx/demo/irregu3.py:1.41 gzz/gfx/demo/irregu3.py:1.42
--- gzz/gfx/demo/irregu3.py:1.41 Fri Nov 1 17:21:33 2002
+++ gzz/gfx/demo/irregu3.py Sat Nov 2 06:42:42 2002
@@ -10,6 +10,9 @@
texscale = 1
use_texture = 0
+scalings = [ "const", "sqrt", "linear" ]
+scaling = scalings[0]
+
matrices = [ "1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1",
"4 0 0 0.005 0 1 0 0 0 0 1 0 0 0 0 1" ]
@@ -39,19 +42,27 @@
def getIrreguTex(components, iformat, format, scale = 1, bias = 0, angle = 0,
angles = 0, invert = 0):
- return getCachedTexture([texsize, texsize, 0, components, iformat, format,
"irregu",
- ["radius", "2",
- "ripple_scale", str(ripple_scale),
- "scale", str(scale),
- "bias", str(bias),
- "angle", str(angle),
- "angles", str(angles),
- "eps", ".125",
- "invert", str(invert),
- ]],
+ args = ["radius", "2",
+ "ripple_scale", str(ripple_scale),
+ "scale", str(scale),
+ "bias", str(bias), ]
+ if angles:
+ args += [
+ "angle", str(angle),
+ "angles", str(angles),
+ "eps", ".125",
+ "scaling", scaling,
+ ]
+ if invert:
+ args += [
+ "invert", "1",
+ ]
+
+ return getCachedTexture([texsize, texsize, 0, components, iformat, format,
+ "irregu", args],
shade_all_levels = 1)
-def init(profile):
+def init():
global tex
global texenv_inner, texenv_outer, alphalevel, w0, w1
global colmap0, colmap1, angles
@@ -396,6 +407,7 @@
print "Using", angles, "precomputed slicing angles"
+ print "Using", scaling, "scaling"
global reinit
reinit = 1
@@ -406,14 +418,19 @@
print ("F%s:" % (i+1)), profiles[i]
-init(profiles[0])
+profile = profiles[0]
+init()
def globalkey(k):
global reinit
-
- if "F1" <= k <= "F8":
- global profiles
- init(profiles[int(k[1]) - 1])
+ if "1" <= k <= "9":
+ global scaling
+ scaling = scalings[int(k) - 1]
+ init()
+ elif "F1" <= k <= "F12":
+ global profile
+ profile = profiles[int(k[1]) - 1]
+ init()
elif k == "m":
global matrices
matrices = matrices[1:] + matrices[:1]
Index: gzz/gfx/libtexture/irregu.texture
diff -u gzz/gfx/libtexture/irregu.texture:1.14
gzz/gfx/libtexture/irregu.texture:1.15
--- gzz/gfx/libtexture/irregu.texture:1.14 Tue Oct 29 08:24:14 2002
+++ gzz/gfx/libtexture/irregu.texture Sat Nov 2 06:42:42 2002
@@ -31,10 +31,20 @@
FPARAM(invert, 0);
FPARAM(quantize, 255);
FPARAM(angle, 0);
+ FPARAM(refsize, 256);
+ enum e_scaling { CONST, LINEAR, SQRT }
+ scaling = (e_scaling)params->getStringEnum("scaling", 0,
+ "const", "linear", "sqrt", 0);
int angles = (int)params->getFloat("angles", 0);
// Note: radius is specified in texels
FPARAM(radius, 2);
+
+ switch (scaling) {
+ case CONST: break;
+ case LINEAR: radius *= (width / refsize); break;
+ case SQRT: radius *= sqrt(width / refsize); break;
+ }
// Ripple amplitude in texture coordinates
FPARAM(ripple_scale, 0.25);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture,
Janne V. Kujala <=