home *** CD-ROM | disk | FTP | other *** search
- // Persistence of Vision Raytracer
- // Sample file
- // By Dan Farmer
- // Minneapolis, MN
- {
- ( with much help from Aaron Collins.)
-
- Pool balls. Illustrates use of intersections.
- Note: Gradients could also be used for the stripes. The pool table
- needs a rail, and perhaps, pockets. Maybe a picture of a nude hanging
- on the back wall and a cube of blue chalk sitting on the rail.
- Go for it!!
-
- }
-
-
- #include "shapes.dat"
- #include "colors.dat"
- #include "textures.dat"
-
- { ***************** set up a bunch of declarations **************************}
-
- #declare Ball = sphere < 0.0 0.0 0.0 > 1.0 end_sphere
-
- #declare RightSide = object
- intersection
- sphere Ball end_sphere
- plane <-1.0 0.0 0.0 > -0.5 end_plane { Cut by Plane Facing Left }
- end_intersection
- texture
- Shiny
- color White
- end_texture
- color White
- end_object
-
-
- #declare Stripe = intersection { Note: we don't know the object color yet! }
- sphere Ball end_sphere
- plane <-1.0 0.0 0.0 > 0.5 end_plane { Cut by Plane Facing Left }
- plane <1.0 0.0 0.0 > 0.5 end_plane { And by Plane Facing Right }
- end_intersection
-
-
- #declare LeftSide = object
- intersection
- sphere Ball end_sphere
- plane <1.0 0.0 0.0 > -0.5 end_plane { Cut by Plane Facing Right }
- end_intersection
- texture
- Shiny
- color White
- end_texture
- color White
- end_object
-
-
-
- #declare _1_Ball = object
- sphere Ball end_sphere
- texture Shiny color Yellow end_texture
- color Yellow
- end_object
-
- #declare _2_Ball = object
- sphere Ball end_sphere
- texture Shiny color CBlue end_texture
- color CBlue
- end_object
-
- #declare _3_Ball = object
- sphere Ball end_sphere
- texture Shiny color CRed end_texture
- color CRed
- end_object
-
- #declare _4_Ball = object
- sphere Ball end_sphere
- texture Shiny color Violet end_texture
- color Violet
- end_object
-
- #declare _5_Ball = object
- sphere Ball end_sphere
- texture Shiny color Orange end_texture
- color Orange
- end_object
-
- #declare _6_Ball = object
- sphere Ball end_sphere
- texture Shiny color ForestGreen end_texture
- color ForestGreen
- end_object
-
- #declare _7_Ball = object
- sphere Ball end_sphere
- texture Shiny color Maroon end_texture
- color Maroon
- end_object
-
- #declare _8_Ball = object
- sphere Ball end_sphere
- texture Shiny color Black end_texture
- color Black
- end_object
-
-
-
- #declare _9_Ball = composite { Yellow Stripe }
- object
- intersection Stripe end_intersection
- texture Shiny color Yellow end_texture
- color Yellow
- end_object
- object LeftSide end_object
- object RightSide end_object
- end_composite
-
- #declare _10_Ball = composite { CBlue Stripe }
- object
- intersection Stripe end_intersection
- texture Shiny color CBlue end_texture
- color CBlue
- end_object
- object LeftSide end_object
- object RightSide end_object
- end_composite
-
- #declare _11_Ball = composite { CRed Stripe }
- object
- intersection Stripe end_intersection
- texture Shiny color CRed end_texture
- color CRed
- end_object
- object LeftSide end_object
- object RightSide end_object
- end_composite
-
-
- #declare _12_Ball = composite { Violet Stripe }
- object
- intersection Stripe end_intersection
- texture Shiny color Violet end_texture
- color Violet
- end_object
- object LeftSide end_object
- object RightSide end_object
- end_composite
-
- #declare _13_Ball = composite { Orange Stripe }
- object
- intersection Stripe end_intersection
- texture Shiny color Orange end_texture
- color Orange
- end_object
- object LeftSide end_object
- object RightSide end_object
- end_composite
-
- #declare _14_Ball = composite { CGreen Stripe }
- object
- intersection Stripe end_intersection
- texture Shiny color ForestGreen end_texture
- color ForestGreen
- end_object
- object LeftSide end_object
- object RightSide end_object
- end_composite
-
- #declare _15_Ball = composite { Maroon Stripe }
- object
- intersection Stripe end_intersection
- texture Shiny color Maroon end_texture
- color Maroon
- end_object
- object LeftSide end_object
- object RightSide end_object
- end_composite
-
- #declare CueStick = object
- intersection
- quadric Cylinder_Y end_quadric
- plane <0.0 1.0 0.0> 1.0 end_plane { Cut by Plane Facing Up }
- end_intersection
- texture
- Dark_Wood
- scale <0.01 0.01 0.01>
- ambient 0.3
- diffuse 0.7
- phong 1.0
- phongsize 20
- reflection 0.3
- end_texture
- end_object
-
- { ***************** set up the view & light sources *************************}
-
- view_point
- location <0.0 0.0 -15.0>
- direction <0.0 0.0 1.0>
- up <0.0 1.0 0.0>
- right <1.33333 0.0 0.0>
- end_view_point
-
- { Light }
- object
- sphere <0.0 0.0 0.0> 2.0 end_sphere
- translate <2.0 2.0 -250.0>
- rotate < 70.0 0.0 0.0 >
- texture
- color White
- ambient 1.0
- diffuse 0.0
- end_texture
- light_source
- color White
- end_object
-
- { ************************** set up the table *******************************}
- {
- note : The pooltable is set up as a composite in the x-y Plane and then
- the whole thing is thing is tilted "flat".
- i personally find this easier to visualize.
- }
- composite
- object { Felt table top }
- plane <0.0 0.0 1.0 > 1.0 end_plane
- texture Dull color MediumForestGreen end_texture
- color MediumForestGreen
- end_object
-
- { Cue stick }
- object CueStick
- scale < 0.15 1.0 0.15 > { Skinny and long }
- translate < 0.0 -7.5 0.0 >
- end_object
-
- { Cue Ball }
- object
- sphere Ball end_sphere
- translate < 0.0 -6.0 0.0 >
- texture Shiny color White end_texture
- color White
- end_object
-
- { **************************** set up the balls *******************************}
- { Row #1 }
- object _1_Ball
- end_object
-
- { Row #2 }
- object _3_Ball
- translate < 1.0 1.732 0.0 >
- end_object
- composite _10_Ball
- rotate < 0.0 0.0 -80.0 >
- translate < -1.0 1.732 0.0 >
- end_composite
-
- { Row #3 }
- composite _11_Ball
- rotate < 0.0 -15.0 -2.0 >
- translate < 2.0 3.464 0.0 >
- end_composite
- object _8_Ball
- translate < 0.0 3.464 0.0 >
- end_object
- object _5_Ball
- translate <-2.0 3.464 0.0 >
- end_object
-
- { Row #4 }
- object _2_Ball
- translate <-3.0 5.196 0.0 >
- end_object
- object _7_Ball
- translate <-1.0 5.196 0.0 >
- end_object
- object _4_Ball
- translate < 1.0 5.196 0.0 >
- end_object
- composite _14_Ball
- rotate < 0.0 -15.0 -2.0 >
- translate < 3.0 5.196 0.0 >
- end_composite
-
- { Row #5 }
- composite _15_Ball
- translate <-4.0 6.928 0.0 >
- end_composite
- composite _13_Ball
- rotate < -5.0 11.0 -1.0 >
- translate <-2.0 6.928 0.0 >
- end_composite
- composite _9_Ball
- rotate < -80.0 -13.0 29.0 >
- translate < 0.0 6.928 0.0 >
- end_composite
- composite _12_Ball
- rotate < 15.0 15.0 -2.0 >
- translate < 2.0 6.928 0.0 >
- end_composite
- object _6_Ball
- translate < 4.0 6.928 0.0 >
- end_object
-
- rotate < 70.0 0.0 0.0 >
- end_composite
-