# -*- coding: utf-8 -*- # Laboratorio 3 Tests.py #Import our gl library import math import os,sys sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) from gllib.gl import Raytracer,colorScale from gllib.material import Material from gllib.sphere import Sphere from gllib.obj import Texture #Material to use button = Material(diffuse = colorScale(0, 0, 0)) eyePupil = button snow = Material(diffuse = colorScale(1, 1, 1)) nose = Material(diffuse = colorScale(255/255, 135/255, 0)) smile = Material(diffuse = colorScale(65/255, 65/255, 65/255 )) #Create our raytracer and spheres to build a snowman raytracerGl=Raytracer(280,176) raytracerGl.FOV = 120 raytracerGl.sceneObjects.append( Sphere((0, 6, -11), 4, snow) ) raytracerGl.sceneObjects.append( Sphere((0, 0, -10), 4, snow) ) raytracerGl.sceneObjects.append( Sphere((0, -6, -9), 4, snow) ) raytracerGl.sceneObjects.append( Sphere((0, 0, -4.99), 0.5, button) ) raytracerGl.sceneObjects.append( Sphere((0, -2, -4.99), 0.5, button) ) raytracerGl.sceneObjects.append( Sphere((0, -4, -4.99), 0.5, button) ) raytracerGl.sceneObjects.append( Sphere((0, 3.6, -4.99), 0.4, nose) ) raytracerGl.sceneObjects.append( Sphere((-0.5, 4.4, -4.99), 0.2, eyePupil) )
# -*- coding: utf-8 -*- # Laboratorio 3 Tests.py #Import our gl library import math import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) from gllib.gl import Raytracer, colorScale from gllib.material import Material from gllib.sphere import Sphere from gllib.light import PointLight, AmbientLight #Material to use button = Material(diffuse=colorScale(0, 0, 0), specularity=16) eyePupil = Material(diffuse=colorScale(25 / 255, 25 / 255, 25 / 255), specularity=80) snow = Material(diffuse=colorScale(1, 1, 1), specularity=32) nose = Material(diffuse=colorScale(255 / 255, 135 / 255, 0), specularity=16) smile = Material(diffuse=colorScale(65 / 255, 65 / 255, 65 / 255), specularity=16) #Create our raytracer and spheres to build a snowman raytracerGl = Raytracer(int(800 / 1), int(500 / 1)) raytracerGl.FOV = 120 raytracerGl.pointLight = PointLight(position=(-1, 1, 0), intensity=1.5) raytracerGl.ambientLight = AmbientLight(strength=0.1) raytracerGl.sceneObjects.append(Sphere((0, 6, -11), 4, snow)) raytracerGl.sceneObjects.append(Sphere((0, 0, -10), 4, snow)) raytracerGl.sceneObjects.append(Sphere((0, -6, -9), 4, snow)) raytracerGl.sceneObjects.append(Sphere((0, 0, -4.99), 0.5, button)) raytracerGl.sceneObjects.append(Sphere((0, -2, -4.99), 0.5, button)) raytracerGl.sceneObjects.append(Sphere((0, -4, -4.99), 0.5, button))
# Laboratorio 3 Tests.py #Import our gl library import math import os,sys sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) from gllib.gl import Raytracer,colorScale from gllib.material import Material,REFLECTIVE from gllib.sphere import Sphere from gllib.obj import Texture from gllib.light import PointLight,AmbientLight #Material to use color1 = Material(diffuse = colorScale(0.8, 0.4, 0.25),specularity=16) color2 = Material(diffuse = colorScale(0.4, 0.4, 0.4),specularity=32) mirror = Material(diffuse = colorScale(0.8, 0.8, 0.8),specularity=1024,matType=REFLECTIVE) #Create our raytracer and spheres to build a snowman raytracerGl=Raytracer(int(512/2),int(512/2)) raytracerGl.pointLight= PointLight(position=(-2,2,0),intensity=1) raytracerGl.glClearColorScaleRGB(0.2,0.6,0.8) raytracerGl.ambientLight= AmbientLight(strength=0.1) raytracerGl.sceneObjects.append( Sphere((1, 1, -8), 1.5, color1)) raytracerGl.sceneObjects.append( Sphere((0, 0, -5), 0.5, color2)) raytracerGl.sceneObjects.append( Sphere((-3, 3, -10), 2, mirror)) raytracerGl.sceneObjects.append( Sphere((-3, -3, -10), 1, mirror)) raytracerGl.rtRender()
# -*- coding: utf-8 -*- # Laboratorio 3 Tests.py #Import our gl library import math import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) from gllib.gl import Raytracer, colorScale from gllib.material import Material, REFLECTIVE from gllib.sphere import Sphere from gllib.obj import Texture from gllib.light import PointLight, AmbientLight #Material to use color1 = Material(diffuse=colorScale(0.8, 0.4, 0.25), specularity=16) color2 = Material(diffuse=colorScale(0.4, 0.4, 0.4), specularity=32) mirror = Material(diffuse=colorScale(0.8, 0.8, 0.8), specularity=1024, matType=REFLECTIVE) #Create our raytracer and spheres to build a snowman raytracerGl = Raytracer(int(512 / 2), int(512 / 2)) raytracerGl.pointLight = PointLight(position=(-2, 2, 0), intensity=1) raytracerGl.glClearColorScaleRGB(0.2, 0.6, 0.8) raytracerGl.ambientLight = AmbientLight(strength=0.1) raytracerGl.sceneObjects.append(Sphere((1, 1, -8), 2, color1)) raytracerGl.sceneObjects.append(Sphere((-0, 0, -5), 0.5, color2)) raytracerGl.sceneObjects.append(Sphere((-3, 3, -10), 2, mirror)) raytracerGl.sceneObjects.append(Sphere((-3, -3, -10), 1, mirror)) raytracerGl.rtRender()
# Laboratorio 3 Tests.py #Import our gl library import math import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) from gllib.gl import Raytracer, colorScale from gllib.material import Material, REFLECTIVE from gllib.sphere import Sphere from gllib.plane import Plane from gllib.aabbox import AABBox from gllib.obj import Texture from gllib.light import PointLight, AmbientLight #Material to use color1 = Material(diffuse=colorScale(116 / 255, 47 / 255, 0), specularity=16) color2 = Material(diffuse=colorScale(231 / 255, 228 / 255, 228 / 255), specularity=32) color3 = Material(diffuse=colorScale(0.2, 0.6, 0.8), specularity=32) color4 = Material(diffuse=colorScale(1, 1, 1), specularity=16) color5 = Material(diffuse=colorScale(1, 0, 0), specularity=16) color6 = Material(diffuse=colorScale(0, 1, 0), specularity=16) #Create our raytracer raytracerGl = Raytracer(int(512 / 2), int(512 / 2)) raytracerGl.pointLight = PointLight(position=(0, 1, -6), intensity=1) raytracerGl.ambientLight = AmbientLight(strength=0.1) #Planes #Below raytracerGl.sceneObjects.append(