home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Raytrace & Morphing / SOS-RAYTRACE.ISO / programm / raytrace / rayce27 / csg1.r < prev    next >
Encoding:
Text File  |  1993-11-25  |  1.7 KB  |  75 lines

  1. // test csg
  2.  
  3. camera{
  4.   location <4, 3, -5>
  5.   fov 90
  6.   look_at <0, 0, 0>
  7. }
  8.  
  9. options { background y color rgb <0.2, 0.2, 0.2> }
  10.  
  11. #declare WeirdGreen =texture {    /* any suggestions for a better name? */
  12.   diffuse color red 0.8 blue 0.8 ambient color green 0.2  
  13. }
  14.  
  15. #declare csg1 = composite {
  16.   object { /* ok */
  17.     intersection {
  18.       sphere { <0, 0, 0>, 4 }
  19.       plane { <1, 0, 0>, 0 }
  20.       plane { <0, 0, -1>, 0 }
  21.     }
  22.     texture { WeirdGreen }  
  23.   }
  24.   object { light_source { <-2, 0, -2> color red 1.0 }  }
  25.   object { light_source { <1, 0, 0> color blue 1.0} }
  26. }
  27.  
  28. #declare csg1a = composite {
  29.     /* the same, now with quadric */
  30.     intersection {    /* this works OK too */
  31.       quadric { <1, 1, 1>, <0, 0, 0>, <0, 0, 0>, -16 }
  32.       plane { <1, 0, 0>, 0 }
  33.       plane { <0, 0, -1>, 0.01 }        
  34.       texture { WeirdGreen }
  35.     }
  36.   object { light_source { <-2, 0, -2> color red 1.0 }  }
  37. }
  38.  
  39. #declare Cilinder_Z = quadric { <1, 1, 0>, <0, 0, 0>, <0, 0, 0>, -1 }
  40.  
  41. #declare csg2 = composite {
  42.     intersection {
  43.       plane { <0, 0, -1>, 0 }
  44.       quadric { Cilinder_Z }
  45.       texture { WeirdGreen }
  46.     }
  47.   object { light_source { <5, 3, -1> color red 1.0 } }
  48. }
  49.  
  50. #declare CSGBox = intersection {    /* test declares */
  51.   plane { <0, 1, 0>, 1 }
  52.   plane { <0, -1, 0>, 1 }
  53.   plane { <0, 0, 1>, 1 }  
  54.   plane { <0, 0, -1>, 1 }  
  55.   plane { <1, 0, 0>, 1 }
  56.   plane { <-1, 0, 0>, 1 }
  57.   scale <2, 2, 2>        /* test scaling */
  58. }
  59.  
  60. #declare csg3 = composite{     /* OK!*/
  61.   intersection { CSGBox texture { WeirdGreen } }
  62.   light_source { <-4, 4, -4> color red 1.0 } 
  63.   light_source { <4, 1, 1> color blue 1.0 } 
  64. }
  65.  
  66. #declare csg6 = composite {
  67.   union { 
  68.       sphere { <0, 0, 0>, 3 }
  69.       sphere { <0, 0, 3>, 3 }
  70.       texture { WeirdGreen }
  71.   }
  72.   object { light_source { <8, 2, 2> color blue 1.0 } }
  73. }
  74.  
  75.