#include "colors.inc" //Dependencias //Iluminação light_source { <15, 15, -15> color rgb <1, 1, 1> } light_source { <10, 10, -10> color rgb <1, 1, 1> } // Observador camera { location <10,5,15> right -1.00*x // Largura RELATIVA da imagem. up 0.50*y // Altura RELATIVA da imagem. sky y // Qual direção é "para cima"? look_at <0, 0, 0> } //Fundo background{ color rgb < 1, 1, 1 > } //Cores #declare cor_metalico = <0.4, 0.31, 0.25>; #declare cor_cristal = <0.98, 0.98, 0.98, 0.9>; #declare amarelo = texture { pigment { color rgb < 1.00, 0.80, 0.10 > } finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 } } //Texturas #declare tx_metalico = texture { pigment { rgb cor_metalico } finish { ambient 0.05 diffuse 0.05 reflection cor_metalico specular 0.20 roughness 0.05 } } #declare tx_cristal = texture { finish { ambient 0 diffuse 0 reflection 0.5 refraction 0.85 ior 1.5 phong 0.3 phong_size 60 specular 1 roughness 0.001 } pigment { color rgbf cor_cristal filter 1} } /*********************Auxiliar******************/ #declare eixos = union { // x axis cylinder { <-50, 0, 0>, <50, 0, 0>, 0.1 pigment { color rgb <1, 0, 0> } } // y axis cylinder { <0, -50, 0>, <0, 50, 0>, 0.1 pigment { color rgb <0, 1, 0> } } //z axis cylinder { <0, 0, -50>, <0, 0, 50>, 0.1 pigment { color rgb <0, 0, 1> } } } /***************************************/ //Cenário/////////////////////////////// #declare trilhos = union { torus { 5.5, 0.05 texture {tx_metalico} //pigment { color Yellow } //scale <1.5, 1, 1> //rotate <-45, 0, 0> //translate <0, 2, 0> } torus { 4.75, 0.05 texture {tx_metalico} //scale <1.5, 1, 1> //rotate <-45, 0, 0> //translate <0, 2, 0> } } plane { // the floor y, 0 // along the x-z plane (y is the normal vector) pigment { color rgb <0, 0.5, 0.32> } // checkered pattern } /////////////////////////////////////////////////// /***********************Trem*********************************/ //Rodas #declare roda_dir = cylinder { < 5.45, 0.35, 0> < 5.55, 0.35, 0> 0.3 texture {tx_metalico} } #declare roda_esq = cylinder { < 4.7, 0.35, 0> < 4.8, 0.35, 0> 0.3 texture {tx_metalico} } #declare rodas4 = union{ #declare i=0; #while (i<2) union { object {roda_dir} object {roda_esq} rotate y*7*i } #declare i = i + 1; #end } #declare rodas_vagao = union{ #declare i = 0; #while (i < 2) object { rodas4 rotate y*20*i } #declare i = i + 1; #end } //Janela #declare janela = box { <4.24, 1.1, 1.3> <6.1,1.9,1.7> texture {tx_cristal } } //Janelas #declare janelas = union{ #declare i = 0; #while (i > -3) object { janela translate <0,0,i> } #declare i = i - 0.7; #end } //Carroceria #declare carroceria = box { <4.25, 0.7, -2> <6,2.3,2> texture { amarelo} } //Carro #declare carro = difference { object {carroceria} object {janelas} rotate y*14 } //Um vagão #declare vagao = union { object {rodas_vagao} object {carro} } //O trem #declare trem = union{ #declare i = 0; #while (i < 4) object { vagao rotate y*52.5*i } #declare i = i + 1; #end } //Estação #declare estacao = union { text { ttf "timrom.ttf" "Estacao Sujera" 1, 0 pigment { Red } rotate 90*y translate <-6.9,3,4> } difference { object { box { <-7, 0, -6> <-10, 4,6> pigment { Blue} } } object { box { <-6.9, 0, -6> <-8.5, 2,6> pigment { Blue} } } } } /*************************Animação*****************/ #declare animacao = union { //Variáveis de Animação #declare tt = clock; #declare h = 0.2; #declare circulo = 360; #declare a = circulo/(2*h*(1-h)); #declare velocidade = 2*a*h; #declare posicao_desaceleracao = -a*h*h; #if (tt < 0.2) #declare posicao = a*tt*tt; object {trem rotate posicao*y} #else #if (tt <0.8) #declare posicao = posicao_desaceleracao + velocidade*tt; object {trem rotate posicao*y} #else #declare posicao = circulo - a*(1-tt)*(1-tt); object {trem rotate posicao*y} #end #end } /*************************************************************/ // Aqui está a cena, finalmente: union { //object {eixos} object {trilhos} object {estacao} //object {trem} object {animacao} }