File talk:MovableBridge subm.gif

出自Wikimedia Commons
跳至導覽 跳至搜尋

POVRay source file

[編輯]

To render the scene file below, an include file (vehicles.inc) is required.

//movable bridge -- 8:submersible 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.

#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 = 0.3;


#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.1 diffuse 0.9}
}

#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}
}


//movavle parts
union{
    box{<2.98,-0.5,-1>, <-2.98, 0, 1>}

    box{<2.95,0.0,-.99>, <2.45,0.1,-0.95>}
    box{<2.35,0.0,-.99>, <1.85,0.1,-0.95>}
    box{<1.75,0.0,-.99>, <1.25,0.1,-0.95>}
    box{<1.15,0.0,-.99>, <0.65,0.1,-0.95>}
    box{<0.55,0.0,-.99>, <0.05,0.1,-0.95>}
    box{<-2.95,0.0,-.99>, <-2.45,0.1,-0.95>}
    box{<-2.35,0.0,-.99>, <-1.85,0.1,-0.95>}
    box{<-1.75,0.0,-.99>, <-1.25,0.1,-0.95>}
    box{<-1.15,0.0,-.99>, <-0.65,0.1,-0.95>}
    box{<-0.55,0.0,-.99>, <-0.05,0.1,-0.95>}

    box{<2.95,0.0,.99>, <2.45,0.1,0.95>}
    box{<2.35,0.0,.99>, <1.85,0.1,0.95>}
    box{<1.75,0.0,.99>, <1.25,0.1,0.95>}
    box{<1.15,0.0,.99>, <0.65,0.1,0.95>}
    box{<0.55,0.0,.99>, <0.05,0.1,0.95>}
    box{<-2.95,0.0,.99>, <-2.45,0.1,0.95>}
    box{<-2.35,0.0,.99>, <-1.85,0.1,0.95>}
    box{<-1.75,0.0,.99>, <-1.25,0.1,0.95>}
    box{<-1.15,0.0,.99>, <-0.65,0.1,0.95>}
    box{<-0.55,0.0,.99>, <-0.05,0.1,0.95>}
    box{<-2.98, 0.01, -0.05>, <2.98, 0.0, 0.05> texture{bLineTexture} }//center line

    translate -1.4*counter*y

    texture{bridgeTexture}    
}

//static parts and road
union{
    box{<-3,0,1.1>,<-999,-3,-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,1.1>,<999,-3,-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>}

    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 -8*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 8*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 <0,1,shipPos>
}


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,-0.5
    texture{
        pigment{color rgbt <.3,.6,1,0.5>}
        finish{ambient 0.5 diffuse 0.7}
        normal{
            bozo 5
            scale <0.2,0.2,1>
            }
        }
}

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

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

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

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>
            }
        }
}