// Last edited on 2003-06-24 19:59:51 by stolfi // Exercicio 8 - MC930 // Nilton Volpato - RA 003243 // Tuba canora e computosa // Imagem 400x200 pixels ou proporcional #include "colors.inc" #include "textures.inc" #include "woods.inc" #include "golds.inc" #include "metals.inc" #default { finish { ambient 0.1 } } #declare bz_scale = 0.20; #include "../../bz-things.inc" //---------------------------------------------- // Cores e Texturas #macro tx_peixe(cor) pigment { color rgb cor } finish { diffuse 0.30 reflection 0.40*<1,1,1> + 0.30*cor ambient 0.00 } #end //---------------------------------------------- // Pontos do Retalho // A #declare A = array[4][4] { {<0.8,1.5,0>, <1,2.0, 0>, <2,2.5, 0>, <3,3, 0>}, {<0.8,1.5,0>, <1,2.0,-1>, <2,2.5,-1>, <3,3,-1>}, {<0.8,1.5,0>, <1,1.5,-2>, <2,0.8,-2>, <3,1,-2>}, {<0.8,1.5,0>, <1,1.0, 0>, <2,0.2, 0>, <3,0, 0>} } // B #declare B = array[4][4] { {A[0][3], A[0][3] + (A[0][3]-A[0][2]), <6, 2.0, 0.0>, <7,2.0, 0.0>}, {A[1][3], A[1][3] + (A[1][3]-A[1][2]), <6, 2.0,-1.0>, <7,2.0,-0.5>}, {A[2][3], A[2][3] + (A[2][3]-A[2][2]), <6, 1.2,-1.0>, <7,1.35,-0.5>}, {A[3][3], A[3][3] + (A[3][3]-A[3][2]), <6, 1.0, 0.0>, <7,1.0, 0.0>} } // C #declare C = array[4][4] { {B[0][3], B[0][3] + (B[0][3]-B[0][2]), <8,2.3, 0>, <9,2.7, 0>}, {B[1][3], B[1][3] + (B[1][3]-B[1][2]), <8,2.3,-1>, <9,2.7, 0>}, {B[2][3], B[2][3] + (B[2][3]-B[2][2]), <8,1.2,-2>, <9,1.0, 0>}, {B[3][3], B[3][3] + (B[3][3]-B[3][2]), <8,0.7, 0>, <9,0.3, 0>} } //---------------------------------------------- // Retalhos de Bézier #macro retalho(pts,cor) bicubic_patch { type 1 flatness 0 u_steps 4 v_steps 4 pts[0][0] pts[0][1] pts[0][2] pts[0][3] pts[1][0] pts[1][1] pts[1][2] pts[1][3] pts[2][0] pts[2][1] pts[2][2] pts[2][3] pts[3][0] pts[3][1] pts[3][2] pts[3][3] } #end #declare escreve_texto = 0; #macro esferas(pts,cor) union { #local i = 0; #local j = 0; #while ( i < 4 ) #declare j = 0; #while ( j < 4 ) sphere { pts[i][j], 0.04 pigment { #if ( ( i = 0 | i = 3 ) & ( j = 0 | j = 3 ) ) color rgb <1,1,1>-cor #else color rgb cor #end } } #if (i > 0) cylinder { pts[i][j], pts[i-1][j]+0.0001*x, #if ((j = 0) | (j = 3)) 0.025 #else 0.015 #end pigment { color rgb cor } } #end #if (j > 0) cylinder { pts[i][j], pts[i][j-1]+0.0001*x, #if ((i = 0) | (i = 3)) 0.025 #else 0.015 #end pigment { color rgb cor } } #end #if (escreve_texto) text { ttf "arial.ttf" concat( str(i,0,0), ",", str(j,0,0) ) 0.1, 0 scale 0.35 translate pts[i][j] pigment { color Red } } #end #declare j = j + 1; #end #declare i = i +1; #end no_shadow } #end //---------------------------------------------- // Objeto Final #macro parte(vec_pts,bool_esferas,cor) union { object { retalho(vec_pts,cor) texture { tx_peixe(cor) } } #if (bool_esferas) esferas(vec_pts,cor) #end } #end #declare peixe = difference { union { object { parte(A,1,<0,1,1>) } object { parte(A,1,<0,1,1>) scale <1,1,-1> } object { parte(B,1,<0,1,0>) } object { parte(B,1,<0,1,0>) scale <1,1,-1> } object { parte(C,1,<1,1,0>) } object { parte(C,1,<1,1,0>) scale <1,1,-1> } } sphere { // boca <0,0,0>, 0.2 scale <4,.6,8> rotate <0,0,15> translate <1.3,0.7,0> pigment { color Red } } } //---------------------------------------------- // Cena #declare scene = union { object { peixe translate <-4.5,-1.5,0> rotate <0, 180, 0> } // object { bz_axes } } object{ bz_checker_bg } object{ scene translate bz_rite_pos } object{ scene rotate -90*y translate bz_left_pos }