예제 #1
0
    w.light = point_light(point(-10, 10, -10), color(1, 1, 1))

    black = color(0, 0, 0)
    white = color(1, 1, 1)

    floor = plane()
    floor.transform = scaling(0.5, 0.5, 0.5)
    floor.material.color = color(0.9, 0.9, 0.9)
    floor.material.specular = 0.3
    floor.material.pattern = checkers_pattern(black, white)
    floor.material.reflective = 0.6
    w.objects.append(floor)

    left_wall = plane()
    left_wall.transform = (translation(0, 0, 5) * rotation_y(-pi / 4) *
                           rotation_x(pi / 2) * scaling(10, 0.01, 10))
    left_wall.material.specular = 0.7
    left_wall.material.pattern = stripe_pattern(black, white)
    w.objects.append(left_wall)

    right_wall = plane()
    right_wall.transform = (translation(0, 0, 5) * rotation_y(pi / 4) *
                            rotation_x(pi / 2) * scaling(10, 0.01, 10))
    right_wall.material.specular = 0.7
    right_wall.material.pattern = stripe_pattern(black, white)
    w.objects.append(right_wall)

    middle = sphere()
    middle.transform = translation(-0.5, 1, 0.5)
    middle.material = material()
    middle.material.color = color(0.1, 1, 0.5)
예제 #2
0
def step_impl(context):
    context.A = rotation_x(pi / 2)
예제 #3
0
def step_impl(context):
    context.full_quarter = rotation_x(pi / 2)
예제 #4
0
def step_impl(context):
    context.half_quarter = rotation_x(pi / 4)
예제 #5
0
    black = color(0, 0, 0)
    white = color(1, 1, 1)

    floor = plane()
    floor.transform = scaling(0.75, 0.75, 0.75)
    floor.material.color = color(0.9, 0.9, 0.9)
    floor.material.specular = 0.1
    floor.material.pattern = checkers_pattern(color(1, 0.8, 0.1),
                                              color(0.1, 0.1, 0.85))
    floor.material.reflective = 0.1
    w.objects.append(floor)

    left_wall = plane()
    left_wall.transform = (translation(0, 0, 5) * rotation_y(-pi / 4) *
                           rotation_x(pi / 2) * scaling(0.25, 0.25, 0.25))
    left_wall.material.specular = 0.1
    left_wall.material.pattern = stripe_pattern(black, white)
    w.objects.append(left_wall)

    right_wall = plane()
    right_wall.transform = (translation(0, 0, 5) * rotation_y(pi / 4) *
                            rotation_x(pi / 2) * scaling(0.25, 0.25, 0.25))
    right_wall.material.specular = 0.1
    right_wall.material.pattern = stripe_pattern(black, white)
    w.objects.append(right_wall)

    middle = sphere()
    middle.transform = translation(-0.5, 1, 0.5)
    middle.material = material()
    middle.material.color = color(0.1, 0.1, 0.85)
예제 #6
0
    w = world()
    w.light = point_light(point(-10, 10, -10), color(1, 1, 1))

    black = color(0, 0, 0)
    white = color(1, 1, 1)

    floor = plane()
    floor.transform = scaling(10, 0.01, 10)
    floor.material.color = color(1, 0.9, 0.9)
    floor.material.specular = 0.1
    floor.material.pattern = checkers_pattern(black, white)
    w.objects.append(floor)

    left_wall = plane()
    left_wall.transform = (
        translation(0, 0, 5) * rotation_y(-pi / 4) * rotation_x(pi / 2)
    )  # * scaling(10, 0.01, 10)
    left_wall.material = floor.material
    w.objects.append(left_wall)

    right_wall = plane()
    right_wall.transform = (
        translation(0, 0, 5) * rotation_y(pi / 4) * rotation_x(pi / 2)
    )  # * scaling(10, 0.01, 10)
    right_wall.material = floor.material
    w.objects.append(right_wall)

    middle = sphere()
    middle.transform = translation(-0.5, 1, 0.5)
    middle.material = material()
    middle.material.color = color(0.1, 1, 0.5)