// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2010-03-04 15:44:01 by stolfi // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_plastico = texture{ pigment{ color rgb < 0.90, 0.90, 0.90 > } finish{ diffuse 0.8 ambient 0.4 specular 0.5 roughness 0.005 } } #declare tx_casca = texture{ pigment{ color rgb < 0, 0.7, 0.00 > } finish{ diffuse 0.5 ambient 0.3 specular 0.1 roughness 0.005 } } #declare tx_fosca = texture{ pigment{ color rgb < 0.69, 0.52, 1.00 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca_prata = texture{ pigment{ color rgb < 0.80, 0.80, 0.80 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca_amarela = texture{ pigment{ color rgb < 1.0, 0.8, 0.1 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca_dark = texture{ pigment{ color rgb < 0.2, 0.2, 0.2 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_espelho = texture{ pigment{ color rgb < 1.00, 1.0, 1.0 > } finish{ diffuse 0.5 reflection 0.7*< 1.0, 1.0, 1.0 > ambient 0.7 } } #declare tx_vidro = texture{ pigment{ color rgb < 0.85, 0.95, 1.00 > filter 0.70 } finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 roughness 0.005 } } #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 } // ====================================================================== // DESCRIÇÃO DA CENA #declare chao = box{ <-20,-20,-1>, <+20,+20,0> } #include "eixos.inc" #macro interpola2(p0, p1, tt) ((1-tt)*p0 + tt*p1) #end #macro claw(L, G) union { box { <-0.5, +0.0, -0.3>, <+0.5, +2.0, +0.3> } cylinder { <+0.0, +1.5, +0.0>, <+0.0, +1.5, -1*L>, 0.1 texture { tx_fosca_dark } } union { cylinder { <+0.0, +0.0, +0.0>, <+0.0, +0.0, -0.2>, 0.3 } #local i = 0; #while (i < 360) union { box { <-0.1, +0.0, +0.0>, <+0.1, +1.0, -0.2> } box { <-0.1, +0.8, +0.0>, <+0.1, +1.0, -1.0> } rotate -45*G*x translate 0.3*y rotate i*z } #local i = i + 360/3; #end translate <+0.0, +1.5, -1*L> texture { tx_fosca_amarela } } } #end #macro arm(A, L, G) union { box { <-0.5, +0.0, -0.3>, <+0.5, +10.0, +0.3> rotate } union { cylinder { -0.6*x, +0.6*x, 0.4 texture { tx_fosca_amarela } } claw(L, G) translate vrotate(<0, +10, 0>, ) } } #end #macro crane(R, B, A, L, G) union { box { <-1, -1, 0>, <+1, +1, +0.5> texture { tx_fosca_amarela } } box { <-0.5, +0.0, -0.3>, <+0.5, +10.0, +0.3> rotate } union { cylinder { -0.6*x, +0.6*x, 0.4 texture { tx_fosca_amarela } } arm(A, L, G) translate vrotate(<0, +10, 0>, ) } rotate R*z texture {tx_fosca_prata} } #end #macro params2pos(R, B, A, L, G) vrotate(<+0.0, +1.5, -1*L-(sqrt(2)/2.0)> + vrotate(<0, +10, 0>, ) + vrotate(<0, +10, 0>, ), R*z) #end #macro ball_pos(A, B, tt) #local s0 = A; #local s1 = s0+0.7*(B-s0); #local s2 = s1+0.3*(B-s0); #if (tt < 0.5) #local X = 2*tt; < interpola2(s0.x, s1.x, X), interpola2(s0.y, s1.y, X), -20*X*(X-1.0)+0.5> #else #local X = 2*tt-1; < interpola2(s1.x, s2.x, X), interpola2(s1.y, s2.y, X), -10*X*(X-1.0)+0.5> #end #end #macro ind(T, tt) #local i = 0; #while (T[i+1] < tt) #local i = i+1; #end i #end #macro frame(tt) #local T_t = array[11]{0.0, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, .85, 0.9, 1.0 } #local R_t = array[11]{ 90, 90, -10, -10, -10, -10, -90, -90, -90, -90, 90 } #local B_t = array[11]{130, 130, 70, 70, 70, 70, 100, 100, 100, 100, 130 } #local A_t = array[11]{-30, -30, 10, 10, 10, 10, -10, -10, -10, -10, -30 } #local L_t = array[11]{ 1, 1, 1, 10, 10, 1, 1, 7, 7, 1, 1 } #local G_t = array[11]{ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0 } #local i = ind(T_t, tt); #local F = (tt-T_t[i])/(T_t[i+1]-T_t[i]); #local R = interpola2(R_t[i], R_t[i+1], F); #local B = interpola2(B_t[i], B_t[i+1], F); #local A = interpola2(A_t[i], A_t[i+1], F); #local L = interpola2(L_t[i], L_t[i+1], F); #local G = interpola2(G_t[i], G_t[i+1], F); union { object { #if (i = 0) sphere{ ball_pos(params2pos(R_t[7], B_t[7], A_t[7], L_t[7], 0), params2pos(R_t[4], B_t[4], A_t[4], L_t[4], 0), F), 0.5 } #else #if ( ( i > 0) & (i < 4) ) sphere{ params2pos(R_t[4], B_t[4], A_t[4], L_t[4], 0), 0.5 } #else #if (i < 8) sphere{ params2pos(R, B, A, L, 0), 0.5 } #else sphere{ params2pos(R_t[7], B_t[7], A_t[7], L_t[7], 0), 0.5 } #end #end #end texture{ tx_espelho } } object { crane(R, B, A, L, G) texture{tx_fosca} } } #end union{ //object{ eixos(3.00) } object{ chao translate < 0,0,0 > texture{ tx_xadrez } } object { frame(clock) translate -10*y } } #include "camlight.inc" #declare centro_cena = < 0.00, -5.0, 2.00 >; #declare raio_cena = 20.0; #declare dir_camera = < 14.00, 7.00, 4.00 >; #declare dist_camera = 100.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)