home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / graphics / ftpovstc / addon.h next >
C/C++ Source or Header  |  1994-05-25  |  6KB  |  238 lines

  1. /****************************************************************************
  2. *
  3. *  ATTENTION!!!
  4. *
  5. *  THIS FILE HAS BEEN MODIFIED!!! IT IS NOT PART OF THE OFFICAL
  6. *  POV-RAY 2.2 DISTRIBUTION!!!
  7. *
  8. *  THIS FILE IS PART OF "FASTER THAN POV-RAY" (VERSION 1.1),
  9. *  A SPED-UP VERSION OF POV-RAY 2.2. USE AT YOUR OWN RISK!!!!!!
  10. *
  11. *  New files: addon0.c, addon1.c, addon2.c, addon3.c, addon.h
  12. *
  13. *  The additional modules were written by Dieter Bayer.
  14. *
  15. *  Send comments, suggestions, bugs, ideas ... to:
  16. *
  17. *  dieter@cip.e-technik.uni-erlangen.de
  18. *
  19. *  All changed/added lines are enclosed in #ifdef DB_CODE ... #endif
  20. *
  21. *  The vista projection was taken from:
  22. *
  23. *    A. Hashimoto, T. Akimoto, K. Mase, and Y. Suenaga, 
  24. *    "Vista Ray-Tracing: High Speed Ray Tracing Using Perspective
  25. *    Projection Image", New Advances in Computer Graphics, Proceedings
  26. *    of CG International '89, R. A. Earnshaw, B. Wyvill (Eds.), 
  27. *    Springer, ..., pp. 549-560
  28. *
  29. *  The idea for the light buffer was taken from:
  30. *
  31. *    E. Haines and D. Greenberg, "The Light Buffer: A Shadow-Testing 
  32. *    Accelerator", IEEE CG&A, Vol. 6, No. 9, Sept. 1986, pp. 6-16
  33. *
  34. *****************************************************************************/
  35.  
  36. /****************************************************************************
  37. *
  38. *  ATTENTION!!!
  39. *
  40. *  THIS FILE HAS BEEN MODIFIED!!! IT IS NOT PART OF THE OFFICAL
  41. *  POV-RAY 2.2 DISTRIBUTION!!!
  42. *
  43. *  THIS FILE IS PART OF "FASTER THAN POV-RAY" (VERSION 1.1),
  44. *  A SPED-UP VERSION OF POV-RAY 2.2. USE AT YOUR OWN RISK!!!!!!
  45. *
  46. *  New files: addon0.c, addon1.c, addon2.c, addon3.c, addon.h
  47. *
  48. *  The additional modules were written by Dieter Bayer.
  49. *
  50. *  Send comments, suggestions, bugs to:
  51. *
  52. *  dieter@cip.e-technik.uni-erlangen.de
  53. *
  54. *  If I have enough time I will try to fix any bugs.
  55. *
  56. *  All changed/added lines are enclosed in #ifdef DB_CODE ... #endif
  57. *
  58. *  The new/changed modules speed-up ray-tracing in two ways:
  59. *
  60. *   - Objects are projected onto the viewing plane a priori. Thus
  61. *     the number of ray/object intersection tests is reduced for
  62. *     primary rays.
  63. *
  64. *   - A light buffer is used for every spotlight. Each object is
  65. *     projected a priori onto the six sides of a cube enclosing
  66. *     the light source. Thus the number of ray/object intersection
  67. *     tests is reduced for shadow rays.
  68. *
  69. *  The vista projection of qaudrics was taken from:
  70. *
  71. *    A. Hashimoto, T. Akimoto, K. Mase, and Y. Suenaga, "Vista
  72. *    Ray-Tracing: High Speed Ray Tracing Using Perspective
  73. *    Projection Image", New Advances in Computer Graphics,
  74. *    Proceedings of CG International '89, R. A. Earnshaw,
  75. *    B. Wyvill (Eds.), Springer, ...
  76. *
  77. *  The idea for the light buffer was taken from:
  78. *
  79. *    E. Haines and D. Greenberg, "The Light Buffer: A Shadow-
  80. *    Testing Accelerator", IEEE CG&A, Vol. 6, No. 9, Sept. 1986, pp. 6-16
  81. *
  82. *****************************************************************************/
  83.  
  84. /****************************************************************************
  85. *  addon.h
  86. *
  87. *  This module was written by Dieter Bayer.
  88. *
  89. *  Some definitions for the addon-modules and lighting.c.
  90. *
  91. *  01.03.1994 : Creation
  92. *
  93. *  29.04.1994 : Version 2.0
  94. *
  95. ******************************************************************************/
  96.  
  97. #ifdef DB_CODE
  98.  
  99. /* extended options */
  100.  
  101. #define USE_VISTA_BUFFER           1
  102. #define USE_LIGHT_BUFFER           2
  103. #define USE_PREVIEW                4
  104. #define USE_BOUND_QUADRICS         8
  105. #define USE_SPLIT_FINITE_UNIONS    16
  106. #define USE_SPLIT_INFINITE_UNIONS  32
  107.  
  108.  
  109.  
  110. /* tracing algorithms */
  111.  
  112. #define STANDARD_ALGORITHM     1
  113. #define WYVILL_SHARP_ALGORITHM 2
  114.  
  115.  
  116.  
  117. /* flags for the different algorithms to descend the vista/light trees */
  118.  
  119. #define PROJECTIONS_WITHOUT_SLABS   1
  120. #define PROJECTIONS_WITH_LEAF_SLABS 2
  121. #define PROJECTIONS_WITH_NODE_SLABS 3
  122.  
  123.  
  124.  
  125. /* flag to mark a node as pruned */
  126.  
  127. #define PRUNE_CHECK 128
  128. #define PRUNE_TEMPORARY 128
  129. #define PRUNE_TEMPORARY_INVERS 127
  130.  
  131.  
  132. #ifndef MAX_LB_ENTRY
  133. #define MAX_LB_ENTRY 32000
  134. #endif
  135.  
  136. #ifndef MIN_LB_ENTRY
  137. #define MIN_LB_ENTRY -32000
  138. #endif
  139.  
  140. #ifndef MAX_VB_ENTRY
  141. #define MAX_VB_ENTRY 32000
  142. #endif
  143.  
  144. #ifndef MIN_VB_ENTRY
  145. #define MIN_VB_ENTRY -32000
  146. #endif
  147.  
  148. #define MAX_CLIP_POINTS 20
  149. #define POINT_MOD 100
  150.  
  151. #define XaxisP 0
  152. #define XaxisM 1
  153. #define YaxisP 2
  154. #define YaxisM 3
  155. #define ZaxisP 4
  156. #define ZaxisM 5
  157.  
  158. #ifndef min
  159. #define min(x,y) ((x)<(y)?(x):(y))
  160. #endif
  161. #ifndef max
  162. #define max(x,y) ((x)>(y)?(x):(y))
  163. #endif
  164.  
  165. #ifndef BOUNDS_VOLUME
  166. #define BOUNDS_VOLUME(a,b) \
  167.     ((a)=((b).Lengths.x)*((b).Lengths.y)*((b).Lengths.z))
  168. #endif
  169.  
  170. /* due to precision problems with the projection of bounding boxes
  171.    with infinte dimensions in one or two directions set the 
  172.    infinite volume to a 'low' value */
  173.  
  174. #ifndef INFINITE_VOLUME
  175. #define INFINITE_VOLUME BOUND_HUGE/1000
  176. #endif
  177.  
  178.  
  179. /* if a bounding box's length is greater than the critical length,
  180.    set it to an infinite bounding box */
  181.  
  182. #ifndef CRITICAL_LENGTH
  183. #define CRITICAL_LENGTH 1e6
  184. #endif
  185.  
  186.  
  187.  
  188.  
  189. /* public functions defined in addon0.c */
  190.  
  191. void Clip_Polygon PARAMS((VECTOR *Points, int *PointCnt,
  192.   VECTOR *VX1, VECTOR *VX2, VECTOR *VY1, VECTOR *VY2,
  193.   DBL DX1, DBL DX2, DBL DY1, DBL DY2));
  194.  
  195. int Clip_Line PARAMS((VECTOR *P1, VECTOR *P2,
  196.   VECTOR *VX1, VECTOR *VX2, VECTOR *VY1, VECTOR *VY2,
  197.   DBL DX1, DBL DX2, DBL DY1, DBL DY2));
  198.  
  199. void Begin_Point PARAMS((void));
  200. void Print_Point PARAMS((int Repeat));
  201. void End_Point PARAMS((void));
  202.  
  203. void MInvers PARAMS((MATRIX *r, MATRIX *m));
  204.  
  205. void *VB_malloc PARAMS((size_t size));
  206. void *LB_malloc PARAMS((size_t size));
  207.  
  208.  
  209. /* public functions defined in addon1.c */
  210.  
  211. void Init_Project_Tree_Queues PARAMS((void));
  212.  
  213. void Build_Projections PARAMS((void));
  214.  
  215. void Init_View_Coordinates PARAMS((void));
  216.  
  217. void Sort_Objects PARAMS((long int l, long int r));
  218.  
  219. void Project_Vista PARAMS((MATRIX *A0, TRANSFORM *Trans, DBL *a20, DBL *a02, DBL *a11, DBL *a10, DBL *a01, DBL *a00));
  220.  
  221. void Build_Vista_Tree PARAMS((void));
  222.  
  223.  
  224.  
  225. /* public functions defined in addon2.c */
  226.  
  227. void Build_Light_Buffers PARAMS((void));
  228.  
  229.  
  230.  
  231. /* public functions defined in addon3.c */
  232.  
  233. void Recompute_Bboxes PARAMS((void));
  234. void Remove_Unnecessary_Bounds PARAMS((void));
  235. void Print_Quadric_Stats PARAMS((void));
  236.  
  237. #endif
  238.