티스토리 뷰

D3DXMatrixDecompose 함수를 사용하면 되는데 매우 간단하다

필요로 하는 인자를 넣으면 알아서 값을 계산해준다.

 

matWorld 변수에는 특정 값들을 얻기 위한 매트릭스를 넣어주면 된다.

아래처럼 쓰레기값이 들어가있는 매트릭스 넣으면 쓰레기값 매트릭스에는 어떤 회전값이 들어가있을까 하는 결과를..

 

하단에 Syntax 를 보면 알겠지만 전부 포인터 형태로 들어가는데

그렇다고 해서 필요없는 인자라고 NULL을 넣을 경우에는

하얗게 질리는 화면을 볼 수가 있다

 

Breaks down a general 3D transformation matrix into its scalar, rotational, and translational components.

Syntax

C++
HRESULT D3DXMatrixDecompose(
  _Inout_       D3DXVECTOR3    *pOutScale,
  _Inout_       D3DXQUATERNION *pOutRotation,
  _Inout_       D3DXVECTOR3    *pOutTranslation,
  _In_    const D3DXMATRIX     *pM
);

Parameters

pOutScale [in, out]

Type: D3DXVECTOR3*

Pointer to the output D3DXVECTOR3 that contains scaling factors applied along the x, y, and z-axes.

pOutRotation [in, out]

Type: D3DXQUATERNION*

Pointer to the D3DXQUATERNION structure that describes the rotation.

pOutTranslation [in, out]

Type: D3DXVECTOR3*

Pointer to the D3DXVECTOR3 vector that describes the translation.

pM [in]

Type: const D3DXMATRIX*

Pointer to an input D3DXMATRIX matrix to decompose.

Return value

Type: HRESULT

If the function succeeds, the return value is S_OK. If the function fails, the return value can be the following: D3DERR_INVALIDCALL.

Requirements

Header

D3dx9math.h

Library

D3dx9.lib

See also

Math Functions

 

 

https://msdn.microsoft.com/en-us/library/windows/desktop/bb205337(v=vs.85).aspx

http://gpgstudy.com/forum/viewtopic.php?t=24416

댓글