/* #ifndef (BrickSize) #declare BrickSize = <0.2,0.8,0.1> #end; */ /* must be defined: BrickSize:vector, : sizes of the brick(s) Radius:scalar, radius from the center of the cylinder to the surface of bricks Height:scalar, height of cylinder, preferably an integer multiple of 'Gap's Gap:scalar, distance between the bases of 2 rows of bricks MortarRecess:scalar, depth of the mortar in % of BrickSize.z BrickTexture:texture, texture of the bricks MortarTexture:texture, texture of the mortar Rseed:int, a seed(.) Defauts to a cylinder with "handle" at <0,0,0>, the center of the bottom face. */ #ifndef (T_B_M) #declare T_B_M=1; #macro t_box(c1,c2,tex,ang) triangle{vrotate(c1,ang),vrotate(,ang),vrotate(,ang) texture{tex}} triangle{vrotate(c1,ang),vrotate(,ang),vrotate(,ang) texture{tex}} triangle{vrotate(c1,ang),vrotate(,ang),vrotate(,ang) texture{tex}} triangle{vrotate(c1,ang),vrotate(,ang),vrotate(,ang) texture{tex}} triangle{vrotate(c1,ang),vrotate(,ang),vrotate(,ang) texture{tex}} triangle{vrotate(c1,ang),vrotate(,ang),vrotate(,ang) texture{tex}} triangle{vrotate(c2,ang),vrotate(,ang),vrotate(,ang) texture{tex}} triangle{vrotate(c2,ang),vrotate(,ang),vrotate(,ang) texture{tex}} triangle{vrotate(c2,ang),vrotate(,ang),vrotate(,ang) texture{tex}} triangle{vrotate(c2,ang),vrotate(,ang),vrotate(,ang) texture{tex}} triangle{vrotate(c2,ang),vrotate(,ang),vrotate(,ang) texture{tex}} triangle{vrotate(c2,ang),vrotate(,ang),vrotate(,ang) texture{tex}} #end #end #declare BTextures=array[5] #declare BTextures[0]=texture { BrickTexture rotate rand(Rseed)*360 translate rand(Rseed)*10 } #declare BTextures[1]=texture { BrickTexture rotate rand(Rseed)*360 translate rand(Rseed)*10 } #declare BTextures[2]=texture { BrickTexture rotate rand(Rseed)*360 translate rand(Rseed)*10 } #declare BTextures[3]=texture { BrickTexture rotate rand(Rseed)*360 translate rand(Rseed)*10 } #declare BTextures[4]=texture { BrickTexture rotate rand(Rseed)*360 translate rand(Rseed)*10 } #declare eps = 0.001; union { #declare __t = Radius-BrickSize.z; #declare InsideRadius = sqrt ( (BrickSize.x*BrickSize.x)/4 + (__t*__t) ); // #declare __t = Radius+(BrickSize.z/2); // #declare OutsideRadius = sqrt ( (BrickSize.x*BrickSize.x)/4 + (__t*__t) ); #declare OutsideRadius = Radius; // ciment / mortar difference { cylinder { <0,eps,0>, <0,Height-eps,0>, OutsideRadius - (BrickSize.z*MortarRecess) } cylinder { <0,0,0>, <0,0.075+Height,0> InsideRadius + (BrickSize.z*MortarRecess) } hollow // hollow isn't inherited texture { MortarTexture } } // briques / bricks #ifdef (BRICK_MESH) mesh { #else union { #end #declare da = 360 / int( InsideRadius*2*3.1415925535 / ((1.05)*BrickSize.x) ); #declare dy = Gap; #declare by = 0; #while (by<=Height) #declare base = 360 * rand(Rseed); #declare ang = 0; #while (ang < 360) // brick #ifdef (BRICK_MESH) #declare c1=0-+<0,by,Radius-(BrickSize.z/2)>; #declare c2=BrickSize-+<0,by,Radius-(BrickSize.z/2)>; #declare b_tex=BTextures[int(rand(Rseed)*5)] t_box(c1,c2,b_tex,<0, (base+ang),0>) #else box { 0, BrickSize translate - translate <0,by,Radius-(BrickSize.z/2)> rotate <0, (base+ang),0> texture { BrickTexture rotate rand(Rseed)*360 translate rand(Rseed)*10 } } #end #declare ang = ang + da; #end // ang #declare by = by+dy; #end // by } hollow // to place the camera inside } // colonne