/* Usage of the macro : (please refer to the "wexpl.jpg" drawing to find out wich dimensions are needed) Fenetre (A,B,E,F,G,H,BaieL,BaieH,FenTex,VitreTex,CroisH,CroisV,AngleG,AngleD) ("fenetre" means "window", in french) BaieL = bay width BaieH = bay height FenTex = texture for the frame; if you use a wood that lies along the z axis, all parts of the window will have the wood in the right direction. VitreTex = texture for the glass CroisH = number of horizontal glass stripes per half window CroisV = number of vertical glass stripes per half window AngleG = opening angle (0=closed) for the left part (viewed from inside) AngleD = opening angle (0=closed) for the right part (viewed from inside) */ //================================================================================================ // MACROS CADRES //================================================================================================ #macro Cadre (Haut,Larg,Epaiss,Prof,Tex1) //tout en positif a partir de 0 union { box {<0,0,0>, texture {Tex1 rotate x*90}} box {<0,0,Larg>, texture {Tex1 rotate x*90}} box {<0,0,Epaiss>, texture {Tex1}} box {<0,Haut,Epaiss>, texture {Tex1}} } #end #macro Cadre3 (Haut,Larg,Epaiss,Prof,Tex1) //tout en positif a partir de 0, manque le montant droit union { box {<0,0,0>, texture {Tex1 rotate x*90}} //--- box {<0,0,Epaiss>, texture {Tex1}} box {<0,Haut,Epaiss>, texture {Tex1}} } #end //================================================================================================ // MACRO VITRE (avec croisillons) //================================================================================================ #macro Vitre (VH,VL,GT,NBH,NBV,ChassintEp,ChassintProf,Vtex,VitreTex) union { object {Cadre (VH,VL,ChassintEp,ChassintProf,texture {Vtex})} box {<0,0,0>, texture {VitreTex}} union { prism {linear_sweep linear_spline 0,VL,4,<0-GT,0>,<-GT-ChassintEp,0>,<0-GT,-ChassintEp>,<0-GT,0> pigment {NewTan} rotate x*90 translate y*0*ChassintEp} prism {linear_sweep linear_spline 0,VL,4,<0-GT,0>,<-GT-ChassintEp,0>,<0-GT,-ChassintEp>,<0-GT,0> pigment {NewTan} rotate x*90 scale <1,-1,1> translate y*(VH)} prism {linear_sweep linear_spline 0,VH,4,<0-GT,0>,<-GT-ChassintEp,0>,<0-GT,-ChassintEp>,<0-GT,0> pigment {NewTan} translate z*(VL)} prism {linear_sweep linear_spline 0,VH,4,<0-GT,0>,<-GT-ChassintEp,0>,<0-GT,-ChassintEp>,<0-GT,0> pigment {NewTan} scale <1,1,-1> translate z*0*ChassintEp} pigment {Green} } #declare boucle=1; #while (boucle < NBH) union { box {,<0,ChassintEp/2,VL-ChassintEp>} box {<-GT-ChassintEp,-ChassintEp/4,0>,<0,ChassintEp/4,VL>} prism {linear_sweep linear_spline 0,VL,4,<0-GT,0>,<-ChassintEp-GT,0>,<0-GT,-ChassintEp/2>,<0-GT,0> pigment {NewTan} rotate x*90 translate y*ChassintEp/4} prism {linear_sweep linear_spline 0,VL,4,<0-GT,0>,<-ChassintEp-GT,0>,<0-GT,-ChassintEp/2>,<0-GT,0> pigment {NewTan} rotate x*90 translate y*ChassintEp/4 scale <1,-1,1>} translate y*(VH/NBH)*boucle texture {Vtex} } #declare boucle=boucle+1; #end #declare boucle=1; #while (boucle < NBV) union { box {,<0,VH-ChassintEp,-ChassintEp/2>} box {<-GT-ChassintEp,0,ChassintEp/4>,<0,VH,-ChassintEp/4>} prism {linear_sweep linear_spline 0,VH,4,<0-GT,0>,<-ChassintEp-GT,0>,<0-GT,-ChassintEp/2>,<0-GT,0> pigment {NewTan} translate z*-ChassintEp/4} prism {linear_sweep linear_spline 0,VH,4,<0-GT,0>,<-ChassintEp-GT,0>,<0-GT,-ChassintEp/2>,<0-GT,0> pigment {NewTan} translate z*-ChassintEp/4 scale <1,1,-1>} translate z*(VL/NBV)*boucle texture {Vtex rotate x*90} } #declare boucle=boucle+1; #end }//fin union #end //================================================================================================ // MACRO FENETRE //================================================================================================ #macro Fenetre (A,B,E,F,G,H,BaieL,BaieH,FenTex,VitreTex,CroisH,CroisV,AngleG,AngleD) union { #declare C=A-2*B; #declare D=C/2; object {Cadre (BaieH,BaieL,G,A,texture {FenTex}) translate x*-A/2} object {Cadre (BaieH-2*G,BaieL-2*G,H/2,A/2,texture {FenTex}) translate <-A/2,G,G>} #declare LargDemi=( BaieL-( 2*(G+(3*H/4)) +H/4 ) )/2; #declare HautDemi=BaieH-(2*(G+(3*H/4))); #declare BaseDemi=union { object {Cadre (HautDemi,LargDemi,H/4,C,texture {FenTex})} object {Cadre3 (HautDemi+H/2,LargDemi+H/2,H/4,C,texture {FenTex}) translate <0,-H/4,-H/4>} object {Cadre3 (HautDemi+H+H/2,LargDemi+((H/2)*2.5),H/2,D,texture {FenTex}) translate } object {Vitre (HautDemi-H/2,LargDemi-H/2,F,CroisH,CroisV,B,E,texture {FenTex},texture {VitreTex}) translate } } #declare OuvrantG= union { object {BaseDemi} box {<0,-H/4,LargDemi>, texture {FenTex rotate x*90}} translate <-C,0,3*(H/4)> rotate y*AngleG translate } #declare OuvrantD= union { object {BaseDemi} box {, texture {FenTex rotate x*90}} box {, texture {FenTex rotate x*90}} translate <-C,0,3*(H/4)> rotate y*AngleD scale <1,1,-1> translate } object {OuvrantG} object {OuvrantD} } #end //fin de la macro fenetre !