cgv
|
base class for all drawables, which is independent of the used rendering API. More...
#include <drawable.h>
Public Member Functions | |
drawable () | |
default construction | |
void | hide () |
hide the drawable | |
void | show () |
show the drawable | |
bool | is_visible () const |
check whether the drawable is visible | |
context * | get_context () const |
access the current context. The context will be available latestly in the init method but not in the contructor. | |
void | set_context (context *_ctx) |
set the current focus context, this should only be called by the context itself | |
view * | find_view_as_node (size_t view_idx=0) const |
convenience function to find the view control in the current hierarchy | |
bool | get_world_location (int x, int y, const view &V, dvec3 &world_location, double *window_z_ptr=0) const |
use given view together with depth buffer of context in order to compute the world location of the point at mouse pointer location (x,y) | |
void | post_redraw () |
posts a redraw event to the current context if one is available | |
void | force_redraw () |
forces a redraw right now. This cannot be called from init, init_frame, draw, finish_draw, finish_frame and clear | |
virtual bool | init (context &) |
this method is called after creation or recreation of the context, return whether all necessary functionality is supported | |
virtual void | resize (unsigned int w, unsigned int h) |
callback to announce resizing of the output window | |
virtual void | init_frame (context &) |
this method is called in one pass over all drawables before the draw method | |
virtual void | draw (context &) |
overload to draw the content of this drawable | |
virtual void | finish_draw (context &) |
this method is called when the current drawable is left in a tree traversal that calls the draw method | |
virtual void | finish_frame (context &) |
this method is called in one pass over all drawables after drawing | |
virtual void | after_finish (context &) |
this method is called in one pass over all drawables after finish frame | |
virtual void | clear (context &) |
clear all objects living in the context like textures or display lists | |
![]() | |
traverse_policy (int _policy=TP_ALL+TP_STOP_ON_SUCCESS, bool _active=true, int _focus=-1) | |
construct default traverse policy that visits everything | |
int | get_policy () const |
return the policy without the stop on success flag | |
bool | stop_on_success () const |
return whether to stop on success | |
bool | stop_on_failure () const |
return whether to stop on failure | |
void | set_policy (int _policy) |
set a new policy, always add stop on success flag if needed | |
int | get_focused_child () const |
return the focused child or -1 if none is focused | |
void | set_focused_child (int _focused_child) |
set the focused child | |
bool | get_active () const |
return whether the current node is active | |
void | set_active (bool _active) |
set the active flag of the current node | |
Additional Inherited Members | |
![]() | |
TraversePolicy | policy |
bool | active |
int | focus |
base class for all drawables, which is independent of the used rendering API.
Definition at line 14 of file drawable.h.
cgv::render::drawable::drawable | ( | ) |
default construction
Definition at line 14 of file drawable.cxx.
|
virtual |
this method is called in one pass over all drawables after finish frame
Reimplemented in cgv::app::canvas_overlay, cgv::render::callback_drawable, and cgv::app::performance_monitor.
Definition at line 125 of file drawable.cxx.
Referenced by cgv::app::performance_monitor::after_finish(), and cgv::render::context::render_pass().
|
virtual |
clear all objects living in the context like textures or display lists
Reimplemented in cgv::app::transformation_gizmo, cgv::app::gizmo, cgv::render::callback_drawable, cgv::app::navigator, cgv::plot::plot2d, cgv::plot::plot3d, cgv::plot::plot_base, vr_test, cgv::app::canvas_overlay, cgv::app::color_map_editor, cgv::app::color_map_legend, cgv::app::color_selector, cgv::app::performance_monitor, cgv::render::gl::image_drawable, cgv::render::gl::gl_implicit_surface_drawable_base, and cgv::render::gl::mesh_drawable.
Definition at line 130 of file drawable.cxx.
|
virtual |
overload to draw the content of this drawable
Reimplemented in vr_emulator, cgv::render::callback_drawable, cgv::render::gl::mesh_drawable, cgv::plot::plot2d, cgv::plot::plot3d, vr_test, cgv::render::gl::image_drawable, and cgv::render::gl::gl_implicit_surface_drawable_base.
Definition at line 112 of file drawable.cxx.
Referenced by cgv::render::context::render_pass().
view * cgv::render::drawable::find_view_as_node | ( | size_t | view_idx = 0 | ) | const |
convenience function to find the view control in the current hierarchy
this only works if your class inherits from the cgv::base::node class.
Definition at line 49 of file drawable.cxx.
Referenced by cgv::render::gl::mesh_drawable::center_view(), cgv::app::gizmo::finish_frame(), vr_test::init(), and cgv::app::navigator::init_frame().
|
virtual |
this method is called when the current drawable is left in a tree traversal that calls the draw method
Reimplemented in cgv::render::callback_drawable, cgv::app::navigator, vr_test, and cgv::render::gl::mesh_drawable.
Definition at line 116 of file drawable.cxx.
Referenced by cgv::render::context::render_pass().
|
virtual |
this method is called in one pass over all drawables after drawing
Reimplemented in vr_emulator, cgv::app::gizmo, cgv::render::callback_drawable, and cgv::render::gl::gl_implicit_surface_drawable_base.
Definition at line 120 of file drawable.cxx.
Referenced by cgv::render::context::render_pass().
void cgv::render::drawable::force_redraw | ( | ) |
forces a redraw right now. This cannot be called from init, init_frame, draw, finish_draw, finish_frame and clear
Definition at line 92 of file drawable.cxx.
References cgv::render::context::force_redraw().
context * cgv::render::drawable::get_context | ( | ) | const |
access the current context. The context will be available latestly in the init method but not in the contructor.
Definition at line 37 of file drawable.cxx.
Referenced by get_world_location(), cgv::app::gizmo::handle(), cgv::app::color_map_editor::handle_member_change(), cgv::app::performance_monitor::handle_member_change(), cgv::app::navigator::handle_mouse_event(), and cgv::app::color_map_editor::handle_mouse_event().
bool cgv::render::drawable::get_world_location | ( | int | x, |
int | y, | ||
const view & | V, | ||
dvec3 & | world_location, | ||
double * | window_z_ptr = 0 |
||
) | const |
use given view together with depth buffer of context in order to compute the world location of the point at mouse pointer location (x,y)
returns true if a world location could be computed which is the case when the context pointer of the drawable has been set and when the mouse location points inside a valid view panel.
Definition at line 59 of file drawable.cxx.
References get_context(), cgv::render::context::get_height(), cgv::render::context::get_model_point(), cgv::render::view::get_modelview_projection_window_matrices(), cgv::render::context::get_width(), cgv::render::context::get_window_z(), and cgv::math::fmat< T, N, M >::ncols().
void cgv::render::drawable::hide | ( | ) |
hide the drawable
Definition at line 21 of file drawable.cxx.
Referenced by cgv::app::overlay::set_visibility().
|
virtual |
this method is called after creation or recreation of the context, return whether all necessary functionality is supported
Reimplemented in cgv::app::transformation_gizmo, cgv::app::gizmo, cgv::render::callback_drawable, cgv::app::navigator, cgv::plot::plot2d, cgv::plot::plot3d, cgv::plot::plot_base, vr_test, vr_emulator, cgv::app::canvas_overlay, cgv::app::color_map_editor, cgv::app::color_map_legend, cgv::app::color_selector, cgv::app::performance_monitor, cgv::app::themed_canvas_overlay, cgv::render::gl::image_drawable, and cgv::render::gl::gl_implicit_surface_drawable_base.
Definition at line 99 of file drawable.cxx.
Referenced by cgv::render::gl::gl_context::configure_gl(), and cgv::render::context::configure_new_child().
|
virtual |
this method is called in one pass over all drawables before the draw method
Reimplemented in vr_emulator, cgv::render::callback_drawable, cgv::app::navigator, cgv::render::gl::mesh_drawable, vr_test, cgv::app::color_map_editor, cgv::app::color_map_legend, cgv::app::color_selector, and cgv::app::performance_monitor.
Definition at line 108 of file drawable.cxx.
bool cgv::render::drawable::is_visible | ( | ) | const |
check whether the drawable is visible
Definition at line 31 of file drawable.cxx.
Referenced by cgv::app::canvas_overlay::after_finish(), cgv::app::performance_monitor::after_finish(), cgv::app::performance_monitor::init_frame(), cgv::app::performance_monitor::on_visibility_change(), and cgv::app::overlay::toggle_visibility().
void cgv::render::drawable::post_redraw | ( | ) |
posts a redraw event to the current context if one is available
Definition at line 43 of file drawable.cxx.
References cgv::render::context::post_redraw().
Referenced by cgv::render::gl::mesh_drawable::center_view(), vr_test::handle(), cgv::app::gizmo::handle(), cgv::app::navigator::handle_mouse_event(), cgv::app::overlay::on_layout_change(), cgv::app::navigator::on_set(), cgv::app::overlay::on_set(), vr_test::on_set(), vr_emulator::on_set(), cgv::app::overlay::on_visibility_change(), cgv::render::gl::gl_implicit_surface_drawable_base::post_rebuild(), cgv::render::gl::image_drawable::read_image(), cgv::render::gl::image_drawable::read_images(), and cgv::render::gl::image_drawable::timer_event().
|
virtual |
callback to announce resizing of the output window
callback to anounce resizing of the output window
Definition at line 104 of file drawable.cxx.
void cgv::render::drawable::set_context | ( | context * | _ctx | ) |
set the current focus context, this should only be called by the context itself
Definition at line 9 of file drawable.cxx.
Referenced by cgv::render::context::configure_new_child().
void cgv::render::drawable::show | ( | ) |
show the drawable
Definition at line 26 of file drawable.cxx.
Referenced by cgv::plot::plot3d::create_config_gui(), cgv::plot::plot_base::create_config_gui(), cgv::plot::plot_base::create_gui(), cgv::plot::plot_base::create_plot_gui(), and cgv::app::overlay::set_visibility().