2016-07-01 1 views
6

quat을 mat4로 변환하려고합니다.quaternion을 사용하여 매트릭스를

내 코드입니다 : 내가 프로그램을 실행하면

#include <iostream> 
#include<glm/glm.hpp> 
#include<glm/gtc/quaternion.hpp> 
#include<glm/common.hpp> 
using namespace std; 


int main() 
{ 
    glm::mat4 MyMatrix=glm::mat4(); 
    glm::quat myQuat; 

    myQuat=glm::quat(0.707107,0.707107,0.00,0.000); 
    glm::mat4 RotationMatrix = quaternion::toMat4(myQuat); 

    for(int i=0;i<4;++i) 
    { 
     for(int j=0;j<4;++j) 
     { 
      cout<<RotationMatrix[i][j]<<" "; 
     } 
     cout<<"\n"; 
    } 
    return 0; 
} 

는 오류 표시 "오류 : '사원 수는'선언되지 않았습니다."

아무도 도와 줄 수 있습니까?

#include <glm/gtx/quaternion.hpp> 

을 그리고 toMat4의 네임 스페이스를 수정 :

+1

#include <glm/gtx/quaternion.hpp>합니까 필요하지 않습니다

glm::mat4 RotationMatrix = glm::mat4_cast(myQuat); 

을'사원 수 : toMat4'는'GLM :: 사원 수 있어야합니다 :: toMat4'? – NathanOliver

답변

8

(가) 포함 추가

glm::mat4 RotationMatrix = glm::toMat4(myQuat); 

glm::toMat4()glm 네임 스페이스가 you can seegtx/quaternion.hpp 파일에 존재

. 보조 노트 로서도

, C++ 14과 같은 중첩 네임 스페이스 (예컨대 GLM :: 쿼터니언 :: toMat4) are not allowed.

0

이 meepzh의 대답 이외에, 그것은 또한 다음과 같이 수행 할 수 있습니다

관련 문제