Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1291 lines
38 KiB

  1. /*
  2. ** Copyright 1991, Silicon Graphics, Inc.
  3. ** All Rights Reserved.
  4. **
  5. ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6. ** the contents of this file may not be disclosed to third parties, copied or
  7. ** duplicated in any form, in whole or in part, without the prior written
  8. ** permission of Silicon Graphics, Inc.
  9. **
  10. ** RESTRICTED RIGHTS LEGEND:
  11. ** Use, duplication or disclosure by the Government is subject to restrictions
  12. ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13. ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14. ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15. ** rights reserved under the Copyright Laws of the United States.
  16. **
  17. ** $Revision: 1.15 $
  18. ** $Date: 1993/10/07 18:43:05 $
  19. */
  20. #include "precomp.h"
  21. #pragma hdrstop
  22. #ifdef _X86_
  23. #include <gli386.h>
  24. #endif
  25. /*
  26. ** Clipping macros. These are used to reduce the amount of code
  27. ** hand written below.
  28. */
  29. #ifdef _X86_
  30. // Do a four-component linear interpolation from b to a based on t
  31. // Set up registers for multiple LERP4s
  32. #ifdef NOT_FASTCALL
  33. #define LERP_START(dst, a, b) \
  34. __asm mov ecx, dst \
  35. __asm mov edx, a \
  36. __asm mov eax, b
  37. #else
  38. // This relies on dst == ecx and a == edx due to fastcall argument passing
  39. #define LERP_START(dst, a, b) \
  40. __asm mov eax, b
  41. #endif
  42. // Do a four-component linear interpolation from b to a based on t
  43. // Offsets are assumed to be equal in a, b and d
  44. // Offsets are assumed to increase by four for each component
  45. // LERP_START must come before this
  46. #define LERP4(t, offs) \
  47. __asm fld t \
  48. __asm fld DWORD PTR [edx+offs] \
  49. __asm fsub DWORD PTR [eax+offs] \
  50. __asm fmul st(0), st(1) \
  51. __asm fld DWORD PTR [edx+offs+4] \
  52. __asm fsub DWORD PTR [eax+offs+4] \
  53. __asm fmul st(0), st(2) \
  54. __asm fld DWORD PTR [edx+offs+8] \
  55. __asm fsub DWORD PTR [eax+offs+8] \
  56. __asm fmul st(0), st(3) \
  57. __asm fld DWORD PTR [edx+offs+12] \
  58. __asm fsub DWORD PTR [eax+offs+12] \
  59. __asm fxch st(4) \
  60. __asm fmulp st(4), st(0) \
  61. /* Stack is now 8 4 0 12 */ \
  62. __asm fadd DWORD PTR [eax+offs+8] \
  63. __asm fxch st(2) \
  64. /* Stack is now 0 4 8 12 */ \
  65. __asm fadd DWORD PTR [eax+offs] \
  66. __asm fxch st(1) \
  67. /* Stack is now 4 0 8 12 */ \
  68. __asm fadd DWORD PTR [eax+offs+4] \
  69. __asm fxch st(3) \
  70. /* Stack is now 12 0 8 4 */ \
  71. __asm fadd DWORD PTR [eax+offs+12] \
  72. __asm fstp DWORD PTR [ecx+offs+12] \
  73. __asm fstp DWORD PTR [ecx+offs] \
  74. __asm fstp DWORD PTR [ecx+offs+8] \
  75. __asm fstp DWORD PTR [ecx+offs+4] \
  76. #define __GL_CLIP_POS(d, a, b, t) LERP4(t, VCLIP_x)
  77. #define __GL_CLIP_COLOR(d, a, b, t) LERP4(t, VFCOL_r)
  78. #define __GL_CLIP_BACKCOLOR(d, a, b, t) LERP4(t, VBCOL_r)
  79. #define __GL_CLIP_TEXTURE(d, a, b, t) LERP4(t, VTEX_x)
  80. #define __GL_CLIP_NORMAL(d, a, b, t) LERP4(t, VNOR_x)
  81. #define __GL_CLIP_EYE(d, a, b, t) LERP4(t, VEYE_x)
  82. #else // _X86_
  83. #define LERP_START(dst, a, b)
  84. #ifdef NT
  85. // window is not used!
  86. #define __GL_CLIP_POS(d,a,b,t) \
  87. d->clip.x = t*(a->clip.x - b->clip.x) + b->clip.x; \
  88. d->clip.y = t*(a->clip.y - b->clip.y) + b->clip.y; \
  89. d->clip.z = t*(a->clip.z - b->clip.z) + b->clip.z; \
  90. d->clip.w = t*(a->clip.w - b->clip.w) + b->clip.w
  91. #else
  92. #define __GL_CLIP_POS(d,a,b,t) \
  93. d->clip.w = t*(a->clip.w - b->clip.w) + b->clip.w; \
  94. /* XXX (mf) Handle w=0.0. Mathematically incorrect, but prevents /0 */ \
  95. if( d->clip.w == (__GLfloat) 0.0 ) { \
  96. d->window.w = (__GLfloat) 0.0; \
  97. } \
  98. else \
  99. d->window.w = ((__GLfloat) 1.0) / d->clip.w; \
  100. d->clip.x = t*(a->clip.x - b->clip.x) + b->clip.x; \
  101. d->clip.y = t*(a->clip.y - b->clip.y) + b->clip.y; \
  102. d->clip.z = t*(a->clip.z - b->clip.z) + b->clip.z
  103. #endif
  104. #define __GL_CLIP_COLOR(d,a,b,t) \
  105. d->colors[__GL_FRONTFACE].r = t*(a->colors[__GL_FRONTFACE].r \
  106. - b->colors[__GL_FRONTFACE].r) + b->colors[__GL_FRONTFACE].r; \
  107. d->colors[__GL_FRONTFACE].g = t*(a->colors[__GL_FRONTFACE].g \
  108. - b->colors[__GL_FRONTFACE].g) + b->colors[__GL_FRONTFACE].g; \
  109. d->colors[__GL_FRONTFACE].b = t*(a->colors[__GL_FRONTFACE].b \
  110. - b->colors[__GL_FRONTFACE].b) + b->colors[__GL_FRONTFACE].b; \
  111. d->colors[__GL_FRONTFACE].a = t*(a->colors[__GL_FRONTFACE].a \
  112. - b->colors[__GL_FRONTFACE].a) + b->colors[__GL_FRONTFACE].a
  113. #define __GL_CLIP_BACKCOLOR(d,a,b,t) \
  114. d->colors[__GL_BACKFACE].r = t*(a->colors[__GL_BACKFACE].r \
  115. - b->colors[__GL_BACKFACE].r) + b->colors[__GL_BACKFACE].r; \
  116. d->colors[__GL_BACKFACE].g = t*(a->colors[__GL_BACKFACE].g \
  117. - b->colors[__GL_BACKFACE].g) + b->colors[__GL_BACKFACE].g; \
  118. d->colors[__GL_BACKFACE].b = t*(a->colors[__GL_BACKFACE].b \
  119. - b->colors[__GL_BACKFACE].b) + b->colors[__GL_BACKFACE].b; \
  120. d->colors[__GL_BACKFACE].a = t*(a->colors[__GL_BACKFACE].a \
  121. - b->colors[__GL_BACKFACE].a) + b->colors[__GL_BACKFACE].a
  122. #define __GL_CLIP_TEXTURE(d,a,b,t) \
  123. d->texture.x = t*(a->texture.x - b->texture.x) + b->texture.x; \
  124. d->texture.y = t*(a->texture.y - b->texture.y) + b->texture.y; \
  125. d->texture.z = t*(a->texture.z - b->texture.z) + b->texture.z; \
  126. d->texture.w = t*(a->texture.w - b->texture.w) + b->texture.w
  127. #define __GL_CLIP_NORMAL(d,a,b,t) \
  128. d->normal.x = t*(a->normal.x - b->normal.x) + b->normal.x; \
  129. d->normal.y = t*(a->normal.y - b->normal.y) + b->normal.y; \
  130. d->normal.z = t*(a->normal.z - b->normal.z) + b->normal.z;
  131. #define __GL_CLIP_EYE(d,a,b,t) \
  132. d->eyeX = t*(a->eyeX - b->eyeX) + b->eyeX; \
  133. d->eyeY = t*(a->eyeY - b->eyeY) + b->eyeY; \
  134. d->eyeZ = t*(a->eyeZ - b->eyeZ) + b->eyeZ;
  135. #endif // _x86_
  136. /*
  137. ** The following is done this way since when we are slow fogging we want to
  138. ** clip the eye.z coordinate only, while when we are cheap fogging we want
  139. ** to clip the fog value. This way we avoid doubling the number of clip
  140. ** routines.
  141. #ifdef GL_WIN_specular_fog
  142. ** anankan: If we are doing specularly lit textures, then we need to clip
  143. ** the fog as well as eyeZ when both fog and specular_fog are enabled.
  144. #endif //GL_WIN_specular_fog
  145. */
  146. #define __GL_CLIP_FOG(d,a,b,t) \
  147. if (a->has & __GL_HAS_FOG) \
  148. d->fog = t * (a->fog - b->fog) + b->fog; \
  149. else \
  150. d->eyeZ = t*(a->eyeZ - b->eyeZ) + b->eyeZ
  151. #define __GL_CLIP_INDEX(d,a,b,t) \
  152. d->colors[__GL_FRONTFACE].r = t*(a->colors[__GL_FRONTFACE].r \
  153. - b->colors[__GL_FRONTFACE].r) + b->colors[__GL_FRONTFACE].r
  154. #define __GL_CLIP_BACKINDEX(d,a,b,t) \
  155. d->colors[__GL_BACKFACE].r = t*(a->colors[__GL_BACKFACE].r \
  156. - b->colors[__GL_BACKFACE].r) + b->colors[__GL_BACKFACE].r
  157. /************************************************************************/
  158. /*
  159. Naming code:
  160. C = Front color
  161. B = Back color
  162. I = Front index
  163. X = Back index
  164. F = Fog
  165. T = Texture
  166. N = Normal
  167. Pos = <no letter>
  168. */
  169. static void FASTCALL Clip(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  170. __GLfloat t)
  171. {
  172. LERP_START(dst, a, b);
  173. __GL_CLIP_POS(dst,a,b,t);
  174. }
  175. static void FASTCALL ClipC(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  176. __GLfloat t)
  177. {
  178. LERP_START(dst, a, b);
  179. __GL_CLIP_POS(dst,a,b,t);
  180. __GL_CLIP_COLOR(dst,a,b,t);
  181. }
  182. static void FASTCALL ClipB(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  183. __GLfloat t)
  184. {
  185. LERP_START(dst, a, b);
  186. __GL_CLIP_POS(dst,a,b,t);
  187. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  188. }
  189. static void FASTCALL ClipI(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  190. __GLfloat t)
  191. {
  192. LERP_START(dst, a, b);
  193. __GL_CLIP_POS(dst,a,b,t);
  194. __GL_CLIP_INDEX(dst,a,b,t);
  195. }
  196. static void FASTCALL ClipX(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  197. __GLfloat t)
  198. {
  199. LERP_START(dst, a, b);
  200. __GL_CLIP_POS(dst,a,b,t);
  201. __GL_CLIP_BACKINDEX(dst,a,b,t);
  202. }
  203. static void FASTCALL ClipCB(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  204. __GLfloat t)
  205. {
  206. LERP_START(dst, a, b);
  207. __GL_CLIP_POS(dst,a,b,t);
  208. __GL_CLIP_COLOR(dst,a,b,t);
  209. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  210. }
  211. static void FASTCALL ClipIX(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  212. __GLfloat t)
  213. {
  214. LERP_START(dst, a, b);
  215. __GL_CLIP_POS(dst,a,b,t);
  216. __GL_CLIP_INDEX(dst,a,b,t);
  217. __GL_CLIP_BACKINDEX(dst,a,b,t);
  218. }
  219. static void FASTCALL ClipT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  220. __GLfloat t)
  221. {
  222. LERP_START(dst, a, b);
  223. __GL_CLIP_POS(dst,a,b,t);
  224. __GL_CLIP_TEXTURE(dst,a,b,t);
  225. }
  226. static void FASTCALL ClipIT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  227. __GLfloat t)
  228. {
  229. LERP_START(dst, a, b);
  230. __GL_CLIP_POS(dst,a,b,t);
  231. __GL_CLIP_INDEX(dst,a,b,t);
  232. __GL_CLIP_TEXTURE(dst,a,b,t);
  233. }
  234. static void FASTCALL ClipXT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  235. __GLfloat t)
  236. {
  237. LERP_START(dst, a, b);
  238. __GL_CLIP_POS(dst,a,b,t);
  239. __GL_CLIP_BACKINDEX(dst,a,b,t);
  240. __GL_CLIP_TEXTURE(dst,a,b,t);
  241. }
  242. static void FASTCALL ClipIXT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  243. __GLfloat t)
  244. {
  245. LERP_START(dst, a, b);
  246. __GL_CLIP_POS(dst,a,b,t);
  247. __GL_CLIP_INDEX(dst,a,b,t);
  248. __GL_CLIP_BACKINDEX(dst,a,b,t);
  249. __GL_CLIP_TEXTURE(dst,a,b,t);
  250. }
  251. static void FASTCALL ClipCT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  252. __GLfloat t)
  253. {
  254. LERP_START(dst, a, b);
  255. __GL_CLIP_POS(dst,a,b,t);
  256. __GL_CLIP_COLOR(dst,a,b,t);
  257. __GL_CLIP_TEXTURE(dst,a,b,t);
  258. }
  259. static void FASTCALL ClipBT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  260. __GLfloat t)
  261. {
  262. LERP_START(dst, a, b);
  263. __GL_CLIP_POS(dst,a,b,t);
  264. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  265. __GL_CLIP_TEXTURE(dst,a,b,t);
  266. }
  267. static void FASTCALL ClipCBT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  268. __GLfloat t)
  269. {
  270. LERP_START(dst, a, b);
  271. __GL_CLIP_POS(dst,a,b,t);
  272. __GL_CLIP_COLOR(dst,a,b,t);
  273. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  274. __GL_CLIP_TEXTURE(dst,a,b,t);
  275. }
  276. static void FASTCALL ClipF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  277. __GLfloat t)
  278. {
  279. LERP_START(dst, a, b);
  280. __GL_CLIP_POS(dst,a,b,t);
  281. __GL_CLIP_FOG(dst,a,b,t);
  282. }
  283. static void FASTCALL ClipIF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  284. __GLfloat t)
  285. {
  286. LERP_START(dst, a, b);
  287. __GL_CLIP_POS(dst,a,b,t);
  288. __GL_CLIP_INDEX(dst,a,b,t);
  289. __GL_CLIP_FOG(dst,a,b,t);
  290. }
  291. static void FASTCALL ClipXF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  292. __GLfloat t)
  293. {
  294. LERP_START(dst, a, b);
  295. __GL_CLIP_POS(dst,a,b,t);
  296. __GL_CLIP_BACKINDEX(dst,a,b,t);
  297. __GL_CLIP_FOG(dst,a,b,t);
  298. }
  299. static void FASTCALL ClipIXF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  300. __GLfloat t)
  301. {
  302. LERP_START(dst, a, b);
  303. __GL_CLIP_POS(dst,a,b,t);
  304. __GL_CLIP_INDEX(dst,a,b,t);
  305. __GL_CLIP_BACKINDEX(dst,a,b,t);
  306. __GL_CLIP_FOG(dst,a,b,t);
  307. }
  308. static void FASTCALL ClipCF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  309. __GLfloat t)
  310. {
  311. LERP_START(dst, a, b);
  312. __GL_CLIP_POS(dst,a,b,t);
  313. __GL_CLIP_COLOR(dst,a,b,t);
  314. __GL_CLIP_FOG(dst,a,b,t);
  315. }
  316. static void FASTCALL ClipBF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  317. __GLfloat t)
  318. {
  319. LERP_START(dst, a, b);
  320. __GL_CLIP_POS(dst,a,b,t);
  321. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  322. __GL_CLIP_FOG(dst,a,b,t);
  323. }
  324. static void FASTCALL ClipCBF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  325. __GLfloat t)
  326. {
  327. LERP_START(dst, a, b);
  328. __GL_CLIP_POS(dst,a,b,t);
  329. __GL_CLIP_COLOR(dst,a,b,t);
  330. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  331. __GL_CLIP_FOG(dst,a,b,t);
  332. }
  333. static void FASTCALL ClipFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  334. __GLfloat t)
  335. {
  336. LERP_START(dst, a, b);
  337. __GL_CLIP_POS(dst,a,b,t);
  338. __GL_CLIP_TEXTURE(dst,a,b,t);
  339. __GL_CLIP_FOG(dst,a,b,t);
  340. }
  341. static void FASTCALL ClipIFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  342. __GLfloat t)
  343. {
  344. LERP_START(dst, a, b);
  345. __GL_CLIP_POS(dst,a,b,t);
  346. __GL_CLIP_INDEX(dst,a,b,t);
  347. __GL_CLIP_TEXTURE(dst,a,b,t);
  348. __GL_CLIP_FOG(dst,a,b,t);
  349. }
  350. static void FASTCALL ClipXFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  351. __GLfloat t)
  352. {
  353. LERP_START(dst, a, b);
  354. __GL_CLIP_POS(dst,a,b,t);
  355. __GL_CLIP_BACKINDEX(dst,a,b,t);
  356. __GL_CLIP_TEXTURE(dst,a,b,t);
  357. __GL_CLIP_FOG(dst,a,b,t);
  358. }
  359. static void FASTCALL ClipIXFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  360. __GLfloat t)
  361. {
  362. LERP_START(dst, a, b);
  363. __GL_CLIP_POS(dst,a,b,t);
  364. __GL_CLIP_INDEX(dst,a,b,t);
  365. __GL_CLIP_BACKINDEX(dst,a,b,t);
  366. __GL_CLIP_TEXTURE(dst,a,b,t);
  367. __GL_CLIP_FOG(dst,a,b,t);
  368. }
  369. static void FASTCALL ClipCFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  370. __GLfloat t)
  371. {
  372. LERP_START(dst, a, b);
  373. __GL_CLIP_POS(dst,a,b,t);
  374. __GL_CLIP_COLOR(dst,a,b,t);
  375. __GL_CLIP_TEXTURE(dst,a,b,t);
  376. __GL_CLIP_FOG(dst,a,b,t);
  377. }
  378. static void FASTCALL ClipBFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  379. __GLfloat t)
  380. {
  381. LERP_START(dst, a, b);
  382. __GL_CLIP_POS(dst,a,b,t);
  383. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  384. __GL_CLIP_TEXTURE(dst,a,b,t);
  385. __GL_CLIP_FOG(dst,a,b,t);
  386. }
  387. static void FASTCALL ClipCBFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  388. __GLfloat t)
  389. {
  390. LERP_START(dst, a, b);
  391. __GL_CLIP_POS(dst,a,b,t);
  392. __GL_CLIP_COLOR(dst,a,b,t);
  393. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  394. __GL_CLIP_TEXTURE(dst,a,b,t);
  395. __GL_CLIP_FOG(dst,a,b,t);
  396. }
  397. #ifdef GL_WIN_phong_shading
  398. /************New Clip Procs*******************************/
  399. static void FASTCALL ClipN(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  400. __GLfloat t)
  401. {
  402. LERP_START(dst, a, b);
  403. __GL_CLIP_POS(dst,a,b,t);
  404. __GL_CLIP_NORMAL(dst,a,b,t);
  405. }
  406. static void FASTCALL ClipNC(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  407. __GLfloat t)
  408. {
  409. LERP_START(dst, a, b);
  410. __GL_CLIP_POS(dst,a,b,t);
  411. __GL_CLIP_COLOR(dst,a,b,t);
  412. __GL_CLIP_NORMAL(dst,a,b,t);
  413. }
  414. static void FASTCALL ClipNB(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  415. __GLfloat t)
  416. {
  417. LERP_START(dst, a, b);
  418. __GL_CLIP_POS(dst,a,b,t);
  419. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  420. __GL_CLIP_NORMAL(dst,a,b,t);
  421. }
  422. static void FASTCALL ClipNI(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  423. __GLfloat t)
  424. {
  425. LERP_START(dst, a, b);
  426. __GL_CLIP_POS(dst,a,b,t);
  427. __GL_CLIP_INDEX(dst,a,b,t);
  428. __GL_CLIP_NORMAL(dst,a,b,t);
  429. }
  430. static void FASTCALL ClipNX(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  431. __GLfloat t)
  432. {
  433. LERP_START(dst, a, b);
  434. __GL_CLIP_POS(dst,a,b,t);
  435. __GL_CLIP_BACKINDEX(dst,a,b,t);
  436. __GL_CLIP_NORMAL(dst,a,b,t);
  437. }
  438. static void FASTCALL ClipNCB(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  439. __GLfloat t)
  440. {
  441. LERP_START(dst, a, b);
  442. __GL_CLIP_POS(dst,a,b,t);
  443. __GL_CLIP_COLOR(dst,a,b,t);
  444. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  445. __GL_CLIP_NORMAL(dst,a,b,t);
  446. }
  447. static void FASTCALL ClipNIX(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  448. __GLfloat t)
  449. {
  450. LERP_START(dst, a, b);
  451. __GL_CLIP_POS(dst,a,b,t);
  452. __GL_CLIP_INDEX(dst,a,b,t);
  453. __GL_CLIP_BACKINDEX(dst,a,b,t);
  454. __GL_CLIP_NORMAL(dst,a,b,t);
  455. }
  456. static void FASTCALL ClipNT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  457. __GLfloat t)
  458. {
  459. LERP_START(dst, a, b);
  460. __GL_CLIP_POS(dst,a,b,t);
  461. __GL_CLIP_TEXTURE(dst,a,b,t);
  462. __GL_CLIP_NORMAL(dst,a,b,t);
  463. }
  464. static void FASTCALL ClipNIT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  465. __GLfloat t)
  466. {
  467. LERP_START(dst, a, b);
  468. __GL_CLIP_POS(dst,a,b,t);
  469. __GL_CLIP_INDEX(dst,a,b,t);
  470. __GL_CLIP_TEXTURE(dst,a,b,t);
  471. __GL_CLIP_NORMAL(dst,a,b,t);
  472. }
  473. static void FASTCALL ClipNXT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  474. __GLfloat t)
  475. {
  476. LERP_START(dst, a, b);
  477. __GL_CLIP_POS(dst,a,b,t);
  478. __GL_CLIP_BACKINDEX(dst,a,b,t);
  479. __GL_CLIP_TEXTURE(dst,a,b,t);
  480. __GL_CLIP_NORMAL(dst,a,b,t);
  481. }
  482. static void FASTCALL ClipNIXT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  483. __GLfloat t)
  484. {
  485. LERP_START(dst, a, b);
  486. __GL_CLIP_POS(dst,a,b,t);
  487. __GL_CLIP_INDEX(dst,a,b,t);
  488. __GL_CLIP_BACKINDEX(dst,a,b,t);
  489. __GL_CLIP_TEXTURE(dst,a,b,t);
  490. __GL_CLIP_NORMAL(dst,a,b,t);
  491. }
  492. static void FASTCALL ClipNCT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  493. __GLfloat t)
  494. {
  495. LERP_START(dst, a, b);
  496. __GL_CLIP_POS(dst,a,b,t);
  497. __GL_CLIP_COLOR(dst,a,b,t);
  498. __GL_CLIP_TEXTURE(dst,a,b,t);
  499. __GL_CLIP_NORMAL(dst,a,b,t);
  500. }
  501. static void FASTCALL ClipNBT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  502. __GLfloat t)
  503. {
  504. LERP_START(dst, a, b);
  505. __GL_CLIP_POS(dst,a,b,t);
  506. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  507. __GL_CLIP_TEXTURE(dst,a,b,t);
  508. __GL_CLIP_NORMAL(dst,a,b,t);
  509. }
  510. static void FASTCALL ClipNCBT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  511. __GLfloat t)
  512. {
  513. LERP_START(dst, a, b);
  514. __GL_CLIP_POS(dst,a,b,t);
  515. __GL_CLIP_COLOR(dst,a,b,t);
  516. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  517. __GL_CLIP_TEXTURE(dst,a,b,t);
  518. __GL_CLIP_NORMAL(dst,a,b,t);
  519. }
  520. static void FASTCALL ClipNF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  521. __GLfloat t)
  522. {
  523. LERP_START(dst, a, b);
  524. __GL_CLIP_POS(dst,a,b,t);
  525. __GL_CLIP_NORMAL(dst,a,b,t);
  526. __GL_CLIP_FOG(dst,a,b,t);
  527. }
  528. static void FASTCALL ClipNIF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  529. __GLfloat t)
  530. {
  531. LERP_START(dst, a, b);
  532. __GL_CLIP_POS(dst,a,b,t);
  533. __GL_CLIP_INDEX(dst,a,b,t);
  534. __GL_CLIP_NORMAL(dst,a,b,t);
  535. __GL_CLIP_FOG(dst,a,b,t);
  536. }
  537. static void FASTCALL ClipNXF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  538. __GLfloat t)
  539. {
  540. LERP_START(dst, a, b);
  541. __GL_CLIP_POS(dst,a,b,t);
  542. __GL_CLIP_BACKINDEX(dst,a,b,t);
  543. __GL_CLIP_NORMAL(dst,a,b,t);
  544. __GL_CLIP_FOG(dst,a,b,t);
  545. }
  546. static void FASTCALL ClipNIXF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  547. __GLfloat t)
  548. {
  549. LERP_START(dst, a, b);
  550. __GL_CLIP_POS(dst,a,b,t);
  551. __GL_CLIP_INDEX(dst,a,b,t);
  552. __GL_CLIP_BACKINDEX(dst,a,b,t);
  553. __GL_CLIP_NORMAL(dst,a,b,t);
  554. __GL_CLIP_FOG(dst,a,b,t);
  555. }
  556. static void FASTCALL ClipNCF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  557. __GLfloat t)
  558. {
  559. LERP_START(dst, a, b);
  560. __GL_CLIP_POS(dst,a,b,t);
  561. __GL_CLIP_COLOR(dst,a,b,t);
  562. __GL_CLIP_NORMAL(dst,a,b,t);
  563. __GL_CLIP_FOG(dst,a,b,t);
  564. }
  565. static void FASTCALL ClipNBF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  566. __GLfloat t)
  567. {
  568. LERP_START(dst, a, b);
  569. __GL_CLIP_POS(dst,a,b,t);
  570. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  571. __GL_CLIP_NORMAL(dst,a,b,t);
  572. __GL_CLIP_FOG(dst,a,b,t);
  573. }
  574. static void FASTCALL ClipNCBF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  575. __GLfloat t)
  576. {
  577. LERP_START(dst, a, b);
  578. __GL_CLIP_POS(dst,a,b,t);
  579. __GL_CLIP_COLOR(dst,a,b,t);
  580. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  581. __GL_CLIP_NORMAL(dst,a,b,t);
  582. __GL_CLIP_FOG(dst,a,b,t);
  583. }
  584. static void FASTCALL ClipNFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  585. __GLfloat t)
  586. {
  587. LERP_START(dst, a, b);
  588. __GL_CLIP_POS(dst,a,b,t);
  589. __GL_CLIP_TEXTURE(dst,a,b,t);
  590. __GL_CLIP_NORMAL(dst,a,b,t);
  591. __GL_CLIP_FOG(dst,a,b,t);
  592. }
  593. static void FASTCALL ClipNIFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  594. __GLfloat t)
  595. {
  596. LERP_START(dst, a, b);
  597. __GL_CLIP_POS(dst,a,b,t);
  598. __GL_CLIP_INDEX(dst,a,b,t);
  599. __GL_CLIP_TEXTURE(dst,a,b,t);
  600. __GL_CLIP_NORMAL(dst,a,b,t);
  601. __GL_CLIP_FOG(dst,a,b,t);
  602. }
  603. static void FASTCALL ClipNXFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  604. __GLfloat t)
  605. {
  606. LERP_START(dst, a, b);
  607. __GL_CLIP_POS(dst,a,b,t);
  608. __GL_CLIP_BACKINDEX(dst,a,b,t);
  609. __GL_CLIP_TEXTURE(dst,a,b,t);
  610. __GL_CLIP_NORMAL(dst,a,b,t);
  611. __GL_CLIP_FOG(dst,a,b,t);
  612. }
  613. static void FASTCALL ClipNIXFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  614. __GLfloat t)
  615. {
  616. LERP_START(dst, a, b);
  617. __GL_CLIP_POS(dst,a,b,t);
  618. __GL_CLIP_INDEX(dst,a,b,t);
  619. __GL_CLIP_BACKINDEX(dst,a,b,t);
  620. __GL_CLIP_TEXTURE(dst,a,b,t);
  621. __GL_CLIP_NORMAL(dst,a,b,t);
  622. __GL_CLIP_FOG(dst,a,b,t);
  623. }
  624. static void FASTCALL ClipNCFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  625. __GLfloat t)
  626. {
  627. LERP_START(dst, a, b);
  628. __GL_CLIP_POS(dst,a,b,t);
  629. __GL_CLIP_COLOR(dst,a,b,t);
  630. __GL_CLIP_TEXTURE(dst,a,b,t);
  631. __GL_CLIP_NORMAL(dst,a,b,t);
  632. __GL_CLIP_FOG(dst,a,b,t);
  633. }
  634. static void FASTCALL ClipNBFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  635. __GLfloat t)
  636. {
  637. LERP_START(dst, a, b);
  638. __GL_CLIP_POS(dst,a,b,t);
  639. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  640. __GL_CLIP_TEXTURE(dst,a,b,t);
  641. __GL_CLIP_NORMAL(dst,a,b,t);
  642. __GL_CLIP_FOG(dst,a,b,t);
  643. }
  644. static void FASTCALL ClipNCBFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  645. __GLfloat t)
  646. {
  647. LERP_START(dst, a, b);
  648. __GL_CLIP_POS(dst,a,b,t);
  649. __GL_CLIP_COLOR(dst,a,b,t);
  650. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  651. __GL_CLIP_TEXTURE(dst,a,b,t);
  652. __GL_CLIP_NORMAL(dst,a,b,t);
  653. __GL_CLIP_FOG(dst,a,b,t);
  654. }
  655. static void FASTCALL ClipNE(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  656. __GLfloat t)
  657. {
  658. LERP_START(dst, a, b);
  659. __GL_CLIP_POS(dst,a,b,t);
  660. __GL_CLIP_NORMAL(dst,a,b,t);
  661. __GL_CLIP_EYE(dst,a,b,t);
  662. }
  663. static void FASTCALL ClipNEC(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  664. __GLfloat t)
  665. {
  666. LERP_START(dst, a, b);
  667. __GL_CLIP_POS(dst,a,b,t);
  668. __GL_CLIP_COLOR(dst,a,b,t);
  669. __GL_CLIP_NORMAL(dst,a,b,t);
  670. __GL_CLIP_EYE(dst,a,b,t);
  671. }
  672. static void FASTCALL ClipNEB(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  673. __GLfloat t)
  674. {
  675. LERP_START(dst, a, b);
  676. __GL_CLIP_POS(dst,a,b,t);
  677. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  678. __GL_CLIP_NORMAL(dst,a,b,t);
  679. __GL_CLIP_EYE(dst,a,b,t);
  680. }
  681. static void FASTCALL ClipNEI(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  682. __GLfloat t)
  683. {
  684. LERP_START(dst, a, b);
  685. __GL_CLIP_POS(dst,a,b,t);
  686. __GL_CLIP_INDEX(dst,a,b,t);
  687. __GL_CLIP_NORMAL(dst,a,b,t);
  688. __GL_CLIP_EYE(dst,a,b,t);
  689. }
  690. static void FASTCALL ClipNEX(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  691. __GLfloat t)
  692. {
  693. LERP_START(dst, a, b);
  694. __GL_CLIP_POS(dst,a,b,t);
  695. __GL_CLIP_BACKINDEX(dst,a,b,t);
  696. __GL_CLIP_NORMAL(dst,a,b,t);
  697. __GL_CLIP_EYE(dst,a,b,t);
  698. }
  699. static void FASTCALL ClipNECB(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  700. __GLfloat t)
  701. {
  702. LERP_START(dst, a, b);
  703. __GL_CLIP_POS(dst,a,b,t);
  704. __GL_CLIP_COLOR(dst,a,b,t);
  705. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  706. __GL_CLIP_NORMAL(dst,a,b,t);
  707. __GL_CLIP_EYE(dst,a,b,t);
  708. }
  709. static void FASTCALL ClipNEIX(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  710. __GLfloat t)
  711. {
  712. LERP_START(dst, a, b);
  713. __GL_CLIP_POS(dst,a,b,t);
  714. __GL_CLIP_INDEX(dst,a,b,t);
  715. __GL_CLIP_BACKINDEX(dst,a,b,t);
  716. __GL_CLIP_NORMAL(dst,a,b,t);
  717. __GL_CLIP_EYE(dst,a,b,t);
  718. }
  719. static void FASTCALL ClipNET(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  720. __GLfloat t)
  721. {
  722. LERP_START(dst, a, b);
  723. __GL_CLIP_POS(dst,a,b,t);
  724. __GL_CLIP_TEXTURE(dst,a,b,t);
  725. __GL_CLIP_NORMAL(dst,a,b,t);
  726. __GL_CLIP_EYE(dst,a,b,t);
  727. }
  728. static void FASTCALL ClipNEIT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  729. __GLfloat t)
  730. {
  731. LERP_START(dst, a, b);
  732. __GL_CLIP_POS(dst,a,b,t);
  733. __GL_CLIP_INDEX(dst,a,b,t);
  734. __GL_CLIP_TEXTURE(dst,a,b,t);
  735. __GL_CLIP_NORMAL(dst,a,b,t);
  736. __GL_CLIP_EYE(dst,a,b,t);
  737. }
  738. static void FASTCALL ClipNEXT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  739. __GLfloat t)
  740. {
  741. LERP_START(dst, a, b);
  742. __GL_CLIP_POS(dst,a,b,t);
  743. __GL_CLIP_BACKINDEX(dst,a,b,t);
  744. __GL_CLIP_TEXTURE(dst,a,b,t);
  745. __GL_CLIP_NORMAL(dst,a,b,t);
  746. __GL_CLIP_EYE(dst,a,b,t);
  747. }
  748. static void FASTCALL ClipNEIXT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  749. __GLfloat t)
  750. {
  751. LERP_START(dst, a, b);
  752. __GL_CLIP_POS(dst,a,b,t);
  753. __GL_CLIP_INDEX(dst,a,b,t);
  754. __GL_CLIP_BACKINDEX(dst,a,b,t);
  755. __GL_CLIP_TEXTURE(dst,a,b,t);
  756. __GL_CLIP_NORMAL(dst,a,b,t);
  757. __GL_CLIP_EYE(dst,a,b,t);
  758. }
  759. static void FASTCALL ClipNECT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  760. __GLfloat t)
  761. {
  762. LERP_START(dst, a, b);
  763. __GL_CLIP_POS(dst,a,b,t);
  764. __GL_CLIP_COLOR(dst,a,b,t);
  765. __GL_CLIP_TEXTURE(dst,a,b,t);
  766. __GL_CLIP_NORMAL(dst,a,b,t);
  767. __GL_CLIP_EYE(dst,a,b,t);
  768. }
  769. static void FASTCALL ClipNEBT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  770. __GLfloat t)
  771. {
  772. LERP_START(dst, a, b);
  773. __GL_CLIP_POS(dst,a,b,t);
  774. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  775. __GL_CLIP_TEXTURE(dst,a,b,t);
  776. __GL_CLIP_NORMAL(dst,a,b,t);
  777. __GL_CLIP_EYE(dst,a,b,t);
  778. }
  779. static void FASTCALL ClipNECBT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  780. __GLfloat t)
  781. {
  782. LERP_START(dst, a, b);
  783. __GL_CLIP_POS(dst,a,b,t);
  784. __GL_CLIP_COLOR(dst,a,b,t);
  785. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  786. __GL_CLIP_TEXTURE(dst,a,b,t);
  787. __GL_CLIP_NORMAL(dst,a,b,t);
  788. __GL_CLIP_EYE(dst,a,b,t);
  789. }
  790. static void FASTCALL ClipNEF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  791. __GLfloat t)
  792. {
  793. LERP_START(dst, a, b);
  794. __GL_CLIP_POS(dst,a,b,t);
  795. __GL_CLIP_NORMAL(dst,a,b,t);
  796. __GL_CLIP_EYE(dst,a,b,t);
  797. __GL_CLIP_FOG(dst,a,b,t);
  798. }
  799. static void FASTCALL ClipNEIF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  800. __GLfloat t)
  801. {
  802. LERP_START(dst, a, b);
  803. __GL_CLIP_POS(dst,a,b,t);
  804. __GL_CLIP_INDEX(dst,a,b,t);
  805. __GL_CLIP_NORMAL(dst,a,b,t);
  806. __GL_CLIP_EYE(dst,a,b,t);
  807. __GL_CLIP_FOG(dst,a,b,t);
  808. }
  809. static void FASTCALL ClipNEXF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  810. __GLfloat t)
  811. {
  812. LERP_START(dst, a, b);
  813. __GL_CLIP_POS(dst,a,b,t);
  814. __GL_CLIP_BACKINDEX(dst,a,b,t);
  815. __GL_CLIP_NORMAL(dst,a,b,t);
  816. __GL_CLIP_EYE(dst,a,b,t);
  817. __GL_CLIP_FOG(dst,a,b,t);
  818. }
  819. static void FASTCALL ClipNEIXF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  820. __GLfloat t)
  821. {
  822. LERP_START(dst, a, b);
  823. __GL_CLIP_POS(dst,a,b,t);
  824. __GL_CLIP_INDEX(dst,a,b,t);
  825. __GL_CLIP_BACKINDEX(dst,a,b,t);
  826. __GL_CLIP_NORMAL(dst,a,b,t);
  827. __GL_CLIP_EYE(dst,a,b,t);
  828. __GL_CLIP_FOG(dst,a,b,t);
  829. }
  830. static void FASTCALL ClipNECF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  831. __GLfloat t)
  832. {
  833. LERP_START(dst, a, b);
  834. __GL_CLIP_POS(dst,a,b,t);
  835. __GL_CLIP_COLOR(dst,a,b,t);
  836. __GL_CLIP_NORMAL(dst,a,b,t);
  837. __GL_CLIP_EYE(dst,a,b,t);
  838. __GL_CLIP_FOG(dst,a,b,t);
  839. }
  840. static void FASTCALL ClipNEBF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  841. __GLfloat t)
  842. {
  843. LERP_START(dst, a, b);
  844. __GL_CLIP_POS(dst,a,b,t);
  845. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  846. __GL_CLIP_NORMAL(dst,a,b,t);
  847. __GL_CLIP_EYE(dst,a,b,t);
  848. __GL_CLIP_FOG(dst,a,b,t);
  849. }
  850. static void FASTCALL ClipNECBF(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  851. __GLfloat t)
  852. {
  853. LERP_START(dst, a, b);
  854. __GL_CLIP_POS(dst,a,b,t);
  855. __GL_CLIP_COLOR(dst,a,b,t);
  856. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  857. __GL_CLIP_NORMAL(dst,a,b,t);
  858. __GL_CLIP_EYE(dst,a,b,t);
  859. __GL_CLIP_FOG(dst,a,b,t);
  860. }
  861. static void FASTCALL ClipNEFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  862. __GLfloat t)
  863. {
  864. LERP_START(dst, a, b);
  865. __GL_CLIP_POS(dst,a,b,t);
  866. __GL_CLIP_TEXTURE(dst,a,b,t);
  867. __GL_CLIP_NORMAL(dst,a,b,t);
  868. __GL_CLIP_EYE(dst,a,b,t);
  869. __GL_CLIP_FOG(dst,a,b,t);
  870. }
  871. static void FASTCALL ClipNEIFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  872. __GLfloat t)
  873. {
  874. LERP_START(dst, a, b);
  875. __GL_CLIP_POS(dst,a,b,t);
  876. __GL_CLIP_INDEX(dst,a,b,t);
  877. __GL_CLIP_TEXTURE(dst,a,b,t);
  878. __GL_CLIP_NORMAL(dst,a,b,t);
  879. __GL_CLIP_EYE(dst,a,b,t);
  880. __GL_CLIP_FOG(dst,a,b,t);
  881. }
  882. static void FASTCALL ClipNEXFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  883. __GLfloat t)
  884. {
  885. LERP_START(dst, a, b);
  886. __GL_CLIP_POS(dst,a,b,t);
  887. __GL_CLIP_BACKINDEX(dst,a,b,t);
  888. __GL_CLIP_TEXTURE(dst,a,b,t);
  889. __GL_CLIP_NORMAL(dst,a,b,t);
  890. __GL_CLIP_EYE(dst,a,b,t);
  891. __GL_CLIP_FOG(dst,a,b,t);
  892. }
  893. static void FASTCALL ClipNEIXFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  894. __GLfloat t)
  895. {
  896. LERP_START(dst, a, b);
  897. __GL_CLIP_POS(dst,a,b,t);
  898. __GL_CLIP_INDEX(dst,a,b,t);
  899. __GL_CLIP_BACKINDEX(dst,a,b,t);
  900. __GL_CLIP_TEXTURE(dst,a,b,t);
  901. __GL_CLIP_NORMAL(dst,a,b,t);
  902. __GL_CLIP_EYE(dst,a,b,t);
  903. __GL_CLIP_FOG(dst,a,b,t);
  904. }
  905. static void FASTCALL ClipNECFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  906. __GLfloat t)
  907. {
  908. LERP_START(dst, a, b);
  909. __GL_CLIP_POS(dst,a,b,t);
  910. __GL_CLIP_COLOR(dst,a,b,t);
  911. __GL_CLIP_TEXTURE(dst,a,b,t);
  912. __GL_CLIP_NORMAL(dst,a,b,t);
  913. __GL_CLIP_EYE(dst,a,b,t);
  914. __GL_CLIP_FOG(dst,a,b,t);
  915. }
  916. static void FASTCALL ClipNEBFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  917. __GLfloat t)
  918. {
  919. LERP_START(dst, a, b);
  920. __GL_CLIP_POS(dst,a,b,t);
  921. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  922. __GL_CLIP_TEXTURE(dst,a,b,t);
  923. __GL_CLIP_NORMAL(dst,a,b,t);
  924. __GL_CLIP_EYE(dst,a,b,t);
  925. __GL_CLIP_FOG(dst,a,b,t);
  926. }
  927. static void FASTCALL ClipNECBFT(__GLvertex *dst, const __GLvertex *a, const __GLvertex *b,
  928. __GLfloat t)
  929. {
  930. LERP_START(dst, a, b);
  931. __GL_CLIP_POS(dst,a,b,t);
  932. __GL_CLIP_COLOR(dst,a,b,t);
  933. __GL_CLIP_BACKCOLOR(dst,a,b,t);
  934. __GL_CLIP_TEXTURE(dst,a,b,t);
  935. __GL_CLIP_NORMAL(dst,a,b,t);
  936. __GL_CLIP_EYE(dst,a,b,t);
  937. __GL_CLIP_FOG(dst,a,b,t);
  938. }
  939. static PFN_VERTEX_CLIP_PROC clipProcs[84] =
  940. #else
  941. static PFN_VERTEX_CLIP_PROC clipProcs[28] =
  942. #endif //GL_WIN_phong_shading
  943. {
  944. Clip, ClipI, ClipC, ClipX, ClipB, ClipIX, ClipCB,
  945. ClipF, ClipIF, ClipCF, ClipXF, ClipBF, ClipIXF, ClipCBF,
  946. ClipT, ClipIT, ClipCT, ClipXT, ClipBT, ClipIXT, ClipCBT,
  947. ClipFT, ClipIFT, ClipCFT, ClipXFT, ClipBFT, ClipIXFT, ClipCBFT,
  948. #ifdef GL_WIN_phong_shading
  949. ClipN, ClipNI, ClipNC, ClipNX, ClipNB, ClipNIX, ClipNCB,
  950. ClipNF, ClipNIF, ClipNCF, ClipNXF, ClipNBF, ClipNIXF, ClipNCBF,
  951. ClipNT, ClipNIT, ClipNCT, ClipNXT, ClipNBT, ClipNIXT, ClipNCBT,
  952. ClipNFT, ClipNIFT, ClipNCFT, ClipNXFT, ClipNBFT, ClipNIXFT, ClipNCBFT,
  953. //
  954. ClipNE, ClipNEI, ClipNEC, ClipNEX, ClipNEB, ClipNEIX, ClipNECB,
  955. ClipNEF, ClipNEIF, ClipNECF, ClipNEXF, ClipNEBF, ClipNEIXF, ClipNECBF,
  956. ClipNET, ClipNEIT, ClipNECT, ClipNEXT, ClipNEBT, ClipNEIXT, ClipNECBT,
  957. ClipNEFT, ClipNEIFT, ClipNECFT, ClipNEXFT, ClipNEBFT, ClipNEIXFT, ClipNECBFT,
  958. #endif //GL_WIN_phong_shading
  959. };
  960. #ifdef GL_WIN_phong_shading
  961. void FASTCALL __glGenericPickParameterClipProcs(__GLcontext *gc)
  962. {
  963. GLint line = 0, poly = 0;
  964. GLuint enables = gc->state.enables.general;
  965. GLboolean twoSided = (enables & __GL_LIGHTING_ENABLE)
  966. && gc->state.light.model.twoSided;
  967. GLboolean colorMaterial = (enables & __GL_COLOR_MATERIAL_ENABLE);
  968. GLboolean doPhong = (enables & __GL_LIGHTING_ENABLE) &&
  969. (gc->state.light.shadingModel == GL_PHONG_WIN);
  970. GLuint modeFlags = gc->polygon.shader.modeFlags;
  971. #ifdef NT
  972. if (gc->renderMode == GL_SELECT)
  973. {
  974. gc->procs.lineClipParam = Clip;
  975. gc->procs.polyClipParam = Clip;
  976. return;
  977. }
  978. #endif
  979. if (gc->modes.rgbMode) {
  980. if (doPhong) {
  981. if (!colorMaterial) {
  982. line = 28; //0+28
  983. poly = 28;
  984. } else {
  985. line = 30; //2+28
  986. poly = 30;
  987. }
  988. }
  989. else {
  990. if (gc->state.light.shadingModel != GL_FLAT) {
  991. line = 2;
  992. poly = 2;
  993. }
  994. }
  995. } else {
  996. if (doPhong) {
  997. if (!colorMaterial) {
  998. line = 28; //0+28
  999. poly = 28;
  1000. } else {
  1001. line = 29; //1+28
  1002. poly = 29;
  1003. }
  1004. }
  1005. else {
  1006. if (gc->state.light.shadingModel != GL_FLAT) {
  1007. line = 1;
  1008. poly = 1;
  1009. }
  1010. }
  1011. }
  1012. // Compute front and back color needs for polygons.
  1013. // Points and lines always use the front color.
  1014. // Unlit primitives always use the front color.
  1015. //
  1016. // Cull enable? Two sided? Cull face Color needs
  1017. // N N BACK FRONT
  1018. // N N FRONT FRONT
  1019. // N N FRONT_AND_BACK FRONT
  1020. // N Y BACK FRONT/BACK
  1021. // N Y FRONT FRONT/BACK
  1022. // N Y FRONT_AND_BACK FRONT/BACK
  1023. // Y N BACK FRONT
  1024. // Y N FRONT FRONT
  1025. // Y N FRONT_AND_BACK None
  1026. // Y Y BACK FRONT
  1027. // Y Y FRONT BACK
  1028. // Y Y FRONT_AND_BACK None
  1029. if (gc->state.light.shadingModel != GL_FLAT &&
  1030. (enables & __GL_LIGHTING_ENABLE) &&
  1031. gc->state.light.model.twoSided)
  1032. {
  1033. if ((enables & __GL_CULL_FACE_ENABLE) == 0)
  1034. {
  1035. // Both colors are needed
  1036. poly += 4;
  1037. }
  1038. else if (gc->state.polygon.cull == GL_FRONT)
  1039. {
  1040. // Only back colors are needed
  1041. poly += 2;
  1042. }
  1043. else if (gc->state.polygon.cull == GL_FRONT_AND_BACK)
  1044. {
  1045. // Neither color is needed
  1046. poly = 0;
  1047. }
  1048. }
  1049. if ((modeFlags & (__GL_SHADE_COMPUTE_FOG | __GL_SHADE_INTERP_FOG)) ||
  1050. ((modeFlags & (__GL_SHADE_CHEAP_FOG | __GL_SHADE_SMOOTH_LIGHT)) ==
  1051. __GL_SHADE_CHEAP_FOG)) {
  1052. #ifdef NT
  1053. // POLYARRAY - fog is not computed in feedback mode!
  1054. if (gc->renderMode == GL_RENDER)
  1055. {
  1056. line += 7;
  1057. poly += 7;
  1058. }
  1059. #else
  1060. line += 7;
  1061. poly += 7;
  1062. #endif
  1063. }
  1064. if (gc->texture.textureEnabled) { /*XXX - don't change this (see Derrick)*/
  1065. line += 14;
  1066. poly += 14;
  1067. }
  1068. if (doPhong &&
  1069. (gc->polygon.shader.phong.flags & __GL_PHONG_NEED_EYE_XPOLATE))
  1070. {
  1071. line += 28;
  1072. poly += 28;
  1073. }
  1074. gc->procs.lineClipParam = clipProcs[line];
  1075. gc->procs.polyClipParam = clipProcs[poly];
  1076. }
  1077. #else //GL_WIN_phong_shading
  1078. void FASTCALL __glGenericPickParameterClipProcs(__GLcontext *gc)
  1079. {
  1080. GLint line = 0, poly = 0;
  1081. GLuint enables = gc->state.enables.general;
  1082. GLuint modeFlags = gc->polygon.shader.modeFlags;
  1083. GLboolean twoSided = (enables & __GL_LIGHTING_ENABLE)
  1084. && gc->state.light.model.twoSided;
  1085. #ifdef NT
  1086. if (gc->renderMode == GL_SELECT)
  1087. {
  1088. gc->procs.lineClipParam = Clip;
  1089. gc->procs.polyClipParam = Clip;
  1090. return;
  1091. }
  1092. #endif
  1093. if (gc->modes.rgbMode) {
  1094. if (gc->state.light.shadingModel != GL_FLAT) {
  1095. line = 2;
  1096. poly = 2;
  1097. }
  1098. } else {
  1099. if (gc->state.light.shadingModel != GL_FLAT) {
  1100. line = 1;
  1101. poly = 1;
  1102. }
  1103. }
  1104. // Compute front and back color needs for polygons.
  1105. // Points and lines always use the front color.
  1106. // Unlit primitives always use the front color.
  1107. //
  1108. // Cull enable? Two sided? Cull face Color needs
  1109. // N N BACK FRONT
  1110. // N N FRONT FRONT
  1111. // N N FRONT_AND_BACK FRONT
  1112. // N Y BACK FRONT/BACK
  1113. // N Y FRONT FRONT/BACK
  1114. // N Y FRONT_AND_BACK FRONT/BACK
  1115. // Y N BACK FRONT
  1116. // Y N FRONT FRONT
  1117. // Y N FRONT_AND_BACK None
  1118. // Y Y BACK FRONT
  1119. // Y Y FRONT BACK
  1120. // Y Y FRONT_AND_BACK None
  1121. if (gc->state.light.shadingModel != GL_FLAT &&
  1122. (enables & __GL_LIGHTING_ENABLE) &&
  1123. gc->state.light.model.twoSided)
  1124. {
  1125. if ((enables & __GL_CULL_FACE_ENABLE) == 0)
  1126. {
  1127. // Both colors are needed
  1128. poly += 4;
  1129. }
  1130. else if (gc->state.polygon.cull == GL_FRONT)
  1131. {
  1132. // Only back colors are needed
  1133. poly += 2;
  1134. }
  1135. else if (gc->state.polygon.cull == GL_FRONT_AND_BACK)
  1136. {
  1137. // Neither color is needed
  1138. poly = 0;
  1139. }
  1140. }
  1141. if ((modeFlags & (__GL_SHADE_COMPUTE_FOG | __GL_SHADE_INTERP_FOG)) ||
  1142. ((modeFlags & (__GL_SHADE_CHEAP_FOG | __GL_SHADE_SMOOTH_LIGHT)) ==
  1143. __GL_SHADE_CHEAP_FOG)) {
  1144. #ifdef NT
  1145. // POLYARRAY - fog is not computed in feedback mode!
  1146. if (gc->renderMode == GL_RENDER)
  1147. {
  1148. line += 7;
  1149. poly += 7;
  1150. }
  1151. #else
  1152. line += 7;
  1153. poly += 7;
  1154. #endif
  1155. }
  1156. if (gc->texture.textureEnabled) { /*XXX - don't change this (see Derrick)*/
  1157. line += 14;
  1158. poly += 14;
  1159. }
  1160. gc->procs.lineClipParam = clipProcs[line];
  1161. gc->procs.polyClipParam = clipProcs[poly];
  1162. }
  1163. #endif //GL_WIN_phong_shading