// Last edited on 2019-07-15 23:44:07 by stolfilocal
// Processed by remove-cam-lights

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

#declare tx_plastico_branco =
  texture{
    pigment{ color rgb < 1.0, 1.0, 1.0 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#declare tx_plastico_preto =
  texture{
    pigment{ color rgb < 0.0, 0.0, 0.0 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#declare tx_plastico_vermelho =
  texture{
    pigment{ color rgb < 0.90, 0.20, 0.10 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#declare tx_plastico_azul =
  texture{
    pigment{ color rgb < 0.1, 0.2, 0.9 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#macro camara_0_0 (textura)
  sphere{
    < 1.0, 1.00, 2.1 >,
                0.6
    texture{ textura }
  }
#end

#macro camara_0 (textura)
                union{
                        object{ camara_0_0(textura) }   // 0 - sphere
                        object{ camara_0_1(textura) }   // 1 - cylinder
                        object{ camara_0_2(textura) }   // 2 - cone
                        object{ camara_0_3(textura) }   // 3 - cylinder
                }
#end

#macro mina (n, m)

        #declare rng = seed(0); // uso: rand(rng)

        #if (n = 1)
                #declare centro = <rand(rng) * 300, rand(rng) * 300, rand(rng) * 300>;

                #declare tamanho = (rand(rng) * 10) + 1;

                #declare prob = rand(rng);
                #if(prob < 0.5)
                        object{ camara_0(tx_plastico_azul) scale tamanho translate centro }
                #else
                        object{ camara_1(tx_plastico_vermelho) scale tamanho translate centro }
                #end // end if

                object{
                        cylinder{
                                centro,
                                centro + <0.0, 0.0, 1000.0>,
                                0.3
                                texture{ tx_plastico_preto }
                        }
                }

        #else
                #if (n > 1)

                        #declare centros_camaras = array[n];
                        #declare i = 0;
                        #while (i < n)
                                #declare centro = <rand(rng) * 300, rand(rng) * 300, rand(rng) * 300>;
                                #declare centros_camaras[i] = centro;

                                #declare tamanho = (rand(rng) * 10) + 1;

                                #declare prob = rand(rng);
                                #if(prob < 0.5)
                                        object{ camara_0(tx_plastico_azul) scale tamanho translate centro }
                                #else
                                        object{ camara_1(tx_plastico_vermelho) scale tamanho translate centro }
                                #end // end if

                                #declare i = i + 1;
                        #end // end while centros

                        #declare i = 0;
                        #while (i < m)

                                #declare j = int(rand(rng) * n);
                                #declare k = int(rand(rng) * n);

                                #while(j = k)
                                        #declare k = int(rand(rng) * n);
                                #end

                                #declare centro0 = centros_camaras[j];
                                #declare centro1 = centros_camaras[k];
                                tunel(centro0, centro1, tx_plastico_branco)

                                #declare i = i + 1;
                        #end // end while tunel

                        #declare j = int(rand(rng) * n);
                        #declare centro = centros_camaras[j];
                        object{
                                cylinder{
                                        centro,
                                        centro + <0.0, 0.0, 1000.0>,
                                        0.3
                                        texture{ tx_plastico_preto }
                                }
                        }

                #end // end if
        #end // end else

#end // end mina macro

#macro bola (raio, centro, textura)
  sphere{
    centro,
                raio
    texture{ textura }
  }
#end

#declare x0 = -5; // posição final
#declare x1 = 5;  // posição inicial

#macro circulo (raioS, raioC, start, stop, passo)
                union{
                        #for (i, start, stop, passo)
                                        #declare centro = raioC * <0, cos(2 * pi * i), sin(2 * pi * i)>;

                                        object{ bola(raioS, centro, tx_plastico_vermelho) }
                        #end // end while
                }
#end

#macro palito (raio, p0, p1, passo)
                union{
                        #for (i, -1, 1, passo)
                                        #declare centro = p0 + i * p1;

                                        object{ bola(raio, centro, tx_plastico_vermelho) }
                        #end // end while
                }
#end

#macro quadrado (raio, p0, p1, passo)
                union{
                        palito(raio, <-0.5, +0.5, 0>, <+0.5, +0.5, 0>, passo)
                        palito(raio, <+0.5, +0.5, 0>, <+0.5, -0.5, 0>, passo)
                        palito(raio, <+0.5, -0.5, 0>, <-0.5, -0.5, 0>, passo)
                        palito(raio, <-0.5, -0.5, 0>, <-0.5, +0.5, 0>, passo)
                }
#end

#include "eixos.inc"

        union{

        palito(0.3, <0, 0, 0>, <0, 0, 1>, 0.01)
        object { circulo(0.3, 1.0, 0.25, 0.5, 0.01)  translate <0, 1.0, 1.0> }
        object{ palito(0.3, <0, 0, 0>, <0, 1, 0>, 0.01) translate <0, 2.0, 2.0> }
        object { circulo(0.3, 1.0, 0.5, 1.0, 0.01) translate <0, -1.0, -1.0> }
}

#include "camlight.inc"
#declare centro_cena = < 0.0, 0.0, 0.0>;
#declare raio_cena = 5.0;
#declare dir_camera = < 14.00, 7.00, 4.00 >;
#declare dist_camera = 5*raio_cena;
#declare intens_luz = 1.20;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)