// Exercicio 7 de MC930 para POV-ray // Last edited on 2000-11-16 12:10 by Alencar Junior // RA: 950060 #include "textures.inc" background { color rgb <1,1,1> } light_source { <-100, 100, -200> color rgb <1,1,1> } plane { y, -12 texture { pigment { checker color rgb <0,1,0> color rgb <1,0,0> } } } camera { location < -4, 5.00, -10.00 > right < 2.40, 0.00, 0.00 > up < 0.00, 0.00, 1.80 > sky < 0.00, 1.00, 0.00 > look_at < -2.00, 2.00, 0.00 > } //#declare Porta = //box { // <-1,0.8,-2.1>, // <1,0,0> // texture{pigment {color rgb <0,0,0> } } // } #declare g = seed (pi); #declare Predio = union { #declare n= int(rand(g)*10)+1; // numero aleatorio de andares #declare r= int(rand(g)*10)+1; // numero aleatorio de janelas da fachada #declare s= int(rand(g)*10)+1; // numero aleatorio de janelas da lateral #declare sver = (n - 0.3*n)/n; // espaco entre andares #declare sfach = (4 - 0.3*r)/(r-2); // espaco entre janelas da fachada #declare slat = (4 - 0.3*s)/(s-2); // espaco entre janelas da lateral box { // Corpo do predio <-2,0,-2>, <2,(n+1),2> texture{pigment { color rgb <0,1,0> } } } union { // loop da fachada #declare j = 1; #declare fach = 2; #while (j <= r) #declare fach = fach - sfach; #declare ver = n+1; #declare i=1; #while ( i <= n) #declare ver = ver - sver; box { < fach,ver,-2.1> < (fach-0.3),(ver-0.3),2.0> texture{pigment {color rgb <1,0,0>}} } #declare ver=ver-0.3; #declare i = i +1; #end #declare j=j+1; #end // agora faremos o loop da lateral #declare j = 1; #declare lat = -2; #while (j <= s) #declare lat = lat + sfach; #declare ver = n+1; #declare i=1; #while ( i <= n) #declare ver = ver - sver; box { < -2.1,ver,lat> < -2,(ver-0.3),(lat+0.3)> texture{pigment {color rgb <1,0,0>}} } #declare ver=ver-0.3; #declare i = i +1; #end #declare j=j+1; #end } box { // Esta eh a porta do predio <-1,0.8,-2.1>, <1,0,0> texture{pigment {color rgb <0,0,0> } } } } //object {Predio} //object {Porta} object {Predio } object {Predio translate < 8,0,0 >}