示例#1
0
void ViewCameraGL::read(const QString& filename)
{
    QFile file(filename);
    if(file.exists() && file.open( QIODevice::ReadOnly )) {
    QTextStream stream ( &file );

        stream >> __azimuth >> __elevation;
        printf("%d\n",__azimuth);
        printf("%d\n",__elevation);
        stream >> __stepMove;
        printf("%i\n",__stepMove);

        IV(stream,__center);
        IV(stream,__eye);
        IV(stream,__translation);

        stream >> __radius >> __far_plane >> __near_plane;
    stream >> __default_view_angle >> __view_angle;
        int i = 0;
    stream >> i;
        __projectionmode = (i != 0);
    stream >> i;
        __geomsys = (i != 0);
//    emit azimuthChanged(QString::number(__azimuth));
//    emit elevationChanged(QString::number(__elevation));
//    emit zoomChanged(QString::number(__translation.x()));
    emit azimuthChanged(__azimuth);
    emit elevationChanged(__elevation);
    emit zoomChanged(__translation.x());
    emit farPlaneChanged(QString::number(__far_plane));
    emit nearPlaneChanged(QString::number(__near_plane));
    emit projectionChanged(__projectionmode);
    emit coordSysChanged(__geomsys);
    emit valueChanged();
        }
示例#2
0
/*!
 * Sets the projection's far plane to \a farPlane. This triggers a projection
 * matrix update.
 */
void QCameraLens::setFarPlane(float farPlane)
{
    Q_D(QCameraLens);
    if (qFuzzyCompare(d->m_farPlane, farPlane))
        return;
    d->m_farPlane = farPlane;
    emit farPlaneChanged(farPlane);
    d->updateProjectionMatrix();
}
示例#3
0
/*! \internal */
QCamera::QCamera(QCameraPrivate &dd, QNode *parent)
    : QEntity(dd, parent)
{
    QObject::connect(d_func()->m_lens, SIGNAL(projectionTypeChanged()), this, SIGNAL(projectionMatrixChanged()));
    QObject::connect(d_func()->m_lens, SIGNAL(nearPlaneChanged()), this, SIGNAL(nearPlaneChanged()));
    QObject::connect(d_func()->m_lens, SIGNAL(farPlaneChanged()), this, SIGNAL(farPlaneChanged()));
    QObject::connect(d_func()->m_lens, SIGNAL(fieldOfViewChanged()), this, SIGNAL(fieldOfViewChanged()));
    QObject::connect(d_func()->m_lens, SIGNAL(aspectRatioChanged()), this, SIGNAL(aspectRatioChanged()));
    QObject::connect(d_func()->m_lens, SIGNAL(leftChanged()), this, SIGNAL(leftChanged()));
    QObject::connect(d_func()->m_lens, SIGNAL(rightChanged()), this, SIGNAL(rightChanged()));
    QObject::connect(d_func()->m_lens, SIGNAL(bottomChanged()), this, SIGNAL(bottomChanged()));
    QObject::connect(d_func()->m_lens, SIGNAL(topChanged()), this, SIGNAL(topChanged()));
    QObject::connect(d_func()->m_lens, SIGNAL(projectionMatrixChanged()), this, SIGNAL(projectionMatrixChanged()));
    QObject::connect(d_func()->m_lookAt, SIGNAL(positionChanged()), this, SIGNAL(positionChanged()));
    QObject::connect(d_func()->m_lookAt, SIGNAL(upVectorChanged()), this, SIGNAL(upVectorChanged()));
    QObject::connect(d_func()->m_lookAt, SIGNAL(viewCenterChanged()), this, SIGNAL(viewCenterChanged()));
    QObject::connect(d_func()->m_transform, SIGNAL(matrixChanged()), this, SIGNAL(matrixChanged()));
    d_func()->m_transform->addTransform(d_func()->m_lookAt);
    addComponent(d_func()->m_lens);
    addComponent(d_func()->m_transform);
}
示例#4
0
void
ViewCameraGL::setFarPlane(const QString& plane)
{
  __far_plane = (double)plane.toFloat();
  emit farPlaneChanged(QString::number(__far_plane));
}