Exemplo n.º 1
0
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)

w = translatedDisk
for c in [negCyl1, negCyl2, negCyl3, negCyl4]:
Exemplo n.º 2
0
import repeated2d
import transform
import light

#cam = camera.YCamera(0, -5, 3)
#cam.setViewDistance(2)
#cam.setViewWidth(2)

cam = camera.FreeCamera(bdgmath.Vector3(10, -8, 6), bdgmath.Vector3(0, 0, 5))

scene = scene.Scene()

scene.addLight(light.DirectionalLight(bdgmath.Vector3(-1, 1, -4), 0.8))
scene.addLight(light.AmbientLight(0.2))

scene.addObject(plane.ZPlane(0))
#scene.addObject(plane.ZPlane(-2))
#scene.addObject(sphere.Sphere(bdgmath.Vector3(-0.1, 0, 2.5), 2.5))

s2 = sphere.Sphere(bdgmath.Vector3(3.5, 2, 2), 2)
s2.color1 = (40, 200, 40)
#s2.color2 = (0, 250, 0)
s2.color2 = (40, 200, 40)
#scene.addObject(s2)

s3 = sphere.Sphere(bdgmath.Vector3(-4, 2, 2), 2)
s3.color1 = (40, 40, 200)
#s3.color2 = (0, 0, 250)
s3.color2 = s3.color1
#scene.addObject(s3)