home *** CD-ROM | disk | FTP | other *** search
- // Scene File: SPACE.PI
- // Author: Rob McGregor
-
- // Planets, space station, and alien ship
-
- // Define the range of the animation
- start_frame 0
- end_frame 299
- total_frames 300
- outfile "space"
-
- // Calculate the values of all transformations
- static define xShipStart 4
- static define zShipStart -100
-
- define xShipPos xShipStart + (0.05 * (frame + zShipStart))
- define zShipPos zShipStart + (1.35 * (frame + zShipStart))
- define zRot 9 * frame
- define zPos -200 + frame
-
- // Lights
- light <-5, 2, -15>
- light <5, 2, -15>
-
- // Set up the camera
- viewpoint {
- from <5, 2, zPos>
- at <0, 0, 0>
- up <0, 1, 0>
- angle 45
- resolution 320, 200
- aspect 1.6
- }
-
- // Create some nice metallic textures
- static define ring_color <0.70, 0.56, 0.37>
- static define hull_color <0.55, 0.5, 0.45>
-
- // The hull of the space station (light side)
- static define light_hull
- texture {
- surface {
- color hull_color
- specular hull_color, 0.85
- ambient 0.20
- diffuse 0.35
- microfacet Cook 12
- reflection 0.45
- }
- }
-
- // The hull of the space station (dark side)
- static define dark_hull
- texture {
- surface {
- color hull_color
- specular hull_color, 0.85
- ambient 0.75
- diffuse 0.35
- microfacet Cook 12
- reflection 0.45
- }
- }
-
- static define ring_color
- texture {
- surface {
- color ring_color
- specular ring_color, 0.65
- ambient 0.1
- diffuse 0.45
- microfacet Cook 12
- reflection 0.45
- }
- }
-
- static define shipTex
- texture {
- special surface {
- color spherical_imagemap(image ("shiptex.tga"), P)
- specular white, 0.65
- ambient 0.9
- microfacet Phong 7
- //reflection 0.45
- }
- }
-
- // Map one of two cool space scenes to the background
- if (zPos <= 0)
- // Toward the station, planets visible...
- background planar_imagemap(image("planets.tga"), P)
- else
- // Away from the station, on the dark side...
- background planar_imagemap(image("stars.tga"), P)
-
- // Build a simple space station
- // Main Hull
- static define hull
- object {
- cylinder <0.0, -1.0, 0.0>, <0.0, 1.0, 0.0>, 0.25
- }
-
- // Create a ring structure from 11 tori.
- static define ring
- object { torus 0.5, 0.015, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0> }
-
- static define rings
- object{
- object { ring }
- +
- object { ring translate <0.0, 0.4, 0.0> }
- +
- object { ring translate <0.0, 0.8, 0.0> }
- +
- object { ring translate <0.0, -0.4, 0.0> }
- +
- object { ring translate <0.0, -0.8, 0.0> }
- +
- object { ring translate <0.0, 0.6, 0.0> }
- +
- object { ring translate <0.0, 0.2, 0.0> }
- +
- object { ring translate <0.0, -0.2, 0.0> }
- +
- object { ring translate <0.0, -0.6, 0.0> }
- +
- object { ring translate <0.0, 1.0, 0.0> }
- +
- object { ring translate <0.0, -1.0, 0.0> }
- }
-
- // CSG space station object
- if (zPos <= 0){ // this is the light side
- define station
- object {
- object { hull light_hull scale <10,10,10> }
- +
- object { rings ring_color scale <10,10,10> }
- }
- }
- else { // this is the dark side, ambience enhanced
- define station
- object {
- object { hull dark_hull scale <10,10,10> }
- +
- object { rings ring_color scale <10,10,10> }
- }
- }
-
- // Rotate the station
- object { station rotate <0, 0, zRot> }
-
- // Bring in another actor, a spaceship
- if (zPos > -99)
- object {
- sphere <0, 0, 0>, 1
- scale <1, 1, 10>
- rotate <0, 10, 0>
- translate <xShipPos, 1.5, zShipPos>
- shipTex
- }
-
- // End of File
-