// MC930 - Laboratorio 5 // Martim Carbone - RA:002193 #include "colors.inc" light_source { <9, 3, -40> color rgb <0.7, 0.7, 0.7>} light_source { <3, 9, -40> color rgb <0.7, 0.7, 0.7>} background{ color rgb < 0.7,0.7, 0.9 > } camera { location <6, 6, -15> look_at <6, 6, 0> sky <0,1,0> } #declare fonte = seed(27118); // qq coisa // Nós da grade #declare yno = 0; #while (yno <= 12) #declare xno = 0; #while (xno <= 12) sphere { , 0.5 texture{pigment{Red}} } #declare xno = xno + 3; #end #declare yno = yno + 3; #end // Arestas horizontais #declare yar = 0; #while (yar <= 12) #declare xar = 0.5; #while (xar <= 10.5) cylinder { , ,0.1 texture{pigment{Green}} } #declare xar = xar + 3; #end #declare yar = yar + 3; #end // Arestas verticais #declare yar = 0.5; #while (yar <= 10.5) #declare xar = 0; #while (xar <= 12) cylinder { , ,0.1 texture{pigment{Green}} } #declare xar = xar + 3; #end #declare yar = yar + 3; #end // Pacotes nas arestas horizontais #declare yar = 0; #while (yar <= 12) #declare xar = 0.5; #while (xar <= 10.5) #declare pacote_x = xar + 2*rand(fonte); #declare pacote_y = yar; #declare pacote_cor = <0.8*rand(fonte)+0.2,0.8*rand(fonte)+0.2,0.8*rand(fonte)+0.2>;// para nao ficarem muito escuros #declare pacote_tipo = rand(fonte); #if (pacote_tipo<0.33) // desenha esfera sphere{ , 0.25 texture{pigment{color rgb pacote_cor}} finish { ambient 0.05 diffuse 0.2 reflection pacote_cor specular 0.80 roughness 0.05 metallic } } #else #if ((pacote_tipo>=0.33) & (pacote_tipo<0.66)) // desenha cone cone{ , 0.2, , 0 texture{pigment{color rgb pacote_cor}} finish { ambient 0.05 diffuse 0.2 reflection pacote_cor specular 0.80 roughness 0.05 metallic } } #else // desenha caixa box { , texture{pigment{color rgb pacote_cor}} finish { ambient 0.05 diffuse 0.2 reflection pacote_cor specular 0.80 roughness 0.05 metallic } } #end #end #declare xar = xar + 3; #end #declare yar = yar + 3; #end // Pacotes nas arestas verticais #declare yar = 0.5; #while (yar <= 10.5) #declare xar = 0; #while (xar <= 12) #declare pacote_x = xar; #declare pacote_y = yar + 2*rand(fonte); #declare pacote_cor = <0.4*rand(fonte)+0.4,0.4*rand(fonte)+0.4,0.4*rand(fonte)+0.4>; // para nao ficarem muito escuros #declare pacote_tipo = rand(fonte); #if (pacote_tipo<0.33) // desenha esfera sphere{ , 0.25 texture{pigment{color rgb pacote_cor}} finish { ambient 0.05 diffuse 0.2 reflection pacote_cor specular 0.80 roughness 0.05 metallic } } #else #if ((pacote_tipo>=0.33) & (pacote_tipo<0.66)) // desenha cone cone{ , 0.2, , 0 texture{pigment{color rgb pacote_cor}} finish { ambient 0.05 diffuse 0.2 reflection pacote_cor specular 0.80 roughness 0.05 metallic } } #else box { , texture{pigment{color rgb pacote_cor}} // desenha caixa finish { ambient 0.05 diffuse 0.2 reflection pacote_cor specular 0.80 roughness 0.05 metallic } } #end #end #declare xar = xar + 3; #end #declare yar = yar + 3; #end