本文整理汇总了Python中scene.Scene.add_light方法的典型用法代码示例。如果您正苦于以下问题:Python Scene.add_light方法的具体用法?Python Scene.add_light怎么用?Python Scene.add_light使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scene.Scene
的用法示例。
在下文中一共展示了Scene.add_light方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_scene
# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import add_light [as 别名]
def get_scene():
scene = Scene((500, 500), Point(0, 0, 800), Vector(0, 0, -1), Vector(0, 1, 0), 45, (0.3, 0.3, 0.3))
mat1 = Material((0.7, 1.0, 0.7), (0.5, 0.7, 0.5), 25, 0.25)
mat2 = Material((0.5, 0.5, 0.5), (0.5, 0.7, 0.5), 25, 0.25)
mat3 = Material((1.0, 0.6, 0.1), (0.5, 0.7, 0.5), 25, 0.25)
mat4 = Material((0.7, 0.6, 1.0), (0.5, 0.4, 0.8), 25, 0.25)
# s1
scene.add_child(Sphere(Point(0, 0, -400), 100, mat1))
# s2
scene.add_child(Sphere(Point(200, 50, -100), 150, mat1))
# s3
scene.add_child(Sphere(Point(0, -1200, -500), 1000, mat2))
# b1 (TODO)
# s4
scene.add_child(Sphere(Point(-100, 25, -300), 50, mat3))
# s5
scene.add_child(Sphere(Point(0, 100, -250), 25, mat1))
# white light
scene.add_light(Light(Point(-100, 150, 400), (0.9, 0.9, 0.9), (1, 0, 0)))
# orange light
scene.add_light(Light(Point(400, 100, 150), (0.7, 0.0, 0.7), (1, 0, 0)))
return scene
示例2: Scene
# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import add_light [as 别名]
#!/usr/bin/env python
from dispatcher import Dispatcher
from scene import Scene
from camera import Camera
from lights import *
from objects import *
from color import Color
width, height = 800, 600
scene = Scene(Camera((0, -80, 20), 60), (80, 60), (width, height))
scene.add_light(Ambiant(intensity=0.2))
scene.add_light(Diffuse(-20, -40, 20, intensity=0.8))
scene.add_light(Diffuse(40, 40, 5, intensity=0.4))
scene.add_light(Specular(-20, -40, 20, intensity=0.6))
scene.add_object(Sphere(10, x=50, y=30, scale_z=1.5, color=Color(r=255)))
scene.add_object(Sphere(3, z=20, scale_x=5, color=Color(g=255)))
scene.add_object(Sphere(5, color=Color(r=255, b=255)).stretch('x', angle_y=60))
scene.add_object(Plane(z=-10, color=Color(255, 255, 255)))
scene.add_object(Plane(z=80, color=Color(255, 255, 255)))
scene.add_object(Plane(x=-80, rot_y=90, color=Color(b=255)))
scene.add_object(Plane(x=80, rot_y=90, color=Color(b=255)))
scene.add_object(Plane(y=100, rot_x=90, color=Color(r=255, g=255)))
scene.add_object(Cylinder(5, x=-80, y=100, color=Color(b=255)))
scene.add_object(Cylinder(5, x=80, y=100, color=Color(b=255)))
scene.add_object(Cone(10, color=Color(r=128, g=128, b=128)))
nb_lines_chunk = 50