home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 215 / DDJ9302.ZIP / XSHRP21.ZIP / INITLIGH.C < prev    next >
Text File  |  1992-04-03  |  2KB  |  58 lines

  1. /* Initializes lighting. */
  2.  
  3. #include "polygon.h"
  4.  
  5. /* Selects 0-10-0% intensity for R, G, and B for initial ambient lighting */
  6. static ModelIntensity InitialAmbient = {
  7.       DOUBLE_TO_FIXED(0.0), DOUBLE_TO_FIXED(0.10), DOUBLE_TO_FIXED(0.0)
  8. };
  9.  
  10. /* Initial spot 0 comes in from the upper right */
  11. static Point3 InitialSpot0Direction = {
  12.       DOUBLE_TO_FIXED(-1), DOUBLE_TO_FIXED(-1), DOUBLE_TO_FIXED(-1)
  13. };
  14.  
  15. /* Initial spot 0 is 0% red, 75% green, 0% blue */
  16. static ModelIntensity InitialSpot0Intensity = {
  17.       DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0.75), DOUBLE_TO_FIXED(0)
  18. };
  19.  
  20. /* Spot 1 comes in from the lower left */
  21. static Point3 Spot1Direction = {
  22.       DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(-1)
  23. };
  24.  
  25. /* Spot 1 is 0% red, 40% green, 0% blue */
  26. static ModelIntensity Spot1Intensity = {
  27.       DOUBLE_TO_FIXED(0.0), DOUBLE_TO_FIXED(0.4), DOUBLE_TO_FIXED(0.0)
  28. };
  29.  
  30. /* Spot 2 comes in from the left */
  31. static Point3 Spot2Direction = {
  32.       DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0)
  33. };
  34.  
  35. /* Spot 2 is 0% red, 0% green, 60% blue */
  36. static ModelIntensity Spot2Intensity = {
  37.       DOUBLE_TO_FIXED(0.0), DOUBLE_TO_FIXED(0.0), DOUBLE_TO_FIXED(0.6)
  38. };
  39.  
  40. void InitializeLighting()
  41. {
  42.    SetAmbientIntensity(&InitialAmbient);
  43.    TurnAmbientOn();
  44.  
  45.    /* Prepare first spotlight for when we'll need it */
  46.    SetSpotDirection(0, &InitialSpot0Direction);
  47.    SetSpotIntensity(0, &InitialSpot0Intensity);
  48.  
  49.    /* Prepare second spotlight for when we'll need it */
  50.    SetSpotDirection(1, &Spot1Direction);
  51.    SetSpotIntensity(1, &Spot1Intensity);
  52.  
  53.    /* Prepare third spotlight for when we'll need it */
  54.    SetSpotDirection(2, &Spot2Direction);
  55.    SetSpotIntensity(2, &Spot2Intensity);
  56. }
  57.  
  58.