[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz gfx/demo/papertest.py gfx/libpaper/papermil...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz gfx/demo/papertest.py gfx/libpaper/papermil... |
Date: |
Tue, 03 Sep 2002 17:15:34 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/09/03 17:15:33
Modified files:
gfx/demo : papertest.py
gfx/libpaper : papermill.py texcomb_NV1X.py texcomb_NV2X.py
textures.py
gfx/libutil : ObjectStorer.hxx
gzz/client : AbstractUpdateManager.java
gzz/client/gl : GLUpdateManager.java
gzz/gfx/gl : PaperMill.java
Log message:
Structure libpaper somewhat better. Change OpenGL scene generation to
set context when updating the window. NV10 now shows interesting band-like
textures.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/papertest.py.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/papermill.py.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/texcomb_NV1X.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/texcomb_NV2X.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/textures.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/ObjectStorer.hxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/AbstractUpdateManager.java.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/gl/GLUpdateManager.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/PaperMill.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/papertest.py
diff -c gzz/gfx/demo/papertest.py:1.16 gzz/gfx/demo/papertest.py:1.17
*** gzz/gfx/demo/papertest.py:1.16 Tue Sep 3 09:42:21 2002
--- gzz/gfx/demo/papertest.py Tue Sep 3 17:15:32 2002
***************
*** 18,37 ****
End
"""%(rgb))
- def randColor(gen):
- r0 = gen.nextDouble()
- r1 = gen.nextDouble()
- r2 = gen.nextDouble()
- sum = 0.8*r0 + r1 + 0.5*r2;
- min = 0.4
- max = 0.6
- if sum < 1.2 or (
- (r0 > min and r0 < max) or
- (r1 > min and r1 < max) or
- (r2 > min and r2 < max)
- ): return randColor(gen)
- return (r0, r1, r2)
-
rng = java.util.Random()
def setSolidPass(pas, color):
--- 18,23 ----
***************
*** 103,136 ****
passmask = [1,1,1,1]
def getpaper(seed):
! pap = Paper()
! GZZGL.startContext()
!
! passes = [ { "trans" : 0, "emboss" : 0 },
! { "trans" : .5, "emboss" : 0 },
! { "trans" : .9375, "emboss" : 0 },
! #{ "trans" : 0, "emboss" : 1 },
! ]
!
!
! rng = java.util.Random(seed)
! for foo in range(0,20):
! rng.nextInt()
! seeds = [rng.nextInt(2000000000) for foo in passes]
!
! pap.setNPasses(len(passes))
! #setSolidPass(pap.getPass(0), (0.1,0.1,0.2))
!
!
! for i in range(0, len(passes)):
! if passmask[i]:
! PaperMill().makePaperPass(seeds[i], pap.getPass(i),
passes[i]["trans"],
! emboss = passes[i]["emboss"])
! else:
! setDummyPass(pap.getPass(i))
!
! GZZGL.endContext()
!
#print "Pq: ",seed
return GZZGL.createPaperQuad(pap, -1, -1, 1, 1)
--- 89,96 ----
passmask = [1,1,1,1]
def getpaper(seed):
! pap = ThePaperMill().getPaper(seed,
! passmask=passmask)
#print "Pq: ",seed
return GZZGL.createPaperQuad(pap, -1, -1, 1, 1)
***************
*** 160,166 ****
self.paperzoom = [0.05, 0.2, 1, 3]
self.seed = 0
! self.initpaper()
def initpaper(self):
self.pq = getpaper(self.seed)
--- 120,126 ----
self.paperzoom = [0.05, 0.2, 1, 3]
self.seed = 0
! self.pq = None
def initpaper(self):
self.pq = getpaper(self.seed)
***************
*** 192,203 ****
AbstractUpdateManager.setNoAnimation()
if oldseed != self.seed:
! self.initpaper()
AbstractUpdateManager.setNoAnimation()
AbstractUpdateManager.chg()
def scene(self, vs):
putnoc(vs, background(self.bgcolor))
#putnoc(vs, getDList("""
--- 152,164 ----
AbstractUpdateManager.setNoAnimation()
if oldseed != self.seed:
! self.pq = None
AbstractUpdateManager.setNoAnimation()
AbstractUpdateManager.chg()
def scene(self, vs):
+ if not self.pq: self.initpaper()
putnoc(vs, background(self.bgcolor))
#putnoc(vs, getDList("""
***************
*** 414,420 ****
class DummyScene:
def __init__(self):
self.bgcolor = (1,1,1)
- getpaper(0)
def key(self, k):
pass
def scene(self, vs):
--- 375,380 ----
Index: gzz/gfx/libpaper/papermill.py
diff -c gzz/gfx/libpaper/papermill.py:1.20 gzz/gfx/libpaper/papermill.py:1.21
*** gzz/gfx/libpaper/papermill.py:1.20 Tue Sep 3 06:14:47 2002
--- gzz/gfx/libpaper/papermill.py Tue Sep 3 17:15:32 2002
***************
*** 3,8 ****
--- 3,10 ----
execfile("gfx/libcolor/spaces.py")
+ from gzz.gfx.gl import GZZGL,Paper,PaperMill
+ from java.lang import Math
def initialize():
global initialized
if initialized: return
***************
*** 21,27 ****
--- 23,31 ----
files = [
"textures.py",
"texcoords.py",
+ "colors.py",
]
+
#
# Now, go through some questions.
#
***************
*** 57,68 ****
for f in files:
execfile("gfx/libpaper/"+f, globals())
- # "gfx/libpaper/texcoords.py",
- # "gfx/libpaper/texops_NV2X.py",
- # "gfx/libpaper/textures.py",
- # "gfx/libpaper/texcomb_NV2X.py",
- dbg=0
-
def randvec(rnd): return [rnd.nextDouble() for i in range(0,3)]
def randunitvec(rnd):
--- 61,66 ----
***************
*** 72,84 ****
m = 1./Math.sqrt(x*x+y*y+z*z)*.5
return [m * x + .5, m * y + .5, m * z + .5]
- def randvec2(rnd, maxlen = 1):
- x = 2 * rnd.nextDouble() - 1
- y = 2 * rnd.nextDouble() - 1
- z = 2 * rnd.nextDouble() - 1
- m = 1./Math.sqrt(x*x+y*y+z*z)*.5 * maxlen * rnd.nextDouble()
- return [m * x + .5, m * y + .5, m * z + .5]
-
def selectRandom(list, gen):
return list[gen.nextInt(len(list))]
--- 70,75 ----
***************
*** 86,95 ****
def selectDet(list, type):
return ( list[type % len(list)], type / len(list) )
! class PaperMill:
def makePaperPass(self, seed, ppass, trans = 0, type = None, emboss = 0):
initialize()
rnd = java.util.Random(seed)
#sh = ShaderPass(selectRandom(shaderTypes,rnd))
if emboss:
sh = makeEmbossShaderPass()
--- 77,112 ----
def selectDet(list, type):
return ( list[type % len(list)], type / len(list) )
! class ThePaperMill(PaperMill):
! def getPaper(self, seed, passmask=[1,1,1,1,1,1,1]):
! pap = Paper()
!
! passes = [ { "trans" : 0, "emboss" : 0 },
! { "trans" : .5, "emboss" : 0 },
! { "trans" : .9375, "emboss" : 0 },
! #{ "trans" : 0, "emboss" : 1 },
! ]
!
! rng = java.util.Random(seed)
! for foo in range(0,20): # eat bad beginning (Java's bad PRNG)
! rng.nextInt()
! seeds = [rng.nextInt(2000000000) for foo in passes]
!
! pap.setNPasses(len(passes))
! #setSolidPass(pap.getPass(0), (0.1,0.1,0.2))
!
! for i in range(0, len(passes)):
! if passmask[i]:
! self.makePaperPass(seeds[i], pap.getPass(i), passes[i]["trans"],
! emboss = passes[i]["emboss"])
! else:
! setDummyPass(pap.getPass(i))
! return pap
!
def makePaperPass(self, seed, ppass, trans = 0, type = None, emboss = 0):
initialize()
rnd = java.util.Random(seed)
+ colors = Colors(rnd.nextInt())
#sh = ShaderPass(selectRandom(shaderTypes,rnd))
if emboss:
sh = makeEmbossShaderPass()
***************
*** 141,147 ****
code += (
sh.setupCode() +
! comb.setupCode(sh.getRGBoutputs(), rnd, trans)
)
ppass.setSetupcode(code)
--- 158,164 ----
code += (
sh.setupCode() +
! comb.setupCode(sh.getRGBoutputs(), colors, rnd, trans)
)
ppass.setSetupcode(code)
Index: gzz/gfx/libpaper/texcomb_NV1X.py
diff -c gzz/gfx/libpaper/texcomb_NV1X.py:1.5
gzz/gfx/libpaper/texcomb_NV1X.py:1.6
*** gzz/gfx/libpaper/texcomb_NV1X.py:1.5 Tue Sep 3 09:57:39 2002
--- gzz/gfx/libpaper/texcomb_NV1X.py Tue Sep 3 17:15:32 2002
***************
*** 2,30 ****
# are only two of them.
class TransparentCombinerPass:
! def setupCode(self, texinputs, rnd, trans = 0):
# 4 colors
! minlum = 66
! while 1:
! col0 = getRandomColor2(minlum,100, rnd)
! col1 = getRandomColor2(minlum,minlum + (100-minlum)*0.5, rnd)
! col2 = getRandomColor2(minlum + (100-minlum)*0.5, 100, rnd)
! col3 = getRandomColor2(minlum + (100-minlum)*0.5, 100, rnd)
! if abdiff(col0, col1) < 40: continue
! #if abdiff(col0, col2) < 40: continue
! #if abdiff(col0, col3) < 40: continue
! #if abdiff(col1, col2) < 40: continue
! #if abdiff(col1, col3) < 40: continue
! if abdiff(col2, col3) < 40: continue
! break
!
! c0 = js(col0)
! c1 = js(col1)
! c2 = js(col2)
! c3 = js(col3)
! # 4 random dot product vectors
! r0, r1, r2, r3 = [ js(randvec2(rnd)) + " 1" for j in range(0,4) ]
# map alpha dot product a \in [0,1] into clamp(1 - (1-a) * alphascale)
if trans > 0:
--- 2,15 ----
# are only two of them.
class TransparentCombinerPass:
! def setupCode(self, texinputs, colors, rnd, trans = 0):
# 4 colors
! colorbase = rnd.nextInt()
! c0, c1, c2, c3 = [ colors.getColorStr(colorbase+i)
! for i in range(0,4) ]
! r0, r1, r2, r3 = [ colors.getNVDP3VecStr(colorbase+i)
! for i in range(0,4) ]
# map alpha dot product a \in [0,1] into clamp(1 - (1-a) * alphascale)
if trans > 0:
***************
*** 38,44 ****
while len(texinputs) < 4:
texinputs = texinputs + texinputs
t0, t1, t2, t3 = texinputs[0:4]
! c = ("""
Enable BLEND
BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA
BlendEquation FUNC_ADD
--- 23,30 ----
while len(texinputs) < 4:
texinputs = texinputs + texinputs
t0, t1, t2, t3 = texinputs[0:4]
!
! constantcode = """
Enable BLEND
BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA
BlendEquation FUNC_ADD
***************
*** 52,103 ****
Color %(c0)s
SecondaryColorEXT %(c1)s
Fog FOG_COLOR %(c2)s
! """+
# Stage 0: calculate dot products of the textures, and of
# a texture times a constant.
! """
! CI0 RGB VARIABLE_A_NV TEXTURE%(t0)s EXPAND_NORMAL_NV RGB
! CI0 RGB VARIABLE_B_NV TEXTURE%(t1)s EXPAND_NORMAL_NV RGB
! CI0 RGB VARIABLE_C_NV CONSTANT_COLOR0_NV EXPAND_NORMAL_NV RGB
! CI0 RGB VARIABLE_D_NV TEXTURE%(t2)s EXPAND_NORMAL_NV RGB
! CombinerOutputNV COMBINER0_NV RGB SPARE0_NV SPARE1_NV DISCARD_NV
SCALE_BY_TWO_NV NONE TRUE TRUE FALSE
!
! CI0 ALPHA VARIABLE_A_NV TEXTURE%(t0)s EXPAND_NORMAL_NV BLUE
! CI0 ALPHA VARIABLE_B_NV TEXTURE%(t1)s EXPAND_NORMAL_NV BLUE
! CI0 ALPHA VARIABLE_C_NV TEXTURE%(t0)s EXPAND_NORMAL_NV ALPHA
! CI0 ALPHA VARIABLE_D_NV TEXTURE%(t1)s EXPAND_NORMAL_NV ALPHA
! CombinerOutputNV COMBINER0_NV ALPHA SPARE0_NV DISCARD_NV DISCARD_NV
SCALE_BY_FOUR_NV NONE FALSE FALSE FALSE
!
!
!
! """+
! # Stage 1: mix primary and secondary as determined
! # by the dot product above.
! """
! CI1 RGB VARIABLE_A_NV PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB
! CI1 RGB VARIABLE_B_NV SPARE0_NV UNSIGNED_IDENTITY_NV RGB
! CI1 RGB VARIABLE_C_NV SECONDARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB
! CI1 RGB VARIABLE_D_NV SPARE0_NV UNSIGNED_INVERT_NV RGB
! CombinerOutputNV COMBINER1_NV RGB DISCARD_NV DISCARD_NV
PRIMARY_COLOR_NV NONE NONE FALSE FALSE FALSE
!
! CI1 ALPHA VARIABLE_A_NV SPARE0_NV UNSIGNED_INVERT_NV BLUE
! CI1 ALPHA VARIABLE_B_NV SPARE0_NV SIGNED_IDENTITY_NV ALPHA
! CombinerOutputNV COMBINER1_NV ALPHA SPARE0_NV DISCARD_NV DISCARD_NV
SCALE_BY_FOUR_NV NONE FALSE FALSE FALSE
!
! """+
! """
! FCI VARIABLE_A_NV SPARE1_NV UNSIGNED_IDENTITY_NV RGB
! FCI VARIABLE_B_NV PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB
! FCI VARIABLE_C_NV FOG UNSIGNED_IDENTITY_NV RGB
! FCI VARIABLE_D_NV ZERO UNSIGNED_IDENTITY_NV RGB
!
! FCI VARIABLE_G_NV SPARE0_NV UNSIGNED_INVERT_NV ALPHA
!
! """) % locals()
c = (c.replace("CI0", "CombinerInputNV COMBINER0_NV").
replace("CI1", "CombinerInputNV COMBINER1_NV").
! replace("FCI", "FinalCombinerInputNV"))
# print "c: ",c
return c
--- 38,133 ----
Color %(c0)s
SecondaryColorEXT %(c1)s
Fog FOG_COLOR %(c2)s
+ """
! # Then, select the combiner path type.
! if 0:
# Stage 0: calculate dot products of the textures, and of
# a texture times a constant.
! c = ("""
! CI0 RGB A TEXTURE%(t0)s EXPAND_NORMAL_NV RGB
! CI0 RGB B TEXTURE%(t1)s EXPAND_NORMAL_NV RGB
! CI0 RGB C CONSTANT_COLOR0_NV EXPAND_NORMAL_NV RGB
! CI0 RGB D TEXTURE%(t2)s EXPAND_NORMAL_NV RGB
! CO0 RGB SPARE0_NV SPARE1_NV DISCARD_NV SCALE_BY_TWO_NV NONE
TRUE TRUE FALSE
!
! CI0 ALPHA A TEXTURE%(t0)s EXPAND_NORMAL_NV BLUE
! CI0 ALPHA B TEXTURE%(t1)s EXPAND_NORMAL_NV BLUE
! CI0 ALPHA C TEXTURE%(t0)s EXPAND_NORMAL_NV ALPHA
! CI0 ALPHA D TEXTURE%(t1)s EXPAND_NORMAL_NV ALPHA
! CO0 ALPHA SPARE0_NV DISCARD_NV DISCARD_NV SCALE_BY_FOUR_NV NONE
FALSE FALSE FALSE
!
!
!
! """+
! # Stage 1: mix primary and secondary as determined
! # by the dot product above.
! """
! CI1 RGB A PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB
! CI1 RGB B SPARE0_NV UNSIGNED_IDENTITY_NV RGB
! CI1 RGB C SECONDARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB
! CI1 RGB D SPARE0_NV UNSIGNED_INVERT_NV RGB
! CO1 RGB DISCARD_NV DISCARD_NV PRIMARY_COLOR_NV NONE NONE FALSE
FALSE FALSE
!
! CI1 ALPHA A SPARE0_NV UNSIGNED_INVERT_NV BLUE
! CI1 ALPHA B SPARE0_NV SIGNED_IDENTITY_NV ALPHA
! CO1 ALPHA SPARE0_NV DISCARD_NV DISCARD_NV SCALE_BY_FOUR_NV NONE
FALSE FALSE FALSE
!
! """+
! """
! FCI A SPARE1_NV UNSIGNED_IDENTITY_NV RGB
! FCI B PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB
! FCI C FOG UNSIGNED_IDENTITY_NV RGB
! FCI D ZERO UNSIGNED_IDENTITY_NV RGB
!
! FCI G SPARE0_NV UNSIGNED_INVERT_NV ALPHA
!
! """)
! else:
! # Band-like texture.
! #
! # A little different from what Tjl and Jvk originally
! # planned, where the EF product would have been used;
! # Sadly, we forgot that E and F are not signed(!).
!
! # Stage 0: multiply the two textures
! c = ("""
! CI0 RGB A TEXTURE%(t0)s EXPAND_NORMAL_NV RGB
! CI0 RGB B TEXTURE%(t1)s EXPAND_NORMAL_NV RGB
! CO0 RGB SPARE0_NV DISCARD_NV DISCARD_NV NONE NONE TRUE FALSE
FALSE
!
! CI1 RGB A SPARE0_NV SIGNED_IDENTITY_NV RGB
! CI1 RGB B SPARE0_NV SIGNED_IDENTITY_NV RGB
! CI1 RGB C TEXTURE%(t0)s EXPAND_NORMAL_NV RGB
! CI1 RGB D CONSTANT_COLOR0_NV EXPAND_NORMAL_NV RGB
! CO1 RGB SPARE1_NV SPARE0_NV DISCARD_NV SCALE_BY_FOUR_NV NONE
FALSE TRUE FALSE
!
! FCI E SPARE1_NV UNSIGNED_INVERT_NV RGB
! FCI F SPARE0_NV UNSIGNED_IDENTITY_NV RGB
!
! FCI A E_TIMES_F_NV UNSIGNED_IDENTITY_NV RGB
! FCI B PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB
! FCI C SECONDARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB
! FCI D ZERO UNSIGNED_IDENTITY_NV RGB
!
! FCI G ZERO UNSIGNED_INVERT_NV ALPHA
! """)
! foo = ("""
! """)
! c = (constantcode + c) % locals()
c = (c.replace("CI0", "CombinerInputNV COMBINER0_NV").
replace("CI1", "CombinerInputNV COMBINER1_NV").
! replace("CO0", "CombinerOutputNV COMBINER0_NV").
! replace("CO1", "CombinerOutputNV COMBINER1_NV").
! replace("FCI", "FinalCombinerInputNV").
! replace(" A ", " VARIABLE_A_NV ").
! replace(" B ", " VARIABLE_B_NV ").
! replace(" C ", " VARIABLE_C_NV ").
! replace(" D ", " VARIABLE_D_NV ").
! replace(" E ", " VARIABLE_E_NV ").
! replace(" F ", " VARIABLE_F_NV ").
! replace(" G ", " VARIABLE_G_NV ")
! )
# print "c: ",c
return c
Index: gzz/gfx/libpaper/texcomb_NV2X.py
diff -c gzz/gfx/libpaper/texcomb_NV2X.py:1.1
gzz/gfx/libpaper/texcomb_NV2X.py:1.2
*** gzz/gfx/libpaper/texcomb_NV2X.py:1.1 Mon Sep 2 08:56:56 2002
--- gzz/gfx/libpaper/texcomb_NV2X.py Tue Sep 3 17:15:32 2002
***************
*** 2,30 ****
# are plenty of them.
class TransparentCombinerPass:
! def setupCode(self, texinputs, rnd, trans = 0):
! # 4 colors
! minlum = 66
! while 1:
! col0 = getRandomColor2(minlum,100, rnd)
! col1 = getRandomColor2(minlum,minlum + (100-minlum)*0.5, rnd)
! col2 = getRandomColor2(minlum + (100-minlum)*0.5, 100, rnd)
! col3 = getRandomColor2(minlum + (100-minlum)*0.5, 100, rnd)
! if abdiff(col0, col1) < 40: continue
! #if abdiff(col0, col2) < 40: continue
! #if abdiff(col0, col3) < 40: continue
! #if abdiff(col1, col2) < 40: continue
! #if abdiff(col1, col3) < 40: continue
! if abdiff(col2, col3) < 40: continue
! break
! c0 = js(col0)
! c1 = js(col1)
! c2 = js(col2)
! c3 = js(col3)
!
! # 4 random dot product vectors
! r0, r1, r2, r3 = [ js(randvec2(rnd)) + " 1" for j in range(0,4) ]
# map alpha dot product a \in [0,1] into clamp(1 - (1-a) * alphascale)
if trans > 0:
--- 2,14 ----
# are plenty of them.
class TransparentCombinerPass:
! def setupCode(self, texinputs, colors, rnd, trans = 0):
! colorbase = rnd.nextInt()
! c0, c1, c2, c3 = [ colors.getColorStr(colorbase+i)
! for i in range(0,4) ]
! r0, r1, r2, r3 = [ colors.getNVDP3VecStr(colorbase+i)
! for i in range(0,4) ]
# map alpha dot product a \in [0,1] into clamp(1 - (1-a) * alphascale)
if trans > 0:
Index: gzz/gfx/libpaper/textures.py
diff -c gzz/gfx/libpaper/textures.py:1.3 gzz/gfx/libpaper/textures.py:1.4
*** gzz/gfx/libpaper/textures.py:1.3 Tue Sep 3 09:06:32 2002
--- gzz/gfx/libpaper/textures.py Tue Sep 3 17:15:32 2002
***************
*** 26,39 ****
name, args = i
return NamedTexture(name, args)
textures["RGB2"] = [
mt(i) for i in [
# ("rgbn", [512, 512, 0, 3, "RGB", "RGB",
# "noise", ["type", "turbulence", "freq", "40", "scale", "-3", "bias",
"2"]]),
! ("rgbw", [512, 512, 0, 3, "RGB", "RGB",
! "fnoise", ["scale", "2"]]),
! ("rgbw", [512, 512, 0, 3, "RGB", "RGB",
! "fnoise", ["freq", "2", "df", "2", "bias", "0.2"]]),
]]
def getPaperTexture(type, gen):
--- 26,41 ----
name, args = i
return NamedTexture(name, args)
+ tres = 128
+
textures["RGB2"] = [
mt(i) for i in [
# ("rgbn", [512, 512, 0, 3, "RGB", "RGB",
# "noise", ["type", "turbulence", "freq", "40", "scale", "-3", "bias",
"2"]]),
! # ("rgbw", [tres, tres, 0, 3, "RGB", "RGB",
! # "fnoise", ["scale", "2","bias",".5"]]),
! ("rgbw2", [tres, tres, 0, 3, "RGB", "RGB",
! "fnoise", ["scale", "2", "freq", "1", "df", "2", "bias", "0.5"]]),
]]
def getPaperTexture(type, gen):
Index: gzz/gfx/libutil/ObjectStorer.hxx
diff -c gzz/gfx/libutil/ObjectStorer.hxx:1.4
gzz/gfx/libutil/ObjectStorer.hxx:1.5
*** gzz/gfx/libutil/ObjectStorer.hxx:1.4 Thu Aug 22 07:09:16 2002
--- gzz/gfx/libutil/ObjectStorer.hxx Tue Sep 3 17:15:32 2002
***************
*** 51,56 ****
--- 51,57 ----
/** Mark the object with the given id for removal.
*/
void remove(int p) {
+ if(p == 0) return;
toBeDeleted.push_back(vec[p]);
vec[p] = 0;
}
Index: gzz/gzz/client/AbstractUpdateManager.java
diff -c gzz/gzz/client/AbstractUpdateManager.java:1.18
gzz/gzz/client/AbstractUpdateManager.java:1.19
*** gzz/gzz/client/AbstractUpdateManager.java:1.18 Wed Aug 21 02:18:35 2002
--- gzz/gzz/client/AbstractUpdateManager.java Tue Sep 3 17:15:32 2002
***************
*** 41,47 ****
*/
public abstract class AbstractUpdateManager implements Runnable {
! public static final String rcsid = "$Id: AbstractUpdateManager.java,v 1.18
2002/08/21 06:18:35 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
--- 41,47 ----
*/
public abstract class AbstractUpdateManager implements Runnable {
! public static final String rcsid = "$Id: AbstractUpdateManager.java,v 1.19
2002/09/03 21:15:32 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
***************
*** 140,145 ****
--- 140,152 ----
void endAnimation();
}
+ /** Call the method of Window. OpenGL needs to wrap this
+ * to put it in context.
+ */
+ protected void callGenerateEnd(Window w, int millis, float lod) {
+ w.generateEndState(millis, lod);
+ }
+
public static void addWindow(Window w) {
if(instance == null)
throw new Error("Trying to add window; no updatemanager instance");
***************
*** 248,256 ****
}
public FractCalculator fractCalc = new SimpleCalculator();
- private void generateEndState(Window w) {
- w.generateEndState(100, 1); // XXX
- }
/** For subclasses to override: process incoming events.
* In order to provide a responsive implementation,
--- 255,260 ----
***************
*** 330,336 ****
regenNeeded[i] = true;
if (wins.length > 0) {
if(dbg) pa("Generating end state for window 0");
! generateEndState(wins[0]);
if(dbg) pa("Generating end state: Phase 1 done");
if (!wins[0].hasEndState()) {
if(dbg) pa("Couldn't generate end state for
window 0!");
--- 334,340 ----
regenNeeded[i] = true;
if (wins.length > 0) {
if(dbg) pa("Generating end state for window 0");
! callGenerateEnd(wins[0], 100, 1);
if(dbg) pa("Generating end state: Phase 1 done");
if (!wins[0].hasEndState()) {
if(dbg) pa("Couldn't generate end state for
window 0!");
***************
*** 360,366 ****
}
if (regenNeeded[ind]) {
if(dbg) pa("Generating end state for "+ind);
! generateEndState(wins[ind]);
if (!wins[ind].hasEndState()) {
if(dbg) pa("Couldn't generate end state for win
"+ind);
} else regenNeeded[ind] = false;
--- 364,370 ----
}
if (regenNeeded[ind]) {
if(dbg) pa("Generating end state for "+ind);
! callGenerateEnd(wins[ind], 100, 1);
if (!wins[ind].hasEndState()) {
if(dbg) pa("Couldn't generate end state for win
"+ind);
} else regenNeeded[ind] = false;
Index: gzz/gzz/client/gl/GLUpdateManager.java
diff -c gzz/gzz/client/gl/GLUpdateManager.java:1.4
gzz/gzz/client/gl/GLUpdateManager.java:1.5
*** gzz/gzz/client/gl/GLUpdateManager.java:1.4 Wed May 29 03:23:43 2002
--- gzz/gzz/client/gl/GLUpdateManager.java Tue Sep 3 17:15:32 2002
***************
*** 30,36 ****
import java.util.*;
public class GLUpdateManager extends AbstractUpdateManager {
! public static final String rcsid = "$Id: GLUpdateManager.java,v 1.4
2002/05/29 07:23:43 tjl Exp $";
private static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
--- 30,36 ----
import java.util.*;
public class GLUpdateManager extends AbstractUpdateManager {
! public static final String rcsid = "$Id: GLUpdateManager.java,v 1.5
2002/09/03 21:15:32 tjl Exp $";
private static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
***************
*** 51,55 ****
--- 51,61 ----
p("HandleEvents "+waitForEvent);
GZZGL.eventLoop(waitForEvent);
return true;
+ }
+
+ protected void callGenerateEnd(Window w, int millis, float lod) {
+ GZZGL.startContext();
+ super.callGenerateEnd(w, millis, lod);
+ GZZGL.endContext();
}
}
Index: gzz/gzz/gfx/gl/PaperMill.java
diff -c gzz/gzz/gfx/gl/PaperMill.java:1.1 gzz/gzz/gfx/gl/PaperMill.java:1.2
*** gzz/gzz/gfx/gl/PaperMill.java:1.1 Mon Aug 19 08:43:45 2002
--- gzz/gzz/gfx/gl/PaperMill.java Tue Sep 3 17:15:33 2002
***************
*** 1,9 ****
! // (c): Tuomas J. Lukka
package gzz.gfx.gl;
public abstract class PaperMill {
public abstract Paper getPaper(int seed);
static public PaperMill getInstance() {
return null;
--- 1,11 ----
! // (c) Tuomas J. Lukka
package gzz.gfx.gl;
public abstract class PaperMill {
public abstract Paper getPaper(int seed);
+
+ static private PaperMill instance;
static public PaperMill getInstance() {
return null;
- [Gzz-commits] gzz gfx/demo/papertest.py gfx/libpaper/papermil...,
Tuomas J. Lukka <=