[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/demo irregu4.py
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx/demo irregu4.py |
Date: |
Mon, 25 Nov 2002 07:59:58 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/11/25 07:59:58
Modified files:
gfx/demo : irregu4.py
Log message:
Make irregu stencil logic compatible with non-infinite objets; paper
edges are currently drawn as a slightly larger paperquad
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregu4.py.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/irregu4.py
diff -u gzz/gfx/demo/irregu4.py:1.22 gzz/gfx/demo/irregu4.py:1.23
--- gzz/gfx/demo/irregu4.py:1.22 Sun Nov 24 05:01:40 2002
+++ gzz/gfx/demo/irregu4.py Mon Nov 25 07:59:58 2002
@@ -8,6 +8,20 @@
pap = ThePaperMill().getPaper(seed)
paperquad = GLRen.createPaperQuad(pap, -4, -4, 4, 4, 0)
+from gzz.gfx.gl import Paper
+pap2 = Paper()
+pap2.setNPasses(1)
+pap2.getPass(0).setSetupcode(
+ """
+ PushAttrib ENABLE_BIT DEPTH_BUFFER_BIT
+ Disable TEXTURE_2D
+ Color 0 0 0
+ DepthMask 0
+ """)
+pap2.getPass(0).setTeardowncode("PopAttrib")
+paperframe0 = GLRen.createPaperQuad(pap2, -4, -4, 4, 4, 0)
+paperframe = GLRen.createPaperQuad(pap2, -4.015, -4.015, 4.015, 4.015, 0)
+
textures = [
("noise",
"type,fBm,freq,4,bias,.5,scale,.5,fbmlacu,1.5,fbmgain,.8,fbmoct,10"),
@@ -64,28 +78,62 @@
self.scale = 150
self.shape = 0
self.texslicing = 0
- self.flags = 255
+ self.flags = 127
self.initcode()
+ self.depthmask0 = getDListNocoords("DepthMask 0")
+ self.depthmask1 = getDListNocoords("DepthMask 1")
+ self.depthtest0 = getDListNocoords("Disable DEPTH_TEST")
+ self.depthtest1 = getDListNocoords("Enable DEPTH_TEST")
+
self.stencil_init = getDListNocoords("""
# Create stencil
StencilMask 255
Enable STENCIL_TEST
- StencilFunc ALWAYS 0 255
- StencilOp INCR INCR INCR
+ StencilFunc ALWAYS 1 255
+ StencilOp KEEP KEEP REPLACE
ColorMask 0 0 0 0
""")
self.stencil_use = getDListNocoords("""
Enable STENCIL_TEST
StencilFunc NOTEQUAL 0 255
+ StencilOp KEEP KEEP KEEP
+ ColorMask 1 1 1 1
+ """)
+
+ self.stencil_use_init2 = getDListNocoords("""
+ Enable STENCIL_TEST
+ StencilFunc NOTEQUAL 0 255
+ StencilOp ZERO ZERO INCR
+ ColorMask 1 1 1 1
+ """)
+
+ self.stencil_use2_clear = getDListNocoords("""
+ Enable STENCIL_TEST
+ StencilFunc LESS 1 255
+ StencilOp ZERO ZERO ZERO
+ ColorMask 1 1 1 1
+ """)
+
+ self.stencil_use_clear = getDListNocoords("""
+ Enable STENCIL_TEST
+ StencilFunc NOTEQUAL 0 255
StencilOp ZERO ZERO ZERO
ColorMask 1 1 1 1
""")
+ self.stencil_clear = getDListNocoords("""
+ Enable STENCIL_TEST
+ StencilFunc NOTEQUAL 0 255
+ StencilOp ZERO ZERO ZERO
+ ColorMask 0 0 0 0
+ """)
+
self.stencil_teardown = getDListNocoords("""
Disable STENCIL_TEST
+ ColorMask 1 1 1 1
""")
def initcode(self):
@@ -200,7 +248,7 @@
texscale = 1.0
linewidth = 2
refsize = 128
- scale_pow = 1
+ scale_pow = .5
border0 = -.5 * ripple_scale * texscale
border1 = .5 * ripple_scale * texscale
texslicing = self.texslicing
@@ -268,16 +316,43 @@
FCI G SPARE0_NV UNSIGNED_IDENTITY_NV ALPHA
""") % texINTENSITY.getTexId()
+ outerflags = (self.flags >> 4 & 1) * INSIDE
+
self.outer = GLRen.createIrregularEdge(shape,
texscale, linewidth, refsize, scale_pow,
border0, border1, texslicing,
"0 0 0 1 0 0 0 0", c1,
0, 0,
- slice + Y_COLOR + SHIFTS, stdcode + """
+ slice + Y_COLOR + SHIFTS + outerflags,
+ stdcode + """
BlendFunc ZERO ZERO
Enable BLEND
""", 1.0)
+ self.clear = GLRen.createIrregularEdge(shape,
+ texscale, linewidth, refsize, scale_pow,
+ border0, border1, texslicing,
+ "", "",
+ 0, 0,
+ SLICE_2D + (self.flags >> 4 & 1) * INSIDE, """
+ PushAttrib ENABLE_BIT
+ Disable TEXTURE_2D
+ Disable ALPHA_TEST
+ Color 0 0 0
+ """, 1.0)
+
+ self.envelope = GLRen.createIrregularEdge(shape,
+ texscale, linewidth, refsize, scale_pow,
+ border0, border1, texslicing,
+ "", "",
+ 0, 0,
+ SLICE_2D, """
+ PushAttrib ENABLE_BIT
+ Disable TEXTURE_2D
+ Disable ALPHA_TEST
+ Color 0 0 0
+ """, 1.0)
+
self.wireframe = GLRen.createIrregularEdge(
shape,
texscale, linewidth, refsize, scale_pow,
@@ -337,7 +412,7 @@
texscale, linewidth, refsize, scale_pow,
border0, border1, texslicing,
"1 1 1 1 0 0 0 0", "", 3, 0,
- Y_SECCOLOR + slice + DOTVEC_COLOR + INTERP_DOTVEC,
+ Y_SECCOLOR + slice + DOTVEC_COLOR + INTERP_DOTVEC + outerflags,
outer_code, 1.0)
if (GL.hasExtension("GL_NV_register_combiners") and
@@ -350,7 +425,7 @@
texscale, linewidth, refsize, scale_pow,
border0, border1, texslicing,
"1 1 1 1 0 0 0 0", "", 0, 1,
- Y_SECCOLOR + slice,
+ Y_SECCOLOR + slice + outerflags,
outer_code, 1.0)
@@ -385,24 +460,42 @@
cspap = vs.coords.affineCoordsys(0, 0, 0, 0, 1, 0, 0, 1)
vs.matcher.add(cspap, "pap")
-
+
+ #vs.map.put(self.clear)
if self.flags & 128:
vs.map.put(self.shadow, cs1shadow, cs2)
- if self.flags & 8:
- vs.map.put(self.outer, cs1, cs2)
- if self.flags & 7:
- if self.flags & 32:
- vs.map.put(self.stencil_init)
+ if self.flags >> 5 & 1:
+ vs.map.put(self.depthmask0)
+ vs.map.put(self.stencil_init)
+ if self.flags >> 3 & 1:
+ vs.map.put(self.outer, cs1, cs2)
+ vs.map.put(self.stencil_use_init2)
+ else:
+ vs.map.put(self.inner, cs1, cs2)
+ vs.map.put(self.stencil_use)
+
+ vs.map.put(self.depthmask1)
+ vs.map.put(paperframe, cs1)
+ vs.map.put(paperquad, cs1, cspap)
+
+ vs.map.put(self.depthmask0)
+ vs.map.put(self.depthtest0)
+ vs.map.put(self.stencil_clear)
+ vs.map.put(self.inner, cs1, cs2)
+ vs.map.put(self.stencil_use2_clear)
+ vs.map.put(self.envelope, cs1, cs2)
+ vs.map.put(self.stencil_teardown)
+
+ vs.map.put(self.depthmask1)
+ vs.map.put(self.depthtest1)
+ else:
+ if self.flags >> 3 & 1:
+ vs.map.put(self.outer, cs1, cs2)
vs.map.put(self.inner, cs1, cs2)
- if self.flags & 32:
- vs.map.put(self.stencil_use)
- vs.map.put(paperquad, cs1, cspap)
-
- vs.map.put(self.stencil_teardown)
if self.flags >> 8 & 1:
vs.map.put(self.wireframe, cs1, cs2)
@@ -450,7 +543,8 @@
elif k == "Y": self.ys -= .1
elif k == "+": self.scale *= 1.2
elif k == "-": self.scale /= 1.2
- elif "1" <= k <= "9":
+ if k == "0": k = "10"
+ if "1" <= k <= "9":
self.flags ^= 1 << int(k) - 1
self.initcode()
elif "F1" <= k <= "F9":
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/11
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/14
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/14
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/15
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/20
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/20
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/21
- [Gzz-commits] gzz/gfx/demo irregu4.py,
Janne V. Kujala <=
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/30
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/30
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/30
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/30
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/30
- [Gzz-commits] gzz/gfx/demo irregu4.py, Janne V. Kujala, 2002/11/30