3#include <cgv/base/node.h>
4#include <cgv/gui/event_handler.h>
5#include <cgv/math/fvec.h>
6#include <cgv/math/quaternion.h>
7#include <cgv/math/ray.h>
8#include <cgv/render/drawable.h>
9#include <cgv/render/view.h>
17 vec3 origin = { 0.0f };
18 vec3 normal = { 0.0f };
21 return length(normal) > std::numeric_limits<float>::epsilon();
25enum class GizmoAction {
31enum class GizmoOrientation {
53 GizmoOrientation get_orientation()
const;
55 void set_orientation(GizmoOrientation orientation);
57 vec3 get_position()
const;
59 void set_position(
const vec3& position);
61 quat get_rotation()
const;
63 void set_rotation(
const quat& rotation);
65 float size_scale = 1.0f;
66 bool keep_screen_size_constant =
true;
67 bool lock_size_during_interaction =
false;
70 enum class InteractionFeature {
83 InteractionFeature _interaction_feature = InteractionFeature::kNone;
84 AxisId _interaction_axis_id = AxisId::kX;
85 plane _interaction_plane;
87 float _drag_start_t = 0.0f;
89 float get_size()
const;
93 void set_geometry_out_of_date();
95 bool captured_mouse()
const;
97 bool is_hovered()
const;
99 int axis_id_to_index(AxisId axis)
const;
101 AxisId index_to_axis_id(
int idx)
const;
103 vec3 get_axis(
int index)
const;
105 vec3 get_axis_mask(InteractionFeature feature, AxisId axis_id)
const;
108 virtual void create_geometry() = 0;
112 virtual bool intersect_bounding_box(
const cgv::math::ray3& ray) {
return true; }
124 bool _geometry_out_of_date =
true;
127 bool _captured_mouse =
false;
128 bool _hovered =
false;
130 vec3 _position = { 0.0f };
132 GizmoOrientation _orientation = GizmoOrientation::kGlobal;
138#include <cgv/config/lib_end.h>
void stream_help(std::ostream &os) override
overload to stream help information to the given output stream
void clear(cgv::render::context &) override=0
clear all objects living in the context like textures or display lists
std::string get_type_name() const override
overload to return the type name of this object. By default the type interface is queried over get_ty...
bool init(cgv::render::context &) override=0
this method is called after creation or recreation of the context, return whether all necessary funct...
The node class keeps a pointer to its parent.
interface for all classes that want to receive events
This class defines a template for n-dimensional rays with arbitrary data type defined by origin and d...
base class for all drawables, which is independent of the used rendering API.
base class for all drawables, which is independent of the used rendering API.
defines a symmetric view with the following quantities:
cgv::math::quaternion< float > quat
declare type of quaternion
cgv::math::fvec< float, 3 > vec3
declare type of 3d single precision floating point vectors