#include "colors.inc" #include "stones.inc" #include "textures.inc" // Trabalho 2 de MC930 // ====================================================================== // CÂMERA camera { location < 35.00, 30.00, 20.00 > // Posição do observador. right -0.75*x // Largura RELATIVA da imagem. up 1.00*y // Altura RELATIVA da imagem. sky z // Qual direção é "para cima"? look_at < -10.00, 0.00, 0.00 > // Para onde a câmera está apontando. } // Nota: os parâmetros "right" e "up" devem ter a mesma proporção // que os parâmetros ${WIDTH} e ${HEIGHT} no Makefile. // ====================================================================== // FONTES DE LUZ light_source { 10 * < +50.0, +30.0, +50.0 > // Posição da lâmpada. color rgb 1.2 * < 1.00, 1.00, 1.00 > // Intensidade e corda luz. } light_source { 10 * < +50.0, -10.0, +10.0 > // Posição da lâmpada. color rgb 0.8 * < 1.00, 1.00, 1.00 > // Intensidade e corda luz. } // ====================================================================== // DESCRIÇÃO DA CENA background{ color rgb < 0.75, 0.80, 0.85 > } #declare eixo = union { //Eixo1 cylinder { < 0, -2.6, 0>, // Center of one end < 0, 2.6, 0>, // Center of other end 0.3 // Radius texture { pigment {color Gray} } } //Roda Box 1 torus { 0.6 , 0.4 // major and minor radius translate 2.1*y texture { pigment { color Gray } } } //Roda Box 2 torus { 0.6 , 0.4 // major and minor radius translate -2.1*y texture { pigment { color Gray } } } } #declare locomotiva = union { lathe { linear_spline 4, <1,0>, <2,3>, <1,3>, <1,0> texture { pigment {color Gray} } rotate x*90 translate z*3 translate x*2 } cylinder { < 4, 0, 2>, // Center of one end < 4.2, 0, 2>, // Center of other end 1.5 // Radius texture { pigment {color rgb <0.5,0.5,0.5>} } } cylinder { < 0, 0, 2>, // Center of one end < 4, 0, 2>, // Center of other end 2 // Radius texture { pigment {color Gray} } } difference { box { <-3, -2, 0>, // Near lower left corner < 0, +2, 8> // Far upper right corner texture { pigment { color Gray } } } box { <-2.8, -1.8, 0.2>, // Near lower left corner <-0.2, +1.8, 7.8> // Far upper right corner texture { pigment { color Gray } } } box { <-2, -2.1, 3>, // Near lower left corner <-1, +2.1, 6> // Far upper right corner } } //difference object {eixo translate x*-1} object {eixo translate x*3} } //Union #declare vagao = union { //Engate box { <-5, +0.5, 0>, // Near lower left corner <-3, -0.5, 1> // Far upper right corner texture { pigment { color Black } } } //Box difference { box { <-11, +2, 0>, // Near lower left corner < -5, -2, 7> // Far upper right corner texture { pigment { color Blue } } } box { <-10.8, +1.8, 0.2>, // Near lower left corner < -5.2, -2.2, 6.8> // Far upper right corner texture { pigment { color Blue } } } cylinder { < -6.5, -2.1, 4>, // Center of one end < -6.5, 2.1, 4>, // Center of other end 0.6 // Radius } cylinder { < -8, -2.1, 4>, // Center of one end < -8, 2.1, 4>, // Center of other end 0.6 // Radius } cylinder { < -9.5, -2.1, 4>, // Center of one end < -9.5, 2.1, 4>, // Center of other end 0.6 // Radius } } //Difference //Detalhe... box { <-9, +1, 7>, // Near lower left corner <-7, -1, 8> // Far upper right corner texture { pigment { color Cyan } } } object { eixo translate -5*x} object { eixo translate -7*x} object { eixo translate -9*x} object { eixo translate -11*x} } //Union #declare trilho = union { box { <-100, 2.6, -1.2>, // Near lower left corner <100, 1.8, -1> // Far upper right corner texture { pigment { color Silver } } } #declare i = 0; #while (i < 200) box { <-0.2, -2, -1.2>, // Near lower left corner < 0.2, 2, -1> // Far upper right corner texture { pigment { color Brown } } translate (i-100)*x } #declare i = i + 1; #end box { <-100, -1.8, -1.2>, // Near lower left corner <100, -2.6, -1> // Far upper right corner texture { pigment { color Silver } } } } #declare vagoes = union { #declare G = seed(1273); #declare i = 0; #declare a=rand(G)*5 + 5; #while (i < a) object {vagao translate (-(8*i))*x} #declare i = i + 1; #end } //agora vem a cena com animação! #declare Xclock = 360*clock; object { locomotiva translate x*10*(sin(Xclock)) } object { vagoes translate x*10*(sin(Xclock)) } object {trilho} //Plano onde o trem descansa plane { <0, 0, 1>, -1.3 texture { Jade } }