colors = [(240, 0, 0), (240, 0, 0), (0, 240, 0), (0, 240, 0), (0, 0, 240), (0, 0, 240), (180, 180, 0), (180, 180, 0), (180, 0, 180), (180, 0, 180), (0, 180, 180), (0, 180, 180), (0, 0, 0), (200, 200, 200), (200, 200, 200), (250, 250, 250), (220, 220, 220), (220, 220, 220)] TOT_FRAMES = 150 WIDTH = 400 HEIGHT = 200 FOV = math.radians(50) NEAR = 0.5 LIGHT_DIR = vector.Vec3f(-0.5, -0.5, -1.0).norm() dirLight = light.DirectionalLight(LIGHT_DIR, (1.0, 1.0, 1.0)) AMBIENT = 0.25 LIGHT_VAL = 0.75 def trace(base, frameNum): print "Frame:", frameNum radius = 9.0 x = radius * math.cos(2 * math.pi * frameNum / TOT_FRAMES) y = radius * math.sin(2 * math.pi * frameNum / TOT_FRAMES) z = 3.0 eye = vector.Vec3f(x, y, z) at = vector.Vec3f(0.0, 0.0, 0.0) worldUp = vector.Vec3f(0.0, 0.0, 1.0)
import donut import box import repeated2d import transform import light import material import csg import roundedge cam = camera.FreeCamera(bdgmath.Vector3(5, -8, 6), bdgmath.Vector3(0, 0, 0.75)) scene = scene.Scene() scene.addLight(light.DirectionalLight(bdgmath.Vector3(-1, 0.5, -4), 0.8)) scene.addLight(light.AmbientLight(0.2)) floor = plane.ZPlane(0) floor.squareSize = 2 scene.addObject(floor) disk = roundedge.RoundEdge(0.1, cylinder.CappedCylinder(0.8, 3.8)) translatedDisk = transform.Translate3d(bdgmath.Vector3(0, 0, 1.5), disk) #scene.addObject(translatedDisk) negCyl1 = cylinder.ZCylinder(bdgmath.Vector2(1.5, 1.5), 1.1) negCyl2 = cylinder.ZCylinder(bdgmath.Vector2(1.5, -1.5), 1.1) negCyl3 = cylinder.ZCylinder(bdgmath.Vector2(-1.5, -1.5), 1.1) negCyl4 = cylinder.ZCylinder(bdgmath.Vector2(-1.5, 1.5), 1.1)