Пример #1
0
cornellObjects[6].setMaterial(Material([1, 1, 1, 1], [0.1, 0.2, 0.1, 1], 127))

grid = Grid()
scene = Scene()
for obj in cornellObjects:
    scene.addObject(obj)
#scene.addObject(grid)

camera = Camera(Vec3d(-3, 25, 76), Vec3d(0, 0, -1))

light1 = Light([0.6, 0.6, 0.6, 1], [1, 1, 1, 1], [.1, .1, .1, 1],
               [16, 44, 0, 1], 1)
light2 = Light(
    [0.6, 0.6, 0.6, 1], [1, 1, 1, 1], [.1, .1, .1, 1], [-3.4, 25, 90], 2
)  #you can detect light2 by pressing s and going backward from initial position
light2.switchLight()  #turning of the light2.

scene.addObject(light1)
scene.addObject(light2)

# Some api in the chain is translating the keystrokes to this octal string
# so instead of saying: ESCAPE = 27, we use the following.
ESCAPE = b'\033'

# Number of the glut window.
window = 0


# A general OpenGL initialization function.  Sets all of the initial parameters.
def InitGL(Width,
           Height):  # We call this right after our OpenGL window is created.