r_main.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. ===========================================================================
  3. Doom 3 BFG Edition GPL Source Code
  4. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
  6. Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __R_MAIN__
  21. #define __R_MAIN__
  22. #include "d_player.h"
  23. #include "r_data.h"
  24. #ifdef __GNUG__
  25. #pragma interface
  26. #endif
  27. //
  28. // POV related.
  29. //
  30. extern fixed_t viewcos;
  31. extern fixed_t viewsin;
  32. extern int viewwidth;
  33. extern int viewheight;
  34. extern int viewwindowx;
  35. extern int viewwindowy;
  36. extern int centerx;
  37. extern int centery;
  38. extern fixed_t centerxfrac;
  39. extern fixed_t centeryfrac;
  40. extern fixed_t projection;
  41. extern int validcount;
  42. extern int linecount;
  43. extern int loopcount;
  44. //
  45. // Lighting LUT.
  46. // Used for z-depth cuing per column/row,
  47. // and other lighting effects (sector ambient, flash).
  48. //
  49. // Lighting constants.
  50. // Now why not 32 levels here?
  51. #define LIGHTLEVELS 16
  52. #define LIGHTSEGSHIFT 4
  53. #define MAXLIGHTSCALE 48
  54. #define LIGHTSCALESHIFT 12
  55. #define MAXLIGHTZ 128
  56. #define LIGHTZSHIFT 20
  57. extern lighttable_t* scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
  58. extern lighttable_t* scalelightfixed[MAXLIGHTSCALE];
  59. extern lighttable_t* zlight[LIGHTLEVELS][MAXLIGHTZ];
  60. extern int extralight;
  61. extern lighttable_t* fixedcolormap;
  62. // Number of diminishing brightness levels.
  63. // There a 0-31, i.e. 32 LUT in the COLORMAP lump.
  64. #define NUMCOLORMAPS 32
  65. // Blocky/low detail mode.
  66. //B remove this?
  67. // 0 = high, 1 = low
  68. extern int detailshift;
  69. //
  70. // Function pointers to switch refresh/drawing functions.
  71. // Used to select shadow mode etc.
  72. //
  73. extern void (*colfunc) ( lighttable_t * ds_colormap,
  74. byte * ds_source );
  75. extern void (*basecolfunc) ( lighttable_t * ds_colormap,
  76. byte * ds_source );
  77. extern void (*fuzzcolfunc) ( lighttable_t * ds_colormap,
  78. byte * ds_source );
  79. // No shadow effects on floors.
  80. extern void (*spanfunc) (
  81. fixed_t xfrac,
  82. fixed_t yfrac,
  83. fixed_t ds_y,
  84. int ds_x1,
  85. int ds_x2,
  86. fixed_t ds_xstep,
  87. fixed_t ds_ystep,
  88. lighttable_t * ds_colormap,
  89. byte * ds_source );
  90. //
  91. // Utility functions.
  92. int
  93. R_PointOnSide
  94. ( fixed_t x,
  95. fixed_t y,
  96. node_t* node );
  97. int
  98. R_PointOnSegSide
  99. ( fixed_t x,
  100. fixed_t y,
  101. seg_t* line );
  102. angle_t
  103. R_PointToAngle
  104. ( fixed_t x,
  105. fixed_t y );
  106. angle_t
  107. R_PointToAngle2
  108. ( fixed_t x1,
  109. fixed_t y1,
  110. fixed_t x2,
  111. fixed_t y2 );
  112. fixed_t
  113. R_PointToDist
  114. ( fixed_t x,
  115. fixed_t y );
  116. fixed_t R_ScaleFromGlobalAngle (angle_t visangle);
  117. subsector_t*
  118. R_PointInSubsector
  119. ( fixed_t x,
  120. fixed_t y );
  121. void
  122. R_AddPointToBox
  123. ( int x,
  124. int y,
  125. fixed_t* box );
  126. //
  127. // REFRESH - the actual rendering functions.
  128. //
  129. // Called by G_Drawer.
  130. void R_RenderPlayerView (player_t *player);
  131. // Called by startup code.
  132. void R_Init (void);
  133. // Called by M_Responder.
  134. void R_SetViewSize (int blocks, int detail);
  135. #endif