Subversion Repositories Games.Descent

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Portions of this file are copyright Rebirth contributors and licensed as
  3.  * described in COPYING.txt.
  4.  * Portions of this file are copyright Parallax Software and licensed
  5.  * according to the Parallax license below.
  6.  * See COPYING.txt for license details.
  7.  
  8. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  9. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  10. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  11. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  12. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  13. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  14. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  15. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  16. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  17. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  18. */
  19.  
  20. /*
  21.  *
  22.  * Lighting system prototypes, structures, etc.
  23.  *
  24.  */
  25.  
  26. #pragma once
  27.  
  28. #include "maths.h"
  29. #include "vecmat.h"
  30.  
  31. #ifdef __cplusplus
  32. #include "fwd-object.h"
  33. #include "fwd-segment.h"
  34. #include "3d.h"
  35.  
  36. #define MAX_LIGHT       0x10000     // max value
  37.  
  38. #define MIN_LIGHT_DIST  (F1_0*4)
  39.  
  40. namespace dcx {
  41.  
  42. struct d_level_unique_light_state
  43. {
  44.         std::array<g3s_lrgb, MAX_VERTICES> Dynamic_light;
  45. };
  46.  
  47. }
  48.  
  49. #if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
  50. namespace dsx {
  51.  
  52. #if defined(DXX_BUILD_DESCENT_II)
  53. struct d_level_unique_headlight_state
  54. {
  55.         unsigned Num_headlights = 0;
  56.         std::array<const object_base *, 8> Headlights = {};
  57. };
  58.  
  59. struct d_level_unique_light_state :
  60.         d_level_unique_headlight_state,
  61.         ::dcx::d_level_unique_light_state
  62. {
  63. };
  64. #endif
  65.  
  66. extern d_level_unique_light_state LevelUniqueLightState;
  67. }
  68. extern const object *old_viewer;
  69.  
  70. namespace dsx {
  71. // compute the lighting for an object.  Takes a pointer to the object,
  72. // and possibly a rotated 3d point.  If the point isn't specified, the
  73. // object's center point is rotated.
  74. g3s_lrgb compute_object_light(const d_level_unique_light_state &LevelUniqueLightState, vcobjptridx_t obj);
  75.  
  76. // turn headlight boost on & off
  77. #if defined(DXX_BUILD_DESCENT_II)
  78. void toggle_headlight_active(object &);
  79. #endif
  80. }
  81. void start_lighting_frame(const object &viewer);
  82. #endif
  83.  
  84. #endif
  85.