D3DXMATRIX 結構 (D3dx9math.h)

注意

D3DX 公用程式程式庫已被取代。 建議您改用 DirectXMath

包含方法和運算子多載的 4x4 矩陣。

語法

typedef struct D3DXMATRIX {
  FLOAT _ij;
} D3DXMATRIX, *LPD3DXMATRIX;

成員

_Ij

類型: FLOAT

矩陣的 (i、 j) 元件,其中 i 是列號,而 j 是資料行編號。 例如,_34 表示與 [a₃₄],第三個數據列和第四個數據行中的元件相同。

備註

C 程式設計人員無法使用 D3DXMATRIX 結構,它們必須使用 D3DMATRIX 結構。 C++ 程式設計人員可以利用多載建構函式和指派、一元和二進位 (,包括相等) 運算子。

在 D3DX 中,投影矩陣的 _34 元素不能是負數。 如果您的應用程式需要在此位置使用負值,它應該改為將整個投影矩陣調整為 -1。

D3DXMATRIX 延伸模組

D3DXMATRIX 具有下列 C++ 延伸模組。

#ifdef __cplusplus
typedef struct D3DXMATRIX : public D3DMATRIX
{
public:
    D3DXMATRIX() {};
    D3DXMATRIX( CONST FLOAT * );
    D3DXMATRIX( CONST D3DMATRIX& );
    D3DXMATRIX( CONST D3DXFLOAT16 * );
    D3DXMATRIX( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14,
                FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24,
                FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34,
                FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 );


    // access grants
    FLOAT& operator () ( UINT Row, UINT Col );
    FLOAT  operator () ( UINT Row, UINT Col ) const;

    // casting operators
    operator FLOAT* ();
    operator CONST FLOAT* () const;

    // assignment operators
    D3DXMATRIX& operator *= ( CONST D3DXMATRIX& );
    D3DXMATRIX& operator += ( CONST D3DXMATRIX& );
    D3DXMATRIX& operator -= ( CONST D3DXMATRIX& );
    D3DXMATRIX& operator *= ( FLOAT );
    D3DXMATRIX& operator /= ( FLOAT );

    // unary operators
    D3DXMATRIX operator + () const;
    D3DXMATRIX operator - () const;

    // binary operators
    D3DXMATRIX operator * ( CONST D3DXMATRIX& ) const;
    D3DXMATRIX operator + ( CONST D3DXMATRIX& ) const;
    D3DXMATRIX operator - ( CONST D3DXMATRIX& ) const;
    D3DXMATRIX operator * ( FLOAT ) const;
    D3DXMATRIX operator / ( FLOAT ) const;

    friend D3DXMATRIX operator * ( FLOAT, CONST D3DXMATRIX& );

    BOOL operator == ( CONST D3DXMATRIX& ) const;
    BOOL operator != ( CONST D3DXMATRIX& ) const;

} D3DXMATRIX, *LPD3DXMATRIX;

#else //!__cplusplus
typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX;
#endif //!__cplusplus

規格需求

需求
標頭
D3dx9math.h

另請參閱

D3DX 結構

D3DMATRIX