fixed camera control,
removed test exe
This commit is contained in:
@@ -26,7 +26,7 @@ void OrbitCamera::rotateAction(QVector2D diff)
|
||||
m_phi -= diff.x() * 0.01;
|
||||
m_theta -= diff.y() * 0.01;
|
||||
|
||||
m_theta = qMax(qMin(M_PI - 0.0001, m_theta), 0.0001);
|
||||
//m_theta = qMax(qMin(M_PI - 0.0001, m_theta), 0.0001);
|
||||
}
|
||||
|
||||
void OrbitCamera::moveAction(QVector2D diff)
|
||||
@@ -44,20 +44,26 @@ void OrbitCamera::recalculateMatrix()
|
||||
{
|
||||
m_matrix = QMatrix4x4();
|
||||
|
||||
QVector3D tmpPosition;
|
||||
tmpPosition.setX(qSin(m_theta) * qCos(m_phi));
|
||||
tmpPosition.setY(qSin(m_theta) * qSin(m_phi));
|
||||
tmpPosition.setZ(qCos(m_theta));
|
||||
// different coordinate (spherical -> world) X->Z | Y->X | Z->Y
|
||||
QVector3D tmpPosition(
|
||||
qSin(m_theta) * qSin(m_phi),
|
||||
qCos(m_theta),
|
||||
qSin(m_theta) * qCos(m_phi)
|
||||
);
|
||||
|
||||
m_matrix.lookAt(m_roh * tmpPosition, QVector3D(0,0,0), QVector3D(0, 0, 1));
|
||||
m_matrix.rotate(90, 1, 0, 0);
|
||||
m_matrix.rotate(90, 0, 1, 0);
|
||||
QVector3D tmpRight(
|
||||
qSin(m_phi - M_PI_2),
|
||||
0,
|
||||
qCos(m_phi - M_PI_2)
|
||||
);
|
||||
|
||||
m_matrix.lookAt(m_roh * tmpPosition, QVector3D(0,0,0), QVector3D::crossProduct(tmpRight, tmpPosition));
|
||||
}
|
||||
|
||||
void OrbitCamera::resetView()
|
||||
{
|
||||
m_roh = 4;
|
||||
m_phi = 0; //-M_PI_2;
|
||||
m_phi = 0;
|
||||
m_theta = M_PI_2;
|
||||
CameraInterface::resetView();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user