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.

46 lines
1.5 KiB

  1. /*============================================================================
  2. *
  3. * Copyright (C) 1999-2000 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: bspline.hpp
  6. * Content: Declarations for B-Splines
  7. *
  8. ****************************************************************************/
  9. #ifndef _BSPLINE_HPP
  10. #define _BSPLINE_HPP
  11. class RDBSpline
  12. {
  13. public:
  14. RDBSpline(DWORD dwWidth, DWORD dwHeight, DWORD dwOrderU, DWORD dwOrderV)
  15. {
  16. m_dwWidth = dwWidth;
  17. m_dwHeight = dwHeight;
  18. m_dwOrderU = dwOrderU;
  19. m_dwOrderV = dwOrderV;
  20. }
  21. void Sample(DWORD dwDataType, double u, double v, const BYTE *B, DWORD dwStride, DWORD dwPitch, BYTE *Q) const;
  22. void SampleNormal(DWORD dwDataType, double u, double v, const BYTE *pRow, DWORD dwStride, DWORD dwPitch, BYTE *Q) const;
  23. void SampleDegenerateNormal(DWORD dwDataType, const BYTE *pRow, DWORD dwStride, DWORD dwPitch, BYTE *Q) const;
  24. double TexCoordU(double u) const
  25. {
  26. return (u - double(m_dwOrderU - 1)) / double(m_dwWidth - (m_dwOrderU - 1));
  27. }
  28. double TexCoordV(double v) const
  29. {
  30. return (v - double(m_dwOrderV - 1)) / double(m_dwHeight - (m_dwOrderV - 1));
  31. }
  32. protected:
  33. virtual double Basis(unsigned i, unsigned k, double s) const;
  34. virtual double BasisPrime(unsigned i, unsigned k, double s) const;
  35. private:
  36. DWORD m_dwWidth, m_dwHeight, m_dwOrderU, m_dwOrderV;
  37. double Knot(unsigned i) const { return double(i); }
  38. };
  39. #endif // _BSPLINE_HPP