Skip to content
Snippets Groups Projects
Commit 8b2e8b88 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fix for render camera motion

parent 2730c5aa
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
......@@ -112,11 +112,25 @@ Eigen::Matrix4d CameraView3D::getUpdatedPose() {
return t.matrix() * rotmat_;
}
void CameraView3D::processAnimation() {
Eigen::Vector3d diff;
diff[0] = neye_[0] - eye_[0];
diff[1] = neye_[1] - eye_[1];
diff[2] = neye_[2] - eye_[2];
// Only update pose if there is enough motion
if (diff.norm() > 0.01) {
pose_up_to_date_.clear();
}
}
void CameraView3D::draw(NVGcontext* ctx) {
double now = glfwGetTime();
delta_ = now - ftime_;
ftime_ = now;
processAnimation();
// poll from ctrl_ or send on event instead?
if (!pose_up_to_date_.test_and_set()) {
ctrl_->sendPose(getUpdatedPose());
......
......@@ -41,6 +41,8 @@ protected:
std::atomic_flag pose_up_to_date_;
void processAnimation();
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment