// Last edited on 2003-04-12 07:47:45 by stolfi // José Renato Paulon // Exercicio 5 #include "colors.inc" #include "textures.inc" #include "stones.inc" #include "finish.inc" background{White} camera { location <120,60,-200> right <1.2,0,0> up <0,0,0.4> sky <0,1,0> look_at <10,15,90> } light_source {20*<30,30,30> color 1.2*White} light_source {20*<30,30,-30> color 1.2*White} light_source {<10,3,-10> color 0.5*White} sky_sphere{ pigment {Blue_Sky} } #declare gerador = seed(1623563); #declare cor_cristal = <1,0,0>; #declare tx_cristal= texture{ finish{ ambient 0.1 diffuse 0.1 reflection 0.25 specular 1 roughness 0.001 } pigment {color cor_cristal filter 1} } #declare cor_espelho = <1,0.5,0.7>; #declare tx_espelho= texture{ pigment{ rgb cor_espelho} finish{ ambient 0.05 diffuse 0.05 reflection cor_espelho specular 0.20 roughness 0.05 } } #declare cor_metal = <0.2,0.2,0.2>; #declare tx_metal= texture{ pigment{ rgb cor_metal} finish{ ambient 0.05 diffuse 0.05 reflection cor_metal specular 0.20 roughness 0.05 } #declare tx_madeira = texture { pigment { DMFWood4 scale 4 } finish { Shiny } // pre-defined in finish.inc } } #declare tx_piso = texture { pigment { checker <0,0,0>,<1,1,1> scale 10 } } plane { y, -10 texture {tx_piso} } //Prateleira------------------------------------------------------------------ #declare prat = box { <-5, -2, -2>, // Near lower left corner <60 , -4, 4> // Far upper right corner pigment {Brown} //texture {tx_metal} } //Missel---------------------------------------------------------------------- //ogiva #declare ogiva = sphere {<18,6,0>, 2.5 pigment {Red} texture {tx_espelho} } //cilindro espelhado #declare corpo = cylinder { <0,6,0>,<18,6,0> 2.5 pigment {Brown} texture{tx_metal} } //aletas #declare aleta = box { <0, 3, 0>, // Near lower left corner <5 , 10, 1> // Far upper right corner texture {tx_metal} } #declare aleta2 = box { <0, 6, -8>, // Near lower left corner <5 , 7, 8> // Far upper right corner texture {tx_metal} } #declare misseis = union{ object {aleta} object {aleta2} object {ogiva} object {corpo} } //------------------------------------------------------------------------ #declare bolas = sphere {<0,0,0>, 6 pigment {Yellow} } //------------------------------------------------------------------------ #declare cilindros = cylinder { <0,0,0>, <0,8,0>, 6 pigment {Red}} //------------------------------------------------------------------------ #declare capas = difference { box { <0,0,0>, // Near lower left corner <3,10,6> // Far upper right corner pigment {Blue} } box { <0.3,-1,0.3>, // Near lower left corner <2.7,11,6.3> // Far upper right corner pigment {Blue} } } #declare livros = union { object {capas} box { <0.4,0.4,0.4>, // Near lower left corner <2.6,9.6,6.4> // Far upper right corner pigment {White} } } //------------------------------------------------------------------------ #declare prateleira_tipo1= union{ object{livros translate <40,2,-2>} object{livros translate <35,2,-2>} object{bolas translate <50,8,0>} object{prat translate <0,4,0> texture {tx_madeira}} object{misseis translate <2,0,0>} object{misseis translate <2,5,5>} } //------------------------------------------------------------------------ #declare prateleira_tipo2= union{ object{livros translate <47,2,-2>} object{livros translate <42,2,-2>} object{livros translate <37,2,-2>} object{bolas translate <27,8,0>} object{bolas translate <15,8,0>} object{prat translate <0,4,0> texture {tx_madeira}} } //------------------------------------------------------------------------ #declare prateleira_tipo3= union{ object{cilindros translate <47,3,0> texture {tx_cristal}} object{cilindros translate <30,3,2> texture {tx_cristal}} object{prat translate <0,4,0> texture {tx_madeira}} } //------------------------------------------------------------------------ #declare capas = difference { box { <0,0,0>, // Near lower left corner <3,10,6> // Far upper right corner pigment {Blue} } box { <0.3,-1,0.3>, // Near lower left corner <2.7,11,6.3> // Far upper right corner pigment {Blue} } } //------------------------------------------------------------------------ //Estante----------------------------------------------------------------- #declare estante = difference{ box { <-5, 65, -4>, // Near lower left corner <60 , -6, 5> // Far upper right corner texture {tx_madeira} } box { <-3, 63, -6>, // Near lower left corner <58 , -5, 6> // Far upper right corner texture {tx_madeira} } } #declare fileira = union{ #declare i =0; #while (i<4) object {estante translate <0,0,i*30> } #declare k =0; #while (k<3) #declare j = floor(3*rand(gerador)); #if (j=0) object {prateleira_tipo1 translate <0,k*20,i*30> } #end #if (j=1) object {prateleira_tipo2 translate <0,k*20,i*30> } #end #if (j=2) object {prateleira_tipo3 translate <0,k*20,i*30> } #end #declare k =k+1; #end #declare i = i+1; #end } object{fileira} //object{prateleira_tipo1 translate <0,40,0>} //object{prateleira_tipo2 translate <0,20,0>} //object{prateleira_tipo3} //object{estante}