3 |
from gfx.libpaper.texcache import getCachedTexture |
from gfx.libpaper.texcache import getCachedTexture |
4 |
|
|
5 |
ripple_scale = .25 |
ripple_scale = .25 |
6 |
size = 256 |
texsize = 256 |
7 |
|
edgetexsize = 1024 |
8 |
lodbias = 0 |
lodbias = 0 |
9 |
|
edgelodbias = 0 |
10 |
texscale = 1 |
texscale = 1 |
11 |
use_texture = 0 |
use_texture = 0 |
12 |
use_stencil = 1 |
use_stencil = 1 |
43 |
using_shader = 1 |
using_shader = 1 |
44 |
global use_stencil |
global use_stencil |
45 |
use_stencil = 0 |
use_stencil = 0 |
46 |
edgetex = getCachedTexture([1, 1024, 0, 4, "RGBA", "RGBA", |
edgetex = getCachedTexture([1, edgetexsize, 0, 4, "RGBA", "RGBA", |
47 |
"irreguedge", ["line_width", "100"]], shade_all_levels = 1) |
"irreguedge", ["line_width", "1"]], shade_all_levels = 1) |
48 |
|
|
49 |
texenv_inner = """ |
texenv_inner = """ |
50 |
Enable TEXTURE_SHADER_NV |
Enable TEXTURE_SHADER_NV |
183 |
"scale", str(tex_scale), "bias", str(tex_bias), "eps", ".125"] |
"scale", str(tex_scale), "bias", str(tex_bias), "eps", ".125"] |
184 |
|
|
185 |
|
|
186 |
tex = getCachedTexture([size, size, 0] + tex_format + |
tex = getCachedTexture([texsize, texsize, 0] + tex_format + |
187 |
["irregu", args], shade_all_levels = 1) |
["irregu", args], shade_all_levels = 1) |
188 |
texinv = getCachedTexture([size, size, 0] + tex_format + |
texinv = getCachedTexture([texsize, texsize, 0] + tex_format + |
189 |
["irregu", args + ["invert", "1"]], |
["irregu", args + ["invert", "1"]], |
190 |
shade_all_levels = 1) |
shade_all_levels = 1) |
191 |
|
|
209 |
global lodbias |
global lodbias |
210 |
if k == "b": lodbias += .25; print "lodbias", lodbias |
if k == "b": lodbias += .25; print "lodbias", lodbias |
211 |
elif k == "B": lodbias -= .25; print "lodbias", lodbias |
elif k == "B": lodbias -= .25; print "lodbias", lodbias |
212 |
|
global edgelodbias |
213 |
|
if k == "e": edgelodbias += .25; print "lodbias", edgelodbias |
214 |
|
elif k == "E": edgelodbias -= .25; print "lodbias", edgelodbias |
215 |
global texscale |
global texscale |
216 |
if k == "s": texscale *= 1.2; print "texscale", texscale |
if k == "s": texscale *= 1.2; print "texscale", texscale |
217 |
elif k == "S": texscale /= 1.2; print "texscale", texscale |
elif k == "S": texscale /= 1.2; print "texscale", texscale |
261 |
if using_shader: |
if using_shader: |
262 |
texcoords += [ [ (0, 0, 0), |
texcoords += [ [ (0, 0, 0), |
263 |
(0, 0, 0), |
(0, 0, 0), |
264 |
(0, 0, striplen / texscale*1024), |
(0, 0, striplen / texscale * edgetexsize), |
265 |
(0, 0, striplen / texscale*1024), |
(0, 0, striplen / texscale * edgetexsize), |
266 |
], |
], |
267 |
[ (dx,dy,0-.5*(dx+dy)), |
[ (dx,dy,0-.5*(dx+dy)), |
268 |
(dx,dy,1-.5*(dx+dy)), |
(dx,dy,1-.5*(dx+dy)), |
304 |
TexEnv TEXTURE_FILTER_CONTROL_EXT TEXTURE_LOD_BIAS_EXT %s |
TexEnv TEXTURE_FILTER_CONTROL_EXT TEXTURE_LOD_BIAS_EXT %s |
305 |
""" % lodbias |
""" % lodbias |
306 |
|
|
307 |
|
if using_shader: |
308 |
|
code += """ |
309 |
|
ActiveTexture TEXTURE2 |
310 |
|
TexEnv TEXTURE_FILTER_CONTROL_EXT TEXTURE_LOD_BIAS_EXT %s |
311 |
|
ActiveTexture TEXTURE0 |
312 |
|
""" % edgelodbias |
313 |
|
|
314 |
if use_stencil: |
if use_stencil: |
315 |
code += """ |
code += """ |
316 |
# Create edge stencil |
# Create edge stencil |
376 |
|
|
377 |
class IrreguScene: |
class IrreguScene: |
378 |
def __init__(self): |
def __init__(self): |
379 |
self.scale = size |
self.scale = texsize |
380 |
self.angle = 0 |
self.angle = 0 |
381 |
self.tx, self.ty = 0, 0 |
self.tx, self.ty = 0, 0 |
382 |
|
|