//tetris! //surely the greatest invention ever to be exploited by a large corporation! //(unless you count: graphical operating systems, the personal computer, the telephone,... ) #include "rad_def.inc" global_settings { radiosity { Rad_Settings(Radiosity_Final,on,on) } } #default { pigment { rgb 1 } finish { diffuse 1 ambient 0 } } background{.7} light_source { (z+y*.2)*1000, 1 area_light x*400, y*400, 4, 8 jitter } #macro block( b1,b2,b3,b4, col ) union { superellipsoid { <.2,.2> scale .5 translate } superellipsoid { <.2,.2> scale .5 translate } superellipsoid { <.2,.2> scale .5 translate } superellipsoid { <.2,.2> scale .5 translate } pigment { rgb col } } #end #declare blocks = array[7]; #declare blocks[0] = block( 0,1,2,3, x+y/2 ); // ____ #declare blocks[1] = block( 0,1,2,5, x+z ); // _|_ #declare blocks[2] = block( 0,1,5,6, y ); // _:- #declare blocks[3] = block( 4,5,1,2, x+y ); // -:_ #declare blocks[4] = block( 0,1,4,5, x ); // :: #declare blocks[5] = block( 0,1,2,4, z+y ); // |__ #declare blocks[6] = block( 0,1,2,6, z ); // __| //throw a few on the ground plane { y, 0 } #local rs = seed(4); #local i = 0; #local pos = array[80]; #while ( i < dimension_size(pos,1) ) #local pos[i] = ()*<150,1,30>; #local j = i-1; #while ( j >= 0 ) #if ( vlength(pos[i]-pos[j]) < 4 ) #local j = -100; //collision, flag it. #end #local j = j - 1; #end #if ( j != -101 ) object { blocks[min(rand(rs)*dimension_size(blocks,1),dimension_size(blocks,1)-1)] rotate x*90 rotate y*360*rand(rs) translate pos[i] } #local i = i + 1; #end #end camera { right x*image_width/image_height up y direction z*1 location <-15,40,-22> look_at 0 }