// 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_fosca = texture{ pigment{ color rgb < 1.00, 0.80, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_blue = texture{ pigment{ color rgb < 0.10, 0.80, 1.00 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_green = texture{ pigment{ color rgb < 0.10, 1.00, 0.20 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_red = texture{ pigment{ color rgb < 1.00, 0.20, 0.20 > } finish{ diffuse 0.9 ambient 0.1 } } #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 0.22 } // ====================================================================== // DESCRIÇÃO DA CENA // Partes da cena: #include "glass.inc" #include "eixos.inc" // Aqui está a cena, finalmente: #macro square_button(button_l, button_z) box { <-button_l/2, -button_l/2, 0>, <+button_l/2, +button_l/2, button_z> } #end #macro round_button(button_l, button_z) cylinder { <0, 0, 0>, <0, 0, button_z>, button_l/2 } #end #local alavanca_haste_r = 0.02; #local alavanca_handle_r = 0.04; #local alavanca_handle_l = 0.16; #macro alavanca(button_l, button_z) #local alavanca_h = 2 * button_z; union { cylinder { <0, 0, 0>, , alavanca_haste_r } cylinder { , , alavanca_handle_r } } #end #local button_h = 0.05; #local button_li = 0.1; #local button_lf = 0.3; #macro button_line(n_buttons, table_x, padding_x, button_kind, central_button) #local button_delta_l = (button_lf-button_li) / n_buttons; union { #local distance_buttons = (table_x - 2*padding_x) / (2*n_buttons); #declare i = 0; #while (i <= 2*n_buttons) #if (i <= n_buttons) #declare button_l = button_li + i*button_delta_l; #else #declare button_l = button_li + (2*n_buttons-i)*button_delta_l; #end #if (i = n_buttons) object { central_button translate } #else #if (button_kind = 1) object { square_button(button_l, button_h) translate } #else #if (button_kind = 2) object { round_button(button_l, button_h) translate } #else object { alavanca(((i <= n_buttons)?(-button_li):(button_li)), button_h) translate } #end #end #end #declare i = i+1; #end } #end #local padding = 0.2; #macro painel(table_x, table_y, table_z) union { box { <0,0,0>, texture{ tx_fosca } } #declare red_button = object{ round_button(button_lf, button_h) texture{ tx_red } } #declare boxed_red_button = object{ union { box { <-button_lf/2, -button_lf/2, 0>, texture{ T_Glass1 } } red_button } } object{ button_line(4, table_x, padding, 1, boxed_red_button) texture{ tx_blue } translate<0, padding+button_lf/2, table_z> } #declare nothing = box{<0,0,0>, <0,0,0>} object{ button_line(5, table_x, padding, 2, nothing) texture{ tx_green } translate<0, 2*padding+3*button_lf/2, table_z> } #declare alavanca_central = alavanca(0, button_h) object{ button_line(3, table_x, padding, 3, alavanca_central) texture{ tx_blue } translate<0, 3*padding+5*button_lf/2, table_z> } #declare central_button = square_button(button_lf, button_h) object{ button_line(4, table_x, padding, 1, central_button) texture{ tx_green } translate<0, 4*padding+7*button_lf/2, table_z> } } #end //#local table_y = 2.0; #local table_y = 5*padding + 4*button_lf; #local table_x = 3.0; #local table_h = 0.3; union{ object{ eixos(3.00) } object{ painel(table_x, table_y, table_h) } } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 4.0; #declare dir_camera = < 7.00, 7.00, 4.00 >; #declare dist_camera = 8.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)