// Last edited on 2013-12-11 11:24:02 by stolfilocal
// Processed by remove-cam-lights

background{ color rgb < 0.75, 0.80, 0.85 > }

#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"
#include "stones.inc"
#include "metals.inc"
#include "transforms.inc"

#declare tx_plastico =
  texture{
    pigment{ color rgb < 0.10, 0.80, 1.00 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#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.7*< 1.00, 0.85, 0.30 > ambient 0.1 }
  }

#declare tx_vidro =
  texture{
    pigment{ color rgb < 0.85, 0.95, 1.00 > 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
  }
#declare vermelho =
  texture{
    pigment{ checker color rgb < 1, 0, 0 >, color rgb < 1.00, 0, 0 > }
    finish{ diffuse 0.9 ambient 0.1 }
    scale 2.0
  }

#declare raio = 2.000;

#include "eixos.inc"
#declare bola =
        sphere{ <0,0,0> 0.5
                texture{tx_fosca}
                }

#macro interpola4(p0,p1,p2,p3,tt)

        #local p01 = interpola2(p0,p1,tt);
        #local p12 = interpola2(p1,p2,tt);
        #local p23 = interpola2(p2,p3,tt);
        #local p012 = interpola2(p01,p12,tt);
        #local p123 = interpola2(p12,p23,tt);
        #local p0123 = interpola2(p012,p123,tt);
        p0123

#end

#macro interpola2(p0,p1,tt)
                #local posicao =         (1-tt)*p0 + tt*p1;
                posicao
#end

#macro tentaculo_animado(p0,p1,p2,p3,tt)
                union{

                #while(tt<=1)
                #local bola2 =
                sphere{ <0,0,0> 0.5*(1-tt)
                texture{tx_fosca}
                }
                object {bola2  translate interpola4(p0,p1,p2,p3,tt) texture{PinkAlabaster} }

                #local tt = tt +0.01;
                #end
        }
        #end

        #if (clock<0.25)
                #declare tempp = 10*(clock);
        #end
        #if (clock>=0.25&clock<0.75)
                #declare tempp = 10*(-clock + 0.5);
        #end
        #if (clock>=0.75)
                #declare tempp = 10*(clock - 1);
        #end

        #declare p0 =<0,0,0.5>;
        #declare p1 =<0,2,3*tempp>;
        #declare p2 =<0,4,-3*tempp>;
        #declare p3 =<0,6,0.5*tempp>;
        #declare q0 =p0;
        #declare q1 = <2,-2,3*tempp>;
        #declare q2 = <4,-4,-3*tempp>;
        #declare q3 = <6,-6,0.5*tempp>;
        #declare g0 = p0;
        #declare g1 = <-2,-2,3*tempp>;
        #declare g2 = <-4,-4,-3*tempp>;
        #declare g3 = <-6,-6,0.5*tempp>;

        union{
                object {bola  translate <0,0,0.5> scale 4 texture{PinkAlabaster} }
                object {bola  translate <0,0,1.1> scale 3 texture{PinkAlabaster} }
        tentaculo_animado(p0,p1,p2,p3,0)
        tentaculo_animado(q0,q1,q2,q3,0)
        tentaculo_animado(g0,g1,g2,g3,0)

        }

#include "camlight.inc"
#declare centro_cena = < 0.00, 0.00, 1.00 >;
#declare raio_cena = 10.0;
#declare dir_camera = < 10, 0,5 >;
#declare dist_camera = 10.0;
#declare intens_luz = 1.00;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)