[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: |
Fri, 25 Oct 2002 04:48:13 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/10/25 04:48:13
Modified files:
gfx/demo : irregu3.py
gfx/libtexture : irregu.texture
Log message:
Fix intensity texture
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregu3.py.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libtexture/irregu.texture.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/irregu3.py
diff -u gzz/gfx/demo/irregu3.py:1.18 gzz/gfx/demo/irregu3.py:1.19
--- gzz/gfx/demo/irregu3.py:1.18 Fri Oct 25 04:28:05 2002
+++ gzz/gfx/demo/irregu3.py Fri Oct 25 04:48:12 2002
@@ -71,7 +71,7 @@
tex_scale = 1
tex_bias = 0
- tex_format = "RGBA"
+ tex_format = [ 4, "RGBA", "RGBA" ]
elif profile == "DOT3":
print "Using 1/4 displacement resolution textures with
GL_EXT_texture_env_dot3"
@@ -95,7 +95,7 @@
tex_scale = .25
tex_bias = .75
- tex_format = "RGBA"
+ tex_format = [ 4, "RGBA", "RGBA" ]
elif profile == "STD":
print "Using full displacement resolution texture with standard GL"
@@ -113,7 +113,7 @@
tex_scale = 1
tex_bias = 0
- tex_format = "INTENSITY"
+ tex_format = [ 1, "INTENSITY", "LUMINANCE" ]
else:
assert(0)
@@ -122,10 +122,10 @@
"scale", str(tex_scale), "bias", str(tex_bias), "eps", ".125"]
- tex = getCachedTexture([size, size, 0, 4, tex_format, "RGBA", "irregu",
- args], shade_all_levels = 1)
- texinv = getCachedTexture([size, size, 0, 4, tex_format, "RGBA", "irregu",
- args + ["invert", "1"]],
+ tex = getCachedTexture([size, size, 0] + tex_format +
+ ["irregu", args], shade_all_levels = 1)
+ texinv = getCachedTexture([size, size, 0] + tex_format +
+ ["irregu", args + ["invert", "1"]],
shade_all_levels = 1)
Index: gzz/gfx/libtexture/irregu.texture
diff -u gzz/gfx/libtexture/irregu.texture:1.8
gzz/gfx/libtexture/irregu.texture:1.9
--- gzz/gfx/libtexture/irregu.texture:1.8 Thu Oct 24 07:36:25 2002
+++ gzz/gfx/libtexture/irregu.texture Fri Oct 25 04:48:12 2002
@@ -45,7 +45,12 @@
// Ripple amplitude in texture coordinates
FPARAM(ripple_scale, 0.25);
- if(components != 4) return;
+ float *origdata = data;
+ if(components != 4) {
+ if (components != 1) return;
+ data = new float[width * height * depth * 4];
+ }
+
if(depth != 1) return;
if(width != height) return;
@@ -58,7 +63,7 @@
char s[1000];
sprintf(s, "gfx/libtexture/sawnoise.bin %d %d %d %d "
"bias 0.5 scale 0.15 freq 1 df 2 scale2 0.25 freq2 10 df2 .5",
- width, height, depth, components);
+ width, height, depth, 4);
fprintf(stderr, "popen: %s", s);
@@ -69,7 +74,7 @@
return;
}
- fread(data, sizeof(float), width * height * depth * components, f);
+ fread(data, sizeof(float), width * height * depth * 4, f);
pclose(f);
fprintf(stderr, "\n");
}
@@ -93,6 +98,7 @@
}
}
+ 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);
@@ -129,6 +135,13 @@
data[i+3]);
}
#endif
+
+ if (components != 4) {
+ /* components == 1 */
+ for (int i = 0; i < width * height * depth; i++)
+ origdata[i] = data[4 * i + 3];
+ 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 <=
- [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, 2002/10/29
- [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/irregu.texture, Janne V. Kujala, 2002/10/29