当先锋百科网

首页 1 2 3 4 5 6 7

http://technet.microsoft.com/zh-cn/bb205546

Describes a three-component vector including operator overloads and type casts.

Syntax

typedef struct D3DXVECTOR3 {
  FLOAT x;
  FLOAT y;
  FLOAT z;
} D3DXVECTOR3, *LPD3DXVECTOR3;

Members

x

Type: FLOAT

The x-component.

y

Type: FLOAT

The y-component.

z

Type: FLOAT

The z-component.

Remarks

D3DXVECTOR3 Extensions

D3DXVECTOR3 has the following C++ extensions.

  1. #ifdef __cplusplus
  2. typedef struct D3DXVECTOR3 : public D3DVECTOR
  3. {
  4. public:
  5.     D3DXVECTOR3() {};
  6.     D3DXVECTOR3( CONST FLOAT * );
  7.     D3DXVECTOR3( CONST D3DVECTOR& );
  8.     D3DXVECTOR3( CONST D3DXFLOAT16 * );
  9.     D3DXVECTOR3( FLOAT x, FLOAT y, FLOAT z );
  10.  
  11.     // casting
  12.     operator FLOAT* ();
  13.     operator CONST FLOAT* () const;
  14.  
  15.     // assignment operators
  16.     D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& );
  17.     D3DXVECTOR3& operator -= ( CONST D3DXVECTOR3& );
  18.     D3DXVECTOR3& operator *= ( FLOAT );
  19.     D3DXVECTOR3& operator /= ( FLOAT );
  20.  
  21.     // unary operators
  22.     D3DXVECTOR3 operator + () const;
  23.     D3DXVECTOR3 operator - () const;
  24.  
  25.     // binary operators
  26.     D3DXVECTOR3 operator + ( CONST D3DXVECTOR3& ) const;
  27.     D3DXVECTOR3 operator - ( CONST D3DXVECTOR3& ) const;
  28.     D3DXVECTOR3 operator * ( FLOAT ) const;
  29.     D3DXVECTOR3 operator / ( FLOAT ) const;
  30.  
  31.     friend D3DXVECTOR3 operator * ( FLOAT, CONST struct D3DXVECTOR3& );
  32.  
  33.     BOOL operator == ( CONST D3DXVECTOR3& ) const;
  34.     BOOL operator != ( CONST D3DXVECTOR3& ) const;
  35.  
  36. } D3DXVECTOR3, *LPD3DXVECTOR3;
  37.  
  38. #else //!__cplusplus
  39. typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3;
  40. #endif //!__cplusplus
  41.  
  42. typedef struct D3DXVECTOR3_16F
  43. {
  44. #ifdef __cplusplus
  45. public:
  46.     D3DXVECTOR3_16F() {};
  47.     D3DXVECTOR3_16F( CONST FLOAT * );
  48.     D3DXVECTOR3_16F( CONST D3DVECTOR& );
  49.     D3DXVECTOR3_16F( CONST D3DXFLOAT16 * );
  50.     D3DXVECTOR3_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y, CONST D3DXFLOAT16 &z );
  51.  
  52.     // casting
  53.     operator D3DXFLOAT16* ();
  54.     operator CONST D3DXFLOAT16* () const;
  55.  
  56.     // binary operators
  57.     BOOL operator == ( CONST D3DXVECTOR3_16F& ) const;
  58.     BOOL operator != ( CONST D3DXVECTOR3_16F& ) const;
  59.  
  60. public:
  61. #endif //__cplusplus
  62.     D3DXFLOAT16 x, y, z;
  63.  
  64. } D3DXVECTOR3_16F, *LPD3DXVECTOR3_16F;