Lagrange
update_gizmo.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/api.h>
15#include <lagrange/ui/Entity.h>
16#include <lagrange/ui/components/Transform.h>
17#include <lagrange/ui/types/Camera.h>
18
19
20namespace lagrange {
21namespace ui {
22
23enum class GizmoMode { SELECT, TRANSLATE, ROTATE, SCALE, count };
24
27{
28 bool active = false;
29 Eigen::Affine3f current_transform = Eigen::Affine3f::Identity();
30 Eigen::Affine3f transform_start = Eigen::Affine3f::Identity();
31};
32
36{
39
42 Eigen::Affine3f parent_inverse;
43};
44
45
46LA_UI_API bool gizmo_system_is_using();
47LA_UI_API bool gizmo_system_is_over();
48LA_UI_API void gizmo_system_set_draw_list();
49
50LA_UI_API void gizmo_system(
51 Registry& registry,
52 const Camera& camera,
53 const Eigen::Vector2f& canvas_pos,
54 GizmoMode mode = GizmoMode::SELECT);
55
56
57} // namespace ui
58} // namespace lagrange
Camera class.
Definition: Camera.h:38
Lagrange UI Viewer and mini 3D engine.
Definition: AcceleratedPicking.h:22
Main namespace for Lagrange.
Definition: AABBIGL.h:30
Gizmo system state (context variable)
Definition: update_gizmo.h:27
GizmoObjectTransform component is attached to every entity being transformed by the gizmo system.
Definition: update_gizmo.h:36
ui::Transform initial_transform
Transform of the object at the start of gizmo interaction.
Definition: update_gizmo.h:38
Eigen::Affine3f parent_inverse
Cached parent inverse Computed as (global * local.inverse()).inverse()
Definition: update_gizmo.h:42
Affine transformation.
Definition: Transform.h:23