Exemplo n.º 1
0
def stage6(scene_width: int, scene_height: int,
           spheres_centers: np.ndarray, spheres_radiuses: list,
           colors: np.ndarray, albedos: np.ndarray, spec_exponents: List[float],
           eye_position: np.ndarray,
           fov_degree: float,
           light_sources: np.ndarray,
           depth_limit: int) -> NoReturn:
    scene: np.ndarray = create_scene(width=scene_width,
                                     height=scene_height)

    shapes: ShapesContainer = ShapesContainer(10000)
    for i in range(0, len(spheres_radiuses)):
        shapes.append(Sphere(center=spheres_centers[i], radius=spheres_radiuses[i], m=Material(colors[i],
                                                                                               albedos[i],
                                                                                               spec_exponents[i])))

    lights: List[Light] = []
    for light_source in light_sources:
        lights.append(Light(position=light_source[:3], intensity=light_source[3]))

    shapes_rendering_reflection(scene=scene, shapes=shapes, fov_degree=fov_degree, eye_position=eye_position,
                                lights=lights, depth_limit=depth_limit)

    show_scene(scene=scene, window_title="Stage 6")

    del scene
Exemplo n.º 2
0
def stage3(scene_width: int, scene_height: int,
           spheres_centers: np.ndarray, spheres_radiuses: list,
           eye_position: np.ndarray,
           fov_degree: float,
           sphere_color: np.ndarray, background_color: np.ndarray) -> NoReturn:
    scene: np.ndarray = create_scene(width=scene_width,
                                     height=scene_height)

    shapes: ShapesContainer = ShapesContainer(1000)
    for i in range(0, len(spheres_radiuses)):
        shapes.append(Sphere(center=spheres_centers[i], radius=spheres_radiuses[i], m=Material(np.array([0, 0, 0]))))

    simple_shapes_rendering(scene=scene, shapes=shapes,
                            fov_degree=fov_degree, eye_position=eye_position,
                            sphere_color=sphere_color,
                            background_color=background_color)

    show_scene(scene=scene, window_title="Stage 3")

    del scene
Exemplo n.º 3
0
def stage2(scene_width: int, scene_height: int,
           sphere_center: np.ndarray, sphere_radius: float,
           eye_position: np.ndarray,
           fov_degree: float,
           sphere_color: np.ndarray, background_color: np.ndarray) -> NoReturn:

    scene: np.ndarray = create_scene(width=scene_width,
                                     height=scene_height)

    sphere: Sphere = Sphere(center=sphere_center,
                            radius=sphere_radius,
                            m=Material(np.array([0, 0, 0])))

    simple_sphere_rendering(scene=scene, sphere=sphere,
                            fov_degree=fov_degree, eye_position=eye_position,
                            sphere_color=sphere_color,
                            background_color=background_color)

    show_scene(scene=scene, window_title="Stage 2")

    del scene
Exemplo n.º 4
0
def stage1(scene_width: int, scene_height: int) -> NoReturn:
    scene: np.ndarray = create_scene(width=scene_width,
                                     height=scene_height)
    gradient_filling(scene)
    show_scene(scene, "Stage 1")
    del scene