// Persistence of Vision Ray Tracer Scene Description File // File: cube_strechted.pov // Vers: 3.5 // Desc: Demo for while loops // Date: 31-Ago/7-Sept 2004 // Auth: B. Gimeno // email: aplenosol[at]ya.com #include "colors.inc" // -------------------------------------------------------------------------------- camera { location <12,-20,-25> direction z*1.5 look_at <0,0,0> } background {color Black} light_source { <-20,50,-70> colour White } light_source { <20,-50,70> colour rgb <.6,.6,.9> } // -------------------------------------------------------------------------------- #macro Pearl (X_r,Y_r,Z_r,Radius,Ratio) #local rs = seed (X_r*Y_r*Z_r) ; #if (rand(rs),Radius // translate translate < X_r+sin(radians((Z_r)*35)), Y_r+sin(radians((X_r)*35)), Z_r+sin(radians((Y_r)*35)) > texture { pigment {rgb } finish {phong .7 reflection 0.6} } } #else sphere {<0,0,0>,0 pigment {Clear} no_image no_shadow no_reflection} #end // end ratio #end // end pearl // -------------------------------------------------------------------------------- #macro Cube_Stretched(X_Num,Y_Num,Z_Num,Radius,Between,Width,Ratio) #local R_S = seed(23); #local Betwn = 1/Between; union { #local X_Num_r = X_Num/2; #while (X_Num_r>-X_Num/2) #local Y_Num_r = Y_Num/2; #while (Y_Num_r>-Y_Num/2) #local Z_Num_r = Z_Num/2; #while (Z_Num_r>-Z_Num/2) // --------------------------------- // object { Pearl (X_Num_r,Y_Num_r,Z_Num_r,Radius) } #if (X_Num_r<=(-X_Num/2)*Width) // -1- #if (Y_Num_r<=(-Y_Num/2)*Width) // -2- #if (Z_Num_r<=(-Z_Num/2)*Width) // -3- object { Pearl (X_Num_r,Y_Num_r,Z_Num_r,Radius,Ratio) } #else #if (Z_Num_r>(Z_Num/2)*Width) // -3b- object { Pearl (X_Num_r,Y_Num_r,Z_Num_r,Radius,Ratio) } #end // -3b- #end // -3- #else #if (Y_Num_r>(Y_Num/2)*Width) // -2b- #if (Z_Num_r<=(-Z_Num/2)*Width) // -3- object { Pearl (X_Num_r,Y_Num_r,Z_Num_r,Radius,Ratio) } #else #if (Z_Num_r>(Z_Num/2)*Width) // -3b- object { Pearl (X_Num_r,Y_Num_r,Z_Num_r,Radius,Ratio) } #end // -3b- #end // -3- #end // -2B- #end // -2- #else #if (X_Num_r>(X_Num/2)*Width) // -1B- #if (Y_Num_r<=(-Y_Num/2)*Width) // -2- #if (Z_Num_r<=(-Z_Num/2)*Width) // -3- object { Pearl (X_Num_r,Y_Num_r,Z_Num_r,Radius,Ratio) } #else #if (Z_Num_r>(Z_Num/2)*Width) // -3b- object { Pearl (X_Num_r,Y_Num_r,Z_Num_r,Radius,Ratio) } #end // -3b- #end // -3- #else #if (Y_Num_r>(Y_Num/2)*Width) // -2b- #if (Z_Num_r<=(-Z_Num/2)*Width) // -3- object { Pearl (X_Num_r,Y_Num_r,Z_Num_r,Radius,Ratio) } #else #if (Z_Num_r>(Z_Num/2)*Width) // -3b- object { Pearl (X_Num_r,Y_Num_r,Z_Num_r,Radius,Ratio) } #end // -3b- #end // -3- #end // -2B- #end // -2- #end //-1B- #end // -1- // --------------------------------- #local Z_Num_r = Z_Num_r-Betwn ; #end #local Y_Num_r = Y_Num_r-Betwn ; #end #local X_Num_r = X_Num_r-Betwn ; #end } #end // end macro cube_stretched // -------------------------------------------------------------------------------- object {Cube_Stretched(10, // Num spheres X 10, // Num spheres Y 10, // Num spheres Z .5, // Sphere Radius 5, // Multiply the number of spheres by X ; .15, // Range 0-1 ; to control the width of the central section .65 // Ratio - control the number of random spheres that will be generated ) rotate y*180 // this side is lighter } // --------------------------------------------------------------------------------