|
From: Bruce S. <bas...@un...> - 2003-01-02 01:20:06
|
Jon Schull is correct; there is something wrong with autoscaling when
scene.forward is not along z. Thanks for reporting this. The autoscaling
seems to be based on the view seen with the default scene.forward rather
than the actual scene.forward.
The other problem he reported, "When I fiddle with scene.range, the image
gets dim as if the lights have been turned down," was basically due to the
fact that the blocks lie along the z axis and so only the single front face
is directly illuminated. The color problem was compounded by setting RGB
values to a maximum of 255 rather than 1, which gives strange results. The
version of the program below resets the RGB values to be within the valid
parameter range. One might also change the direction of the lighting so that
the side faces of the blocks are directly illuminated. (When running the
program, click to advance.)
from visual import *
##"jon schull" <js...@so...>
##This program builds blocks out into space correctly, but it automatically
##"zooms" way out (too far out) about midway through.
c=[]
def init():
for i in range(10):
c.append((0,0,0))
c[0]=[255,255,255]
c[1]=[255,153,51]
c[2]=[102,102,153]
c[3]=[255,0,102]
c[4]=[102,102,153]
c[5]=[255,102,0]
c[6]=[128,0,128]
c[7]=[255,255,0]
c[8]=[51,51,153]
c[9]=[255,0,102]
for i in range(10):
for j in range(3):
c[i][j] = c[i][j]/255.0
for each in c:
for i in (0,1,2):
each[i]=each[i]/255.
scene.forward=[0.5,-0.5,-1]
scene.range=10 ## added to avoid the autoscaling problem
init()
def tenblocks(firstblock=0):
for i in range(10):
b = box(color=c[i],pos=(0,0,-firstblock + 10 -i))
scene.mouse.getclick()
def ShowUpTo(Number=50):
Tens=Number/10
for i in range(Tens):
tenblocks(firstblock=i*10)
ShowUpTo(Number=100)
|