home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / graphics / directx / tri3 / d3dmath.h < prev    next >
C/C++ Source or Header  |  1997-07-14  |  2KB  |  59 lines

  1. /*==========================================================================
  2.  *
  3.  *  Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved.
  4.  *
  5.  *  File: d3dmath.h
  6.  *
  7.  ***************************************************************************/
  8. #ifndef __D3DMATH_H__
  9. #define __D3DMATH_H__
  10.  
  11. #include <math.h>
  12.  
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /*
  17.  * Normalises the vector v
  18.  */
  19. LPD3DVECTOR D3DVECTORNormalise(LPD3DVECTOR v);
  20.  
  21. /*
  22.  * Calculates cross product of a and b.
  23.  */
  24. LPD3DVECTOR D3DVECTORCrossProduct(LPD3DVECTOR lpd, LPD3DVECTOR lpa, LPD3DVECTOR lpb);
  25.  
  26. /*
  27.  * lpDst = lpSrc1 * lpSrc2
  28.  * lpDst can be equal to lpSrc1 or lpSrc2
  29.  */
  30. LPD3DMATRIX MultiplyD3DMATRIX(LPD3DMATRIX lpDst, LPD3DMATRIX lpSrc1, 
  31.                               LPD3DMATRIX lpSrc2);
  32. /*
  33.  * -1 d = a
  34.  */
  35. LPD3DMATRIX D3DMATRIXInvert(LPD3DMATRIX d, LPD3DMATRIX a);
  36.  
  37. /*
  38.  * Set the rotation part of a matrix such that the vector lpD is the new
  39.  * z-axis and lpU is the new y-axis.
  40.  */
  41. LPD3DMATRIX D3DMATRIXSetRotation(LPD3DMATRIX lpM, LPD3DVECTOR lpD, LPD3DVECTOR lpU);
  42.  
  43. /*
  44.  * Calculates a point along a B-Spline curve defined by four points. p
  45.  * n output, contain the point. t                 Position
  46.  * along the curve between p2 and p3.  This position is a float between 0
  47.  * and 1. p1, p2, p3, p4    Points defining spline curve. p, at parameter
  48.  * t along the spline curve
  49.  */
  50. void spline(LPD3DVECTOR p, float t, LPD3DVECTOR p1, LPD3DVECTOR p2,
  51.             LPD3DVECTOR p3, LPD3DVECTOR p4);
  52.  
  53. #ifdef __cplusplus
  54. };
  55. #endif
  56.  
  57. #endif // __D3DMATH_H__
  58.  
  59.