[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: |
Tue, 29 Oct 2002 06:53:54 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/10/29 06:53:53
Modified files:
gfx/demo : irregu3.py
gfx/libtexture : irregu.texture
Log message:
cleanup
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregu3.py.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libtexture/irregu.texture.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/irregu3.py
diff -u gzz/gfx/demo/irregu3.py:1.27 gzz/gfx/demo/irregu3.py:1.28
--- gzz/gfx/demo/irregu3.py:1.27 Tue Oct 29 04:43:44 2002
+++ gzz/gfx/demo/irregu3.py Tue Oct 29 06:53:52 2002
@@ -32,7 +32,7 @@
def init(profile):
global tex, texinv
global texenv_inner, texenv_outer, alphalevel, w0, w1
- global colmap0, colmap1
+ global colmap0, colmap1, angles
global using_shader, using_secondary_color
using_shader = 0
@@ -89,6 +89,7 @@
def colmap0(dotvec): return (1,1,1)
def colmap1(dotvec): return (1,1,1)
+ angles = 0
tex_scale = 1
tex_bias = 0
tex_format = [ 2, "HILO_NV", "HILO_NV" ]
@@ -136,6 +137,7 @@
def colmap0(dotvec): return (1,1,1)
def colmap1(dotvec): return (0,0,0)
+ angles = 3
tex_scale = 1
tex_bias = 0
tex_format = [ 4, "RGBA", "RGBA" ]
@@ -160,6 +162,7 @@
def colmap0(dotvec): return [.5 + .5 * c for c in dotvec]
def colmap1(dotvec): return [.5 + .25 * c for c in dotvec]
+ angles = 3
tex_scale = .25
tex_bias = .75
tex_format = [ 4, "RGBA", "RGBA" ]
@@ -178,6 +181,7 @@
def colmap0(dotvec): return (1,1,1,1)
def colmap1(dotvec): return (0,0,0,0)
+ angles = 0
tex_scale = 1
tex_bias = 0
tex_format = [ 1, "INTENSITY", "LUMINANCE" ]
@@ -186,7 +190,8 @@
args = ["radius", "2", "ripple_scale", str(ripple_scale),
- "scale", str(tex_scale), "bias", str(tex_bias), "eps", ".125"]
+ "scale", str(tex_scale), "bias", str(tex_bias),
+ "angles", str(angles), "eps", ".125"]
tex = getCachedTexture([texsize, texsize, 0] + tex_format +
@@ -280,18 +285,28 @@
]
]
- if outer:
- a = angle * 6 / (2 * pi)
- while a < 0: a+=3
- i = int(a) % 3
- f = a - int(a)
+ vec = [ 0 for i in range(0, angles) ]
- vecs = [ (1,0,0), (0,0,1), (0,1,0), (1,0,0) ]
- vec = lerp(vecs[i], vecs[i+1], f)
- else:
- vec = (1,0,0)
-
- dotvec = js(vec)
+ if angles:
+ if outer:
+ a = angle * (angles / pi)
+ while a < 0: a += angles
+ i0 = int(a) % angles
+ i1 = (i0 + 1) % angles
+ f = a - int(a)
+
+ vec[i0] = 1 - f
+ vec[i1] = f
+ else:
+ vec[0] = 1
+
+ dotvec = js(vec)
+
+ if not using_shader:
+ # Interpolate outer edge towards inner edge with NV_COMB
+ a = 2**-edgelodbias
+ dotvec = js(vecmul(vec,a) + [1-a]) + " #"
+
cols = [ colmap0(vec),
colmap1(vec),
Index: gzz/gfx/libtexture/irregu.texture
diff -u gzz/gfx/libtexture/irregu.texture:1.12
gzz/gfx/libtexture/irregu.texture:1.13
--- gzz/gfx/libtexture/irregu.texture:1.12 Mon Oct 28 04:54:56 2002
+++ gzz/gfx/libtexture/irregu.texture Tue Oct 29 06:53:53 2002
@@ -30,6 +30,7 @@
FPARAM(eps, .25);
FPARAM(invert, 0);
FPARAM(quantize, 255);
+ int angles = (int)params->getFloat("angles", 0);
// Note: radius is specified in texels
FPARAM(radius, 2);
@@ -38,9 +39,7 @@
FPARAM(ripple_scale, 0.25);
float *origdata = data;
- if(components != 4) {
- data = new float[width * height * depth * 4];
- }
+ data = new float[width * height * depth * 4];
if(depth != 1) return;
if(width != height) return;
@@ -89,14 +88,14 @@
data[i] = f * scale + bias;
// Add outer edge to quantized inner edge
- if (components == 4)
+ if (angles)
data[i] = floor(data[i] * quantize + 0.5) / quantize;
}
- if (components == 4)
- for (int comp = 0; comp < 3; comp++) {
- float dx = cos(comp * 2*M_PI / 3);
- float dy = sin(comp * 2*M_PI / 3);
+ for (int comp = 0; comp < angles && comp < components; comp++) {
+
+ float dx = cos(comp * M_PI / angles);
+ float dy = sin(comp * M_PI / angles);
ind = 0;
for (j = 0, y = 0; j < height; j++, y += ystep) {
@@ -114,8 +113,9 @@
if (h > maxh) maxh = h;
}
- data[ind + comp] = maxh;
- ind += 4;
+ origdata[ind + comp] = maxh;
+
+ ind += components;
}
}
@@ -131,12 +131,11 @@
}
#endif
- if (components < 4) {
- for (int i = 0; i < width * height * depth; i++)
- for (int c = 0; c < components; c++)
- origdata[i * components + c] = data[4 * i + 3 - c];
- delete[] data;
- }
+ for (int i = 0; i < width * height * depth; i++)
+ for (int c = angles; c < components; c++)
+ origdata[i * components + c] = data[4 * i + 3 - (c - angles)];
+
+ delete[] data;
}
- [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture, Janne V. Kujala, 2002/10/21
- [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture, Janne V. Kujala, 2002/10/21
- [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture, Janne V. Kujala, 2002/10/21
- [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture, Janne V. Kujala, 2002/10/21
- [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture, Janne V. Kujala, 2002/10/22
- [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture, Janne V. Kujala, 2002/10/25
- [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture, Janne V. Kujala, 2002/10/25
- [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture, Janne V. Kujala, 2002/10/28
- [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture,
Janne V. Kujala <=
- [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture, Janne V. Kujala, 2002/10/29