/*****************************************************************************\ Pier.inc v0.5 [POV3.1] (c) 3/2000 Eugene Shumulinsky http://art.wickedgremlin.org/three-d/ A generic pier designed for the Spelljammer setting, but could easily be adapted to fit on any seaside shore. The pier starts at 0 and runs along the X axis. The upper surface lies along Y = 0. Modelled at 1 unit = 1 foot scale. Use it as you will, but please let me know of any major changes so they can be added to this version (with proper credit given to the author). Requires the Planks.inc include file which can also be found at http://art.darkwood.org/three-d/. /////////////////////////////////////////////////////////// Variables to #declare before including this file: Pier_Length: The length of the pier. Pier starts at 0 and runs this many units along the X axis. Default is 104. Minimum is 8. The supports start 2 units from the end. Pier_Width: The width of the pier. Pier is centered around the X axis along the Z axis. Supports reach outside this distance. Default is 10. Minumun is 6. T_Pier_Base_Wood: Overrides the wood texture used for the pier. T_Pier_Metal: Overrides the metal texture used for the pier. //// Pier_Light_Type: Type of light, if any. 0 [Default] No lightpost 1 Post with single light on top 2 Post with double light on top Pier_Light_Dist: Distance between lights. Given in units of distance between supports. For example, a value of 1 means put a light at every support, and a value of 2 means skip every other light. Default is 2. Pier_Lights_On: Set 'true' or 'false' whether the lights are on or off. Default is 'false'. Pier_Light_Intensity: Intensity multiplier on the lights. Default is 1. Pier_Lights_At_Center: If set to 'true', puts one row of lights in the center instead of along the sides. Default is 'false'. Pier_Light_Source: Overrides the default point light used by existing lightposts. Pier_Lightpost_macro: Used to generate user-defined lightposts. The macro takes two arguments (plusZ, onoff). plusZ is 'true' if the light will go on the +Z side, and 'false' if it goes on the -Z side. (Pier_Lights_At_Center=true uses the -Z light.) onoff controls the if the light is on or off. Pier_Support_Type must set to one of the invalid types, such as -1. //// Pier_Support_Type: Type of supports under the pier. 0 No additional supports 1 [Default] Short supports for SJ pier 2 Long supports Pier_Support_Dist: Distance between supports. Supports begin 2 units from the start. Pier_Light_Dist uses this value as a multiplier. Default is 10. Pier_Support_macro: Used to generate user-defined pier supports. The macro takes one argument (flipZ), which toggles from 'true' to 'false' for every other support. Can be used to place alternate features. /////////////////////////////////////////////////////////// When this file is included, it sets a Pier_height variable. In a Spelljammer scene, this value is how high the pier needs to be moved so that it lies along gravity plane. \*****************************************************************************/ #include "Planks.inc" //#macro T_Plank(wood_type) wood_type #end //#macro T_Plank_Plane(wood_type,a,b,c,d,e,f) wood_type #end #ifndef (Pier_Light_Type) #declare Pier_Light_Type = 0; #end #ifndef (Pier_Light_Dist) #declare Pier_Light_Dist = 2; #end #ifndef (Pier_Lights_On) #declare Pier_Lights_On = false; #end #ifndef (Pier_Light_Intensity) #declare Pier_Light_Intensity = 1; #end #ifndef (Pier_Lights_At_Center) #declare Pier_Lights_At_Center = false; #end #ifndef (Pier_Support_Type) #declare Pier_Support_Type = 1; #end #ifndef (Pier_Support_Dist) #declare Pier_Support_Dist = 10; #end #local min_pier_supp_d = 3; #if (Pier_Support_Dist < min_pier_supp_d) #warning concat("\nPier_Support_Dist ", str(Pier_Support_Dist,0,0), " too narrow. Setting to minimum (", str(min_pier_supp_d,0,0), ").") #declare Pier_Support_Dist = min_pier_supp_d; #end #ifndef (T_Pier_Base_Wood) #include "colors.inc" #include "woods.inc" #declare T_Pier_Base_Wood = T_Wood23 #end #ifndef (T_Pier_Metal) #include "textures.inc" #declare T_Pier_Metal = Rusty_Iron #end #ifndef (Pier_Length) #declare Pier_Length = 104; #end #local min_pier_len = 8; #if (Pier_Length < min_pier_len) #warning concat("\nPier_Length ", str(Pier_Length,0,0), " too narrow. Setting to minimum (", str(min_pier_len,0,0), ").") #declare Pier_Length = min_pier_len; #end #ifndef (Pier_Width) #declare Pier_Width = 10; #end #local min_pier_width = 6; #if (Pier_Width < min_pier_width) #warning concat("\nPier_Width ", str(Pier_Width,0,0), " too narrow. Setting to minimum (", str(min_pier_width,0,0), ").") #declare Pier_Width = min_pier_width; #end #local pier_w = Pier_Width/2; #macro T_Pier_Wood() T_Plank(T_Pier_Base_Wood) #end #macro T_Pier_Planks() T_Plank_Plane(T_Pier_Base_Wood, 15, 1, 4, 5, 15, 0.025) #end #switch (Pier_Light_Type) #case (0) //#debug "\nNo Pier_Light_Type selected. None used." #break #case (1) #macro lightpost_macro(plusZ, onoff) union { union { union { cylinder { -0.1*y, 7*y, 0.1 texture { T_Pier_Wood() rotate 90*x } } sphere { 0, 0.2 scale <1,3,1> } sphere { 0, 0.4 scale <1,0.25,1> } sphere { 7*y, 0.2 } } object { cone { -1*y, 0.11, -0.175*y, 0.02 } translate 8*y } texture { T_Pier_Metal } } #if (onoff) union { #ifdef (Pier_Light_Source) object { Pier_Light_Source } #else light_source { 0, color rgb 1*Pier_Light_Intensity fade_distance 6 fade_power 2 } #end #else object { #end sphere { 0, 0.2 texture { pigment { rgb <1,1,0.5> } finish { ambient 1 } } no_shadow } translate <0, 8, 0> } translate y } #end #break #case (2) #macro lightpost_macro(plusZ, onoff) union { union { union { cylinder { -0.1*y, 8*y, 0.1 texture { T_Pier_Wood() rotate 90*x } } sphere { 0, 0.2 scale <1,3,1> } sphere { 0, 0.4 scale <1,0.25,1> } sphere { 8*y, 0.2 } } intersection { union { torus { 0.75, 0.1 translate -0.75*x } torus { 0.75, 0.1 translate 0.75*x } rotate 90*x } plane { -y, 0 } translate 8*y } texture { T_Pier_Metal } translate y } #if (onoff) union { #ifdef (Pier_Light_Source) object { Pier_Light_Source } #else light_source { 0, color rgb 0.5*Pier_Light_Intensity fade_distance 6 fade_power 2 } #end #else object { #end sphere { 0, 0.2 texture { pigment { rgb <1,1,0.5> } finish { ambient 1 } } no_shadow } translate <1.5, 8.85, 0> } #if (Pier_Lights_On) union { #ifdef (Pier_Light_Source) object { Pier_Light_Source } #else light_source { 0, color rgb 0.5*Pier_Light_Intensity fade_distance 6 fade_power 2 } #end #else object { #end sphere { 0, 0.2 texture { pigment { rgb <1,1,0.5> } finish { ambient 1 } } no_shadow } translate <-1.5, 8.85, 0> } } #end #break #else #ifdef (Pier_Lightpost_macro) #macro lightpost_macro(plusZ, onoff) Pier_Lightpost_macro(plusZ, onoff) #end #else #warning concat("\nPier_Light_Type '", str(Pier_Light_Type,0,0), "' is invalid, and no Pier_Lightpost or", " Pier_Lightpost_macro set.") #end #break #end #switch (Pier_Support_Type) #case (0) #declare Pier_height = 0; //#debug concat("\nNo Pier_Support selected. None used.\n") #break #case (1) #declare Pier_height = 1; #macro pier_support(flipZ) union { union { box { <0.25, -0.8, -pier_w-1.75>, <0.75, 0, pier_w+1.75> texture { T_Pier_Wood() } } box { <-0.75, -0.8, -pier_w-1.75>, <-0.25, 0, pier_w+1.75> texture { T_Pier_Wood() } } union { sphere { 0, 0.075 texture { T_Pier_Metal } translate <-0.75, -0.25, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <-0.75, -0.55, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <0.75, -0.25, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <0.75, -0.55, 0> } translate -(pier_w+1)*z } union { sphere { 0, 0.075 texture { T_Pier_Metal } translate <-0.75, -0.25, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <-0.75, -0.55, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <0.75, -0.25, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <0.75, -0.55, 0> } translate (pier_w+1)*z } } cylinder { -1.5*y, 2.5*y, 0.5 texture { T_Pier_Wood() rotate 90*x } translate <0, 0, -pier_w-1> } cylinder { -1.5*y, 2.5*y, 0.5 texture { T_Pier_Wood() rotate 90*x } translate <0, 0, pier_w+1> } union { box { <0.25, -0.8, -pier_w-1.75>, <0.75, -0.2, pier_w+1.75> texture { T_Pier_Wood() } } box { <-0.75, -0.8, -pier_w-1.75>, <-0.25, -0.2, pier_w+1.75> texture { T_Pier_Wood() } } union { sphere { 0, 0.075 texture { T_Pier_Metal } translate <-0.75, -0.5, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <0.75, -0.5, 0> } translate -(pier_w+1)*z } union { sphere { 0, 0.075 texture { T_Pier_Metal } translate <-0.75, -0.5, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <0.75, -0.5, 0> } translate (pier_w+1)*z } translate 1*y } } #end #local Pier_Long_Support = union { box { <0.5, -1, pier_w/2+0.5>, texture { T_Pier_Wood() rotate 90*y } } box { <0.5, -1, -pier_w/2+0.5>, texture { T_Pier_Wood() rotate 90*y } } translate -0.5*y } #break #case (2) #declare Pier_height = 3.5; #macro pier_support(flipZ) union { union { box { <0.25, -0.8, -pier_w-1.75>, <0.75, 0, pier_w+1.75> texture { T_Pier_Wood() } } box { <-0.75, -0.8, -pier_w-1.75>, <-0.25, 0, pier_w+1.75> texture { T_Pier_Wood() } } union { sphere { 0, 0.075 texture { T_Pier_Metal } translate <-0.75, -0.25, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <-0.75, -0.55, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <0.75, -0.25, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <0.75, -0.55, 0> } translate -(pier_w+1)*z } union { sphere { 0, 0.075 texture { T_Pier_Metal } translate <-0.75, -0.25, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <-0.75, -0.55, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <0.75, -0.25, 0> } sphere { 0, 0.075 texture { T_Pier_Metal } translate <0.75, -0.55, 0> } translate (pier_w+1)*z } } cylinder { -10*y, 2.5*y, 0.5 texture { T_Pier_Wood() rotate 90*x } translate <0, 0, -pier_w-1> } cylinder { -10*y, 2.5*y, 0.5 texture { T_Pier_Wood() rotate 90*x } translate <0, 0, pier_w+1> } union { box { <0.25, -0.8, -pier_w-2>, <0.75, 0, pier_w+2> texture { T_Pier_Wood() } } box { <-0.75, -0.8, -pier_w-2>, <-0.25, 0, pier_w+2> texture { T_Pier_Wood() } } translate -8.2*y } intersection { box { <-0.25, -6.5, -0.5>, <0.25, 7, 0.5> rotate 40*x } plane { y, 4.4 } texture { T_Pier_Wood() rotate 130*x } translate -4.5*y #if (flipZ) scale <1,1,-1> #end } } #end #local Pier_Long_Support = union { box { <0.5, -1, pier_w/2-0.5>, texture { T_Pier_Wood() rotate 90*y } } box { <0.5, -1, -pier_w/2+0.5>, texture { T_Pier_Wood() rotate 90*y } } translate -8.5*y } #break #else #declare Pier_height = 0; #ifdef (Pier_Support_macro) #macro pier_support(flipZ) Pier_Support_macro(flipZ) #end #else #warning concat("\nPier_Support_Type '", str(Pier_Support_Type,0,0), "' is invalid, and no Pier_Support_macro set.\n") #end #end #declare Pier = union { box { <0, -0.5, -pier_w>, texture { T_Pier_Planks() translate -0.5*x } } box { <0, -1.4, -pier_w+1.75>, texture { T_Pier_Wood() rotate 90*y } } box { <0, -1.4, pier_w-1.75>, texture { T_Pier_Wood() rotate 90*y } } box { <0, -1.4, -0.5>, texture { T_Pier_Wood() rotate 90*y } } #if (Pier_Support_Type | Pier_Light_Type) #local from_edge = 2; #local support = 0; #while (support <= (Pier_Length-(from_edge*2))/Pier_Support_Dist) #if (mod(support,Pier_Light_Dist) = 0) #local support_has_light = true; #else #local support_has_light = false; #end #if (Pier_Support_Type & (Pier_Light_Type & support_has_light)) union { #else object { #end #ifdef (pier_support) object { pier_support(mod(support, 2)) } #end #if (support_has_light) #ifdef (lightpost_macro) #if (Pier_Lights_At_Center) object { lightpost_macro(0, Pier_Lights_On) } #else object { lightpost_macro(1, Pier_Lights_On) translate (pier_w-1)*z } object { lightpost_macro(0, Pier_Lights_On) translate -(pier_w-1)*z } #end #end #end translate } #declare support = support + 1; //Pier_Support_Dist; #end #ifdef (Pier_Long_Support) object { Pier_Long_Support translate -1*y } #end #end }