// CORES E TEXTURAS
#include "eixos.inc"
background{ color rgb < 0.75, 0.80, 0.85 > }
#declare random = seed (1153);
#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 < 0, 0.80, 0> }
finish{ diffuse 0.9 ambient 0.1 }
}
#declare tx_verde =
texture{
pigment{ color rgb < 0, 0.80, 0> }
finish{ diffuse 0.9 ambient 0.1 }
}
#declare tx_azul =
texture{
pigment{ color rgb < 0, 0, 1> }
finish{ diffuse 0.9 ambient 0.1 }
}
#declare tx_laranja =
texture{
pigment{ color rgb < 0.9, 0.5, 0.2> }
finish{ diffuse 0.9 ambient 0.1 }
}
#declare tx_marrom =
texture{
pigment{ color rgb < 0.6, 0.3, 0> }
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 roleta = seed(1);
#declare chao =
box{ <-20,-20,-2>, <+20,+20,-3> texture{tx_xadrez}}
#declare esfera_base =
sphere{
<0,0,0>, 1
texture {tx_laranja}
}
#macro gera_esfera(P, R)
union{
object{esfera_base translate
}
}
#end
#macro segtaculo(M, P0, R0, P1, R1, P2, R2, P3, R3)
union{
#local mm = 0;
#local tt = 0;
#while(mm < M)
#local pp = inter_bezier(tt, P0, P1, P2, P3);
#local rr = inter_bezier(tt, R0, R1, R2, R3);
object{sphere{pp, rr texture{tx_verde}}}
#local mm = mm + 1;
#local tt = tt + (1/M);
#end
}
#end
#macro tentaculo(M, N, PP, RR)
union{
#local nn = 0;
#while(nn < N)
segtaculo(M, PP[nn][0], RR[nn][0], PP[nn][1], RR[nn][1], PP[nn][2], RR[nn][2], PP[nn][3], RR[nn][3])
#local nn = nn + 1;
#end
}
#end
#macro tentaculo_teste(M)
union{
#local N = 4;
#local PP = array[4][4];
#local RR = array[4][4];
#local PP[0][0] = <0,0,0>;
#local PP[0][1] = <0,2,2>;
#local PP[0][2] = <0,4,2>;
#local PP[1][1] = <0,8,-2>;
#local PP[1][2] = <0,10,-2>;
#local PP[2][1] = <0,14,2>;
#local PP[2][2] = <0,16,2>;
#local PP[3][1] = <0,20,-2>;
#local PP[3][2] = <0,22,-2>;
#local PP[3][3] = <0,24,0>;
#local PP[0][3] = (PP[0][2] + PP[1][1])/2;
#local PP[1][0] = PP[0][3];
#local PP[1][3] = (PP[1][2] + PP[2][1])/2;
#local PP[2][0] = PP[1][3];
#local PP[2][3] = (PP[2][2] + PP[3][1])/2;
#local PP[3][0] = PP[2][3];
#local RR[0][0] = 0.15;
#local RR[0][1] = 0.4;
#local RR[0][2] = 0.6;
#local RR[1][1] = 0.6;
#local RR[1][2] = 0.4;
#local RR[2][1] = 0.6;
#local RR[2][2] = 0.4;
#local RR[3][1] = 0.6;
#local RR[3][2] = 0.4;
#local RR[3][3] = 0.15;
#local RR[0][3] = (RR[0][2] + RR[1][1])/2;
#local RR[1][0] = RR[0][3];
#local RR[1][3] = (RR[1][2] + RR[2][1])/2;
#local RR[2][0] = RR[1][3];
#local RR[2][3] = (RR[2][2] + RR[3][1])/2;
#local RR[3][0] = RR[2][3];
tentaculo(M, N, PP, RR)
}
#end
#macro inter_bezier(tt, P1, P2, P3, P4)
#local PB = P1 * pow((1-tt), 3) + 3 * P2 * tt * pow((1-tt), 2) + 3 * P3 * pow(tt,2) * (1-tt) + P4 * pow(tt,3);
PB
#end
object{tentaculo_teste(20)}
#include "camlight.inc"
#declare centro_cena = <0, 13, 0>;
#declare raio_cena = 17.0;
#declare dir_camera = <3, 3, 2>;
#declare dist_camera = 5*raio_cena;
#declare intens_luz = 1.20;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)