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.

70 lines
2.4 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // This file contains color generation functions.
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997.
  6. //
  7. // WARNING WARNING WARNING
  8. // This cpp file generated from mcp file.
  9. // EDIT THE MCP FILE.
  10. // I warned you.
  11. // WARNING WARNING WARNING
  12. //
  13. //-----------------------------------------------------------------------------
  14. include(`m4hdr.mh')dnl
  15. #include "rgb_pch.h"
  16. #pragma hdrstop
  17. #include "ccrgn_mh.h"
  18. define(`d_ColorGen', `
  19. void C_ColorGen_$1_$2_$3_$4(PD3DI_RASTCTX pCtx, PD3DI_RASTPRIM pP,
  20. PD3DI_RASTSPAN pS)
  21. {
  22. ifelse(`$1', `Gouraud', `
  23. pS->uB += pP->iDBDX; pS->uG += pP->iDGDX;
  24. pS->uR += pP->iDRDX; pS->uA += pP->iDADX;')
  25. ifelse(`$2', `Specular', `
  26. // ATTENTION if we really care, one could argue that saturation after fog is better
  27. pCtx->SI.uBB = (UINT16)min< UINT32>((UINT32)pCtx->SI.uBB + (UINT32)pS->uBS, 0xffff);
  28. pCtx->SI.uBG = (UINT16)min< UINT32>((UINT32)pCtx->SI.uBG + (UINT32)pS->uGS, 0xffff);
  29. pCtx->SI.uBR = (UINT16)min< UINT32>((UINT32)pCtx->SI.uBR + (UINT32)pS->uRS, 0xffff);
  30. pS->uBS += pP->iDBSDX; pS->uGS += pP->iDGSDX;
  31. pS->uRS += pP->iDRSDX;')
  32. ifelse(`$3', `VertexFog', `
  33. UINT16 uFog = pS->uFog >> 8; // 0.8
  34. pCtx->SI.uBB = (pCtx->SI.uBB>>8)*uFog; // 8.0 * 0.8 = 8.8
  35. pCtx->SI.uBG = (pCtx->SI.uBG>>8)*uFog;
  36. pCtx->SI.uBR = (pCtx->SI.uBR>>8)*uFog;
  37. // this is unsigned saturating add in MMX
  38. pCtx->SI.uBB = (UINT16)min< UINT32>((UINT32)pCtx->SI.uBB + pCtx->SI.uFogB, 0xffff);
  39. pCtx->SI.uBG = (UINT16)min< UINT32>((UINT32)pCtx->SI.uBG + pCtx->SI.uFogG, 0xffff);
  40. pCtx->SI.uBR = (UINT16)min< UINT32>((UINT32)pCtx->SI.uBR + pCtx->SI.uFogR, 0xffff);
  41. pS->uFog += (INT16)pS->iDFog;
  42. pCtx->SI.uFogB += pCtx->SI.iFogBDX;
  43. pCtx->SI.uFogG += pCtx->SI.iFogGDX;
  44. pCtx->SI.uFogR += pCtx->SI.iFogRDX;')
  45. pCtx->pfnColorGenEnd(pCtx, pP, pS);
  46. }')dnl
  47. dnl
  48. d_RepStr(`d_RepStr(`d_RepStr(`d_ColorGen(AA, BB, CC, NoMonochrome)',
  49. `AA', `Flat', `Gouraud')',
  50. `BB', `NoSpecular', `Specular')',
  51. `CC', `NoFog', `VertexFog')
  52. void C_ColorGen_All_Monochrome(PD3DI_RASTCTX pCtx, PD3DI_RASTPRIM pP,
  53. PD3DI_RASTSPAN pS)
  54. {
  55. // ATTENTION, need to implement this
  56. // D3D_WARN(0,"ColorGen_All_Monochrome unimplemented");
  57. // DDASSERT(0);
  58. }