[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/demo irregu3.py
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx/demo irregu3.py |
Date: |
Tue, 29 Oct 2002 11:11:04 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/10/29 11:11:04
Modified files:
gfx/demo : irregu3.py
Log message:
Start multitex profile
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregu3.py.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/irregu3.py
diff -u gzz/gfx/demo/irregu3.py:1.30 gzz/gfx/demo/irregu3.py:1.31
--- gzz/gfx/demo/irregu3.py:1.30 Tue Oct 29 08:24:14 2002
+++ gzz/gfx/demo/irregu3.py Tue Oct 29 11:11:03 2002
@@ -22,6 +22,10 @@
if (GL.hasExtension("GL_NV_register_combiners") and
GL.hasExtension("GL_EXT_secondary_color")):
+ if (GL.getGLFloat("MAX_GENERAL_COMBINERS_NV") >= 4 and
+ GL.getGLFloat("MAX_TEXTURE_UNITS") >= 3):
+ profiles.append("NV_COMB_MULTITEX")
+
profiles.append("NV_COMB_DOT3")
profiles.append("NV_COMB_DOT4")
@@ -49,10 +53,11 @@
global tex
global texenv_inner, texenv_outer, alphalevel, w0, w1
global colmap0, colmap1, angles
- global using_shader, using_secondary_color
+ global using_shader, using_secondary_color, using_multitex
using_shader = 0
using_secondary_color = 0
+ using_multitex = 0
if profile == "NV_SHAD":
print "Using 2-vector HILO displacement texture with
GL_NV_texture_shader"
@@ -109,7 +114,17 @@
tex = ( getIrreguTex(2, "HILO_NV", "HILO_NV"),
)
- elif profile == "NV_COMB_DOT3" or profile == "NV_COMB_DOT4":
+ elif profile == "NV_COMB_MULTITEX":
+
+ alphalevel = 1
+ w0,w1 = 1,1
+ def colmap0(dotvec): return (1,1,1)
+ def colmap1(dotvec): return (1,1,1)
+
+ tex = ( getIrreguTex(1, "INTENSITY", "LUMINANCE"),
+ )
+
+ elif profile == "NV_COMB_DOT3" or profile == "NV_COMB_DOT4" or profile ==
"NV_COMB_MULTITEX":
print "Using full displacement resolution textures with
GL_NV_register_combiners"
using_secondary_color = 1
@@ -156,7 +171,7 @@
tex = ( getIrreguTex(4, "RGBA", "RGBA", angles = angles),
getIrreguTex(4, "RGBA", "RGBA", angles = angles, invert =
1),
)
- else:
+ elif profile == "NV_COMB_DOT4":
texenv_inner = texenv % "0 0 0 1"
texenv_outer = texenv % "%(dotvec)s"
angles = 4
@@ -165,6 +180,80 @@
getIrreguTex(4, "RGBA", "RGBA", angles = angles),
getIrreguTex(4, "RGBA", "RGBA", angles = angles, invert =
1),
)
+ else:
+ using_multitex = 1
+ texenv_inner = texenv % "0 0 0 1"
+ texenv_outer = combinercode("""
+ # compute alpha = max( SEC_COL.b + TEX0 + COL.alpha + COL.b,
+ # SEC_COL.b + TEX1 + COL.alpha,
+ # SEC_COL.b + TEX2 + COL.alpha )
+
+ Enable REGISTER_COMBINERS_NV
+ CombinerParameterNV NUM_GENERAL_COMBINERS_NV 4
+
+ # TEX2 -= TEX1
+ CI0 RGB A TEXTURE2 UNSIGNED_IDENTIY_NV RGB
+ CI0 RGB B ZERO_NV UNSIGNED_INVERT_NV RGB
+ CI0 RGB C TEXTURE1 SIGNED_NEGATE_NV RGB
+ CI0 RGB D ZERO_NV UNSIGNED_INVERT_NV RGB
+ CO0 RGB DISCARD_NV DISCARD_NV TEXTURE2_NV NONE NONE FALSE FALSE FALSE
+
+ # TEX0 += COL.b
+ CI0 ALPHA A TEXTURE0 UNSIGNED_IDENTIY_NV ALPHA
+ CI0 ALPHA B ZERO_NV UNSIGNED_INVERT_NV ALPHA
+ CI0 ALPHA C PRIMARY_COLOR_NV UNSIGEND_IDENTITY_NV BLUE
+ CI0 ALPHA D ZERO_NV UNSIGNED_INVERT_NV ALPHA
+ CO0 ALPHA DISCARD_NV DISCARD_NV TEXTURE0_NV NONE NONE FALSE FALSE FALSE
+
+
+ # TEX1 -= TEX0
+ CI1 RGB A TEXTURE1 UNSIGNED_IDENTIY_NV RGB
+ CI1 RGB B ZERO_NV UNSIGNED_INVERT_NV RGB
+ CI1 RGB C TEXTURE0 SIGNED_NEGATE_NV ALPHA
+ CI1 RGB D ZERO_NV UNSIGNED_INVERT_NV RGB
+ CO1 RGB DISCARD_NV DISCARD_NV TEXTURE1_NV NONE NONE FALSE FALSE FALSE
+
+ # TEX0 += COL.alpha
+ CI1 ALPHA A TEXTURE0 UNSIGNED_IDENTIY_NV ALPHA
+ CI1 ALPHA B ZERO_NV UNSIGNED_INVERT_NV ALPHA
+ CI1 ALPHA C PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV ALPHA
+ CI1 ALPHA D ZERO_NV UNSIGNED_INVERT_NV ALPHA
+ CO1 ALPHA DISCARD_NV DISCARD_NV TEXTURE0_NV NONE NONE FALSE FALSE FALSE
+
+
+ # TEX1 += unsigned(TEX2)
+ CI2 RGB A TEXTURE1 SIGNED_IDENTIY_NV RGB
+ CI2 RGB B ZERO_NV UNSIGNED_INVERT_NV RGB
+ CI2 RGB C TEXTURE2 UNSIGNED_IDENTITY_NV RGB
+ CI2 RGB D ZERO_NV UNSIGNED_INVERT_NV RGB
+ CO2 RGB DISCARD_NV DISCARD_NV TEXTURE1_NV NONE NONE FALSE FALSE FALSE
+
+ # TEX0 += SEC_COL.b
+ CI2 ALPHA A TEXTURE0 UNSIGNED_IDENTIY_NV ALPHA
+ CI2 ALPHA B ZERO_NV UNSIGNED_INVERT_NV ALPHA
+ CI2 ALPHA C SECONDARY_COLOR_NV UNSIGNED_IDENTITY_NV BLUE
+ CI2 ALPHA D ZERO_NV UNSIGNED_INVERT_NV ALPHA
+ CO2 ALPHA DISCARD_NV DISCARD_NV TEXTURE0_NV NONE NONE FALSE FALSE FALSE
+
+
+ # TEX0 += unsigned(TEX1)
+ CI3 RGB A TEXTURE0 SIGNED_IDENTIY_NV ALPHA
+ CI3 RGB B ZERO_NV UNSIGNED_INVERT_NV RGB
+ CI3 RGB C TEXTURE1 UNSIGNED_IDENTITY_NV RGB
+ CI3 RGB D ZERO_NV UNSIGNED_INVERT_NV RGB
+ CO3 RGB DISCARD_NV DISCARD_NV TEXTURE0_NV NONE NONE FALSE FALSE FALSE
+
+
+ # alpha <- TEXTURE0
+ FCI G TEXTURE0_NV UNSIGNED_IDENTITY_NV BLUE
+ """)
+ angles = 0
+ tex = ( getIrreguTex(1, "INTENSITY", "LUMINANCE"),
+ getIrreguTex(1, "INTENSITY", "LUMINANCE", invert = 1),
+ )
+
+
+
elif profile == "DOT3":
@@ -212,7 +301,6 @@
)
if profile == "STD_4":
- texenv_outer = texenv_outer + "\n"
angles = 4
for i in range(0, angles):
angle = i * 180. / angles
@@ -323,6 +411,23 @@
]
]
+ if using_multitex and outer:
+ t = .01
+ dx = cos(angle) * t
+ dy = sin(angle) * t
+
+ texcoords += [ [ vecmul((x0+dx,y0+dy,0,texscale), w0),
+ vecmul((x0+dx,y0+dy,0,texscale), w1),
+ vecmul((x1+dx,y1+dy,0,texscale), w0),
+ vecmul((x1+dx,y1+dy,0,texscale), w1)
+ ],
+ [ vecmul((x0-dx,y0-dy,0,texscale), w0),
+ vecmul((x0-dx,y0-dy,0,texscale), w1),
+ vecmul((x1-dx,y1-dy,0,texscale), w0),
+ vecmul((x1-dx,y1-dy,0,texscale), w1)
+ ]
+ ]
+
vec = [ 0 for i in range(0, angles) ]
if angles:
@@ -360,6 +465,21 @@
TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
Enable TEXTURE_2D
""" % locals()
+
+ if using_multitex:
+ code += """
+ ActiveTexture TEXTURE1
+ BindTexture TEXTURE_2D %(texid)s
+ TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
+ TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
+ Enable TEXTURE_2D
+ ActiveTexture TEXTURE2
+ BindTexture TEXTURE_2D %(texid)s
+ TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
+ TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
+ Enable TEXTURE_2D
+ ActiveTexture TEXTURE0
+ """
if GL.hasExtension("GL_EXT_texture_lod_bias"):
code += """
@@ -529,7 +649,7 @@
self.initIrregu()
if self.use_stencil:
- if texenv_inner == texenv_outer:
+ if texenv_inner == texenv_outer and angles == 0:
vs.map.put(getDListNocoords("PushMatrix\n"
"Translate -2 0 0"))
vs.map.put(self.stencil_init)
- [Gzz-commits] gzz/gfx/demo irregu3.py, (continued)
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/19
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/22
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/22
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/23
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/24
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/25
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/25
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/28
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/29
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/29
- [Gzz-commits] gzz/gfx/demo irregu3.py,
Janne V. Kujala <=
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/29
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/29
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/30
- [Gzz-commits] gzz/gfx/demo irregu3.py, Janne V. Kujala, 2002/10/31