home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / GRAPHICS / MISC / PVDAT.ZIP / POOLBALL.DAT < prev    next >
Encoding:
Text File  |  1991-09-07  |  7.6 KB  |  309 lines

  1. // Persistence of Vision Raytracer
  2. // Sample file
  3. // By Dan Farmer
  4. //    Minneapolis, MN
  5.  {
  6.    ( with much help from Aaron Collins.)
  7.  
  8.       Pool balls. Illustrates use of intersections.
  9.       Note: Gradients could also be used for the stripes.  The pool table
  10.       needs a rail, and perhaps, pockets.  Maybe a picture of a nude hanging
  11.       on the back wall and a cube of blue chalk sitting on the rail.
  12.       Go for it!!
  13.    
  14.  }
  15.  
  16.  
  17. #include "shapes.dat"
  18. #include "colors.dat"
  19. #include "textures.dat"
  20.  
  21. { ***************** set up a bunch of declarations **************************}
  22.  
  23. #declare Ball = sphere < 0.0 0.0 0.0 > 1.0 end_sphere
  24.  
  25. #declare RightSide = object
  26.     intersection
  27.         sphere Ball end_sphere
  28.         plane  <-1.0  0.0  0.0 > -0.5 end_plane  { Cut by Plane Facing Left }
  29.     end_intersection
  30.     texture
  31.       Shiny
  32.       color White
  33.     end_texture
  34.     color White
  35. end_object
  36.  
  37.  
  38. #declare Stripe = intersection    { Note: we don't know the object color yet! }
  39.     sphere Ball end_sphere
  40.     plane  <-1.0  0.0  0.0 > 0.5 end_plane  { Cut by Plane Facing Left }
  41.     plane  <1.0  0.0  0.0 >  0.5 end_plane  { And by Plane Facing Right }
  42. end_intersection
  43.  
  44.  
  45. #declare LeftSide = object
  46.     intersection
  47.         sphere Ball end_sphere
  48.         plane  <1.0  0.0  0.0 > -0.5 end_plane  { Cut by Plane Facing Right }
  49.     end_intersection
  50.     texture
  51.       Shiny
  52.       color White
  53.     end_texture
  54.     color White
  55. end_object
  56.  
  57.  
  58.  
  59. #declare _1_Ball = object
  60.     sphere  Ball  end_sphere
  61.     texture Shiny color Yellow end_texture
  62.     color   Yellow
  63. end_object
  64.  
  65. #declare _2_Ball = object
  66.     sphere  Ball  end_sphere
  67.     texture Shiny color CBlue end_texture
  68.     color   CBlue
  69. end_object
  70.  
  71. #declare _3_Ball = object
  72.     sphere  Ball  end_sphere
  73.     texture Shiny color CRed end_texture
  74.     color   CRed
  75. end_object
  76.  
  77. #declare _4_Ball = object
  78.     sphere  Ball  end_sphere
  79.     texture Shiny color Violet end_texture
  80.     color   Violet
  81. end_object
  82.  
  83. #declare _5_Ball = object
  84.     sphere  Ball  end_sphere
  85.     texture Shiny color Orange end_texture
  86.     color   Orange
  87. end_object
  88.  
  89. #declare _6_Ball = object
  90.     sphere  Ball  end_sphere
  91.     texture Shiny color ForestGreen end_texture
  92.     color   ForestGreen
  93. end_object
  94.  
  95. #declare _7_Ball = object
  96.     sphere  Ball  end_sphere
  97.     texture Shiny color Maroon end_texture
  98.     color   Maroon
  99. end_object
  100.  
  101. #declare _8_Ball = object
  102.     sphere  Ball  end_sphere
  103.     texture Shiny color Black end_texture
  104.     color   Black
  105. end_object
  106.  
  107.  
  108.  
  109. #declare _9_Ball = composite    { Yellow Stripe }
  110.     object
  111.       intersection Stripe end_intersection
  112.       texture Shiny color Yellow end_texture
  113.       color Yellow
  114.     end_object
  115.     object LeftSide  end_object
  116.     object RightSide end_object
  117. end_composite
  118.  
  119. #declare _10_Ball = composite    { CBlue Stripe }
  120.     object
  121.       intersection Stripe end_intersection
  122.       texture Shiny color CBlue end_texture
  123.       color CBlue
  124.     end_object
  125.     object LeftSide  end_object
  126.     object RightSide end_object
  127. end_composite
  128.  
  129. #declare _11_Ball = composite    { CRed Stripe }
  130.     object
  131.       intersection Stripe end_intersection
  132.       texture Shiny color CRed end_texture
  133.       color CRed  
  134.     end_object
  135.     object LeftSide  end_object
  136.     object RightSide end_object
  137. end_composite
  138.  
  139.  
  140. #declare _12_Ball = composite    { Violet Stripe }
  141.     object
  142.       intersection Stripe end_intersection
  143.       texture Shiny color Violet end_texture
  144.       color Violet
  145.     end_object
  146.     object LeftSide  end_object
  147.     object RightSide end_object
  148. end_composite
  149.  
  150. #declare _13_Ball = composite    { Orange Stripe }
  151.     object
  152.       intersection Stripe end_intersection
  153.       texture Shiny color Orange end_texture
  154.       color Orange
  155.     end_object
  156.     object LeftSide  end_object
  157.     object RightSide end_object
  158. end_composite
  159.  
  160. #declare _14_Ball = composite    { CGreen Stripe }
  161.     object
  162.       intersection Stripe end_intersection
  163.       texture Shiny color ForestGreen end_texture
  164.       color ForestGreen
  165.     end_object
  166.     object LeftSide  end_object
  167.     object RightSide end_object
  168. end_composite
  169.  
  170. #declare _15_Ball = composite    { Maroon Stripe }
  171.     object
  172.       intersection Stripe end_intersection
  173.       texture Shiny color Maroon end_texture
  174.       color Maroon
  175.     end_object
  176.     object LeftSide  end_object
  177.     object RightSide end_object
  178. end_composite
  179.  
  180. #declare CueStick = object
  181.     intersection
  182.       quadric Cylinder_Y end_quadric
  183.       plane <0.0  1.0  0.0>  1.0 end_plane     { Cut by Plane Facing Up }
  184.     end_intersection
  185.     texture
  186.       Dark_Wood
  187.       scale <0.01  0.01  0.01>
  188.       ambient 0.3
  189.       diffuse 0.7
  190.       phong 1.0
  191.       phongsize 20
  192.       reflection 0.3
  193.     end_texture
  194. end_object        
  195.  
  196. { ***************** set up the view & light sources *************************}
  197.  
  198. view_point
  199.    location <0.0  0.0  -15.0>
  200.    direction <0.0 0.0  1.0>
  201.    up  <0.0  1.0  0.0>
  202.    right <1.33333 0.0 0.0>
  203. end_view_point
  204.  
  205. { Light }
  206. object
  207.    sphere <0.0  0.0  0.0>  2.0 end_sphere
  208.    translate <2.0  2.0  -250.0>
  209.    rotate < 70.0 0.0 0.0 >
  210.    texture
  211.      color White
  212.      ambient 1.0
  213.      diffuse 0.0
  214.    end_texture
  215.    light_source
  216.    color White
  217. end_object
  218.  
  219. { ************************** set up the table *******************************}
  220.     note : The pooltable is set up as a composite in the x-y Plane and then 
  221.            the whole thing is thing is tilted "flat". 
  222.            i personally find this easier to visualize.
  223. }         
  224. composite
  225.     object     { Felt table top }
  226.         plane <0.0 0.0 1.0 > 1.0 end_plane
  227.         texture Dull color MediumForestGreen end_texture
  228.     color MediumForestGreen
  229.     end_object
  230.  
  231.     { Cue stick }
  232.     object CueStick
  233.         scale     <  0.15  1.0  0.15  >         { Skinny and long }
  234.         translate <  0.0  -7.5    0.0  > 
  235.     end_object
  236.  
  237.     { Cue Ball }
  238.     object
  239.         sphere Ball end_sphere
  240.         translate < 0.0  -6.0  0.0 >
  241.         texture Shiny color White end_texture
  242.         color White
  243.     end_object
  244.  
  245. { **************************** set up the balls *******************************}
  246.     { Row #1 }
  247.     object _1_Ball
  248.     end_object
  249.  
  250.     { Row #2 }
  251.     object _3_Ball
  252.         translate < 1.0  1.732  0.0 >
  253.     end_object
  254.     composite _10_Ball
  255.         rotate < 0.0  0.0  -80.0 >
  256.         translate < -1.0  1.732  0.0 >
  257.     end_composite
  258.  
  259.     { Row #3 }
  260.     composite _11_Ball
  261.         rotate < 0.0  -15.0  -2.0 >
  262.         translate < 2.0  3.464  0.0 >
  263.     end_composite
  264.     object _8_Ball
  265.         translate < 0.0  3.464  0.0 >
  266.     end_object
  267.     object _5_Ball
  268.         translate <-2.0  3.464  0.0 >
  269.     end_object
  270.  
  271.     { Row #4 }
  272.     object _2_Ball
  273.         translate <-3.0  5.196  0.0 >
  274.     end_object
  275.     object _7_Ball
  276.         translate <-1.0  5.196  0.0 >
  277.     end_object
  278.     object _4_Ball
  279.         translate < 1.0  5.196  0.0 >
  280.     end_object
  281.     composite _14_Ball
  282.         rotate < 0.0  -15.0  -2.0 >
  283.         translate < 3.0  5.196  0.0 >
  284.     end_composite
  285.  
  286.     { Row #5 }
  287.     composite _15_Ball
  288.         translate <-4.0  6.928  0.0 >
  289.     end_composite
  290.     composite _13_Ball
  291.         rotate < -5.0  11.0  -1.0 >
  292.         translate <-2.0  6.928  0.0 >
  293.     end_composite
  294.     composite _9_Ball
  295.         rotate < -80.0  -13.0  29.0 >
  296.         translate < 0.0  6.928  0.0 >
  297.     end_composite
  298.     composite _12_Ball
  299.         rotate < 15.0  15.0  -2.0 >
  300.         translate < 2.0  6.928  0.0 >
  301.     end_composite
  302.     object _6_Ball
  303.         translate < 4.0  6.928  0.0 >
  304.     end_object
  305.  
  306.     rotate < 70.0  0.0  0.0 >     
  307. end_composite
  308.