/usr/share/doc/python-visual/examples/texturetest.py is in python-visual 1:5.12-1.6build5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | from visual import *
# Jonathan Brandmeyer
scene.background = color.gray(0.8)
checkerboard = array([[0,0,1,1],
[0,0,1,1],
[1,1,0,0],
[1,1,0,0]], float)
lum = materials.texture( data=checkerboard,
mapping="rectangular",
interpolate=False)
op = materials.texture( data=checkerboard,
channels=["luminance"],
mapping="rectangular",
interpolate=False)
balp1 = box( axis=(0,0,1), color=color.orange, material=op)
blum1 = box( axis=(0,0,1), color=color.orange, material=lum, pos=(-2, 0))
box( pos=(0, 2), color=color.orange, opacity=0.5)
box( pos=(0,-2), color=color.orange)
blum2 = box( pos=(0, 0, -2), axis=(0,0,1), color=color.orange, material=lum)
z = arrow(color=color.green)
z.axis *= 2
scene.mouse.getclick()
# Change the texture
save = array(checkerboard[:,1])
checkerboard[:,1] = checkerboard[:,2]
checkerboard[:,2] = save
save = array(checkerboard[1,:])
checkerboard[1,:] = checkerboard[2,:]
checkerboard[2,:] = save
# Recreate and reassign the textures; Visual doesn't check for texture changes
lum = materials.texture( data=checkerboard,
mapping="rectangular",
interpolate=False)
op = materials.texture( mipmap=False, data=checkerboard,
channels=["luminance"],
mapping="rectangular",
interpolate=False)
balp1.material = op
blum1.material = lum
blum2.material = lum
|