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.

72 lines
2.6 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1997 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: d3dfei.hpp
  6. * Content: Direct3D frontend internal include file
  7. *
  8. ***************************************************************************/
  9. #ifndef _D3DFEI_H_
  10. #define _D3DFEI_H_
  11. #include "tlhal.h"
  12. #include "clipper.h"
  13. extern void setIdentity(D3DMATRIXI * m);
  14. extern void MatrixProduct(D3DMATRIXI *d, D3DMATRIXI *a, D3DMATRIXI *b);
  15. extern void D3DFE_updateExtents(LPDIRECT3DDEVICEI lpDevI);
  16. extern void D3DFE_ConvertExtent(LPDIRECT3DDEVICEI lpDevI, LPD3DRECTV from, LPD3DRECT to);
  17. extern void SetInterpolationFlags(LPD3DFE_PROCESSVERTICES pv);
  18. extern LIGHT_VERTEX_FUNC_TABLE lightVertexTable;
  19. //---------------------------------------------------------------------
  20. // Clamp extents to viewport window.
  21. // For guard band it is possible that extents are outside viewport window
  22. // after clipping
  23. //
  24. inline void ClampExtents(LPD3DFE_PROCESSVERTICES pv)
  25. {
  26. if (pv->dwDeviceFlags & D3DDEV_GUARDBAND &&
  27. !(pv->dwDeviceFlags & D3DDEV_DONOTUPDATEEXTENTS))
  28. {
  29. if (pv->rExtents.x1 < pv->vcache.minX)
  30. pv->rExtents.x1 = pv->vcache.minX;
  31. if (pv->rExtents.x2 > pv->vcache.maxX)
  32. pv->rExtents.x2 = pv->vcache.maxX;
  33. if (pv->rExtents.y1 < pv->vcache.minY)
  34. pv->rExtents.y1 = pv->vcache.minY;
  35. if (pv->rExtents.y2 > pv->vcache.maxY)
  36. pv->rExtents.y2 = pv->vcache.maxY;
  37. }
  38. }
  39. //---------------------------------------------------------------------
  40. // Returns TRUE if cipping is needed
  41. //
  42. inline BOOL CheckIfNeedClipping(LPD3DFE_PROCESSVERTICES pv)
  43. {
  44. if (pv->dwDeviceFlags & D3DDEV_GUARDBAND)
  45. {
  46. if (pv->dwClipUnion & ~__D3DCLIP_INGUARDBAND)
  47. return TRUE;
  48. }
  49. else
  50. if (pv->dwClipUnion)
  51. return TRUE;
  52. return FALSE;
  53. }
  54. //---------------------------------------------------------------------
  55. // Updates lighting and computes process vertices flags
  56. //
  57. extern void DoUpdateState(LPDIRECT3DDEVICEI lpDevI);
  58. //---------------------------------------------------------------------
  59. // Updates clip status in the device
  60. //
  61. // We have to mask all guard band bits
  62. //
  63. inline void D3DFE_UpdateClipStatus(LPDIRECT3DDEVICEI lpDevI)
  64. {
  65. lpDevI->iClipStatus |= lpDevI->dwClipUnion & D3DSTATUS_CLIPUNIONALL;
  66. lpDevI->iClipStatus &= (~D3DSTATUS_CLIPINTERSECTIONALL |
  67. ((lpDevI->dwClipIntersection & D3DSTATUS_CLIPUNIONALL) << 12));
  68. }
  69. #endif // _D3DFEI_H_