/opengles/src/RasterizerTriangles.cpp

http://ftk.googlecode.com/ · C++ · 861 lines · 504 code · 223 blank · 134 comment · 26 complexity · 4fd666823eafb39122998c49706925e4 MD5 · raw file

  1. // ==========================================================================
  2. //
  3. // RasterizerTraingles.cpp Rasterizer Class for 3D Rendering Library
  4. //
  5. // The rasterizer converts transformed and lit primitives and creates a
  6. // raster image in the current rendering surface.
  7. //
  8. // This files contains the triangle rasterization code, which was
  9. // previously in the Rasterizer.cpp source file.
  10. //
  11. // --------------------------------------------------------------------------
  12. //
  13. // 05-22-2004 Hans-Martin Will initial version
  14. //
  15. // --------------------------------------------------------------------------
  16. //
  17. // Copyright (c) 2004, Hans-Martin Will. All rights reserved.
  18. //
  19. // Redistribution and use in source and binary forms, with or without
  20. // modification, are permitted provided that the following conditions are
  21. // met:
  22. //
  23. // * Redistributions of source code must retain the above copyright
  24. // notice, this list of conditions and the following disclaimer.
  25. // * Redistributions in binary form must reproduce the above copyright
  26. // notice, this list of conditions and the following disclaimer in the
  27. // documentation and/or other materials provided with the distribution.
  28. //
  29. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  30. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  31. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  32. // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  33. // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  34. // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  35. // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  36. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  37. // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  38. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  39. // THE POSSIBILITY OF SUCH DAMAGE.
  40. //
  41. // ==========================================================================
  42. #include "stdafx.h"
  43. #include "Rasterizer.h"
  44. #include "Surface.h"
  45. #include "Texture.h"
  46. #include "arm/FunctionCache.h"
  47. using namespace EGL;
  48. namespace {
  49. const I8 Permutation[8][3] = {
  50. { 0, 1, 2 },
  51. { 0, 2, 1 },
  52. { 0, 0, 0 }, // impossible
  53. { 2, 0, 1 },
  54. { 1, 0, 2 },
  55. { 0, 0, 0 }, // impossible
  56. { 1, 2, 0 },
  57. { 2, 1, 0 },
  58. };
  59. inline const I8 * SortPermutation(I32 x0, I32 x1, I32 x2) {
  60. U32 y0 = static_cast<U32>(x0);
  61. U32 y1 = static_cast<U32>(x1);
  62. U32 y2 = static_cast<U32>(x2);
  63. const I8 * result = Permutation[
  64. (((y1 - y0) >> 29) & 4) |
  65. (((y2 - y0) >> 30) & 2) |
  66. (((y2 - y1) >> 31) & 1)];
  67. assert(result[0] | result[1] | result[2]);
  68. return result;
  69. }
  70. inline int Greater(I32 x0, I32 x1) {
  71. U32 y0 = static_cast<U32>(x0);
  72. U32 y1 = static_cast<U32>(x1);
  73. return (y1 - y0) >> 31;
  74. }
  75. inline EGL_Fixed TriangleArea(EGL_Fixed x0, EGL_Fixed y0,
  76. EGL_Fixed x1, EGL_Fixed y1,
  77. EGL_Fixed x2, EGL_Fixed y2) {
  78. return
  79. EGL_Abs(
  80. EGL_Mul(x1, y2) + EGL_Mul(x2, y0) + EGL_Mul(x0, y1)
  81. - EGL_Mul(x2, y1) - EGL_Mul(x0, y2) - EGL_Mul(x1, y0));
  82. }
  83. inline int Log2(int value) {
  84. if (value <= 1) {
  85. return 0;
  86. }
  87. int result = 0;
  88. while (value > 1) {
  89. result++;
  90. value >>= 1;
  91. }
  92. return result;
  93. }
  94. #define DET_SHIFT 4
  95. inline EGL_Fixed Det2x2(EGL_Fixed a11, EGL_Fixed a12, EGL_Fixed a21, EGL_Fixed a22) {
  96. return EGL_Mul(a11 >> DET_SHIFT, a22 >> DET_SHIFT) -
  97. EGL_Mul(a12 >> DET_SHIFT, a21 >> DET_SHIFT);
  98. }
  99. inline EGL_Fixed Det2x2NoShift(EGL_Fixed a11, EGL_Fixed a12, EGL_Fixed a21, EGL_Fixed a22) {
  100. I64 first = static_cast<I64>(a11) * static_cast<I64>(a22);
  101. I64 second = static_cast<I64>(a12) * static_cast<I64>(a21);
  102. return (EGL_Fixed) ((first - second) >> EGL_PRECISION);
  103. }
  104. }
  105. #define SOLVE_PARAM_XY(val, p1, p2, p3, scale) \
  106. grad.dx.val = EGL_Mul( \
  107. Det2x2NoShift( \
  108. p2 - p1, (pos2.m_WindowCoords.y - pos1.m_WindowCoords.y) >> DET_SHIFT, \
  109. p3 - p1, (pos3.m_WindowCoords.y - pos1.m_WindowCoords.y) >> DET_SHIFT) >> DET_SHIFT, \
  110. scale); \
  111. grad.dy.val = EGL_Mul( \
  112. Det2x2NoShift( \
  113. (pos2.m_WindowCoords.x - pos1.m_WindowCoords.x) >> DET_SHIFT, p2 - p1, \
  114. (pos3.m_WindowCoords.x - pos1.m_WindowCoords.x) >> DET_SHIFT, p3 - p1) >> DET_SHIFT, \
  115. scale)
  116. #define SOLVE_XY(param, scale) \
  117. SOLVE_PARAM_XY(param, pos1.param, pos2.param, pos3.param, scale)
  118. namespace {
  119. bool hasAlpha(RasterizerState::TextureFormat format) {
  120. switch (format) {
  121. case RasterizerState::TextureFormatAlpha:
  122. case RasterizerState::TextureFormatLuminanceAlpha:
  123. case RasterizerState::TextureFormatRGBA8:
  124. case RasterizerState::TextureFormatRGBA4444:
  125. case RasterizerState::TextureFormatRGBA5551:
  126. return true;
  127. default:
  128. return false;
  129. }
  130. }
  131. }
  132. // ---------------------------------------------------------------------------
  133. // Prepare rasterizer object for triangles
  134. // ---------------------------------------------------------------------------
  135. void Rasterizer :: PrepareTriangle() {
  136. PrepareTexture();
  137. m_ScanlineFunction = (ScanlineFunction *)
  138. m_FunctionCache->GetFunction(FunctionCache::FunctionTypeScanline,
  139. *m_State);
  140. // could be optimized
  141. bool needsColor = !m_State->m_Texture[0].Enabled ||
  142. m_State->m_Texture[0].Mode != RasterizerState::TextureModeReplace;
  143. bool needsTexture = false;
  144. for (size_t unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
  145. needsTexture |= m_State->m_Texture[unit].Enabled;
  146. }
  147. bool needsFog = m_State->m_Fog.Enabled;
  148. bool needsDepth = m_State->m_DepthTest.Enabled || m_State->m_Mask.Depth || m_State->m_Stencil.Enabled;
  149. bool needsScissor = m_State->m_ScissorTest.Enabled;
  150. bool needsStencil = m_State->m_Stencil.Enabled;
  151. U32 selector =
  152. ((needsColor ? 1 : 0) << RasterTriangleColor ) |
  153. ((needsTexture ? 1 : 0) << RasterTriangleTexture ) |
  154. ((needsFog ? 1 : 0) << RasterTriangleFog ) |
  155. ((needsDepth ? 1 : 0) << RasterTriangleDepth ) |
  156. ((needsScissor ? 1 : 0) << RasterTriangleScissor ) |
  157. ((needsStencil ? 1 : 0) << RasterTriangleStencil );
  158. m_RasterTriangleFunction = m_RasterTriangleFunctions[selector];
  159. if (m_RasterTriangleFunction == 0)
  160. m_RasterTriangleFunction = &Rasterizer::RasterTriangleAll;
  161. memset(m_RasterInfo.MipmapLevel, 0, sizeof(m_RasterInfo.MipmapLevel));
  162. }
  163. // --------------------------------------------------------------------------
  164. // number of pixels done with linear interpolation
  165. // --------------------------------------------------------------------------
  166. #define LOG_LINEAR_SPAN 3 // logarithm of value base 2
  167. #define LINEAR_SPAN (1 << LOG_LINEAR_SPAN) // must be power of 2
  168. #if !EGL_USE_JIT
  169. inline void Rasterizer :: RasterScanLine(RasterInfo & rasterInfo, const EdgePos & start, const EdgePos & delta) {
  170. // In the edge buffer, z, tu and tv are actually divided by w
  171. FractionalColor baseColor = start.m_Color;
  172. if (!(delta.m_WindowCoords.x - start.m_WindowCoords.x)) {
  173. return;
  174. }
  175. const FractionalColor& colorIncrement = delta.m_Color;
  176. EGL_Fixed deltaFog = delta.m_FogDensity;
  177. EGL_Fixed deltaDepth = delta.m_WindowCoords.depth;
  178. EGL_Fixed deltaInvZ = delta.m_WindowCoords.invZ;
  179. size_t unit;
  180. EGL_Fixed deltaInvU[EGL_NUM_TEXTURE_UNITS],
  181. deltaInvV[EGL_NUM_TEXTURE_UNITS],
  182. invTu[EGL_NUM_TEXTURE_UNITS],
  183. invTv[EGL_NUM_TEXTURE_UNITS];
  184. #if EGL_MIPMAP_PER_TEXEL
  185. EGL_Fixed deltaInvDu[EGL_NUM_TEXTURE_UNITS],
  186. deltaInvDv[EGL_NUM_TEXTURE_UNITS],
  187. dTuDxOverInvZ2[EGL_NUM_TEXTURE_UNITS],
  188. dTuDyOverInvZ2[EGL_NUM_TEXTURE_UNITS],
  189. dTvDxOverInvZ2[EGL_NUM_TEXTURE_UNITS],
  190. dTvDyOverInvZ2[EGL_NUM_TEXTURE_UNITS];
  191. #endif
  192. for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
  193. deltaInvU[unit] = delta.m_TextureCoords[unit].tu;
  194. deltaInvV[unit] = delta.m_TextureCoords[unit].tv;
  195. invTu[unit] = start.m_TextureCoords[unit].tu;
  196. invTv[unit] = start.m_TextureCoords[unit].tv;
  197. #if EGL_MIPMAP_PER_TEXEL
  198. deltaInvDu[unit] = delta.m_TextureCoords[unit].dtudy;
  199. deltaInvDv[unit] = delta.m_TextureCoords[unit].dtvdy;
  200. dTuDxOverInvZ2[unit] = start.m_TextureCoords[unit].dtudx;
  201. dTuDyOverInvZ2[unit] = start.m_TextureCoords[unit].dtudy;
  202. dTvDxOverInvZ2[unit] = start.m_TextureCoords[unit].dtvdx;
  203. dTvDyOverInvZ2[unit] = start.m_TextureCoords[unit].dtvdy;
  204. #endif
  205. }
  206. EGL_Fixed invZ = start.m_WindowCoords.invZ;
  207. EGL_Fixed fogDensity = start.m_FogDensity;
  208. I32 x = EGL_IntFromFixed(start.m_WindowCoords.x);
  209. I32 xEnd = EGL_IntFromFixed(delta.m_WindowCoords.x);
  210. I32 xLinEnd = x + ((xEnd - x) & ~(LINEAR_SPAN - 1));
  211. EGL_Fixed z = EGL_Inverse(invZ);
  212. EGL_Fixed tu[EGL_NUM_TEXTURE_UNITS], tv[EGL_NUM_TEXTURE_UNITS];
  213. for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
  214. tu[unit] = EGL_Mul(invTu[unit], z);
  215. tv[unit] = EGL_Mul(invTv[unit], z);
  216. }
  217. EGL_Fixed depth = start.m_WindowCoords.depth;
  218. for (; x < xLinEnd;) {
  219. // to get started, do mipmap selection at beginning of span
  220. #if EGL_MIPMAP_PER_TEXEL
  221. for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
  222. if (m_UseMipmap[unit]) {
  223. EGL_Fixed z2 = EGL_Mul(z << 4, z << 4);
  224. EGL_Fixed maxDu = EGL_Max(EGL_Abs(dTuDxOverInvZ2[unit]), EGL_Abs(dTuDyOverInvZ2[unit])) >> (16 - m_Texture[unit]->GetTexture(0)->GetLogWidth());
  225. EGL_Fixed maxDv = EGL_Max(EGL_Abs(dTvDxOverInvZ2[unit]), EGL_Abs(dTvDyOverInvZ2[unit])) >> (16 - m_Texture[unit]->GetTexture(0)->GetLogHeight());
  226. //EGL_Fixed maxD = EGL_Max(maxDu, maxDv);
  227. EGL_Fixed maxD = maxDu + maxDv;
  228. //I64 rho64 = ((I64) EGL_Mul(z2, EGL_FixedFromFloat(1/sqrt(2.0f)) + 1)) * ((I64) maxD);
  229. EGL_Fixed rho = EGL_Mul(z2, maxD);
  230. // we start with nearest/minification only selection; will add LINEAR later
  231. rasterInfo.MipmapLevel[unit] = EGL_Min(Log2(rho), rasterInfo.MaxMipmapLevel[unit]);
  232. dTuDyOverInvZ2[unit] += deltaInvDu[unit] << LOG_LINEAR_SPAN;
  233. dTvDyOverInvZ2[unit] += deltaInvDv[unit] << LOG_LINEAR_SPAN;
  234. }
  235. }
  236. #endif
  237. invZ += deltaInvZ << LOG_LINEAR_SPAN;
  238. EGL_Fixed endZ = EGL_Inverse(invZ);
  239. EGL_Fixed deltaZ = (endZ - z) >> LOG_LINEAR_SPAN;
  240. EGL_Fixed endTu[EGL_NUM_TEXTURE_UNITS];
  241. EGL_Fixed endTv[EGL_NUM_TEXTURE_UNITS];
  242. EGL_Fixed deltaTu[EGL_NUM_TEXTURE_UNITS];
  243. EGL_Fixed deltaTv[EGL_NUM_TEXTURE_UNITS];
  244. for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
  245. invTu[unit] += deltaInvU[unit] << LOG_LINEAR_SPAN;
  246. invTv[unit] += deltaInvV[unit] << LOG_LINEAR_SPAN;
  247. endTu[unit] = EGL_Mul(invTu[unit], endZ);
  248. endTv[unit] = EGL_Mul(invTv[unit], endZ);
  249. deltaTu[unit] = (endTu[unit] - tu[unit]) >> LOG_LINEAR_SPAN;
  250. deltaTv[unit] = (endTv[unit] - tv[unit]) >> LOG_LINEAR_SPAN;
  251. }
  252. int count = LINEAR_SPAN;
  253. do {
  254. Fragment(&rasterInfo, x, depth, tu, tv, baseColor, fogDensity);
  255. baseColor += colorIncrement;
  256. depth += deltaDepth;
  257. fogDensity += deltaFog;
  258. z += deltaZ;
  259. for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
  260. tu[unit] += deltaTu[unit];
  261. tv[unit] += deltaTv[unit];
  262. }
  263. ++x;
  264. } while (--count);
  265. }
  266. if (x != xEnd) {
  267. I32 deltaX = xEnd - x;
  268. #if EGL_MIPMAP_PER_TEXEL
  269. for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
  270. if (m_UseMipmap[unit]) {
  271. EGL_Fixed z2 = EGL_Mul(z << 4, z << 4);
  272. EGL_Fixed maxDu = EGL_Max(EGL_Abs(dTuDxOverInvZ2[unit]), EGL_Abs(dTuDyOverInvZ2[unit])) >> (16 - m_Texture[unit]->GetTexture(0)->GetLogWidth());
  273. EGL_Fixed maxDv = EGL_Max(EGL_Abs(dTvDxOverInvZ2[unit]), EGL_Abs(dTvDyOverInvZ2[unit])) >> (16 - m_Texture[unit]->GetTexture(0)->GetLogHeight());
  274. //EGL_Fixed maxD = EGL_Max(maxDu, maxDv);
  275. EGL_Fixed maxD = maxDu + maxDv;
  276. //I64 rho64 = ((I64) EGL_Mul(z2, EGL_FixedFromFloat(1/sqrt(2.0f)) + 1)) * ((I64) maxD);
  277. EGL_Fixed rho = EGL_Mul(z2, maxD);
  278. // we start with nearest/minification only selection; will add LINEAR later
  279. rasterInfo.MipmapLevel[unit] = EGL_Min(Log2(rho), rasterInfo.MaxMipmapLevel[unit]);
  280. dTuDyOverInvZ2[unit] += deltaInvDu[unit] << LOG_LINEAR_SPAN;
  281. dTvDyOverInvZ2[unit] += deltaInvDv[unit] << LOG_LINEAR_SPAN;
  282. }
  283. }
  284. #endif
  285. EGL_Fixed endZ = EGL_Inverse(invZ + deltaX * deltaInvZ);
  286. EGL_Fixed invSpan = EGL_Inverse(EGL_FixedFromInt(xEnd - x));
  287. EGL_Fixed deltaZ = EGL_Mul(endZ - z, invSpan);
  288. EGL_Fixed endTu[EGL_NUM_TEXTURE_UNITS];
  289. EGL_Fixed endTv[EGL_NUM_TEXTURE_UNITS];
  290. EGL_Fixed deltaTu[EGL_NUM_TEXTURE_UNITS];
  291. EGL_Fixed deltaTv[EGL_NUM_TEXTURE_UNITS];
  292. for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
  293. endTu[unit] = EGL_Mul(invTu[unit] + deltaX * deltaInvU[unit], endZ);
  294. endTv[unit] = EGL_Mul(invTv[unit] + deltaX * deltaInvV[unit], endZ);
  295. deltaTu[unit] = EGL_Mul(endTu[unit] - tu[unit], invSpan);
  296. deltaTv[unit] = EGL_Mul(endTv[unit] - tv[unit], invSpan);
  297. }
  298. for (; x < xEnd; ++x) {
  299. Fragment(&rasterInfo, x, depth, tu, tv, baseColor, fogDensity);
  300. baseColor += colorIncrement;
  301. depth += deltaDepth;
  302. for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
  303. tu[unit] += deltaTu[unit];
  304. tv[unit] += deltaTv[unit];
  305. }
  306. fogDensity += deltaFog;
  307. }
  308. }
  309. }
  310. #endif // !EGL_USE_JIT
  311. // --------------------------------------------------------------------------
  312. // Specialized triangle rasterizers go here
  313. // --------------------------------------------------------------------------
  314. //
  315. // RasterTriangleAll
  316. //
  317. #define InitScanlineStart InitScanlineStartAll
  318. #define InitScanlineDeltas InitScanlineDeltasAll
  319. #define RasterTriangle RasterTriangleAll
  320. #define HasFog 1
  321. #define HasDepth 1
  322. #define HasColor 1
  323. #define HasTexture 1
  324. #define HasStencil 1
  325. #define HasScissor 1
  326. #include "RasterizerTriangles.inc"
  327. //
  328. // void RasterTriangle_cTdfs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  329. //
  330. #define InitScanlineStart InitScanlineStart_cTdfs
  331. #define InitScanlineDeltas InitScanlineDeltas_cTdfs
  332. #define RasterTriangle RasterTriangle_cTdfs
  333. #define HasFog 0
  334. #define HasDepth 0
  335. #define HasColor 0
  336. #define HasTexture 1
  337. #define HasStencil 0
  338. #define HasScissor 0
  339. #include "RasterizerTriangles.inc"
  340. //
  341. // void RasterTriangle_cTdFs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  342. //
  343. #define InitScanlineStart InitScanlineStart_cTdFs
  344. #define InitScanlineDeltas InitScanlineDeltas_cTdFs
  345. #define RasterTriangle RasterTriangle_cTdFs
  346. #define HasFog 1
  347. #define HasDepth 0
  348. #define HasColor 0
  349. #define HasTexture 1
  350. #define HasStencil 0
  351. #define HasScissor 0
  352. #include "RasterizerTriangles.inc"
  353. //
  354. // void RasterTriangle_cTDfs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  355. //
  356. #define InitScanlineStart InitScanlineStart_cTDfs
  357. #define InitScanlineDeltas InitScanlineDeltas_cTDfs
  358. #define RasterTriangle RasterTriangle_cTDfs
  359. #define HasColor 0
  360. #define HasTexture 1
  361. #define HasDepth 1
  362. #define HasFog 0
  363. #define HasStencil 0
  364. #define HasScissor 0
  365. #include "RasterizerTriangles.inc"
  366. //
  367. // void RasterTriangle_cTDFs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  368. //
  369. #define InitScanlineStart InitScanlineStart_cTDFs
  370. #define InitScanlineDeltas InitScanlineDeltas_cTDFs
  371. #define RasterTriangle RasterTriangle_cTDFs
  372. #define HasColor 0
  373. #define HasTexture 1
  374. #define HasDepth 1
  375. #define HasFog 1
  376. #define HasStencil 0
  377. #define HasScissor 0
  378. #include "RasterizerTriangles.inc"
  379. //
  380. // void RasterTriangle_Ctdfs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  381. //
  382. #define InitScanlineStart InitScanlineStart_Ctdfs
  383. #define InitScanlineDeltas InitScanlineDeltas_Ctdfs
  384. #define RasterTriangle RasterTriangle_Ctdfs
  385. #define HasColor 1
  386. #define HasTexture 0
  387. #define HasDepth 0
  388. #define HasFog 0
  389. #define HasStencil 0
  390. #define HasScissor 0
  391. #include "RasterizerTriangles.inc"
  392. //
  393. // void RasterTriangle_CtdFs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  394. //
  395. #define InitScanlineStart InitScanlineStart_CtdFs
  396. #define InitScanlineDeltas InitScanlineDeltas_CtdFs
  397. #define RasterTriangle RasterTriangle_CtdFs
  398. #define HasColor 1
  399. #define HasTexture 0
  400. #define HasDepth 0
  401. #define HasFog 1
  402. #define HasStencil 0
  403. #define HasScissor 0
  404. #include "RasterizerTriangles.inc"
  405. //
  406. // void RasterTriangle_CtDfs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  407. //
  408. #define InitScanlineStart InitScanlineStart_CtDfs
  409. #define InitScanlineDeltas InitScanlineDeltas_CtDfs
  410. #define RasterTriangle RasterTriangle_CtDfs
  411. #define HasColor 1
  412. #define HasTexture 0
  413. #define HasDepth 1
  414. #define HasFog 0
  415. #define HasStencil 0
  416. #define HasScissor 0
  417. #include "RasterizerTriangles.inc"
  418. //
  419. // void RasterTriangle_CtDFs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  420. //
  421. #define InitScanlineStart InitScanlineStart_CtDFs
  422. #define InitScanlineDeltas InitScanlineDeltas_CtDFs
  423. #define RasterTriangle RasterTriangle_CtDFs
  424. #define HasColor 1
  425. #define HasTexture 0
  426. #define HasDepth 1
  427. #define HasFog 1
  428. #define HasStencil 0
  429. #define HasScissor 0
  430. #include "RasterizerTriangles.inc"
  431. //
  432. // void RasterTriangle_CTdfs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  433. //
  434. #define InitScanlineStart InitScanlineStart_CTdfs
  435. #define InitScanlineDeltas InitScanlineDeltas_CTdfs
  436. #define RasterTriangle RasterTriangle_CTdfs
  437. #define HasColor 1
  438. #define HasTexture 1
  439. #define HasDepth 0
  440. #define HasFog 0
  441. #define HasStencil 0
  442. #define HasScissor 0
  443. #include "RasterizerTriangles.inc"
  444. //
  445. // void RasterTriangle_CTdFs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  446. //
  447. #define InitScanlineStart InitScanlineStart_CTdFs
  448. #define InitScanlineDeltas InitScanlineDeltas_CTdFs
  449. #define RasterTriangle RasterTriangle_CTdFs
  450. #define HasColor 1
  451. #define HasTexture 1
  452. #define HasDepth 0
  453. #define HasFog 1
  454. #define HasStencil 0
  455. #define HasScissor 0
  456. #include "RasterizerTriangles.inc"
  457. //
  458. // void RasterTriangle_CTDfs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  459. //
  460. #define InitScanlineStart InitScanlineStart_CTDfs
  461. #define InitScanlineDeltas InitScanlineDeltas_CTDfs
  462. #define RasterTriangle RasterTriangle_CTDfs
  463. #define HasColor 1
  464. #define HasTexture 1
  465. #define HasDepth 1
  466. #define HasFog 0
  467. #define HasStencil 0
  468. #define HasScissor 0
  469. #include "RasterizerTriangles.inc"
  470. //
  471. // void RasterTriangle_CTDFs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  472. //
  473. #define InitScanlineStart InitScanlineStart_CTDFs
  474. #define InitScanlineDeltas InitScanlineDeltas_CTDFs
  475. #define RasterTriangle RasterTriangle_CTDFs
  476. #define HasColor 1
  477. #define HasTexture 1
  478. #define HasDepth 1
  479. #define HasFog 1
  480. #define HasStencil 0
  481. #define HasScissor 0
  482. #include "RasterizerTriangles.inc"
  483. //
  484. // void RasterTriangle_cTdfS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  485. //
  486. #define InitScanlineStart InitScanlineStart_cTdfS
  487. #define InitScanlineDeltas InitScanlineDeltas_cTdfS
  488. #define RasterTriangle RasterTriangle_cTdfS
  489. #define HasFog 0
  490. #define HasDepth 0
  491. #define HasColor 0
  492. #define HasTexture 1
  493. #define HasScissor 1
  494. #define HasStencil 0
  495. #include "RasterizerTriangles.inc"
  496. //
  497. // void RasterTriangle_cTdFS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  498. //
  499. #define InitScanlineStart InitScanlineStart_cTdFS
  500. #define InitScanlineDeltas InitScanlineDeltas_cTdFS
  501. #define RasterTriangle RasterTriangle_cTdFS
  502. #define HasFog 1
  503. #define HasDepth 0
  504. #define HasColor 0
  505. #define HasTexture 1
  506. #define HasStencil 0
  507. #define HasScissor 1
  508. #include "RasterizerTriangles.inc"
  509. //
  510. // void RasterTriangle_cTDfS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  511. //
  512. #define InitScanlineStart InitScanlineStart_cTDfS
  513. #define InitScanlineDeltas InitScanlineDeltas_cTDfS
  514. #define RasterTriangle RasterTriangle_cTDfS
  515. #define HasColor 0
  516. #define HasTexture 1
  517. #define HasDepth 1
  518. #define HasFog 0
  519. #define HasStencil 0
  520. #define HasScissor 1
  521. #include "RasterizerTriangles.inc"
  522. //
  523. // void RasterTriangle_cTDFS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  524. //
  525. #define InitScanlineStart InitScanlineStart_cTDFS
  526. #define InitScanlineDeltas InitScanlineDeltas_cTDFS
  527. #define RasterTriangle RasterTriangle_cTDFS
  528. #define HasColor 0
  529. #define HasTexture 1
  530. #define HasDepth 1
  531. #define HasFog 1
  532. #define HasStencil 0
  533. #define HasScissor 1
  534. #include "RasterizerTriangles.inc"
  535. //
  536. // void RasterTriangle_CtdfS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  537. //
  538. #define InitScanlineStart InitScanlineStart_CtdfS
  539. #define InitScanlineDeltas InitScanlineDeltas_CtdfS
  540. #define RasterTriangle RasterTriangle_CtdfS
  541. #define HasColor 1
  542. #define HasTexture 0
  543. #define HasDepth 0
  544. #define HasFog 0
  545. #define HasStencil 0
  546. #define HasScissor 1
  547. #include "RasterizerTriangles.inc"
  548. //
  549. // void RasterTriangle_CtdFS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  550. //
  551. #define InitScanlineStart InitScanlineStart_CtdFS
  552. #define InitScanlineDeltas InitScanlineDeltas_CtdFS
  553. #define RasterTriangle RasterTriangle_CtdFS
  554. #define HasColor 1
  555. #define HasTexture 0
  556. #define HasDepth 0
  557. #define HasFog 1
  558. #define HasStencil 0
  559. #define HasScissor 1
  560. #include "RasterizerTriangles.inc"
  561. //
  562. // void RasterTriangle_CtDfS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  563. //
  564. #define InitScanlineStart InitScanlineStart_CtDfS
  565. #define InitScanlineDeltas InitScanlineDeltas_CtDfS
  566. #define RasterTriangle RasterTriangle_CtDfS
  567. #define HasColor 1
  568. #define HasTexture 0
  569. #define HasDepth 1
  570. #define HasFog 0
  571. #define HasStencil 0
  572. #define HasScissor 1
  573. #include "RasterizerTriangles.inc"
  574. //
  575. // void RasterTriangle_CtDFS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  576. //
  577. #define InitScanlineStart InitScanlineStart_CtDFS
  578. #define InitScanlineDeltas InitScanlineDeltas_CtDFS
  579. #define RasterTriangle RasterTriangle_CtDFS
  580. #define HasColor 1
  581. #define HasTexture 0
  582. #define HasDepth 1
  583. #define HasFog 1
  584. #define HasStencil 0
  585. #define HasScissor 1
  586. #include "RasterizerTriangles.inc"
  587. //
  588. // void RasterTriangle_CTdfS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  589. //
  590. #define InitScanlineStart InitScanlineStart_CTdfS
  591. #define InitScanlineDeltas InitScanlineDeltas_CTdfS
  592. #define RasterTriangle RasterTriangle_CTdfS
  593. #define HasColor 1
  594. #define HasTexture 1
  595. #define HasDepth 0
  596. #define HasFog 0
  597. #define HasStencil 0
  598. #define HasScissor 1
  599. #include "RasterizerTriangles.inc"
  600. //
  601. // void RasterTriangle_CTdFS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  602. //
  603. #define InitScanlineStart InitScanlineStart_CTdFS
  604. #define InitScanlineDeltas InitScanlineDeltas_CTdFS
  605. #define RasterTriangle RasterTriangle_CTdFS
  606. #define HasColor 1
  607. #define HasTexture 1
  608. #define HasDepth 0
  609. #define HasFog 1
  610. #define HasStencil 0
  611. #define HasScissor 1
  612. #include "RasterizerTriangles.inc"
  613. //
  614. // void RasterTriangle_CTDfS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  615. //
  616. #define InitScanlineStart InitScanlineStart_CTDfS
  617. #define InitScanlineDeltas InitScanlineDeltas_CTDfS
  618. #define RasterTriangle RasterTriangle_CTDfS
  619. #define HasColor 1
  620. #define HasTexture 1
  621. #define HasDepth 1
  622. #define HasFog 0
  623. #define HasStencil 0
  624. #define HasScissor 1
  625. #include "RasterizerTriangles.inc"
  626. //
  627. // void RasterTriangle_CTDFS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
  628. //
  629. #define InitScanlineStart InitScanlineStart_CTDFS
  630. #define InitScanlineDeltas InitScanlineDeltas_CTDFS
  631. #define RasterTriangle RasterTriangle_CTDFS
  632. #define HasColor 1
  633. #define HasTexture 1
  634. #define HasDepth 1
  635. #define HasFog 1
  636. #define HasStencil 0
  637. #define HasScissor 1
  638. #include "RasterizerTriangles.inc"