Apollo 11.0
自动驾驶开放平台
target_camera.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
18
20 : AbstractCamera(), target_pos_(0.0, 0.0, 0.0), distance_(10.0) {}
21
23 QMatrix4x4 R = YawPitchRoll(yaw(), pitch(), roll());
24 QVector3D T{0, 0, distance_};
25 T = QVector3D(R * QVector4D(T, 0.0f));
26 position_ = target_pos_ + T;
27 look_ = target_pos_ - position_;
28 look_.normalize();
29
30 up_ = QVector3D(R * QVector4D(UP, 0.0f));
31 right_ = QVector3D::crossProduct(look_, up_);
32
33 model_view_mat_.setToIdentity();
34 model_view_mat_.lookAt(position_, target_pos_, up_);
35}
float roll(void) const
QMatrix4x4 model_view_mat_
static QMatrix4x4 YawPitchRoll(float yawInDegrees, float picthInDegrees, float rollInDegrees)
float pitch(void) const
static const QVector3D UP
float yaw(void) const
virtual void UpdateWorld()