// 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 } } global_settings { assumed_gamma 1.0 } background { color LightBlue } //---------------------------------------------- // Luzes, Câmeras, ... light_source { < -5.00, 10.00, -15.00 > color rgb < .5, .5, .5 > } light_source { <-12, 30, -45> color rgb <0.4,0.4,0.4> spotlight radius 18 falloff 20 tightness 7 point_at <0,0,0> } camera { //location < 0, 10, -30 > //location <-6, 0, -5> location <0, 0, -10> right <1,0,0> up <0,.5,0> look_at 0 //rotate <0,-75,0> } //---------------------------------------------- // Cores e Texturas #declare cor_peixe = texture { //Polished_Chrome //T_Chrome_5B //T_Silver_5B } #declare cor_peixe2 = texture { pigment { checker color rgbf <1,1,1,0> color 0.5*Yellow//rgbf <0,0,1,0> scale .08 } finish { phong 0.6 phong_size 20 } } //---------------------------------------------- // 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 ) 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) union { #local i = 0; #local j = 0; #while ( i < 4 ) #declare j = 0; #while ( j < 4 ) sphere { pts[i][j], 0.07 no_shadow pigment { #if ( ( i = 0 | i = 3 ) & ( j = 0 | j = 3 ) ) color rgb <1,0,0> #else color rgb <0,1,1> #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 } #end //---------------------------------------------- // Objeto Final #macro parte(vec_pts, bool_esferas) union { object { retalho(vec_pts) texture { cor_peixe2 } } #if (bool_esferas) esferas(vec_pts) #end } #end #declare peixe = difference { union { object { parte(A,1) } object { parte(A,1) scale <1,1,-1> } object { parte(B,1) } object { parte(B,1) scale <1,1,-1> } object { parte(C,1) } object { parte(C,1) 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 object { peixe translate <-4.5,-1.5,0> rotate <0, -30, 0> } plane { y, -10 pigment { checker color Black color White scale 5 } }