Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Lego.pov"
- #declare brickWidth = 10;
- #declare brickHeight = 3.5;
- #declare brickLength = 5;
- #declare random = seed(1000);
- #declare leftRight = 0;
- #declare forwardBackward = 1;
- #declare aFloor = 2;
- #declare zoom = 100;
- camera
- {
- location <500, 200, -500>
- look_at <0, 0, 0>
- }
- light_source
- {
- <500, 1000, 0>
- //<0, 50 * 3, -10 * 7 * 3>
- color rgb <1, 1, 1>
- }
- light_source
- {
- <-500, 1000, 0>
- //<0, 50 * 3, -10 * 7 * 3>
- color rgb <1, 1, 1>
- }
- light_source
- {
- <0, 1000, 500>
- //<0, 50 * 3, -10 * 7 * 3>
- color rgb <1, 1, 1>
- }
- light_source
- {
- <0, 1000, -500>
- //<0, 50 * 3, -10 * 7 * 3>
- color rgb <1, 1, 1>
- }
- light_source
- {
- <0, 1000, 0>
- //<0, 50 * 3, -10 * 7 * 3>
- color rgb <1, 1, 1>
- }
- sky_sphere
- {
- pigment
- {
- color rgb <0, .5, 0>
- }
- }
- // uses image color index as height, extends along X-Z axes
- // from <0 0 0> to <1 1 1>
- height_field {
- png
- "heightMapRiver.png"
- smooth
- water_level 0.055
- texture
- {
- pigment
- {
- color rgb <0, 0, .5>
- }
- }
- //rotate <0, 90, 0>
- #declare scaleFactor = 8.7;
- scale <640 * scaleFactor, 5 ,400 * scaleFactor>
- translate <-315 * scaleFactor, -1 , -175 * scaleFactor>
- }
- #declare showCenter = false;
- #if (showCenter)
- box
- {
- <-3 * brickWidth, 0, 10>
- <3 * brickWidth, 10, 0>
- pigment
- {
- color rgb <1, 1, 0>
- }
- }
- box
- {
- <-1, 0, 10.5>
- <1, 10.5, -0.5>
- pigment
- {
- color rgb <1, 0, 0>
- }
- }
- #end
- #macro buildObject(varWidth, varHeight, varLength, varX, varY, varZ, varType, varCrenulate varMirrorX, varMirrorZ)
- #declare vx = 0;
- #declare vy = 0;
- #declare varX = varX * brickWidth;
- #declare varY = varY * brickHeight;
- #declare varZ = varZ * brickLength;
- #if (varType = leftRight)
- #declare vw = varWidth;
- #declare vh = varHeight;
- #end
- #if (varType = forwardBackward)
- #declare vw = varLength;
- #declare vh = varHeight;
- #end
- #if (varType = aFloor)
- #declare vw = varWidth;
- #declare vh = varLength;
- #declare varCrenulate = false;
- #end
- #declare f = 1;
- #declare draw = true;
- #while (vx < vw)
- #while (vy < vh)
- #declare r = 0.5 - rand(random) / 5;
- #declare g = 1 - rand(random); // / 5;
- #declare b = 1 - rand(random); // / 5;
- //#declare g = r;
- //#declare b = r;
- #if (varCrenulate)
- #if (vy = vh - 1)
- #if (f = 1)
- #declare draw = false;
- #declare f = 0;
- #else
- #declare f = 1;
- #end
- #else
- #end
- #else
- #end
- #if (draw)
- box
- {
- #if (varType = leftRight)
- <vx * brickWidth + varX, vy * brickHeight + varY, varZ>
- <vx * brickWidth + brickWidth + varX, vy * brickHeight + brickHeight + varY, brickLength + varZ>
- createLego(vx * brickWidth + varX, vy * brickHeight + varY, varZ,
- 4, 2, 2,
- <180, 0, 0>,
- <1, 0, 0>)
- #end
- #if (varType = forwardBackward)
- <varX, vy * brickHeight + varY, vx * brickWidth + varZ>
- <brickLength + varX, vy * brickHeight + brickHeight + varY, vx * brickWidth + brickWidth + varZ>
- #end
- #if (varType = aFloor)
- <vx * brickWidth + varX, varY, vy * brickLength + varZ>
- <vx * brickWidth + brickWidth + varX, brickHeight + varY, vy * brickLength + brickLength + varZ>
- #end
- pigment
- {
- color rgb <r, g, b>
- }
- }
- #end
- #declare draw = true;
- #declare vy = vy + 1;
- #end
- #declare vx = vx + 1;
- #declare vy = 0;
- #end
- #if (varMirrorZ)
- #if (varType = forwardBackward)
- #declare w = -(varLength - 1) * 2;
- #end
- #if (varType = aFloor)
- #declare w = -(varLength - 2);
- #end
- #if (varType = leftRight)
- #declare w = varLength;
- #end
- #declare varX = ( varX / brickWidth);
- #declare varY = ( varY / brickHeight);
- #declare varZ = (-varZ / brickLength) + w;
- buildObject(varWidth, varHeight, varLength, varX, varY, varZ, varType, varCrenulate, false, false)
- #end
- #if (varMirrorX)
- #if (varType = forwardBackward)
- #declare w = varWidth / 2;
- #else
- #declare w = varWidth;
- #end
- #declare varX = (-varX / brickWidth) - (w);
- #declare varY = ( varY / brickHeight);
- #declare varZ = ( varZ / brickLength);
- buildObject(varWidth, varHeight, varLength, varX, varY, varZ, varType, varCrenulate, false, varMirrorZ)
- #end
- #end
- #macro createLego(varX, varY, varZ, varWidth, varHeight, varLength, varRot, varColor)
- #declare cylinderHeight = .3;
- object
- {
- merge
- {
- box
- {
- <-varWidth / 2, -varHeight / 2, -varLength / 2>
- < varWidth / 2, varHeight / 2, varLength / 2>
- pigment
- {
- color rgb varColor
- }
- }
- #declare vx = 1;
- #declare vy = 1;
- #declare vz = 1;
- #while (vz < varLength * 2)
- #while (vx < varWidth * 2)
- cylinder
- {
- <(-varWidth / 2) + (varWidth * (vx / 8)), (varHeight / 2) , (-varLength / 2) + (varLength * (vz / 4))>
- <(-varWidth / 2) + (varWidth * (vx / 8)), (varHeight / 2) + .3, (-varLength / 2) + (varLength * (vz / 4))>
- .375
- pigment
- {
- color rgb varColor
- }
- }
- #declare vx = vx + 2;
- #end
- #declare vx = 1;
- #declare vz = vz + 2;
- #end
- }
- rotate varRot
- translate <varX + (varWidth / 2), varY + (varHeight / 2), varZ + (varLength / 2)>
- }
- #end
- //#macro buildWalls()
- // buildObject(8 , 10, 1 , 3 , 0 , -25 , leftRight , true , true , false)
- // buildObject(10, 10, 1 , 1 , 0 , -20 , leftRight , true , true , false)
- //
- // buildObject(22, 10, 1 , -11 , 0 , 26 , leftRight , true , false, false)
- // buildObject(1 , 10, 17, 14.5 , 0 , -16 , forwardBackward, true , true , false)
- //
- // buildObject(22, 10, 1 , -11 , 0 , 22 , leftRight , true , false, false)
- //#end
- //
- //#macro buildCornerTowers()
- // buildObject(6 , 20, 1 , 11 , 0 , -29 , leftRight , true , true , true )
- // buildObject(1 , 20, 2 , 11 , 0 , -28 , forwardBackward, true , true , true )
- // buildObject(1 , 20, 6 , 16.5 , 0 , -28 , forwardBackward, true , true , true )
- // buildObject(2 , 20, 1 , 14.5 , 0 , -17 , leftRight , true , true , true )
- //#end
- //
- //#macro buildPlatforms()
- // buildObject(5 , 1 , 11, 11.5 , 16, -28 , aFloor , false, true , true )
- // buildObject(22, 1 , 4 , -11 , 6 , -24 , aFloor , false, false, true )
- //#end
- //
- //#macro buildCenterTower()
- // buildObject(6 , 20, 1 , -3 , 0 , -6 , leftRight , true , false , true )
- //#end
- //
- //#macro buildHouse(varX, varY, varZ)
- //
- //#end
- #macro buildWalls()
- buildObject(20, 10, 1 , 3 , 0 , -25 , leftRight , true , true , false)
- buildObject(22, 10, 1 , 1 , 0 , -20 , leftRight , true , true , false)
- buildObject(34, 10, 1 , -19 , 0 , 26 , leftRight , true , false, false)
- buildObject(1, 10, 33, 23 , 0 , -24 , forwardBackward, true , true , false)
- buildObject(34, 10, 1 , -19 , 0 , 22 , leftRight , true , false, false)
- #end
- #macro buildCornerTowers()
- buildObject(12, 30, 1 , 21.5 , 0 , -57 , leftRight , true , true , true )
- buildObject(1 , 30, 4 , 22 , 0 , -56.5 , forwardBackward, true , true , true )
- buildObject(1 , 30, 12 , 33 , 0 , -56 , forwardBackward, true , true , true )
- buildObject(4 , 30, 1 , 29 , 0 , -33 , leftRight , true , true , true )
- #end
- #macro buildPlatforms()
- buildObject(5 , 1 , 11, 11.5 , 16, -28 , aFloor , false, true , true )
- buildObject(22, 1 , 4 , -11 , 6 , -24 , aFloor , false, false, true )
- #end
- #macro buildCenterTower()
- buildObject(6 , 60, 1 , -3 , 0 , -6 , leftRight , true , false , true )
- #end
- #macro buildHouse(varX, varY, varZ)
- #end
- buildCornerTowers()
- //buildWalls()
- buildCenterTower()
- //buildPlatforms()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement