17 enum OrientationOption {
31 OrientationOption orientation = OO_HORIZONTAL;
32 AlignmentOption label_alignment = AO_END;
35 cgv::g2d::irect color_map_rect;
37 float title_angle = 90.0f;
39 void update(
const ivec2& parent_size) {
41 ivec2 size(parent_size);
43 switch(label_alignment) {
45 if(orientation == OO_HORIZONTAL) {
46 offset.
x() = x_label_size / 2;
47 offset.
y() = title_space;
48 size.x() -= x_label_size;
49 size.y() -= label_space + title_space;
51 offset.
x() = x_label_size + 4;
53 size.x() -= x_label_size + 4 + title_space;
57 if(orientation == OO_HORIZONTAL) {
58 offset.
x() = x_label_size / 2;
59 offset.
y() = label_space;
60 size.x() -= x_label_size;
61 size.y() -= label_space + title_space;
63 offset.
x() = title_space;
64 size.x() -= x_label_size + 4 + title_space;
70 color_map_rect.position = offset + padding;
71 color_map_rect.
size = size - 2 * padding;
75 bool invert_color =
false;
76 bool flip_texture =
false;
81 vec2 value_range = { 0.0f, 1.0f };
82 vec2 display_range = { 0.0f, 1.0f };
83 unsigned num_ticks = 3;
85 AlignmentOption title_align = AO_START;
88 unsigned precision = 0;
89 bool auto_precision =
true;
90 bool trailing_zeros =
false;
91 bool integers =
false;
94 bool show_opacity =
true;
97 cgv::g2d::shape2d_style border_style, color_map_style, tick_style;
98 cgv::g2d::grid2d_style background_style;
101 cgv::g2d::text2d_style text_style;
102 cgv::g2d::msdf_text_geometry labels;
104 cgv::g2d::generic_2d_renderer tick_renderer;
105 DEFINE_GENERIC_RENDER_DATA_CLASS(tick_geometry, 2, vec2, position, vec2, size);
108 void init_styles()
override;
112 void create_gui_impl()
override;
128 void set_width(
size_t w);
129 void set_height(
size_t h);
131 void set_title(
const std::string& t);
133 OrientationOption get_orientation()
const {
return layout.orientation; }
134 void set_orientation(OrientationOption orientation);
136 AlignmentOption get_label_alignment()
const {
return layout.label_alignment; }
137 void set_label_alignment(AlignmentOption alignment);
139 vec2 get_range()
const {
return value_range; }
140 void set_range(vec2 r);
142 vec2 get_display_range()
const {
return display_range; }
143 void set_display_range(vec2 r);
145 void set_invert_color(
bool flag);
147 unsigned get_num_ticks() {
return num_ticks; }
148 void set_num_ticks(
unsigned n);
150 void set_label_precision(
unsigned p);
151 void set_label_auto_precision(
bool enabled);
152 void set_label_prune_trailing_zeros(
bool enabled);
153 void set_label_integer_mode(
bool enabled);
154 void set_show_opacity(
bool enabled);
base class for all drawables, which is independent of the used rendering API.
the texture class encapsulates all functionality independent of the rendering api.