Esempio n. 1
0
/*
 * The time event will keep looking for updates to the motion key statuses
 */
void GLWidget::timerEvent( QTimerEvent *timer )
{
        /*
         * This area will control all possible directions of camera movement
         */
        if (moveUp_) {
                panVertical(-1.0);
        } else if (moveDn_) {
                panVertical(1.0);
        } else if (moveLeft_) {
                panHorizontal(1.0);
        } else if (moveRight_){
                panHorizontal(-1.0);
        }
}
void Camera::setFocusPosition( float distance, float longitude, float latitude, float rotation )
{
    // Set Camera to l=0, b=0, rotation=0
    vEye.set(1., 0., 0.);
    vUp.set(0., 0., 1.);
    vRight.set(0., -1., 0.);

    // Change values according to parameters
    panHorizontal(longitude*TRIG_DEG_TO_RAD);
    panVertical(latitude*TRIG_DEG_TO_RAD);
    rotate(rotation*TRIG_DEG_TO_RAD);

    // Set position relative to distance
    position = vEye*-distance;
    position.x -= 8;

    stop();
    setMatrix();
}
void Camera::panLeft()
{
    panHorizontal(panSpeed);
}
void Camera::panRight()
{
    panHorizontal(-panSpeed);
}