/**********************************************************************************/ // Persistence of Vision Ray Tracer Scene Description File // File name : RandStairs_mcr.pov Version 1 // Version : 3.6 // Description : Macro for building a stone wall with random-sized and -rotated stones // Date : November 2004 // Update : // Author : Thomas A. M. de Groot // E-mail : t.degroot@inter.nl.net // Copyright (C) 2004. All rights reserved. /**********************************************************************************/ #version 3.6; #ifndef (Standalone) #declare Standalone = true; #end // see after macro definition #include "rand.inc" global_settings { assumed_gamma 1.0 noise_generator 2 } default {texture {pigment { rgb <1,0,0> }}} //========================================================================================================= // Macro definition: // old: TotLength TotHeight #macro RandStairs (StairWidth, StairHeight, StoneHeight, StoneThick, StoneWidth, Space, Cdepth, Object1, Object2, Object3, Object4, StoneTex, Cement, Moray, Stream) // Initial local definitions: #local Seed = seed (Stream); #local MinStoneLength = 3*StoneHeight; #local MaxStoneLength = 9*StoneHeight; #local MinRot = -0.5; #local MaxRot = 0.5; #local StoneMin = 1; #local StoneMax = 5; #local L = 0; // Width of the stair controller #local H = 0; // Height of the stair controller #local Offset = 0; // Offset of steps #local Vert = true; // Switch between vertical stepstones (true) and horizontal stepstones (false) #declare Stairs = union { //box {<0, 0, Cdepth>, material {Cement} } #while (H < StairHeight) //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #if (Vert) //================= Stepstones are vertical: #while (L < StairWidth) #local StoneLength = RRand (MinStoneLength, MaxStoneLength, Seed); #local StoneRot = RRand (MinRot, MaxRot, Seed); #local L1 = L + StoneLength + Space; //---------------------------------------------- selection of stone -------------------------------------- #local T = RRand(StoneMin, StoneMax, Seed); #local T = int(T); #switch (T) #case (1) #local Stone = object {Stone1} #break #case (2) #local Stone = object {Stone2} #break #case (3) #local Stone = object {Stone3} #break #case (4) #local Stone = object {Stone4} #end //-------------------------------------------------------------------------------------------------------- #if (L1 > StairWidth) #local StoneLength = StairWidth - L; object {Stone scale translate // shift origin to centre rotate StoneRot translate <-(StoneLength/2), -(StoneHeight/2), -(StoneThick/2)> // shift origin back to front-lower-left corner translate material {StoneTex translate rand(Seed)} } #else object {Stone scale translate // shift origin to centre rotate StoneRot translate <-(StoneLength/2), -(StoneHeight/2), -(StoneThick/2)> // shift origin back to front-lower-left corner translate material {StoneTex translate rand(Seed)} } #end //end if L1 #local L = L1; //#debug concat("Stone", str(T,1,0), " length ", str(StoneLength,0,2), " L ", str(L,0,2), " \n") #end // end while L for vertical stepstones =============================================================== #else //================= Stepstones are horizontal: #local L = 0; #while (L < StairWidth) #local StoneLength = RRand (MinStoneLength, MaxStoneLength, Seed); #local StoneRot = RRand (MinRot, MaxRot, Seed); #local L1 = L + StoneLength + Space; //---------------------------------------------- selection of stone -------------------------------------- #local T = RRand(StoneMin, StoneMax, Seed); #local T = int(T); #switch (T) #case (1) #local Stone = object {Stone1} #break #case (2) #local Stone = object {Stone2} #break #case (3) #local Stone = object {Stone3} #break #case (4) #local Stone = object {Stone4} #end //-------------------------------------------------------------------------------------------------------- #if (L1 > StairWidth) #local StoneLength = StairWidth - L; object {Stone scale translate // shift origin to centre rotate StoneRot translate <-(StoneLength/2), -(StoneThick/2), -(StoneWidth/2)> // shift origin back to front-lower-left corner translate material {StoneTex translate rand(Seed)} } #else object {Stone scale translate // shift origin to centre rotate StoneRot translate <-(StoneLength/2), -(StoneThick/2), -(StoneWidth/2)> // shift origin back to front-lower-left corner translate material {StoneTex translate rand(Seed)} } #end //end if L1 #local L = L1; //#debug concat("Stone", str(T,1,0), " length ", str(StoneLength,0,2), " L ", str(L,0,2), " \n") #end // end while L for horizontal stepstones ============================================================= #end //================= end of stepstone switch #local L = 0; #if (Vert) #local H = H + StoneHeight + Space; #local Vert = false; #else #local Offset = Offset + StoneWidth - StoneThick; #local H = H + StoneThick + Space; #local Vert = true; #end #end //end while H ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } //end Stairs union // Transform for Moray. #if (Moray) #declare Stairs = object {Stairs scale <1,1,-1> rotate <90,0,0> } #end //end if Moray #end //end of macro //========================================================================================================= #if (Standalone) #include "colors.inc" camera { location <0.0, 5, -12.0> direction 1*z right x*image_width/image_height look_at <0.0, 5, 0.0> } sky_sphere { pigment { gradient y color_map { [0.0 rgb <0.6,0.7,1.0>] [0.7 rgb <0.0,0.1,0.8>] } } } light_source { <0, 0, 0> // light's position (translated below) color rgb <1, 1, 1> // light's color translate <-100, 300, -300> } // ---------------------------------------- plane { y, 0 pigment { color rgb <0.7,0.5,0.3> } } // ---------------------------------------- #declare Grnt6 = texture { pigment {granite turbulence 0.5 color_map {[0.000, 0.153 color rgbt <0.545, 0.380, 0.345, 0.000> color rgbt <0.588, 0.475, 0.333, 0.000>] [0.153, 0.398 color rgbt <0.588, 0.475, 0.333, 0.000> color rgbt <0.675, 0.478, 0.404, 0.000>] [0.398, 0.559 color rgbt <0.675, 0.478, 0.404, 0.000> color rgbt <0.757, 0.635, 0.522, 0.000>] [0.559, 0.729 color rgbt <0.757, 0.635, 0.522, 0.000> color rgbt <0.659, 0.549, 0.443, 0.000>] [0.729, 1.001 color rgbt <0.659, 0.549, 0.443, 0.000> color rgbt <0.545, 0.380, 0.345, 0.000>] } } } #declare Grnt6_alt = texture { pigment {granite turbulence 0.5 color_map {[0.000, 0.153 color rgbt <0.300, 0.300, 0.300, 0.000> color rgbt <0.300, 0.300, 0.300, 0.000>] [0.153, 0.398 color rgbt <0.300, 0.300, 0.300, 0.000> color rgbt <0.300, 0.300, 0.300, 0.000>] [0.398, 0.559 color rgbt <0.300, 0.300, 0.300, 0.000> color rgbt <0.300, 0.300, 0.300, 0.000>] [0.559, 0.729 color rgbt <0.300, 0.300, 0.300, 0.000> color rgbt <0.300, 0.300, 0.300, 0.000>] [0.729, 1.001 color rgbt <0.300, 0.300, 0.300, 0.000> color rgbt <0.300, 0.300, 0.300, 0.000>] } } } #declare Grnt10a = texture { pigment {granite turbulence 0.6 color_map {[0.000, 0.179 color rgbt <0.843, 0.655, 0.655, 0.455> color rgbt <0.886, 0.769, 0.627, 0.608>] [0.179, 0.368 color rgbt <0.886, 0.769, 0.627, 0.608> color rgbt <0.906, 0.820, 0.714, 0.392>] [0.368, 0.538 color rgbt <0.906, 0.820, 0.714, 0.392> color rgbt <0.851, 0.671, 0.671, 0.659>] [0.538, 0.744 color rgbt <0.851, 0.671, 0.671, 0.659> color rgbt <0.890, 0.792, 0.675, 0.392>] [0.744, 0.983 color rgbt <0.890, 0.792, 0.675, 0.392> color rgbt <0.827, 0.612, 0.612, 0.706>] [0.983, 1.001 color rgbt <0.827, 0.612, 0.612, 0.706> color rgbt <0.843, 0.655, 0.655, 0.455>] } } } #declare Stone4 = texture{Grnt6 scale <1.5, 3, 2> rotate <0, 0, 40> finish{diffuse 0.5} } texture{Grnt10a scale <1, 3, 2> rotate <0, 0, -30> //finish{phong 1.0 phong_size 90} } #declare AltStone = texture {Stone4} #declare Stone4a = texture {Grnt6_alt scale <1.5, 3, 2> rotate <0, 0, 40> finish{diffuse 0.5} } // ---------------------------------------- #declare BrickStandalone = false; // this switches off the standalone feature of Bricks.pov #declare BrickTex = texture {Stone4} // texture for mesh2 object(s) #include "Bricks.pov" // this is the file with mesh2 bricks // the original stone should be a cube with its origin at the front lower left corner. // make necessary transformations here. #declare Stone0 = object {Irregular_brick scale <0.5, 2, 1>} // here, the same object is used 4x: #declare Stone1 = object {Stone0 translate 0.5} #declare Stone2 = object {Stone0 rotate 180*y translate 0.5} #declare Stone3 = object {Stone0 rotate 180*z translate 0.5} #declare Stone4 = object {Stone0 rotate <0,180,180> translate 0.5} // ---------------------------------------- // alternative, simple example: //#declare Stone0 = box {<0, 0, 0>,<1, 1, 1> } //#declare Stone1 = object {Stone0} //#declare Stone2 = object {Stone0} //#declare Stone3 = object {Stone0} //#declare Stone4 = object {Stone0} // ---------------------------------------- // in case you do not use mesh2 objects, you need this: #declare Tex1 = material {texture {AltStone}} // texture for the cement between the stones: #declare Tex2 = material {texture {Stone4a}} #declare Width = 25; //usage: RandStairs (Width, // StairWidth: Total length of the stairs 10.0, // StairHeight: Total height of the stairs 0.5, // StoneHeight: Height of the stepstone 0.2, // StoneThick: Thickness of the stepstone 1.5, // StoneWidth: Width of the stepstone 0.0, // Space: Space between stones 0.1, // Cdepth: Cement depth Stone1, // Object: Type of stone Stone2, // Object: Type of stone Stone3, // Object: Type of stone Stone4, // Object: Type of stone Tex1, // StoneTex: Texture of the individual stones (not mesh2) Tex2, // Cement: Texture of the cement between the tones false, // Moray: Transformation for Moray yes or no 7432 // Stream: Random number seed ) object {Stairs scale 1 translate <-Width/2, 0, 0> rotate -20*y } #declare TotHeight = 17.6; /* cylinder { <0, 0, -1>, <0, TotHeight+2, -1>, 0.1 } cylinder { <-100, TotHeight, -1>, <2, TotHeight, -1>, 0.1 } */ #end //end of Standalone