Lagrange
CameraComponents.h
1/*
2 * Copyright 2021 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <lagrange/ui/Entity.h>
15#include <Eigen/Eigen>
16
17namespace lagrange {
18namespace ui {
19
20
22{
23 bool any_control_active = false;
24
25 // Viewport state
26 Eigen::Vector2f mouse_current = Eigen::Vector2f::Zero();
27 Eigen::Vector2f mouse_delta = Eigen::Vector2f::Zero();
28
29 // Rotation
30 bool rotation_active = false;
31 Eigen::Vector2f rotation_mouse_start = Eigen::Vector2f::Zero();
32 Eigen::Vector3f rotation_camera_pos_start = Eigen::Vector3f::Zero();
33 Eigen::Vector3f rotation_camera_up_start = Eigen::Vector3f::Zero();
34
35 //Zoom/dolly
36 bool dolly_active = false;
37 float dolly_delta = 0.0f;
38 Eigen::Vector2f dolly_mouse_start = Eigen::Vector2f::Zero();
39
40 // Panning
41 bool pan_active = false;
42 float pan_speed = 0.0005f;
43
44 // Other options
45 bool ortho_interaction_2D = false;
46 bool auto_nearfar = true;
47 bool fov_zoom = false;
48};
49
50
52{
53 bool enabled = false;
54 float speed = 1.0f / 4.0f;
55 Eigen::Vector3f start_pos = Eigen::Vector3f::Zero();
56 Eigen::Vector3f axis = Eigen::Vector3f(0, 1, 0);
57};
58
60{
61 std::function<bool(Registry& r, Entity e)> filter = nullptr;
62 bool focus = true;
63 bool fit = false;
64 float current_time = 0.0f;
65 float speed = 0.25f;
66};
67
68
69} // namespace ui
70} // namespace lagrange
Lagrange UI Viewer and mini 3D engine.
Definition: AcceleratedPicking.h:22
Main namespace for Lagrange.
Definition: AABBIGL.h:30
Definition: CameraComponents.h:22
Definition: CameraComponents.h:60
Definition: CameraComponents.h:52