// Last edited on 2019-07-17 12:54:58 by stolfilocal // Processed by remove-cam-lights #include "eixos.inc" #include "dados.inc" background{ color rgb < 0.75, 0.80, 0.85 > } #declare tex = texture{ pigment{ color rgb < 1.00, 0.80, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare body = difference{ cylinder{ <-2,0,0>, <2,0,0>, 0.5 texture {tex} } box{ <-2.1,-0.5,0>, <2.1,0.5,-0.5> texture {tex} } } #declare Claw = union{ sphere{ <0,0,0>, legRadio texture {tex} } cylinder{ <0,legRadio,0>, <0,clawLen,0>, legRadio texture {tex} } } #macro Tarsus(angClaw) union{ sphere{ <0,0,0>, legRadio texture {tex} } cylinder{ <0,legRadio,0>, <0,tarsusLen,0>, legRadio texture {tex} } object{Claw rotate translate <0,legRadio+tarsusLen,0>} } #end #macro Tibia(angTarsus,angClaw) union{ sphere{ <0,0,0>, legRadio texture {tex} } cylinder{ <0,legRadio,0>, <0,tibiaLen,0>, legRadio texture {tex} } object{Tarsus(angClaw) rotate translate <0,legRadio+tibiaLen,0>} } #end #macro Femur(angTibia,angTarsus,angClaw) union{ sphere{ <0,0,0>, legRadio texture {tex} } cylinder{ <0,legRadio,0>, <0,femurLen,0>, legRadio texture {tex} } object{Tibia(angTarsus,angClaw) rotate translate <0,legRadio+femurLen,0>} } #end #macro Coxa(angFemur,angTibia,angTarsus,angClaw) union{ sphere{ <0,0,0>, legRadio texture {tex} } cylinder{ <0,legRadio,0>, <0,coxaLen,0>, legRadio texture {tex} } object{Femur(angTibia,angTarsus,angClaw) rotate translate <0,legRadio+coxaLen,0>} } #end #macro Leg(angCoxa,angFemur,angTibia,angTarsus,angClaw,transl,reflect) object{Coxa(angFemur,angTibia,angTarsus,angClaw) rotate<0,0,angCoxa> translate < transl,0,0 > scale<1,reflect,1>} #end #macro Dragon(dragon) #local f=0; #for(l,0,nLegs-1) object{body translate <0,0,0.1>} object{Leg( dragon[l][0], dragon[l][1], dragon[l][2], dragon[l][3], dragon[l][4], dragon[l][5], dragon[l][6])} #end #end #macro interp1KeyFrame (NP,NA,Q,k0,t0,t1,tt,R) #for (i, 0, NP-1, 1) #for (k, 0, NA-1, 1) #declare R[i][k] = interp1(Q[k0][i][k], Q[k0+1][i][k], t0, t1, tt); #end #end #end #macro interp1 (v0, v1, t0, t1, tt) #local rr = (tt - t0) / (t1 - t0); #local ss = 1 - rr; #local vv = ss * v0 + rr * v1; vv #end #macro busca_tempo(clk, nk, tk) #local result = -1; #for (k, 0, nk-2, 1) #if ((tk[k] <= clk) & (clk <= tk[k+1])) #local result = k; #end #end #if (result = -1) #local result = nk-1; #end result #end // object{ eixos(3.00) } #declare frame = busca_tempo(clock, nFrames, tk); interp1KeyFrame(nLegs,nParam,Q,frame,0,1,clock,R) Dragon(R) #include "camlight.inc" #declare centro_cena = < 0, 0, -1.0>; #declare raio_cena = 6.0; #declare dir_camera = < 10, -5, 5 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)