light.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*=============================================================================
  2. Name : Light.h
  3. Purpose : Definitions for manipulating lights
  4. Created 8/13/1997 by lmoloney
  5. Copyright Relic Entertainment, Inc. All rights reserved.
  6. =============================================================================*/
  7. #ifndef ___LIGHT_H
  8. #define ___LIGHT_H
  9. #include "types.h"
  10. /*=============================================================================
  11. Switches
  12. =============================================================================*/
  13. #ifndef HW_Release
  14. #define LIGHT_ERROR_CHECKING 1 //general error checking
  15. #define LIGHT_VERBOSE_LEVEL 2 //print extra info
  16. #define LIGHT_PLAYER_COLORS 0 //set colored lights for players
  17. #else //HW_Debug
  18. #define LIGHT_ERROR_CHECKING 0 //general error checking
  19. #define LIGHT_VERBOSE_LEVEL 0 //print extra info
  20. #define LIGHT_PLAYER_COLORS 0 //set colored lights for players
  21. #endif //HW_Debug
  22. /*=============================================================================
  23. Type definitions:
  24. =============================================================================*/
  25. typedef struct
  26. {
  27. udword type; //from tagLightTypes enum
  28. real32 ambient[4];
  29. real32 diffuse[4];
  30. real32 specular[4];
  31. real32 position[4];
  32. }
  33. lightinfo;
  34. enum tagLightTypes
  35. {
  36. L_DistantLight,
  37. L_PointLight,
  38. L_SpotLight,
  39. L_LinearLight,
  40. L_AreaLight,
  41. L_AmbientLight
  42. };
  43. #define HSF_FILE_ID "rrasberry"
  44. typedef struct
  45. {
  46. char identifier[12];
  47. udword version;
  48. udword nLights;
  49. } HSFFileHeader;
  50. typedef struct
  51. {
  52. udword type;
  53. real32 x, y, z;
  54. real32 h, p, b;
  55. real32 coneAngle;
  56. real32 edgeAngle;
  57. ubyte red, green, blue;
  58. real32 intensity;
  59. } HSFLight;
  60. /*=============================================================================
  61. Data:
  62. =============================================================================*/
  63. extern udword lightNumLights;
  64. extern char lightCurrentLighting[];
  65. /*=============================================================================
  66. Functions:
  67. =============================================================================*/
  68. //startup/shutdown
  69. void lightStartup(void);
  70. void lightShutdown(void);
  71. //set the current lighting properties
  72. void lightPositionSet(void);
  73. void lightDefaultLightSet(void);
  74. #if LIGHT_PLAYER_COLORS
  75. void lightPlayerColorLightSet(sdword playerIndex);
  76. #endif
  77. //parse an HSF file full of lighting data, filling in the default lightinfo struct
  78. void lightParseHSF(char*);
  79. //gl up the lighting info (either from an hsf, or defaultlightset)
  80. void lightSetLighting(void);
  81. void lightSetNumLights(udword numLights);
  82. void lightGetPosition(sdword lightIndex, hvector* position);
  83. #endif //___LIGHT_H