git-svn-id: svn://db.shs.com.ru/libs@60 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2015-12-04 13:59:10 +00:00
parent 6ab9283a18
commit 822e1518ce
15 changed files with 70 additions and 51 deletions

View File

@@ -59,13 +59,27 @@ void Camera::apply(const GLdouble & aspect) {
pm.rotate(angles_.z(), 0., 0., 1.);
//pm.translate(-aim_);
if (parent_) {
pm.translate(-aim_);
pm *= parent_->worldTransform().inverted();
//double dist = pm(2, 3);
QMatrix4x4 pmat = parent_->worldTransform();//.inverted();
//offset_.setZ(offset_.z() - dist);
offset_ = pmat.column(3).toVector3D();
pmat(0, 3) = pmat(1, 3) = pmat(2, 3) = 0.;
pmat.translate(aim_);
//pm.translate(-aim_);
pm *= pmat.inverted();
//qDebug() << pmat;
}
setGLMatrix(pm);
//qDebug() << angles_;
}
QMatrix4x4 Camera::offsetMatrix() const {
QMatrix4x4 ret;
ret.translate(parent_ ? -offset_ : -aim_);
return ret;
}
/*
void Camera::localTransform(QMatrix4x4 & m) {
return;