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.

114 lines
2.7 KiB

  1. dnl----------------------------------------------------------------------------
  2. dnl
  3. dnl rtexread.mh
  4. dnl
  5. dnl Ramp texel reading macros.
  6. dnl
  7. dnl Copyright (C) Microsoft Corporation, 1997.
  8. dnl
  9. dnl----------------------------------------------------------------------------
  10. dnl
  11. pushdef(`d_BeadMacrosOnly', `')dnl
  12. include(`rampbead.mh')dnl
  13. popdef(`d_BeadMacrosOnly')dnl
  14. dnl
  15. dnl d_RampTexelRead
  16. dnl
  17. dnl Generates a texel read function body.
  18. dnl Assumes pTex is the texture.
  19. dnl
  20. dnl $1 is a combination of:
  21. dnl Palette8 Palette4
  22. dnl NoTrans MaybeTrans ColorKey
  23. dnl Modulate Copy
  24. dnl $2 is the U coordinate, $3 is the V coordinate,
  25. dnl $4 is a pointer to the texture bits, $5 is the U shift.
  26. dnl
  27. define(`d_RampTexelRead', `
  28. ifelse(eval(d_index($1, `Palette8') >= 0), `1', `
  29. INT32 iTexel;
  30. iTexel = $4[$2 | ($3 << $5)];
  31. ', `
  32. ifelse(eval(d_index($1, `Palette4') >= 0), `1', `
  33. INT32 iIndex;
  34. iIndex = $2 | ($3 << $5);
  35. INT32 iTexel;
  36. iTexel = $4[iIndex >> 1];
  37. if ((iIndex & 1) == 0)
  38. {
  39. iTexel &= 0xf;
  40. }
  41. else
  42. {
  43. iTexel >>= 4;
  44. }', `
  45. INT32 iTexel;
  46. iTexel = ((PUINT16)$4)[$2 | ($3 << $5)];
  47. ')dnl
  48. ')dnl
  49. D3DCOLOR Color;
  50. ifelse(eval(d_index($1, `Modulate') >= 0), `1', `
  51. Color = pTex->pRampmap[iTexel];
  52. ', `
  53. Color = (D3DCOLOR)iTexel;
  54. ')dnl
  55. ifelse(eval(d_index($1, `NoColorKey') >= 0), `1', `
  56. // if going into alpha blend code, must set alpha so textured objects
  57. // dont disappear
  58. Color |= 0xff000000;
  59. ', `
  60. if (iTexel == (INT32)pTex->TransparentColor)
  61. {
  62. Color &= 0x00ffffff;
  63. }
  64. else
  65. {
  66. Color |= 0xff000000;
  67. }
  68. ')dnl
  69. ')dnl
  70. dnl
  71. dnl d_RampTexelReadNoPixel
  72. dnl
  73. dnl Generates a texel read function body.
  74. dnl Handles colorkeying by directly going to a label on failures.
  75. dnl
  76. dnl $1 is a combination of:
  77. dnl Palette8 Palette4
  78. dnl NoTrans MaybeTrans ColorKey
  79. dnl Modulate Copy
  80. dnl $2 is the U coordinate, $3 is the V coordinate,
  81. dnl $4 is a pointer to the texture bits, $5 is the U shift.
  82. dnl $6 is the no-pixel label to jump to.
  83. dnl
  84. define(`d_RampTexelReadNoPixel', `
  85. ifelse(eval(d_index($1, `Palette8') >= 0), `1', `
  86. INT32 iTexel;
  87. iTexel = $4[$2 | ($3 << $5)];
  88. ', `
  89. INT32 iIndex;
  90. iIndex = $2 | ($3 << $5);
  91. INT32 iTexel;
  92. iTexel = $4[iIndex >> 1];
  93. if ((iIndex & 1) == 0)
  94. {
  95. iTexel &= 0xf;
  96. }
  97. else
  98. {
  99. iTexel >>= 4;
  100. }
  101. ')dnl
  102. D3DCOLOR Color;
  103. ifelse(eval(d_index($1, `Modulate') >= 0), `1', `
  104. Color = pTex->pRampmap[iTexel];
  105. ', `
  106. Color = (D3DCOLOR)iTexel;
  107. ')dnl
  108. ifelse(eval(d_index($1, `NoColorKey') < 0), `1', `
  109. if (iTexel == (INT32)pTex->TransparentColor)
  110. {
  111. goto $6;
  112. }
  113. ')dnl
  114. ')dnl