File talk:MovableBridge draw.gif

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

POVRay source file[edit]

//movable bridge -- 1:drawbridge (bascule bridge)
//for POV-Ray3.6 (created by MacMegaPOV)
//by Y tambe
//You can use this source file under either GFDL or CC-by-sa (dual license)
//You can use the images you render as free.

//This file requires the include file below.
#include "vehicles.inc"

//camera
camera {
    angle 15
    location <0.0, 0.0, 40>
    look_at <0.0, 0.0, 0.0>

    rotate -20*x
    rotate -10*y
}

//lights
light_source {//main light
    <0, 50,10>
    rgb <1, 1, 1>
    shadowless
}
light_source {//sub
    <0, 0,100>
    rgb <1, 1, 1>*.2
    shadowless
}

//for animation

#declare shipPos = (clock -0.35)*90;

#declare counter = clock;
#switch (clock)
    #range (0.0, 0.2)
        #declare counter = clock *5;
        #break
    #range (0.2, 0.4)
        #declare counter = 1;
        #break
    #range (0.4, 0.6)
        #declare counter = (0.6-clock)*5;
        #break
    #range (0.6, 1.0)
        #declare counter = 0;
        #break
    #default
        #declare counter = 0;
        #break
#end

//car1Pos
#switch (clock)
    #range (0.0, 0.1)
        #declare car1Pos = -7+3*clock*10;
        #break
    #range (0.1, 0.6)
        #declare car1Pos = -4;
        #break
    #range (0.6, 1)
        #declare car1Pos = -4+3*(clock-0.6)*10;
        #break
    #default
        #declare car1Pos = -9;
        #break
#end

//car2Pos
#switch (clock)
    #range (0.0, 0.6)
        #declare car2Pos = 9;
        #break
    #range (0.6, 1.0)
        #declare car2Pos = 9-3.8*(clock-0.6)*10;
        #break
    #default
        #declare car2Pos = -9;
        #break
#end

//#declare counter = 1;



#declare bridgeTexture = texture{
    pigment{color rgb <0.8,0.0,0.2>}
    finish{ambient 0.2 diffuse 0.8}
}

#declare bLineTexture = texture{
        pigment{color rgb <0.8,0.3,0.3>}
        finish{ambient 0.3 diffuse 0.7}
}


#declare roadTexture = texture{
    pigment{color rgb 0.6}
    finish{ambient 0.2 diffuse 0.8}
}

#declare rLineTexture = texture{
    pigment{color rgb 0.8}
    finish{ambient 0.2 diffuse 0.8}
}


//movable parts
union{
    union{
        box{<-3,-0.25,-1>, <-0.02, 0, 1>}
        box{<-3,0.0,.99>, <-0.02,0.2,0.95>}
        box{<-3,0.0,-.99>, <-0.02,0.2,-0.95>}
        
        box{<-3, 0.01, -0.05>, <-0.02, 0, 0.05> texture{bLineTexture} }//center line

        translate 3*x
        rotate counter*85*z
        translate -3*x
    }

    union{
        box{<3,-0.25,-1>, <0.02, 0, 1>}
        box{<3,0.0,-.99>, <0.02,0.2,-0.95>}
        box{<3,0.0,0.99>, <0.02,0.2,0.95>}

        box{<3, 0.01, -0.05>, <0.02, 0, 0.05> texture{bLineTexture} }//center line

        translate -3*x
        rotate -counter*85*z
        translate 3*x
    }

    texture{bridgeTexture}    
}

//static parts and road
union{

    box{<-3,0,1.1>,<-999,-0.4,-1.1>}
    box{<-3, 0.01, -0.05>, <-999, 0, 0.05> texture{rLineTexture} }//center line

    box{<3,0,1.1>,<999,-0.4,-1.1>}
    box{<3, 0.01, -0.05>, <999, 0, 0.05> texture{rLineTexture} }//center line

    box{<-3,-0.01,1.07>,<-9,0.15,1.02>}
    box{<-3,-0.01,-1.07>,<-9,0.15,-1.02>}

    box{<3,-0.01,1.07>,<9,0.15,1.02>}
    box{<3,-0.01,-1.07>,<9,0.15,-1.02>}

    cylinder{-0.2*y,-2*y,0.4 translate 4*x }
    cylinder{-0.2*y,-2*y,0.4 translate -4*x }
    cylinder{-0.2*y,-2*y,0.4 translate 7*x }
    cylinder{-0.2*y,-2*y,0.4 translate -7*x }

    texture{roadTexture}
}

//ground
union{

    prism{
        linear_sweep
        cubic_spline
        20,    -20,
        7,
        <2,1>,<2,-1>,<-2,-1>,<-2,1>,<2,1>,<2,-1>,<-2,-1>
        scale <2,2,2>
        rotate 90*x
        translate -2.5*y
        translate -13*x
    }

    prism{
        linear_sweep
        cubic_spline
        20,    -20,
        7,
        <2,1>,<2,-1>,<-2,-1>,<-2,1>,<2,1>,<2,-1>,<-2,-1>
        scale <2,2,2>
        rotate 90*x
        translate -2.5*y
        translate 13*x
    }

    texture{
        pigment{color rgb <0.3,0.5,0.1>}
        finish{ambient 0.2 diffuse 0.8}
        normal{bozo 5 scale 0.2}
    }
}



object{Ship
    translate shipPos*z
}


object {Car
    translate <car1Pos, 0, -0.45>
    texture{
        pigment{color rgb 0.9}
        finish{ambient 0.2 diffuse 0.8}
    }
}

object {Car
    rotate -180*y
    translate <car2Pos,0, 0.45>
    texture{
        pigment{color rgb <1,0,0>}
        finish{ambient 0.2 diffuse 0.8}
    }
}

plane{y,-1.5
    texture{
        pigment{color rgbt <.3,.6,1,0>}
        finish{ambient 0.5 diffuse 0.7}
        normal{
            bozo 5
            scale <0.2,0.2,1>
            }
        }
}

include file[edit]

//vehicles.inc
//for POV-Ray3.6 (created by MacMegaPOV)
//by Y tambe
//You can use this source file under either GFDL or CC-by-sa (dual license)
//You can use the images you render as free.

//ship
#declare Ship = 
union{
    intersection{
        sphere{<0,0,0>,3
            scale <1,1,1.5>
            rotate 20*y
            translate 1.5*x
            scale <0.6,0.8,0.6>
        }

        sphere{<0,0,0>,3
            scale <1,1,1.5>
            rotate -20*y
            translate -1.5*x
            scale <0.6,0.8,0.6>
        }
        box{<3,-0.5,5>,<-3,-2,-3>}
    translate -0.3*y
    }

    intersection{
        sphere{<0,0,0>,3
            scale <1,1,1.5>
            rotate 20*y
            translate 1.5*x
            scale <0.7,0.6,0.7>
        }
        sphere{<0,0,0>,3
            scale <1,1,1.5>
            rotate -20*y
            translate -1.5*x
            scale <0.7,0.2,0.7>
        }
        box{<3,0,5>,<-3,-0.4,-2.5>}
        box{<3,0,5>,<-3,-1,-2.5> rotate -2*x}
    translate -0.7*y
    }

    superellipsoid{ <0.3,0.6>
        scale <0.9,0.4,0.9>
        rotate -2*x
        translate -0.6*y
        translate -0.9*z
    }

    superellipsoid{ <0.3,0.3>
        scale <0.3,0.7,0.4>
        rotate -2*x
        translate -0.6*y
        translate -1.1*z
    }

    texture{
        pigment{color rgb <0.3,0.3,0.3>}
        finish{ambient 0.2 diffuse 0.8}
    }
}

//car
#declare Car =
union{

    //car body
    difference{
        intersection{

            union{
                superellipsoid{ <0.8, 0.2> scale <2,1,0.99>}
    
                intersection{
                    superellipsoid{ <0.8, 0.2> scale <3.5,1.2,1> translate -0.8*y}
                    box{ <5,-5,-5> , <0,5,5>}
                }

                intersection{
                    superellipsoid{ <0.9, 0.2> scale <3,1.2,1> translate -0.8*y}
                    box{ <-5,-5,-5> , <0,5,5>}
                }
            }

            superellipsoid{ <0.1, 0.1> scale <4, 2,2> translate <0, 0.7,0>}
        }
        //interior
        union{
            box{<1.5,0.0,4>,<0.4, 0.6, -4>}
            box{<0.0,0.0,4>,<-1.5, 0.6, -4>}
            box{<2.0,0.2,0.8>,<-2.0, 0.6, -0.8>}

            texture{
                pigment{color rgb 0.2}
                finish{ambient 0.1 diffuse 0.6}
            }
        }
    }
    //tires
    union{
        superellipsoid{ <1,0.1> scale <0.6, 0.6, 0.3> translate <2.2, -1.1, 0.88>}
        superellipsoid{ <1,0.1> scale <0.6, 0.6, 0.3> translate <2.2, -1.1,-0.88>}
        superellipsoid{ <1,0.1> scale <0.6, 0.6, 0.3> translate <-1.8, -1.1, 0.88>}
        superellipsoid{ <1,0.1> scale <0.6, 0.6, 0.3> translate <-1.8, -1.1,-0.88>}

        texture{
            pigment{color rgb 0.2}
            finish{ambient 0.2 diffuse 0.8}
        }
    }
    translate 1.7*y
    scale <0.15,0.15,0.25>
}