|
 |
//===================================================================================================
// 2-parts window macro (v 1.1), by Fabien Mosen 1999,
//
// features :
// - totally incompatible with previous window macro (v 1) !!
// - more control of final aspect, especially the thickness of
divisions
// - the middle piece of wood has a better thickness now (main
fault in v 1.0)
// - hinges
// - you can now use any handle you like, the origin of the
handle will
// be placed at the center of the middle post.
// - the lower-left-inside point of the window is at the origin
// - frame and glass texture may both be specified
// - if you use a wood texture (log lies along Z axis), every
piece
// of the window will have the veins in the right direction
// - the macro is not foolproof, you could get strange results
// with inapproprite dimensionning
//===================================================================================================
// some scenery...
#include "colors.inc"
#include "woods.inc"
//#include "mestex.inc"
camera {location <180,62,10> angle 70 look_at <0,60,30>}
//preliminary macro
#macro Cadre (Haut,Larg,Epaiss,Prof,Tex1) //tout en positif a partir de
0
union {
box {<0,0,0>,<Prof,Haut,Epaiss> texture {Tex1 rotate x*90}}
box {<0,0,Larg>,<Prof,Haut,Larg-Epaiss> texture {Tex1 rotate x*90}}
box {<0,0,Epaiss>,<Prof,Epaiss,Larg-Epaiss> texture {Tex1}}
box {<0,Haut,Epaiss>,<Prof,Haut-Epaiss,Larg-Epaiss> texture {Tex1}}
}
#end
//====================================================================================================
// the window macro itself
//====================================================================================================
#macro Dbl_Open_Window_1_1
(Bay_W,Bay_H,A,B,C,D,E,F,G,NbGlassW,NbGlassH,FenTex,GlassTex,LeftAngle,RightAngle,Handle)
union {
#declare X=((D/2)-C);
#declare Ouvrant=union {
object {Cadre (
Bay_H-(2*A),
(Bay_W-(2*A)-X)/2,
B,
-X,
texture {FenTex}
)
}
object {Cadre (
Bay_H-(2*A)-(2*X),
((Bay_W-(2*A)-X)/2)-(2*X),
B-X,
-X,
texture {FenTex}
) translate <-X,X,X>
}
#declare Width_internal_frame=((Bay_W-(2*A)-X)/2)-(2*B);
#declare Height_internal_frame=Bay_H-(2*A)-(2*B);
#declare Profil1=prism {linear_spline 0,1,4,<0,0>,<-X+G,0>,<0,F>,<0,0>
pigment {Wheat}}
#declare BaguetteV=union {
box {<0,0,0>,<E,Height_internal_frame,F> texture {FenTex rotate x*90}}
object {Profil1 scale <1,Height_internal_frame,1> translate x*-G}
}
#declare BaguetteH=union {
box {<0,0,0>,<E,Width_internal_frame,F> texture {FenTex rotate x*90}}
object {Profil1 scale <1,Width_internal_frame,1> translate x*-G}
rotate x*-90 translate z*Width_internal_frame
}
box {<-X,B,B>,<-X-G,Height_internal_frame+B,B+Width_internal_frame>
material {GlassTex}}
object {BaguetteV translate <-X,B,B>}
object {BaguetteV scale <1,1,-1> translate <-X,B,((Bay_W-(2*A)-X)/2)-B>}
object {BaguetteH translate <-X,B,B>}
object {BaguetteH scale <1,-1,1> translate
<-X,B+Height_internal_frame,B>}
#declare SeparV=union {
box {<E,0,F/2>,<-X,Height_internal_frame,-F/2> texture {FenTex rotate
x*90}}
object {BaguetteV translate <0,0,F/2>}
object {BaguetteV scale <1,1,-1> translate <0,0,-F/2>}
}
#declare SeparH=union {
box {<E,F/2,0>,<-X,-F/2,Width_internal_frame> texture {FenTex}}
object {BaguetteH translate <0,F/2,0>}
object {BaguetteH scale <1,-1,1> translate <0,-F/2,0>}
}
#declare Boucle=1;
#while (Boucle < NbGlassW)
#declare Step=Width_internal_frame/NbGlassW;
object {SeparV translate <-X,B,B+(Boucle*Step)>}
#declare Boucle=Boucle+1;
#end
#declare Boucle=1;
#while (Boucle < NbGlassH)
#declare Step=Height_internal_frame/NbGlassH;
object {SeparH translate <-X,B+(Boucle*Step),B>}
#declare Boucle=Boucle+1;
#end
}//fin de Ouvrant
#declare Ouvrant_Left=union {
object {Ouvrant}
box
{<-X,X,B+Width_internal_frame+B-X>,<-2*X,B+Height_internal_frame+B-X,B+Width_internal_frame+B+X>
texture {FenTex rotate x*90}}
rotate y*LeftAngle
}
#declare Ouvrant_Right=union {
object {Ouvrant}
box
{<-X,X,B+Width_internal_frame+B-X>,<-2*X,B+Height_internal_frame+B-X,B+Width_internal_frame+B>
texture {FenTex rotate x*90}}
box
{<-X,X,B+Width_internal_frame+B-X>,<0,B+Height_internal_frame+B,B+Width_internal_frame+B+X>
texture {FenTex rotate x*90}}
box
{<C,0,B+Width_internal_frame+B-X>,<0,B+Height_internal_frame+B,B+Width_internal_frame+B+X>
texture {FenTex rotate x*90}}
object {Handle translate
<C,B+(Height_internal_frame/2),B+Width_internal_frame+B>}
scale <1,1,-1>
rotate y*-RightAngle
}
object {Cadre (Bay_H,Bay_W,A,-D/2,FenTex)}
object {Cadre (Bay_H,Bay_W,A+X,-D/2,FenTex) translate x*-D/2}
object {Ouvrant_Left translate <-C,A,A>}
object {Ouvrant_Right translate <-C,A,Bay_W-A>}
union {
cylinder {<-C/2,0,(A+C/2)>,<-C/2,B,(A+C/2)>,C/2 translate y*(A+B)
pigment {Gray50}}
cylinder {<-C/2,0,(A+C/2)>,<-C/2,B,(A+C/2)>,C/2 translate y*(Bay_H/2)
pigment {Gray50}}
cylinder {<-C/2,0,(A+C/2)>,<-C/2,B,(A+C/2)>,C/2 translate
y*(Bay_H-(A+B)) pigment {Gray50}}
}
union {
cylinder {<-C/2,0,(A+C/2)>,<-C/2,B,(A+C/2)>,C/2 translate y*(A+B)
pigment {Gray50}}
cylinder {<-C/2,0,(A+C/2)>,<-C/2,B,(A+C/2)>,C/2 translate y*(Bay_H/2)
pigment {Gray50}}
cylinder {<-C/2,0,(A+C/2)>,<-C/2,B,(A+C/2)>,C/2 translate
y*(Bay_H-(A+B)) pigment {Gray50}}
scale <1,1,-1> translate z*Bay_W
}
}//fin de l'union de la macro
#end //
//MACRO ENDS HERE
//====================================================================================================
// SOME SAMPLES...
//====================================================================================================
#declare Glass1=material {
texture {pigment {LightBlue filter .95} finish {reflection .4} normal
{wrinkles .1}}
interior {ior 1.5}
}
#declare Glass1=material {
texture {pigment {LightBlue filter .99} finish {reflection .2}}
interior {ior 1.1}
}
object {
Dbl_Open_Window_1_1 (80,120, 4,5,1,5,1.2,.8,.4, 2,3,texture {T_Wood23
scale 5},Glass1, 150,30,sphere {<2,0,0>,2})
translate y*-15
}
object {
Dbl_Open_Window_1_1 (80,120, 4,5,1,5,1.2,.8,.4, 1,2,texture {T_Wood23
scale 5},Glass1, 0,0,sphere {<2,0,0>,2})
translate <-100,15,30>
}
object {
Dbl_Open_Window_1_1 (100,140, 6,5,.8,5,1,.8,.4, 3,8,texture {T_Wood21
scale 8},Glass1, 40,0,sphere {<2,0,0>,2})
translate z*90
}
object {
Dbl_Open_Window_1_1 (100,140, 6,5,.8,5,1,1.3,.4, 1,6,pigment
{MediumForestGreen},Glass1, 20,30,cylinder {<2,-5,0>,<2,5,0>,1 pigment
{MediumForestGreen}})
translate z*-100
}
light_source {<480,1022,1000> White*3}
light_source {<180,42,10> White*1}
fog {distance 1000 rgb <.2,.3,.4>}
Post a reply to this message
Attachments:
Download 'graphic1.jpg' (40 KB)
Preview of image 'graphic1.jpg'

|
 |