D3DXMatrixRotationZ 의 회전축 문제 ...
글쓴이: hol_ding / 작성시간: 일, 2013/08/04 - 10:23오전
// 월드, 이동, 회전, 확대 행렬 초기화 및 설정 D3DXMATRIXA16 matWorld; // 월드 행렬 D3DXMATRIXA16 matRotation; // 회전 행렬 D3DXMATRIXA16 matScale; // 확대 행렬 D3DXMATRIXA16 matTranslation; // 이동 행렬 D3DXMatrixIdentity(&matWorld); D3DXMatrixIdentity(&matRotation); D3DXMatrixIdentity(&matScale); D3DXMatrixIdentity(&matTranslation); D3DXMatrixRotationZ(&matRotation, angle); D3DXMatrixTranslation(&matTranslation, this->center->x, this->center->y, 0.0f); D3DXMatrixScaling(&matScale, scale, scale, scale); matWorld = matScale * matRotation * matTranslation; this->device->SetTransform(D3DTS_WORLD, &matWorld); TriangleVertex vertices[3] = { { 0, -(this->size->height / 2.0f), 1.0f, color, }, { (this->size->width / 2.0f), (this->size->height / 2.0f), 1.0f, color, }, { -(this->size->width / 2.0f), (this->size->height / 2.0f), 1.0f, color, }, }; this->device->SetRenderState(D3DRS_ZENABLE, FALSE); this->device->SetTexture(0, NULL); this->device->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE); this->device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 1, (void*)vertices, sizeof(TriangleVertex));
현재 이런식으로 삼각형 출력을 하고있습니다.
헌데 삼각형 출력까진 괜찮은데 이게 삼각형을 회전시키면 중심이 진짜 삼각형의 중심보다 약간 떨어져 있습니다..
왜그러는 걸까요?
Forums:
댓글 달기