Advertisement
FoxyCorndog

Castle asdf

Mar 28th, 2012
491
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #declare brickWidth      = 10;
  2. #declare brickHeight     = 3.5;
  3. #declare brickLength     = 5;
  4.  
  5. #declare random          = seed(1000);
  6.  
  7. #declare leftRight       = 0;
  8. #declare forwardBackward = 1;
  9. #declare aFloor          = 2;
  10.  
  11. #declare zoom = 100;
  12.  
  13. camera
  14. {
  15.     location <500, 200, -500>
  16.     look_at <0, 0, 0>
  17. }
  18.  
  19. light_source
  20. {
  21.     <500, 1000, 0>
  22.     //<0, 50 * 3, -10 * 7 * 3>
  23.     color rgb <1, 1, 1>
  24. }
  25.  
  26. light_source
  27. {
  28.     <-500, 1000, 0>
  29.     //<0, 50 * 3, -10 * 7 * 3>
  30.     color rgb <1, 1, 1>
  31. }
  32.  
  33. light_source
  34. {
  35.     <0, 1000, 500>
  36.     //<0, 50 * 3, -10 * 7 * 3>
  37.     color rgb <1, 1, 1>
  38. }
  39.  
  40. light_source
  41. {
  42.     <0, 1000, -500>
  43.     //<0, 50 * 3, -10 * 7 * 3>
  44.     color rgb <1, 1, 1>
  45. }
  46.  
  47. light_source
  48. {
  49.     <0, 1000, 0>
  50.     //<0, 50 * 3, -10 * 7 * 3>
  51.     color rgb <1, 1, 1>
  52. }
  53.  
  54. sky_sphere
  55. {
  56.   pigment
  57.   {
  58.     color rgb <0, .5, 0>
  59.   }
  60. }
  61.  
  62. // uses image color index as height, extends along X-Z axes
  63. // from <0 0 0> to <1 1 1>
  64. height_field {
  65.   png
  66.         "heightMapRiver.png"    
  67.         smooth    
  68.         water_level 0.055
  69.         texture
  70.         {
  71.                
  72.                 pigment
  73.                 {
  74.                         color rgb <0, 0, .5>
  75.                 }
  76.            
  77.         }
  78.         //rotate <0, 90, 0>
  79.        
  80.         #declare scaleFactor = 7.3;
  81.        
  82.         scale <640 * scaleFactor, 5 ,400 * scaleFactor>
  83.         translate <-315 * scaleFactor, -1 , -175 * scaleFactor>  
  84. }
  85.  
  86. #declare showCenter = false;
  87.  
  88. #if (showCenter)
  89.     box
  90.     {
  91.         <-3 * brickWidth, 0, 10>
  92.         <3 * brickWidth, 10, 0>
  93.        
  94.         pigment
  95.         {
  96.             color rgb <1, 1, 0>
  97.         }
  98.     }
  99.    
  100.     box
  101.     {
  102.         <-1, 0, 10.5>
  103.         <1, 10.5, -0.5>
  104.        
  105.         pigment
  106.         {
  107.             color rgb <1, 0, 0>
  108.         }
  109.     }
  110. #end
  111.  
  112. #macro buildObject(varWidth, varHeight, varLength, varX, varY, varZ, varType, varCrenulate varMirrorX, varMirrorZ)
  113.     #declare vx = 0;
  114.     #declare vy = 0;
  115.    
  116.     #declare varX = varX * brickWidth;
  117.     #declare varY = varY * brickHeight;
  118.     #declare varZ = varZ * brickLength;
  119.    
  120.     #if (varType = leftRight)
  121.         #declare vw = varWidth;
  122.         #declare vh = varHeight;
  123.     #end
  124.     #if (varType = forwardBackward)
  125.         #declare vw = varLength;
  126.         #declare vh = varHeight;
  127.     #end
  128.     #if (varType = aFloor)
  129.         #declare vw = varWidth;
  130.         #declare vh = varLength;
  131.        
  132.         #declare varCrenulate = false;
  133.     #end
  134.    
  135.     #declare f = 1;
  136.     #declare draw = true;
  137.    
  138.     #while (vx < vw)
  139.         #while (vy < vh)
  140.             #declare r = 0.5 - rand(random) / 5;
  141.             #declare g = 1 - rand(random); // / 5;
  142.             #declare b = 1 - rand(random); // / 5;
  143.            
  144.             //#declare g = r;
  145.             //#declare b = r;
  146.            
  147.             #if (varCrenulate)
  148.                 #if (vy = vh - 1)
  149.                     #if (f = 1)
  150.                         #declare draw = false;
  151.                         #declare f = 0;
  152.                     #else
  153.                         #declare f = 1;
  154.                     #end
  155.                 #else
  156.                 #end
  157.             #else
  158.             #end
  159.            
  160.             #if (draw)
  161.                 box
  162.                 {
  163.                     #if (varType = leftRight)
  164.                         <vx * brickWidth + varX, vy * brickHeight + varY, varZ>
  165.                         <vx * brickWidth + brickWidth + varX, vy * brickHeight + brickHeight + varY, brickLength + varZ>
  166.                     #end
  167.                    
  168.                     #if (varType = forwardBackward)
  169.                         <varX, vy * brickHeight + varY, vx * brickWidth + varZ>
  170.                         <brickLength + varX, vy * brickHeight + brickHeight + varY, vx * brickWidth + brickWidth + varZ>
  171.                     #end
  172.                    
  173.                     #if (varType = aFloor)
  174.                         <vx * brickWidth + varX, varY, vy * brickLength + varZ>
  175.                         <vx * brickWidth + brickWidth + varX, brickHeight + varY, vy * brickLength + brickLength + varZ>
  176.                     #end
  177.                    
  178.                     pigment
  179.                     {
  180.                         color rgb <r, g, b>
  181.                     }
  182.                 }
  183.             #end
  184.            
  185.             #declare draw = true;
  186.            
  187.             #declare vy = vy + 1;
  188.         #end
  189.        
  190.         #declare vx = vx + 1;
  191.         #declare vy = 0;
  192.     #end
  193.    
  194.     #if (varMirrorZ)
  195.         #if (varType = forwardBackward)
  196.             #declare w = -(varLength - 1) * 2;
  197.         #end
  198.        
  199.         #if (varType = aFloor)
  200.             #declare w = -(varLength - 2);
  201.         #end
  202.        
  203.         #if (varType = leftRight)
  204.             #declare w = varLength;
  205.         #end
  206.    
  207.         #declare varX = ( varX / brickWidth);
  208.         #declare varY = ( varY / brickHeight);
  209.         #declare varZ = (-varZ / brickLength) + w;
  210.    
  211.         buildObject(varWidth, varHeight, varLength, varX, varY, varZ, varType, varCrenulate, false, false)
  212.     #end
  213.    
  214.     #if (varMirrorX)
  215.         #if (varType = forwardBackward)
  216.             #declare w = varWidth / 2;
  217.         #else
  218.             #declare w = varWidth;
  219.         #end
  220.    
  221.         #declare varX = (-varX / brickWidth) - (w);
  222.         #declare varY = ( varY / brickHeight);
  223.         #declare varZ = ( varZ / brickLength);
  224.    
  225.         buildObject(varWidth, varHeight, varLength, varX, varY, varZ, varType, varCrenulate, false, varMirrorZ)
  226.     #end
  227. #end
  228.  
  229. //#macro buildWalls()
  230. //  buildObject(8 , 10, 1 , 3    , 0 , -25 , leftRight      , true , true , false)
  231. //  buildObject(10, 10, 1 , 1    , 0 , -20 , leftRight      , true , true , false)
  232. // 
  233. //  buildObject(22, 10, 1 , -11  , 0 ,  26 , leftRight      , true , false, false)
  234. //  buildObject(1 , 10, 17, 14.5 , 0 , -16 , forwardBackward, true , true , false)
  235. // 
  236. //  buildObject(22, 10, 1 , -11  , 0 ,  22 , leftRight      , true , false, false)
  237. //#end
  238. //
  239. //#macro buildCornerTowers()
  240. //  buildObject(6 , 20, 1 , 11   , 0 , -29 , leftRight      , true , true , true )
  241. //  buildObject(1 , 20, 2 , 11   , 0 , -28 , forwardBackward, true , true , true )
  242. //  buildObject(1 , 20, 6 , 16.5 , 0 , -28 , forwardBackward, true , true , true )
  243. //  buildObject(2 , 20, 1 , 14.5 , 0 , -17 , leftRight      , true , true , true )
  244. //#end
  245. //
  246. //#macro buildPlatforms()
  247. //  buildObject(5 , 1 , 11, 11.5 , 16, -28 , aFloor         , false, true , true )
  248. //  buildObject(22, 1 , 4 , -11  , 6 , -24 , aFloor         , false, false, true )
  249. //#end
  250. //
  251. //#macro buildCenterTower()
  252. //  buildObject(6 , 20, 1 , -3   , 0 , -6 , leftRight      , true , false , true )
  253. //#end
  254. //
  255. //#macro buildHouse(varX, varY, varZ)
  256. //
  257. //#end
  258.  
  259. #macro buildWalls()
  260.     buildObject(20, 10, 1 ,    3    , 0 , -25 ,    leftRight      , true , true , false)
  261.     buildObject(22, 10, 1 ,    1    , 0 , -20 ,    leftRight      , true , true , false)
  262.    
  263.     buildObject(34, 10, 1 ,    -19  , 0 ,  26 ,    leftRight      , true , false, false)
  264.     buildObject(1, 10, 33,    23 , 0 , -24 ,    forwardBackward, true , true , false)
  265.    
  266.     buildObject(34, 10, 1 ,    -19  , 0 ,  22 ,    leftRight      , true , false, false)
  267. #end
  268.  
  269. #macro buildCornerTowers()
  270.     buildObject(12, 30, 1 ,    21.5   , 0 , -57 ,    leftRight      , true , true , true )
  271.     buildObject(1 , 30, 4 ,    22   , 0 , -56.5 ,    forwardBackward, true , true , true )
  272.     buildObject(1 , 30, 12 ,    33 , 0 , -56 ,    forwardBackward, true , true , true )
  273.     buildObject(4 , 30, 1 ,    29 , 0 , -33 ,    leftRight      , true , true , true )
  274. #end
  275.  
  276. #macro buildPlatforms()
  277.     buildObject(5 , 1 , 11,    11.5 , 16, -28 ,    aFloor         , false, true , true )
  278.     buildObject(22, 1 , 4 ,    -11  , 6 , -24 ,    aFloor         , false, false, true )
  279. #end
  280.  
  281. #macro buildCenterTower()
  282.     buildObject(6 , 60, 1 ,    -3   , 0 , -6 ,    leftRight      , true , false , true )
  283. #end
  284.  
  285. #macro buildHouse(varX, varY, varZ)
  286.  
  287. #end
  288.  
  289. buildCornerTowers()
  290. //buildWalls()
  291. buildCenterTower()
  292. //buildPlatforms()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement