Swap yaw and pitch in camera computation. Add functions to convert view matrix to camera position, and camera position to camera yaw pitch roll.

This commit is contained in:
yunfeibai
2017-06-01 15:30:37 -07:00
parent 4388a6ea02
commit e6d1a8cf97
74 changed files with 347 additions and 281 deletions

View File

@@ -115,11 +115,11 @@ TinyRendererVisualShapeConverter::TinyRendererVisualShapeConverter()
m_data = new TinyRendererVisualShapeConverterInternalData();
float dist = 1.5;
float pitch = -80;
float yaw = 10;
float pitch = -10;
float yaw = -80;
float targetPos[3]={0,0,0};
m_data->m_camera.setCameraUpAxis(m_data->m_upAxis);
resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
resetCamera(dist,yaw,pitch,targetPos[0],targetPos[1],targetPos[2]);
}
@@ -678,7 +678,7 @@ void TinyRendererVisualShapeConverter::setUpAxis(int axis)
m_data->m_camera.setCameraUpAxis(axis);
m_data->m_camera.update();
}
void TinyRendererVisualShapeConverter::resetCamera(float camDist, float pitch, float yaw, float camPosX,float camPosY, float camPosZ)
void TinyRendererVisualShapeConverter::resetCamera(float camDist, float yaw, float pitch, float camPosX,float camPosY, float camPosZ)
{
m_data->m_camera.setCameraDistance(camDist);
m_data->m_camera.setCameraPitch(pitch);