from obj import Obj, Texture from sphere import Sphere, Material, PointLight, AmbientLight import random snowman = Material(diffuse=color(1, 1, 1), spec=16) button = Material(diffuse=color(0, 0, 0), spec=32) nose = Material(diffuse=color(1, 0.5, 0), spec=64) width = 960 height = 1280 # width = 240 # height = 320 r = Raytracer(width, height) r.glClearColor(0.3, 0.5, 0.8) r.pointLight = PointLight(position=V3(-2, 2, 0), intensity=1) r.ambientLight = AmbientLight(strength=0.1) r.glClearColor(0.3, 0.5, 0.8) print('\nThis render gonna be legen—\n') r.scene.append(Sphere(V3(0.15, 1.6, -4), 0.05, button)) r.scene.append(Sphere(V3(-0.15, 1.6, -4), 0.05, button)) r.scene.append(Sphere(V3(0, 1.4, -3.9), 0.10, nose)) r.scene.append(Sphere(V3(0.20, 1.25, -4), 0.04, button)) r.scene.append(Sphere(V3(-0.08, 1.20, -4), 0.04, button)) r.scene.append(Sphere(V3(0.08, 1.20, -4), 0.04, button))
from gl import Raytracer, color, V2, V3 from obj import Obj, Texture, Envmap from sphere import * import random brick = Material(diffuse = color(0.8, 0.25, 0.25 ), spec = 16) stone = Material(diffuse = color(0.4, 0.4, 0.4 ), spec = 32) mirror = Material(spec = 64, matType = REFLECTIVE) glass = Material(spec = 64, ior = 1.5, matType= TRANSPARENT) width = 256 height = 256 r = Raytracer(width,height) r.glClearColor(0.2, 0.6, 0.8) r.glClear() r.envmap = Envmap('envmap.bmp') r.pointLight = PointLight(position = V3(0,0,0), intensity = 1) r.ambientLight = AmbientLight(strength = 0.1) #r.scene.append( Sphere(V3( 1, 1, -10), 1.5, brick) ) #r.scene.append( Sphere(V3( 0, -1, -5), 1, glass) ) #r.scene.append( Sphere(V3(-3, 3, -10), 2, mirror) ) r.scene.append( Plane( V3(-2,-3,0), V3(1,1,0), stone)) #r.scene.append( AABB(V3(0, 1.5, -5), 1.5, stone ) ) r.scene.append( AABB(V3(1.5, -1.5, -5), 1.5, mirror ) )