home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Raytrace & Morphing / SOS-RAYTRACE.ISO / programm / raytrace / rayce27 / lamp.r < prev    next >
Encoding:
Text File  |  1994-02-02  |  1.8 KB  |  97 lines

  1. /*
  2.    Just an idea.
  3.  
  4.    A lamp on a table, demonstrating falloff of light.
  5.  
  6.    Tests shadowcache: with: 1.9 ms/ray
  7.      without: 2.5 ms/ray
  8.  
  9.    1993 HWN
  10. */
  11.  
  12. #include "shapes.inc"
  13. #include "colors.inc"
  14.  
  15. camera { 
  16.   location <-130, 200, -200>
  17.   sky <0, 1, 0>
  18.   fov 40
  19.   look_at <0, 150, 0>
  20. }
  21.  
  22. #declare Cream = color rgb <0.9, 1.0, 1.0>
  23.  
  24. #declare Wall_Text = texture {
  25.   diffuse color Cream diffuse 0.8
  26.   ambient color Cream ambient 0.2
  27. }
  28.  
  29. #declare  wall = object {
  30.   plane { -z, 0 }
  31.   texture { 
  32.     Wall_Text
  33.   }
  34. }
  35.  
  36.  
  37. #declare Wood_Texture = texture { 
  38.     diffuse color Brown diffuse 0.45
  39.     ambient color Brown ambient 0.05
  40. }
  41.  
  42. #declare leg = box { <-4, 0, -4>, <4, 100, 4> }
  43.  
  44. #declare table = composite {
  45.   box { leg translate <-100, 0, 50> }
  46.   box { leg translate <100, 0, 50> }
  47.   box { leg translate <-100, 0, 50> }
  48.   box { leg translate <100, 0, 50> }
  49.   box { <-110, 100, -60>, <110, 110, 60> }
  50.   texture { Wood_Texture }
  51. }
  52.  
  53. #declare cap = object {
  54.   quadric { QCone_Y }
  55.   bounded_by  { box { <-100, -20, -100>, <100, -40, 100> } }
  56.   clipped_by { bounded_by }
  57.   translate 40*y
  58.   texture  {
  59.     ambient color rgb 0.7 * <color CornflowerBlue>
  60.     diffuse color rgb 0.3 * <color CornflowerBlue>
  61.   }
  62. }
  63.  
  64. #declare stand = composite {
  65.   cylinder { <0,0,0>, <0,32,0>, 3}
  66.   cylinder { <0,0,0>, <0,3,0>,  15}
  67.   torus { 15,1.5 translate 1.5*y }
  68.   light_source { 
  69.     y*45 color rgb 10*<color Yellow> 
  70.     radius 4 attenuation 1
  71.   }
  72.   texture {
  73.     ambient color Brass    ambient 0.2
  74.     diffuse color Brass diffuse 0.8
  75.     specular color Brass    // metallic!
  76.     reflection 0.1
  77.   }
  78. }
  79.  
  80. #declare lamp = composite {
  81.   composite {  
  82.     stand
  83.   }
  84.   object { cap translate y*30 }
  85. }
  86.  
  87. /**********************/
  88.  
  89. composite { table
  90.   translate z*-60
  91. }
  92.  
  93. object { wall }
  94.  
  95. composite { lamp translate <0, 110, -40> } 
  96. object { light_source { <-200, 200, -200> color rgb 0.2*<1,1,1> } }
  97.