我无法理解为什么会这样做......
引用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;
}