// ====================================================================== // CORES E TEXTURAS background{ color rgb <0.75, 0.80, 0.85> } #declare tx_brown = texture{ pigment { color rgb <0.5, 0.3, 0> } finish { diffuse 0.2 ambient 0.2 } } // ====================================================================== // DESCRIÇÃO DA CENA #declare s = seed(360); #macro robot( p1b1, p1b2, p1b3, p1b4, p2b1, p2b2, p2b3, p2b4, p3b1, p3b2, p3b3, p3b4, p4b1, p4b2, p4b3, p4b4, a1, a2, a3 ) union { box { <-2, -1.25, -0.4>, <2, 1.25, 0.4> } union { object { leg(p1b2, p1b3, p1b4) rotate scale 6 translate <1.75, -1, 0> } object { leg(p2b2, p2b3, p2b4) rotate scale 6 translate <1.75, 1, 0> } object { leg(p3b2, p3b3, p3b4) rotate scale 6 translate <-1.75, -1, 0> } object { leg(p4b2, p4b3, p4b4) rotate scale 6 translate <-1.75, 1, 0> } } object { neck(a2, a3) rotate <0, a1, 0> scale 3 translate <2, 0, 0> } texture { tx_brown } } #end #macro leg(b2, b3, b4) #local leg_base = cylinder { <0, 0, 0>, <0, 0, -0.25>, 0.04 } union { object { leg_base } object { shin(b3, b4) rotate <0, b2 - 90, 0> translate <0, 0, -0.25> } } #end #macro shin(b3, b4) #local shin_base = cylinder { <0, 0, 0>, <0, 0, -0.25>, 0.04 } union { object { shin_base } object { metatarsus(b4) rotate <0, 90 - b3, 0> translate <0, 0, -0.25> } } #end #macro metatarsus(b4) #local metatarsus_base = cylinder { <0, 0, 0>, <0, 0, -0.25>, 0.04 } union { object { metatarsus_base } object { paw() rotate <0, b4 - 90, 0> translate <0, 0, -0.25> } } #end #macro paw() box { <-0.01, -0.05, -0.025>, <0.19, 0.05, 0.025> } #end #macro neck(a2, a3) #local neck_base = cylinder { <0, 0, 0>, <0, 0, 0.75>, 0.10 } union { object { neck_base } object { metaneck(a3) rotate <0, 90 - a2, 0> translate <0, 0, 0.75> } } #end #macro metaneck(a3) #local metaneck_base = cylinder { <0, 0, 0>, <0, 0, 0.4>, 0.075 } union { object { metaneck_base } object { head() rotate <0, a3 - 90, 0> translate <0, 0, 0.4> } } #end #macro head() sphere { <0, 0, 0.25>, 0.25 } #end #declare NQ = 6; #declare PQ = array[19][NQ] { // frente-esquerda {0, 0, 0, 45, 45, 45}, {0, -45, -45, -45, -45, 0}, {0, -20, -20, -20, -20, 0}, {90, 90, 90, 90, 90, 90}, // frente-direita {0, 0, 0, -45, -45, -45}, {0, -45, -45, -45, -45, 0}, {0, -20, -20, -20, -20, 0}, {90, 90, 90, 90, 90, 90}, // trás-esquerda {0, 0, 0, 0, 45, 45}, {0, 0, -45, -45, -45, 0}, {0, 0, -20, -20, -20, 0}, {90, 90, 90, 90, 90, 90}, // trás-direita {0, 0, 0, 0, -45, -45}, {0, 0, -45, -45, -45, 0}, {0, 0, -20, -20, -20, 0}, {90, 90, 90, 90, 90, 90}, // cabeça {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {90, 90, 90, 90, 90, 90} } #declare TQ = array[NQ + 1] { 0, 0.166, 0.333, 0.5, 0.666, 0.833, 1 } #macro acha_quadro(tt) #local i = 0; #while (tt > TQ[i]) #local i = i + 1; #end max(i - 1, 0) #end #macro interpol(p, tt) #local k = acha_quadro(tt); #local current = PQ[p][k]; #local next = PQ[p][mod(k + 1, NQ)]; #local ta = TQ[k]; #local tb = TQ[k + 1]; #local s = (mod(tt, 1) - ta) / (tb - ta); current + ((next - current) * s) #end #macro cena(tt) union { object { robot( interpol(0, tt), interpol(1, tt), interpol(2, tt), interpol(3, tt), interpol(4, tt), interpol(5, tt), interpol(6, tt), interpol(7, tt), interpol(8, tt), interpol(9, tt), interpol(10, tt), interpol(11, tt), interpol(12, tt), interpol(13, tt), interpol(14, tt), interpol(15, tt), interpol(16, tt), interpol(17, tt), interpol(18, tt) ) translate <-2, 0, 0> rotate <-45, -90, 0> } cylinder { <0, -1, -10>, <0, -1, 5>, 0.25 texture { tx_brown } } } #end #include "eixos.inc" eixos(5) union { object { cena(clock) } } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 8.0; #declare dir_camera = < 14.00, 7.00, 6.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)