#include "colors.inc" 
#include "woods.inc"  
#include "metals.inc"
#include "textures.inc"
#include "stones.inc"
#include "fenetrouverte.pov"


 /* camera{
	//orthographic 
	location <0,-85,45>
	look_at <0,20,0> 
	angle 80
	translate <20,0,0>
	rotate <17,0,0> 
	
	}

 



light_source{<-5,100,30> color White*2  jitter adaptive 1} 
light_source{<0,-50,-20> color White shadowless } */ 



              
            
           
           
// Définition de la texture qui correspond au papier peint           
#declare papierpeint=
  texture{
    pigment{ 
       marble
        color_map{
	          [0.1 rgb <244/255,184/255,41/255>]
	          [0.5 rgb <239/255,228/255,108/255>] 
	          
	     
	         } 
	         turbulence 2.8
	         scale 10
	         frequency 5 
	         
	 }                    
	 finish {ambient 0.2 diffuse 0.6 specular 0.05 roughness 0.01 }
	 }
           
           
          
    
// Création du mur qui supporte la fenêtre 
#declare mur1=
  union {
   difference {
        box {<-550,370,-1> <600,-200,-50> texture {PinkAlabaster}}      // mur extérieur 
        box {<-6,60,4> <114,-60,-54> texture {PinkAlabaster} scale 1.4} // emplacement de la fenêtre
        } 
   difference { 
        box {<-550,370,1> <600,-200,-1> texture {papierpeint}}         // mur intérieur
        box {<-6,60,4> <114,-60,-4> texture {papierpeint} scale 1.4}   // emplacement de la fenêtre
        } 
   box {<-550,-170,1> <600,-200,2> pigment {color White}}              // plainte                                    
        }                                                    

               
               
               
// Création du mur sur lequel se trouve le miroir et le petit tableau               
#declare mur2=
        union{
           box {<-150,370,20> <500,-200,-3> texture {papierpeint}}   //mur
           box {<-150,-170,-3> <500,-200,-4> pigment {color White}}  // plainte
           }   
        
        


// Création du mur sur lequel se trouve le grand tableau                 
#declare mur3=
        union{
           box {<-150,370,20> <500,-200,-3> texture {papierpeint}}   // mur
           box {<-150,-170,20> <500,-200,19> pigment {color White}}  // plainte
           }                      
                   
    
                      
// Plancher                   
#declare plancher=
          box{<-550,-190,-350> <600,-200,900> pigment {checker rgb <233/255,211/255,153/255> rgb <163/255,129/255,70/255>  scale 50} finish{phong 1 diffuse 0.6 reflection 0.2 ambient 0.4}} 
      // "checker" permet de créer un damier avec deux couleurs de dalles          
 
        
        
// Plafond               
#declare plafond=
          box{<-550,-190,-350> <600,-200,900> pigment {color White}}                
                
           
           

// Création du petit tableau           
#declare tableau=
    union{
       difference{
                box {<50,50,2> <-50,-50,-2> texture {T_Wood6}  finish{ phong 0.8 }}
                box {<40,40,3> <-40,-40,-3> texture {T_Wood6}  finish{ phong 0.8 }}
                }
                box {<40,40,1> <-40,-40,-2> pigment {image_map {jpeg "dali.jpg" once} scale <-40,-40,-2>} translate <20,20,0> scale 2 } 
                
                }
                 
      
                 
// Création du grand tableau                  
#declare tableau2=
     union{
        difference{
                box {<100,50,2> <-100,-50,-2> texture {T_Wood6}  finish{ phong 0.8 }}
                box {<90,40,3> <-90,-40,-3> texture {T_Wood6}  finish{ phong 0.8 }}
                }
                box {<90,40,1> <-90,-40,0> pigment {image_map {jpeg "chausey.jpg" once} scale <-90,-40,0>} translate <45,20,0> scale 2 } 
                
                }
             
             
       
// Création du miroir avec des objets CSG             
#declare miroir=
     union{ 
      // Partie correspondant au cadre du miroir
          difference{ 
                sphere {<0,0,0> 60 texture {T_Wood6} scale <1.2,1.8,1.2>} // L'utilisation de "scale" permet de donner une forme ovale  
                sphere {<0,0,0> 50 texture {T_Wood6} scale <1.2,1.8,1.2>}
                box {<150,150,0> <-150,-150,150> texture {T_Wood6}}
                box {<150,150,-10> <-150,-150,-150> texture {T_Wood6}}
                } 
          torus {55 5 texture {T_Wood6} finish {phong 1} rotate 90*x scale <1.2,1.8,1.2>} 
      
      // Partie correspondant à la glace (partie réfléchissante)          
          difference{ 
                sphere {<0,0,0> 50 texture {Silver2 } finish{ reflection 0.8 } scale <1.2,1.8,1.2>}
                box {<150,150,0> <-150,-150,150> texture {Silver2 } finish{ reflection 0.8 }}
                box {<150,150,-10> <-150,-150,-150> texture {Silver2}  finish{ reflection 0.8 }} 
                
                            }
                           
            }                                            
            
              
              
              
              
// Tapis             
#declare tapis=
            box {<80,-60,0> <-80,60,0> pigment {image_map {jpeg "tapis.jpg" once} scale <-80,60,0>} scale 2 translate <60,-60,0>}                                                                        
                                                                       

 

// Création des appliques
#declare applique=
     difference{
        sphere {<0,0,0> 40 texture{T_Chrome_2B}}
        sphere {<0,0,0> 38 texture{T_Chrome_2B}} 
        box {<-45,0,-45> <45,45,45> texture{T_Chrome_2B}}
        }




// Assemblages des différents éléments ci-dessus qui constituent la pièce
#declare piece=
   union{
      object {fenetre rotate 180*z scale 1.5 translate <-100,0,-150>}
      object {mur1 translate <-100,0,-150>}
      object {mur2 rotate -90*y translate -200*x} 
      object {mur3 rotate -90*y translate 420*x} 
      object {plancher rotate 45*y}
      object {plafond translate 400*y}
      object {tableau rotate <0,-90,180> translate <-218,0,-20> scale 0.9} 
      object {tableau2 rotate <0,90,180> translate <360,0,40> scale 1.1} 
      object {miroir rotate <0,-90,180> translate <-240,-10,160> scale 0.8}
      object {tapis rotate 90*x scale 2 translate <60,-189,130>} 
      object {applique translate <410,50,-160>}
      object {applique translate <-200,50,-160>}
     } 
     



//object {piece rotate 90*x scale 0.225 translate <0,30,15>}