small speed improvement in rendering
[pyRayTrace.git] / acceptance / test_ambient.py
blob003979e180a35128b52e0e215be051acdbb4d4d9
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 # Copyright 2009 Tuukka Turto
6 # This file is part of pyRayTrace.
8 # pyRayTrace is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # pyRayTrace is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with pyRayTrace. If not, see <http://www.gnu.org/licenses/>.
21 from camera import Camera
22 from camera import GridViewPort
23 from camera import Vector
24 from sphere import Sphere
25 from scene import Scene
27 def test_ambient_light_with_sphere():
28 camera = Camera()
29 viewport = GridViewPort()
30 sphere = Sphere()
31 scene = Scene()
33 sphere.location = Vector(0.0, 0.0, 0.0)
34 sphere.radius = 5
35 sphere.colour = (255, 255, 255)
37 camera.location = Vector(0.0, 0.0, -20.0)
38 viewport.point0 = Vector(7.0, -7.0, 0.0)
39 viewport.point1 = Vector(-7.0, 7.0, 0.0)
40 viewport.resolution = (255, 255)
41 camera.viewport = viewport
43 scene.objects.append(sphere)
44 scene.cameras.append(camera)
45 scene.render_to_file('./acceptance/report/ambient_light_with_sphere.png')