// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2010-03-04 15:44:01 by stolfi // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_plastico = texture{ pigment{ color rgb < 0.10, 0.80, 1.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.2 roughness 0.005 } } #declare tx_verde = texture{ pigment{ color rgb < 0.48, 0.99, 0.00 > } }; #declare tx_cinza_escuro = texture{ pigment{ color rgb < 0.2, 0.2, 0.2 > } }; #declare tx_vermelho = texture{ pigment{ color rgb < 1.00, 0.00, 0.00 > } } #declare tx_marrom = texture{ pigment{ color rgb < 0.92, 0.64, 0.51 > } }; #declare tx_branco = texture{ pigment{ color rgb < 1, 1, 1 > } }; #declare tx_fosca = texture{ pigment{ color rgb < 1.00, 0.80, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_espelho = texture{ pigment{ color rgb < 1.00, 0.85, 0.30 > } finish{ diffuse 0.2 reflection 0.2*< 1.00, 0.85, 0.30 > ambient 0.1 } } #declare tx_vidro = texture{ pigment{ color rgb < 0.90, 0.90, 0.90 > filter 0.70 } finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 roughness 0.005 } } #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 } // ====================================================================== // DESCRIÇÃO DA CENA #declare NQ = 7; //Num Quadros //Movimentos braco esquerdo #declare argBracoEsq = array[NQ]; #declare argBracoEsq[0] = 0; #declare argBracoEsq[1] = 0; #declare argBracoEsq[2] = -90; #declare argBracoEsq[3] = 90; #declare argBracoEsq[4] = -90; #declare argBracoEsq[5] = 0; #declare argBracoEsq[6] = 0; //Movimentos braco direito #declare argBracoDir = array[NQ]; #declare argBracoDir[0] = 0; #declare argBracoDir[1] = 0; #declare argBracoDir[2] = -90; #declare argBracoDir[3] = -90; #declare argBracoDir[4] = 90; #declare argBracoDir[5] = 0; #declare argBracoDir[6] = 0; //Movimentos coxa esquerda #declare argCoxaEsq = array[NQ]; #declare argCoxaEsq[0] = 0; #declare argCoxaEsq[1] = -45; #declare argCoxaEsq[2] = 0; #declare argCoxaEsq[3] = -90; #declare argCoxaEsq[4] = 0; #declare argCoxaEsq[5] = 0; #declare argCoxaEsq[6] = 0; //Movimentos coxa direita #declare argCoxaDir = array[NQ]; #declare argCoxaDir[0] = 0; #declare argCoxaDir[1] = -45; #declare argCoxaDir[2] = 0; #declare argCoxaDir[3] = 0; #declare argCoxaDir[4] = 0; #declare argCoxaDir[5] = 90; #declare argCoxaDir[6] = 0; //Movimentos pernas #declare argPerna = array[NQ]; #declare argPerna[0] = 0; #declare argPerna[1] = 60; #declare argPerna[2] = 0; #declare argPerna[3] = 0; #declare argPerna[4] = 0; #declare argPerna[5] = 0; #declare argPerna[6] = 0; //tempo da danca #declare tempo = array[NQ]; #declare tempo[0] = 0.0; #declare tempo[1] = 0.16; #declare tempo[2] = 0.32; #declare tempo[3] = 0.48; #declare tempo[4] = 0.68; #declare tempo[5] = 0.84; #declare tempo[6] = 1.0; // Partes da cena: #declare cone_branco = cone{ <0, 0, 0>, 1, <0, 0, 2>, 0 texture{ tx_branco } } #declare esfera_branca = sphere{ < 0,0,0 >, 1 texture{ tx_branco } } #declare caixa = box{ <+5,+5,+3>, <-5,-5,-3> texture { tx_branco } } #declare chao = box{ <50, 50, 0>, <-50, -50, 0.5> texture { tx_verde } } #macro cabeca () union{ //cabeca object{ esfera_branca scale <3, 3, 3> } //bochecha E object{ esfera_branca scale <1.4, 1.4, 1.4> translate <2, 0.7, 0.2> } //bochecha D object{ esfera_branca scale <1.4, 1.4, 1.4> translate <2, -0.7, 0.2> } //olho E union { object{ esfera_branca scale <1.2, 1.2, 1.5> translate <1.6, 0.5, 0.8> } object{ esfera_branca scale <0.5, 0.5, 0.5> translate <2.2, 0.65, 1.5> texture{ tx_verde }} } //olho D union { object{ esfera_branca scale <1.2, 1.2, 1.5> translate <1.6, -0.5, 0.8> } object{ esfera_branca scale <0.5, 0.5, 0.5> translate <2.2, -0.65, 1.5> texture{ tx_verde }} } //orelha E difference { object { cone_branco } object { cone_branco translate <0.5, 0, 0> } translate < 0, 0, 2.8> rotate 35 *x } //orelha E difference { object { cone_branco } object { cone_branco translate <0.5, 0, 0> } translate < 0, 0, 2.8> rotate -35 *x } //nariz object{ esfera_branca scale <0.5, 0.7, 0.5> translate <2.8, 0, 1> texture{ tx_cinza_escuro }} //boca difference { object{ esfera_branca scale <1.4, 1.4, 1.4> translate <1.8, 0, -0.2>} object{ esfera_branca scale <1.2, 1.2, 1.2> translate <4, 0, -0.2> texture{ tx_vermelho }} } } #end #macro pata() union { difference { object { esfera_branca scale <1.5,1.5,1.5> } object { caixa translate <0,0,-3>} } } #end #macro corpo(bracoEsqRot, bracoDirRot, maoEsqRot, maoDirRot, coxaEsqRot, coxaDirRot, pernaEsqRot, pernaDirRot, peEsqRot, peDirRot) union{ object { cabeca() translate <0,0,4> scale<1.3, 1.3, 1.3>} object { esfera_branca scale <4, 4, 4>} object { braco(maoEsqRot) rotate sin(bracoEsqRot)*90 *z rotate 50 *x translate <0, 3, 0.5>} object { braco(maoDirRot) rotate sin(bracoDirRot)*90 *z rotate 50 *x scale<1, -1, 1> translate <0, -3, 0.5>} object { coxa(pernaEsqRot,peEsqRot) rotate 20 *x rotate sin(coxaEsqRot)*90 *y translate <0, 1, -1>} object { coxa(pernaDirRot,peDirRot) rotate -20 *x rotate sin(coxaDirRot)*90 *y translate <0, -1, -1>} } #end #macro braco(pataRot) union{ object { esfera_branca scale <1.5, 3, 1.5> translate <0, 1.5, 0>} object { pata() rotate 90 *x rotate sin(pataRot)*60 *z translate <0, 5.5, 0>} } #end #macro coxa(pernaRot, peRot) union { object { esfera_branca scale <2,2,3> translate <0,0,-3>} object { perna(peRot) rotate sin(pernaRot)*60 *y translate <0,0,-3.5>} } #end #macro perna(peRot) union { object { esfera_branca scale <1.5, 1.5, 2> translate <0, 0, -2.5>} object { pata() rotate sin(peRot)*30 *x translate <0,0,-5.5>} } #end #macro gato(bracoEsqRot, bracoDirRot, maoEsqRot, maoDirRot, coxaEsqRot, coxaDirRot, pernaEsqRot, pernaDirRot, peEsqRot, peDirRot) union { corpo(bracoEsqRot*pi/180, bracoDirRot*pi/180, maoEsqRot*pi/180, maoDirRot*pi/180, coxaEsqRot*pi/180, coxaDirRot*pi/180, pernaEsqRot*pi/180, pernaDirRot*pi/180, peEsqRot*pi/180, peDirRot*pi/180) } #end #macro quadro_anterior(fase) #local i=0; #while(i=fase)) #local resp = i; #end #local i=i+1; #end resp #end #macro danca(fase) union { #local i = quadro_anterior(fase); object { gato( interpola(tempo[i], argBracoEsq[i], tempo[i+1], argBracoEsq[i+1], fase), interpola(tempo[i], argBracoDir[i], tempo[i+1], argBracoDir[i+1], fase), 0, 0, interpola(tempo[i], argCoxaEsq[i], tempo[i+1], argCoxaEsq[i+1], fase), interpola(tempo[i], argCoxaDir[i],tempo[i+1], argCoxaDir[i+1], fase), interpola(tempo[i], argPerna[i], tempo[i+1], argPerna[i+1], fase), interpola(tempo[i], argPerna[i], tempo[i+1], argPerna[i+1], fase) 0, 0 ) } } #end #macro interpola(f0, v0, f1, v1, f) #local ss = (f-f0)/(f1-f0); #local rr = 1 - ss; (rr*v0 + ss*v1) #end #include "eixos.inc" // Aqui está a cena, finalmente: union{ object{ chao translate <0,0,-5.5>} object{ danca(clock) scale <0.5, 0.5, 0.5>} } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 12.0; #declare dir_camera = < 10.00, -5.00, 5.00 >; #declare dist_camera = 16.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)