Exemplo n.º 1
0
// Move the camera
bool GLC_TsrMover::move(const GLC_UserInput& userInput)
{
    const GLC_Vector3d VectCur(m_pViewport->mapPosMouse(static_cast<double>(userInput.x()), static_cast<double>(userInput.y())));
    const GLC_Vector3d VectPan= VectCur - m_PreviousVector;	// moving Vector

    GLC_Camera* pCamera= m_pViewport->cameraHandle();

    // Pan the camera
    pCamera->pan(-VectPan);

    // Zoom
    //m_pViewport->reframeFromDeltaCover(userInput.scaleFactor());
    zoom(userInput.scaleFactor());

    // Rotation
    if (!qFuzzyCompare(userInput.rotationAngle(), 0.0))
    {
        GLC_Point3d unProjectedPoint= userInput.unprojectedPoint();

        pCamera->rotateAround(pCamera->forward(), userInput.rotationAngle(), unProjectedPoint);
    }

    m_PreviousVector= VectCur;
    return true;
}