|
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) | |
| cgv::ray3 | get_world_ray (int x, int y, view *view_ptr, const cgv::dmat4 &modelview_projection_window_matrix) const |
| compute ray from eye of given view_ptr through pixel at given mouse location (x,y) according to given modelview projection window matrix | |
| 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 | |
| virtual void | destruct (context &) final |
| do not use destruct for a drawable but clear!! | |
Public Member Functions inherited from cgv::base::traverse_policy | |
| 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 | |
Protected Attributes inherited from cgv::base::traverse_policy | |
| TraversePolicy | policy |
| bool | active |
| int | focus |
base class for all drawables, which is independent of the used rendering API.
Definition at line 15 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::overlay::canvas_overlay, cgv::render::callback_drawable, and cgv::overlay::performance_monitor.
Definition at line 142 of file drawable.cxx.
Referenced by cgv::overlay::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::render::callback_drawable, cgv::overlay::navigator, cgv::plot::plot2d, cgv::plot::plot3d, cgv::plot::plot_base, vr_test, cgv::overlay::canvas_overlay, cgv::overlay::color_scale_legend, cgv::overlay::color_selector, cgv::overlay::performance_monitor, cgv::overlay::transfer_function_editor, cgv::render::gl::image_drawable, cgv::render::gl::gl_implicit_surface_drawable_base, and cgv::render::gl::mesh_drawable.
Definition at line 147 of file drawable.cxx.
Referenced by destruct().
|
finalvirtual |
do not use destruct for a drawable but clear!!
Definition at line 150 of file drawable.cxx.
References clear().
|
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 129 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(), vr_test::init(), and cgv::overlay::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::overlay::navigator, vr_test, and cgv::render::gl::mesh_drawable.
Definition at line 133 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::overlay::canvas_overlay, cgv::render::callback_drawable, and cgv::render::gl::gl_implicit_surface_drawable_base.
Definition at line 137 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 109 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(), get_world_ray(), cgv::overlay::performance_monitor::handle_member_change(), cgv::overlay::navigator::handle_mouse_event(), and cgv::overlay::color_selector::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().
| cgv::ray3 cgv::render::drawable::get_world_ray | ( | int | x, |
| int | y, | ||
| view * | view_ptr, | ||
| const cgv::dmat4 & | modelview_projection_window_matrix | ||
| ) | const |
compute ray from eye of given view_ptr through pixel at given mouse location (x,y) according to given modelview projection window matrix
compute ray through pixel at given mouse location according to given modelview projection window matrix
Definition at line 91 of file drawable.cxx.
References get_context(), and cgv::render::context::get_height().
| void cgv::render::drawable::hide | ( | ) |
hide the drawable
Definition at line 21 of file drawable.cxx.
Referenced by cgv::overlay::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::render::callback_drawable, cgv::overlay::navigator, cgv::plot::plot2d, cgv::plot::plot3d, cgv::plot::plot_base, vr_test, vr_emulator, cgv::overlay::canvas_overlay, cgv::overlay::color_scale_legend, cgv::overlay::color_selector, cgv::overlay::performance_monitor, cgv::overlay::themed_canvas_overlay, cgv::overlay::transfer_function_editor, cgv::render::gl::image_drawable, and cgv::render::gl::gl_implicit_surface_drawable_base.
Definition at line 116 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::render::gl::mesh_drawable, cgv::overlay::navigator, vr_test, cgv::overlay::color_scale_legend, cgv::overlay::color_selector, cgv::overlay::performance_monitor, and cgv::overlay::transfer_function_editor.
Definition at line 125 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::overlay::canvas_overlay::after_finish(), cgv::overlay::performance_monitor::after_finish(), cgv::overlay::canvas_overlay::finish_frame(), cgv::overlay::performance_monitor::init_frame(), cgv::overlay::performance_monitor::on_visibility_change(), and cgv::overlay::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::overlay::navigator::handle_mouse_event(), cgv::overlay::overlay::on_layout_change(), cgv::overlay::navigator::on_set(), cgv::overlay::overlay::on_set(), vr_test::on_set(), vr_emulator::on_set(), cgv::overlay::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 121 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::overlay::overlay::set_visibility().