Exemplo n.º 1
0
    def setUp(self):
        '''
        Create a scene with a camera placed at [0, 0, 4] and looking at the
        world origin.
        '''
        scene = Scene()
        self.scene = scene

        #Camera
        camera = Camera({
            'from': np.array([1., 4., -2.]),
            'to': np.array([1., -2., 4]),
            'up': GT.normalize(np.array([-1., 1., 0.])),
            'fov': 45,
            'width': 10001,
            'height': 10001
        })  # choose very high dimension to avoid rounding error
        render = Render({'camera': camera})
        scene.render = render
Exemplo n.º 2
0
def test_red_sphere_blue_background():
    from Intersectable import Sphere

    scene = Scene()

    # Materials
    red = Material()

    # Lights
    light = Light({'color': [0.8, 0.2, 0.2], 'from': [0, 0, 10], 'power': 0.6})
    scene.lights.append(light)

    # Surfaces
    sphere = Sphere({'radius': 1, 'center': [0, 0, 0], 'material': red})
    scene.surfaces.append(sphere)

    # Camera
    camera = Camera({'from': [0, 0, 4], 'to': [0, 0, 0], 'up': [0, 1, 0], 'fov': 45, 'width': 160, 'height': 120})
    render = Render({'camera': camera, 'bgcolor': [.2, .2, .8], 'output': 'red_sphere_blue_background.png'})
    scene.render = render
    scene.renderScene()
Exemplo n.º 3
0
 def process_camera(self, node):
     camera = Camera(self.create_params(node.attributes))
     return camera