QCamera - 倾斜/平移旋转引起滚动旋转

时间:2016-09-08 20:33:59

标签: c++ qt

我无法理解为什么会这样做......

引用the documentation,我使用tilt(float)pan(float)来完成这项工作。

相机代码:

#include "camera.h"

#define SLOW_FACTOR 0.1

Camera::Camera() : QCamera() {
    //Projection
    setFieldOfView(45.0);
    setAspectRatio(1.0);
    setNearPlane(1.0);
    setFarPlane(100.0);

    //View
    setPosition(QVector3D(0,0,10));
    setViewCenter(QVector3D(0,0,0));
}

void Camera::orientate(int xRotate, int yRotate) {
    pan(xRotate * SLOW_FACTOR);
    tilt(yRotate * SLOW_FACTOR);
}

void Camera::move(QVector3D vec) {
    translate(vec);
}

QMatrix4x4 Camera::getModelView(QMatrix4x4 model) {
    return projectionMatrix() * viewMatrix() * model;
}

Tilt/Pan/Roll

0 个答案:

没有答案