#include "camlight.inc" #include "eixos.inc" #include "textures.inc" #include "objs.inc" // ====================================================================== // DESCRICAO DA CENA #declare raio = 1.000; #declare PI = 3.14159; #declare space = 2.000; /////////////////// braco //////////////////// #macro braco(b3, b4) union { #local sub = object { antebraco(b4) } object{ toco } object{ sub rotate <0, b3, 0> translate <0, 0, 2> } } #end #macro antebraco(b4) union { #local sub = object { mao() } object{ toco } object{ sub rotate <0, b4, 0> translate <0, 0, 2> } } #end #macro mao() object{ palma } #end /////////////////// pescoco //////////////////// #macro pescoco(b3, b4) union { #local sub = object { nuca(b4) } object{ toco } object{ sub rotate translate <0, 0, 2> } } #end #macro nuca(b4) union { #local sub = object { m_cabeca() } object{ toco } object{ sub rotate <0, b4, 0> translate <0, 0, 2> } } #end #macro m_cabeca() object{ cabeca } #end // Partes da cena: // #declare chao = box{ <-50,-50,-1>, <+50,+50,0> } // object{ chao translate < -50,-50,-50 > texture{ tx_xadrez } } #macro bicho(b01, b02, b03, b04, b11, b12, b13, b14, b21, b22, b23, b24, b31, b32, b33, b34, p1, p2, p3, p4) union { object { corpo translate <0, 0, 2> } object { braco(b03, b04) rotate translate < -2.0 , 2.00, 2.5 > } object { braco(b13, b14) rotate scale <-1, 1, 1> translate < 2.0 , 2.00, 2.5 > } object { braco(b23, b24) rotate translate < -2.0 , -2.00, 2.5 > } object { braco(b33, b34) rotate scale <-1, 1, 1> translate < 2.0 , -2.00, 2.5 > } object { pescoco(p1, p2) rotate translate < 0.0 , 3.0, 2.5 > } } #end #macro cena(tt) #local walking_motion = sin(2 * PI * tt) * 30; #local neck_motion = -sin(2 * PI * tt) * 15; #local head_motion = sin(4 * PI * tt) * 15 - sin(2 * PI * tt) * 15; #local open_arms_1 = max(0, -cos(2 * PI * tt) * 45); #local open_arms_2 = max(0, cos(2 * PI * tt) * 45); #local b01 = -10 + walking_motion; #local b02 = 200; #local b03 = -45 + open_arms_1; #local b04 = -10; #local b11 = -10 - walking_motion; #local b12 = 200; #local b13 = -45 + open_arms_2; #local b14 = -10; #local b21 = 30 - walking_motion; #local b22 = 200; #local b23 = -45 + open_arms_2; #local b24 = -10; #local b31 = 10 + walking_motion; #local b32 = 200; #local b33 = -45 + open_arms_1; #local b34 = -10; #local p1 = 30 + head_motion; #local p2 = 0; #local p3 = -90 - neck_motion; #local p4 = 0; object { bicho(b01, b02, b03, b04, b11, b12, b13, b14, b21, b22, b23, b24, b31, b32, b33, b34, p1, p2, p3, p4) rotate <180, 0, 90> translate < 0 , 0, 0 > } #end cena(clock) union { object { eixos(5) } } #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 20.0; #declare dir_camera = < 180.00, 180.00, 10.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.0; camlight(centro_cena, raio_cena, dir_camera, dist_camera, z, intens_luz)