Advertisement
FoxyCorndog

Lego

Mar 30th, 2012
737
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. camera
  2. {
  3.     location <0, 20, -20>
  4.     look_at <0, 0, 0>
  5. }
  6.  
  7. light_source
  8. {
  9.     <10, 20, -20>
  10.    
  11.     color rgb <1, 1, 1>
  12. }
  13.  
  14. #macro createLego(varX, varY, varZ, varWidth, varHeight, varLength, varRot, varColor)
  15.     #declare cylinderHeight = .3;
  16.    
  17.     object
  18.     {
  19.         merge
  20.         {
  21.             box
  22.             {
  23.                 <-varWidth / 2, -varHeight / 2, -varLength / 2>
  24.                 < varWidth / 2,  varHeight / 2,  varLength / 2>
  25.                
  26.                 pigment
  27.                 {
  28.                     color rgb varColor
  29.                 }
  30.             }
  31.            
  32.             #declare vx = 1;
  33.             #declare vy = 1;
  34.             #declare vz = 1;
  35.        
  36.             #while (vz < varLength * 2)
  37.                 #while (vx < varWidth * 2)
  38.                     cylinder
  39.                     {
  40.                         <(-varWidth / 2) + (varWidth * (vx / (varWidth * 2))), (varHeight / 2)     , (-varLength / 2) + (varLength * (vz / (varLength * 2)))>
  41.                         <(-varWidth / 2) + (varWidth * (vx / (varWidth * 2))), (varHeight / 2) + .3, (-varLength / 2) + (varLength * (vz / (varLength * 2)))>
  42.                        
  43.                         .375
  44.                        
  45.                         pigment
  46.                         {
  47.                             color rgb varColor
  48.                         }
  49.                     }
  50.                    
  51.                     #declare vx = vx + 2;
  52.                 #end
  53.                
  54.                 #declare vx = 1;
  55.                 #declare vz = vz + 2;
  56.             #end
  57.         }
  58.        
  59.         rotate varRot
  60.        
  61.         translate <varX + (varWidth / 2), varY + (varHeight / 2), varZ + (varLength / 2)>
  62.     }
  63. #end
  64.  
  65. //createLego(0, 0, 0,
  66. //          4, 2, 2,
  67. //          <180, 0, 0>,
  68. //          <1, 0, 0>)
  69. //
  70. //createLego(2, 0, -2,
  71. //          4, 2, 2,
  72. //          <0, 0, 0>,
  73. //          <0, 0, 1>)
  74.            
  75. createLego(0, 0, 0,
  76.             2, 2, 4,
  77.             <0, 0, 0>,
  78.             <0, 0, 1>)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement