background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_xadrez = texture{ pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } #declare chao = box{ <-20,-20,-1>, <+20,+20,0> texture{tx_xadrez}} #declare toco= cylinder { <0,0,0>, <0.1,0,0>, 0.05 texture{ pigment{ color rgb < 0.5, 0.5, 0.5 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } #declare tanque1= union { cylinder { <0,0,0>, <0,0,0.3>, 0.5 texture{ pigment{ color rgb < 0.90, 0.30, 0.30 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } cylinder { <0,0,0.3>, <0,0,1.0>, 0.35 texture{ pigment{ color rgb < 0.80, 0.30, 0.30 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } object { toco rotate 90*z translate<0,0.35,0.4> } object { toco translate<0.35,0,0.8> } object { toco rotate -90*y translate<0,0,1> } } #declare tanque2= union { box { <-0.5,-0.5,0>, <0.5,0.5,0.2> texture{ pigment{ color rgb < 0.6, 0.6, 0.30 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } cone { <0,0,0.2>, 0.4 <0,0,1>, 0 texture{ pigment{ color rgb < 0.8, 0.8, 0.30 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } object { toco translate<0.35,0,0.3> } object { toco rotate -90*z translate<0,-0.20,0.55> } object { toco rotate 90*z translate<0,0.07,0.8> } } #declare tanque3= union { box{ <-0.5,-0.5,0>, <0.5,0.5,0.5> texture{ pigment{ color rgb < 0.9, 0.9, 0.9 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } box{ <-0.4,-0.4,0.5>, <0.4,0.4,1> texture{ pigment{ color rgb < 1, 1, 1 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } object { toco translate<0.4,0,0.8> } object { toco rotate 90*z translate<0,0.5,0.25> } object { toco rotate -90*y translate<0,0,1> } } #declare tocos_1 = array[3] {<0,0.45,0.4>,<0.45,0,0.8>,<0,0,1.1>} #declare tocos_2 = array[3] {<0.45,0,0.3>,<0,-0.30,0.55>,<0,0.17,0.8>} #declare tocos_3 = array[3] {<0.5,0,0.8>,<0,0.6,0.25>,<0,0,1.1>} #declare m_global = 4; // use isso como m #declare n_global = 5; // use isso como n #declare tocos = array[3*m_global*n_global+10]; #declare toco_indice = 0; #declare roleta1 = seed(9); #macro gera_tanques(m,n) #declare i=0; union{ #while(i; object { #if(escolhido<1) tanque1 #declare tocos[toco_indice] = tocos_1[0]+position; #declare tocos[toco_indice+1] = tocos_1[1]+position; #declare tocos[toco_indice+2] = tocos_1[2]+position; #declare toco_indice=toco_indice+3; #elseif(escolhido<2) tanque2 #declare tocos[toco_indice] = tocos_2[0]+position; #declare tocos[toco_indice+1] = tocos_2[1]+position; #declare tocos[toco_indice+2] = tocos_2[2]+position; #declare toco_indice=toco_indice+3; #else tanque3 #declare tocos[toco_indice] = tocos_3[0]+position; #declare tocos[toco_indice+1] = tocos_3[1]+position; #declare tocos[toco_indice+2] = tocos_3[2]+position; #declare toco_indice=toco_indice+3; #end //rotate z*rotacao translate position } #declare j=j+1; #end #declare i=i+1; #end } #end #macro cano(p1, p2) #local altura = 1.1+4*rand(roleta1); #local pa1 = ; #local pa2 = ; union { sphere { p1, 0.05 } sphere { p2, 0.05 } sphere { pa1, 0.05 } sphere { pa2, 0.05 } cylinder { p1, pa1, 0.05 } cylinder { pa1, pa2, 0.05 } cylinder { pa2, p2, 0.05 } texture{ pigment{ color rgb < rand(roleta1), rand(roleta1), rand(roleta1) > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } } #end #macro gera_canos() union{ #while(toco_indice>1) #local indice1 = int(toco_indice*rand(roleta1)); #local toco1 = tocos[indice1]; #declare tocos[indice1] = tocos[toco_indice-1]; #declare tocos[toco_indice-1] = toco1; #declare toco_indice=toco_indice-1; #local indice2 = int(toco_indice*rand(roleta1)); #local toco2 = tocos[indice2]; #declare tocos[indice2] = tocos[toco_indice-1]; #declare tocos[toco_indice-1] = toco2; #declare toco_indice=toco_indice-1; cano(toco1, toco2) #end } #end union { object {chao} gera_tanques(m_global,n_global) gera_canos() } #include "camlight.inc" #declare centro_cena = < m_global*1.5/2, n_global*1.5/2, 2>; #declare raio_cena = 6; #declare dir_camera = < 1, 0.2, 1 >; #declare dist_camera = raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)