// ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_xadrez = texture{ pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } #declare tx_gato = texture{ pigment{ color rgb <0.4,0.4,0.4>} } // ====================================================================== // DESCRIÇÃO DA CENA #declare NQ = 6; #declare argA = array[NQ] {0,0,30,0,0,0} #declare argB = array[NQ] {0,0,0,30,0,0} #declare argC = array[NQ] {0,30,-30,0,0,0} #declare argD = array[NQ] {0,0,0,-30,30,0} #declare argP = array[NQ] {0,15,30,30,15,0} #declare argQ = array[NQ] {0,15,30,30,15,0} #declare argR = array[NQ] {0,-15,-30,-30,-15,0} #declare argS = array[NQ] {0,-15,-30,-30,-15,0} #declare argT = array[NQ] {0,0,15,-30,0,0} #declare argU = array[NQ] {0,0,15,-30,0,0} #declare tempo = array[NQ] {0.0,0.20,0.40,0.60,0.80,1.00} #macro interpola (f0,v0,f1,v1,f) #local ss=(f-f0)/(f1-f0); #local rr=1-ss; (rr*v0+ss*v1) #end #macro quadro_anterior(fase) #local i=0; #while (i=fase)) #local resp= i; #end #local i=i+1; #end (resp) #end #macro boneco_dancando(fase) #local i = quadro_anterior(fase); #local a = interpola (tempo[i],argA[i],tempo[i+1],argA[i+1],fase); #local b = interpola (tempo[i],argB[i],tempo[i+1],argB[i+1],fase); #local c = interpola (tempo[i],argC[i],tempo[i+1],argC[i+1],fase); #local d = interpola (tempo[i],argD[i],tempo[i+1],argD[i+1],fase); #local p = interpola (tempo[i],argP[i],tempo[i+1],argP[i+1],fase); #local q = interpola (tempo[i],argQ[i],tempo[i+1],argQ[i+1],fase); #local r = interpola (tempo[i],argR[i],tempo[i+1],argR[i+1],fase); #local s = interpola (tempo[i],argS[i],tempo[i+1],argS[i+1],fase); #local T = interpola (tempo[i],argT[i],tempo[i+1],argT[i+1],fase); #local U = interpola (tempo[i],argU[i],tempo[i+1],argU[i+1],fase); gato(a,b,c,d,p,q,r,s,T,U) #end // Partes da cena: #declare chao = box{ <-20,-20,-1>, <+20,+20,0> } #declare cabeca = sphere{ <0,0,0>, 1 texture{ tx_gato }} #declare tronco = cone {<0,0,0>, 2, <0,0,4>, 1 texture{ tx_gato }} #declare orelha = cone {<0,0,0>, 0.3, <0,0,0.7>, 0 texture{ tx_gato }} #macro gato(bdir,besq,abdir,abesq,pdir,pesq,cdir,cesq,pedir,peesq) union{ object{cabeca translate <0,0,5>} object{orelha translate <0,+0.6,5.6>} object{orelha translate <0,-0.6,5.6>} object{tronco translate <0,0,0>} object{braco(abdir) rotate <90+bdir,0,0> translate <0,+1,3.7> } object{braco(abesq) rotate <90+besq,0,0> scale<+1,-1,+1> translate <0,-1,3.7>} object{perna(cdir,pedir) rotate translate <0,+1,-0.1>} object{perna(cesq,peesq) rotate scale<+1,-1,+1> translate <0,-1,-0.1>} } #end #macro braco(alfa) #local ombro = sphere {<0,0,0>, 0.4 texture{ tx_gato }} #local brac = cylinder {<0,0,0>, <0,0,-1.6>, 0.4 texture{ tx_gato }} union{ object{ ombro } object{ brac translate <0,0,-0.1> } object{ antebraco() rotate translate <0,0,-1.8> } } #end #macro antebraco() #local cotovelo = sphere {<0,0,0>, 0.4 texture{ tx_gato }} #local antebrac = cylinder {<0,0,0>, <0,0,-1.7>, 0.4 texture{ tx_gato }} #local mao = sphere {<0,0,0> 0.5 texture{ tx_gato }} union{ object { cotovelo } object { antebrac translate <0,0,-0.1> } object { mao translate <0,0,-2.0> } } #end #macro perna(alfa,beta) #local artic = sphere {<0,0,0>, 0.5 texture{ tx_gato }} #local coxaa = cylinder {<0,0,0>, <0,0,-1.8>, 0.6 texture{ tx_gato }} union{ object{ artic } object{ coxaa translate <0,0,-0.2> } object{ canela(beta) rotate translate <0,0,-2.1> } } #end #macro canela(alfa) #local artic = sphere {<0,0,0>, 0.5 texture{ tx_gato }} #local canelaa = cylinder {<0,0,0>, <0,0,-1.5>, 0.5 texture{ tx_gato }} union{ object{ artic } object{ canelaa translate <0,0,-0.2> } object{ pe() rotate <0,alfa,0> translate <0.4,0,-1.7> } } #end #macro pe() #local pee = sphere {<0,0,0>, 0.7 texture{ tx_gato }} object{ pee scale <2,1,0.5>} #end #include "eixos.inc" // Aqui está a cena, finalmente: union{ object{ eixos(3.00) } object{ chao translate < 0,0,-5 > texture{ tx_xadrez } } object{ boneco_dancando(clock) translate <0,0,0> scale <0.5,0.5,0.5>} } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 6.0; #declare dir_camera = < 3,0,2 >; #declare dist_camera = 10.0; #declare intens_luz = 1; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)