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.

90 lines
3.0 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1997 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: clipfunc.h
  6. * Content: Clipper functions
  7. *
  8. ***************************************************************************/
  9. #ifndef _CLIPFUNC_H_
  10. #define _CLIPFUNC_H_
  11. #include "clipper.h"
  12. #include "ddibase.h"
  13. DWORD D3DFE_GenClipFlags(D3DFE_PROCESSVERTICES *pv);
  14. //---------------------------------------------------------------------
  15. // This function is called by the clipper to draw unclipped part of a primitive
  16. //
  17. inline HRESULT DRAW_PRIM(D3DFE_PROCESSVERTICES *pv,
  18. D3DPRIMITIVETYPE primitiveType,
  19. LPVOID startVertex, DWORD vertexCount, DWORD numPrim)
  20. {
  21. pv->lpvOut = startVertex;
  22. pv->primType = primitiveType;
  23. pv->dwNumVertices = vertexCount;
  24. pv->dwNumPrimitives = numPrim;
  25. try
  26. {
  27. pv->pDDI->DrawPrim(pv);
  28. }
  29. catch( HRESULT hr )
  30. {
  31. return hr;
  32. }
  33. return D3D_OK;
  34. }
  35. //---------------------------------------------------------------------
  36. // This function is called by the clipper to draw clipped part of a primitive
  37. //
  38. inline HRESULT DRAW_CLIPPED_PRIM(D3DFE_PROCESSVERTICES *pv,
  39. D3DPRIMITIVETYPE primitiveType,
  40. LPVOID startVertex, DWORD vertexCount, DWORD numPrim)
  41. {
  42. pv->lpvOut = startVertex;
  43. pv->primType = primitiveType;
  44. pv->dwNumVertices = vertexCount;
  45. pv->dwNumPrimitives = numPrim;
  46. try
  47. {
  48. pv->pDDI->DrawClippedPrim(pv);
  49. }
  50. catch( HRESULT hr )
  51. {
  52. return hr;
  53. }
  54. return D3D_OK;
  55. }
  56. //---------------------------------------------------------------------
  57. // This function is called by the clipper to draw unclipped part of an
  58. // indexed primitive
  59. //
  60. inline HRESULT DRAW_INDEX_PRIM(D3DFE_PROCESSVERTICES *pv,
  61. D3DPRIMITIVETYPE primitiveType,
  62. LPWORD startIndex, DWORD vertexCount, DWORD numPrim)
  63. {
  64. pv->lpwIndices = startIndex;
  65. pv->primType = primitiveType;
  66. pv->dwNumIndices = vertexCount;
  67. pv->dwNumPrimitives = numPrim;
  68. try
  69. {
  70. pv->pDDI->DrawIndexPrim(pv);
  71. }
  72. catch( HRESULT hr )
  73. {
  74. return hr;
  75. }
  76. return D3D_OK;
  77. }
  78. //----------------------------------------------------------------------
  79. // Clip a triangle made by 3 vertices
  80. // bCanModifyVertices is set to TRUE, if the function can modify the original
  81. // vertices
  82. //
  83. HRESULT Clip(D3DFE_PROCESSVERTICES *pv, ClipVertex *cv1, ClipVertex *cv2, ClipVertex *cv3);
  84. HRESULT ClipLine(D3DFE_PROCESSVERTICES *pv, ClipVertex *cv1, ClipVertex *cv2);
  85. #endif // _CLIPFUNC_H_