Esempio n. 1
0
    middle.material.color = color(0.1, 1, 0.5)
    middle.material.diffuse = 0.7
    middle.material.specular = 0.3
    middle.material.reflective = 0.1
    middle.material.pattern = checkers_pattern(color(0.2, 0.5, 0.7),
                                               color(0.8, 0.8, 0.2))
    w.objects.append(middle)

    right = sphere()
    right.transform = translation(1.5, 0.5, -0.5) * scaling(0.5, 1.5, 0.5)
    right.material = material()
    right.material.color = color(0.5, 1, 0.1)
    right.material.diffuse = 0.7
    right.material.specular = 0.3
    right.material.reflective = 0.15
    right.material.pattern = ring_pattern(color(0.2, 0.5, 0.7),
                                          color(0.8, 0.8, 0.2))
    w.objects.append(right)

    left = sphere()
    left.transform = translation(-1.5, 0.33, -0.75) * scaling(0.33, 0.33, 0.33)
    left.material = material()
    left.material.color = color(1, 0.8, 0.1)
    left.material.diffuse = 0.7
    left.material.specular = 0.3
    left.material.reflective = 0.1
    left.material.pattern = gradient_pattern(color(0.7, 0.5, 0.7),
                                             color(0, 0.8, 0.2))
    w.objects.append(left)

    cam = camera(1600, 800, pi / 2)
    cam.transform = view_transform(point(0, 1.5, -5), point(0, 1, 0),
Esempio n. 2
0
def step_impl(context):
    context.pattern = ring_pattern(context.white, context.black)