#include "colors.inc"
#include "stones.inc"
#include "textures.inc"
#include "finish.inc"

camera {
   location <71, 10, 15>
   look_at <11, 20, -11>
}
background { color White }
light_source { <0, 50, 0> White }
light_source { <32 128, 5> White }
light_source { <0, 130, 50> White }
light_source { <180, 70, 30> White }
light_source { <-120,10, 3> White }

#declare t_prata =
texture {
    pigment { Gray }
    finish {
      ambient .1
      diffuse .4
      specular .3
      roughness 0.001
      reflection .3
      metallic
    }                                      
  }


#declare t_granito =
	texture {
         pigment
         {
            granite
            color_map
            {
               [ 0.0     rgbft <0.3, 0.2, 0.3, 0.0, 0.0> ]
               [ 0.22    rgbft <0.55, 0.56, 0.50, 0.0, 0.0> ]
               [ 1.0     rgbft <0.73, 0.70, 0.60, 0.0, 0.0> ]
            }
            turbulence 0.7
            ramp_wave
         }
         normal
         {
            bumps , 0.1
            scale  0.2
         }
         finish
         {
            ambient 0.5
            diffuse 1.0
            crand 0.25
         }
      }


#declare t_vidro =

   material
   {
      texture
      {
         pigment
         {
            color rgbf <0.5, 0.5, 0.65, 0.95>
         }
         normal
         {
            bumps , 0.2
            scale  <0.5, 0.5, 5.0>
         }
         finish
         {
            ambient 0.1
            diffuse 0.2
            phong 1.0
            phong_size 50.0
            specular 0.5
            roughness 0.06
            reflection 0.15
         }
      }
      interior
      {
         ior 1.1
      }
   }


#declare eixos =
union
{
	cylinder {<-20,0,0>, <20,0,0>, 0.02 pigment { Red }}
	cylinder {<0,-20,0>, <0,20,0>, 0.02 pigment { Green }}
	cylinder {<0,0,-20>, <0,0,20>, 0.02 pigment { Blue }}
}



#declare prisma =
	prism {
		linear_sweep
		linear_spline
		-0.01, 1.01, 4,
		<0,.2>,<0,-.2>,<-.8,0>,<0,.2>    			
 	}
 	
#declare triangulotopo =
        prism {
                linear_sweep
                linear_spline
                0.0, 0.2, 5,
                <0,0>,<4.698,1.71>,<4.698,-3>,<0,-3>,<0,0>
                texture { t_granito }
        }

#declare estrela =
difference
{
	cylinder{<0,0,0>,<0,.5,0>, 1 }
	merge
	{
		object { prisma }
		object { prisma rotate <0,90,0> }
		object { prisma rotate <0,180,0> }
		object { prisma rotate <0,270,0> }
	}
	scale <0.6,0.6,0.4>
	rotate <90,0,0>
}

#declare logo =
union
{
	text { ttf "ariali.ttf" "CITIBANK" 0.5, 0}     // Configurar o caminho correto
	object { estrela translate <5.5,0.5,0> }
}

#declare ceu = 
plane { y, 700
    texture {
      pigment { SkyBlue }
      finish { ambient 1 diffuse 0}
     }
     texture {
       pigment {
         bozo
         turbulence .5
         color_map {
           [0 White]
           [1 White filter 1]
         }
       }
       finish { ambient 1 diffuse 0 }
       scale <1000, 250, 250>
    }
  }


#declare Janela =
union 
{
        box { <0,0,0>, <1,1,0.1> material { t_vidro } }
        box { <0,0,0>, <0.01,1,0.1> texture{ pigment { Black }}}
        box { <0,0,0>, <1,0.01,0.1> texture{ pigment { Black }}}
        box { <0,1,0>, <1,1-0.01,0.1> texture{ pigment { Black }}}
        box { <1,0,0>, <1-0.01,1,0.1> texture{ pigment { Black }}}
}

#declare coluna =
        box { <0,0,-0.3>, <0.2,1,0.5> texture { t_granito }}



#declare paredeandar =
union
{
        object { Janela }
        object { Janela translate <1,0,0> }
        object { coluna translate <2,0,0> }
        object { Janela translate <2.2,0,0> }
        object { Janela translate <3.2,0,0> }
        object { Janela translate <4.2,0,0> }
        object { coluna translate <5.2,0,0> }
        object { Janela translate <5.4,0,0> }
        object { Janela translate <6.4,0,0> }
        object { Janela translate <7.4,0,0> }
        object { coluna translate <8.4,0,0> }
        object { Janela translate <8.6,0,0> }
        object { Janela translate <9.6,0,0> }
        object { Janela translate <10.6,0,0> }
        object { coluna translate <11.6,0,0> }
        object { Janela translate <11.8,0,0> }
        object { Janela translate <12.8,0,0> }
        object { Janela translate <13.8,0,0> }
        object { coluna translate <14.8,0,0> }
        object { Janela translate <15,0,0> }
        object { Janela translate <16,0,0> }
        object { Janela rotate <0,45,0> translate <17,0,0>}
}


#declare fatiaandar =
union
{
        object { paredeandar }
        object { paredeandar rotate <0, 90, 0> translate <17+(sqrt(2))/2,0,-(sqrt(2))/2>}
        object { paredeandar rotate <0, -90, 0> translate <-(sqrt(2))/2, 0, -17-(sqrt(2))/2>}
        object { Janela rotate <0,-135,0> translate <0,0,-17-sqrt(2)> }
        object { Janela rotate <0,180,0> translate <1,0,-17-sqrt(2)> }
        object { Janela rotate <0,180,0> translate <17,0,-17-sqrt(2)> }
        
}




#declare corpo =
union
{
        #declare dig = sqrt(2)/2;
        #declare Count1 = 0;
        #while (Count1 < 12)
                prism {
                        linear_sweep
                        linear_spline
                        0.0, 0.2, 9,
                        <0,0>,<17,0>,<17+dig,-dig>,<17+dig,-17-dig>,<17,-17-2*dig>,<0,-17-2*dig>,<-dig,-17-dig>,<-dig,-dig>,<0,0>
                        texture {  t_granito  }
                        translate <0,3*Count1,0>
                }
                #declare Count1 = Count1+1;
        #end                
        prism {
                  linear_sweep
                  linear_spline
                  0.0, 0.2, 9,
                  <0,0>,<17,0>,<17+dig,-dig>,<17+dig,-17-dig>,<17,-17-2*dig>,<0,-17-2*dig>,<-dig,-17-dig>,<-dig,-dig>,<0,0>
                  texture { t_granito }
                  translate <0,37,0>
                 }

        #declare Count1 = 0;
        #while (Count1 < 37)
                object { fatiaandar translate <0, Count1, 0> }
                #declare Count1 = Count1+1 ;
        #end                
        box { <1,-19,-17-sqrt(2)>, <1.2,48,-22> texture { t_granito }}
        box { <16,-19,-17-sqrt(2)>, <15.8,48,-22> texture { t_granito }}
        box { <0,-19,0>,<0.2,48,-sqrt(2)> texture { t_granito } rotate <0,-45,0> translate <1,0,-22> }
        box { <0,-19,0>,<0.2,48,-sqrt(2)> texture { t_granito } rotate <0,-45,0> scale <-1,1,1> translate <16,0,-22> }
        box { <2,-19,-22.8>, <15,48,-23> texture { t_granito } }
        box { <1,37,-17-sqrt(2)>,<16,48,-17-sqrt(2)-0.2> texture { t_granito } }
        

}            


#declare cbase =
box { <2,.2,0>,<15,-3.5,0.5> texture { t_granito } rotate <14,0,0> }

#declare ccol =           
union 
{
        #declare Count2 = 0;
        #while (Count2 < 5)
                object { coluna translate <2+3.2*Count2,0,0> scale <1,2,1>}
                #declare Count2 = Count2+1 ;
        #end
        box { <2,2,0.5>,<15,2.2,-2-sqrt(2)/2> texture { t_granito } }
        box { <2,0.2,0.0>,<15,0,-5> texture { t_granito }  rotate <70,0,0> translate <0,2,0.35>}
        object { triangulotopo  rotate <0,0,-90> translate <2,4.638+2.2,0.5-1.71>}
        object { triangulotopo  rotate <0,0,-90> translate <15,4.638+2.2,0.5-1.71>}
        object { logo texture { t_prata  } scale <-1.8,1.8,1.4> translate <14,4,-0.6>}
}

#declare coltopo =
union
{
        prism {
                linear_sweep
                linear_spline
                0.0, 0.2, 5,
                <2,-2>,<17,-2>,<17,-17>,<2,-27>,<2,-2>
                texture { t_granito }
                translate <0,2,0>
               }

        object { ccol }            
        object { ccol rotate <0, 90, 0> translate <17+(sqrt(2))/2,0,-(sqrt(2))/2>}
        object { ccol rotate <0, -90, 0> translate <-(sqrt(2))/2, 0, -17-(sqrt(2))/2>}
        object { ccol rotate <0, 180, 0> translate <17,0,-17-sqrt(2)>}
        translate <0,37,0>
}                      
        

#declare junta =
union
{
        object { cbase }
        object { cbase rotate <0, 90, 0> translate <17+(sqrt(2))/2,0,-(sqrt(2))/2>}
        object { cbase rotate <0, -90, 0> translate <-(sqrt(2))/2, 0, -17-(sqrt(2))/2>}
        object { cbase rotate <0, 180, 0> translate <17,0,-17-sqrt(2)>}
}
        

object { coltopo }        
object { corpo }
object{ eixos }
object{ ceu }


plane{ y, -19 texture{ pigment { White }}}        





#declare vitro =
union
{
        #declare Count2 = 0;
        #while (Count2 <6)
                #declare Count3 = 0;
                #while (Count3 < 7)
                        object { Janela translate <-3+Count2,Count3,0> }
                        #declare Count3 = Count3+1;
                #end
                #declare Count2 = Count2 + 1;
        #end
        rotate <0,90,0>
        scale <1,1.8,1>
}
                        
#declare vitro2 =
union
{
        #declare Count2 = 0;
        #while (Count2 <4)
                #declare Count3 = 0;
                #while (Count3 < 8)
                        object { Janela translate <-2+Count2,Count3,0> }
                        #declare Count3 = Count3+1;
                #end
                #declare Count2 = Count2 + 1;
        #end
        rotate <0,90,0>
        scale <1,1.8,1>
}

#declare base = 
union 
{
          union
          {
          intersection
          {
                  box{ <-11,0,11>,<11,19,-11> texture { t_granito } }
                  plane { z, 11*sqrt(2)-3.5 texture { t_granito } rotate <0,45,0>}
                  plane { z, 11*sqrt(2)-3.5 texture { t_granito } rotate <0,135,0>}
                  plane { z, 11*sqrt(2)-3.5 texture { t_granito } rotate <0,-45,0>}
                  plane { z, 11*sqrt(2)-3.5 texture { t_granito } rotate <0,-135,0>}
                  plane { y, 16 texture { t_granito } }
                  plane { y, 0 texture { t_granito } rotate <45,0,0> rotate <0,45,0> translate <0,25,0>}
                  plane { y, 0 texture { t_granito } rotate <45,0,0> rotate <0,135,0> translate <0,25,0>}
                  plane { y, 0 texture { t_granito } rotate <45,0,0> rotate <0,-45,0> translate <0,25,0>}
           
                
                
          }      
//                 object { vitro2 translate <11,0,0> }
                 object { vitro2 translate <11,0,0> rotate <0,180,0> }
                 object { vitro2 translate <11,0,0> rotate <0,90,0> }
                 object { vitro2 translate <11,0,0> rotate <0,-90,0> }
                 rotate <0,45,0>
          }
        object { vitro translate <11*sqrt(2)-3.5,0,0>}
        object { vitro translate <11*sqrt(2)-3.5,0,0> rotate <0,90,0>}
        object { vitro translate <11*sqrt(2)-3.5,0,0> rotate <0,180,0>}
        object { vitro translate <11*sqrt(2)-3.5,0,0> rotate <0,-90,0>}
       

}


object { base translate <8.5,-19,-8.5-sqrt(2)/2>}
object { junta }