Commit 92245be3 authored by Anakin's avatar Anakin

finished OrbitCamera

parent 333eca25
......@@ -13,6 +13,7 @@ private:
double m_phi;
double m_theta;
double m_roh;
QVector3D m_center;
// functions
public:
......
......@@ -85,10 +85,10 @@ void MshFile::loadChunks(QList<ChunkHeader*>& destination, qint64 start, const q
ChunkHeader* tmp_header = new ChunkHeader();
char workaround[5] = { 0 };
// get information
m_file.read(F2V(workaround[0]), sizeof(workaround) -1);
tmp_header->name = QString(workaround);
char tmpName[5] = { 0 };
m_file.read(F2V(tmpName[0]), sizeof(tmpName) -1);
tmp_header->name = QString(tmpName);
m_file.read(F2V(tmp_header->size), sizeof(tmp_header->size));
tmp_header->position = m_file.pos();
......
......@@ -23,10 +23,10 @@ OrbitCamera::~OrbitCamera()
void OrbitCamera::rotateAction(QVector2D diff)
{
//m_phi += diff.x() * 0.01;
m_phi -= diff.x() * 0.01;
m_theta -= diff.y() * 0.01;
m_theta = qMax(qMin(M_PI_2, m_theta), -M_PI_2);
m_theta = qMax(qMin(M_PI - 0.0001, m_theta), 0.0001);
}
......@@ -50,15 +50,15 @@ void OrbitCamera::recalculateMatrix()
tmpPosition.setY(qSin(m_theta) * qSin(m_phi));
tmpPosition.setZ(qCos(m_theta));
std::cout << m_theta << ":" << tmpPosition.x() << "-" << tmpPosition.y() << "-" << tmpPosition.z() << std::endl;
m_matrix.lookAt(m_roh * tmpPosition, QVector3D(0, 0, 0), QVector3D(0, 1, 0));
m_matrix.lookAt(m_roh * tmpPosition, QVector3D(0,0,0), QVector3D(0, 0, 1));
m_matrix.rotate(90, 90, 0);
}
void OrbitCamera::resetView()
{
m_roh = 4;
m_phi = - M_PI_2;
m_theta = 0;
m_phi = -M_PI_2;
m_theta = M_PI_2;
CameraInterface::resetView();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment