cgv
|
base class of drawables that show static or animated images More...
#include <image_drawable.h>
Public Member Functions | |
image_drawable () | |
construct base image drawable | |
void | timer_event (double t, double dt) |
timer event that can be used for animation, connect this to some animation trigger | |
bool | read_image (const std::string &_file_name) |
function to read a single image | |
bool | read_images (const std::string &_file_name, const std::vector< std::string > &_files) |
function to read a list of images | |
bool | save_images (const std::string &output_file_name) |
function to save all images | |
unsigned | get_nr_images () const |
return the number of loaded subimages | |
bool | init (context &) |
construct shader program | |
void | draw (context &) |
draw the image | |
void | clear (context &) |
destruct textures and shader program | |
![]() | |
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 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 | 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 | |
![]() | |
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 | |
Protected Attributes | |
std::vector< unsigned > | tex_ids |
std::vector< float > | durations |
unsigned | current_image |
std::string | file_name |
std::vector< std::string > | files |
cgv::render::vertex_buffer | vbo |
cgv::render::attribute_array_binding | aab |
double | start_time |
double | anim_time |
double | aspect |
bool | animate |
bool | use_blending |
bool | wireframe |
float | tess_level |
ibox2 | selection |
extent selection box | |
bool | show_selection |
whether to show the selection rectangle | |
int | W |
extent of image | |
int | H |
vec4 | min_value |
vec4 | max_value |
vec4 | gamma4 |
float | checker_lambda |
float | k1 |
float | k2 |
float | k3 |
float | k4 |
float | k5 |
float | k6 |
float | p1 |
float | p2 |
float | cx |
float | cy |
float | s |
bool | use_mixing |
unsigned | mix_with |
float | mix_param |
bool | spherical |
vec2 | pan_tilt |
float | scale |
cgv::render::shader_program | prog |
![]() | |
TraversePolicy | policy |
bool | active |
int | focus |
base class of drawables that show static or animated images
Definition at line 15 of file image_drawable.h.
cgv::render::gl::image_drawable::image_drawable | ( | ) |
construct base image drawable
Definition at line 22 of file image_drawable.cxx.
References cgv::media::axis_aligned_box< T, N >::add_point(), selection, show_selection, and W.
destruct textures and shader program
Reimplemented from cgv::render::drawable.
Definition at line 104 of file image_drawable.cxx.
References cgv::render::attribute_array_binding::destruct(), cgv::render::shader_program::destruct(), and cgv::render::vertex_buffer::destruct().
draw the image
Reimplemented from cgv::render::drawable.
Definition at line 241 of file image_drawable.cxx.
References cgv::render::attribute_array_binding::disable(), cgv::render::shader_program::disable(), cgv::render::attribute_array_binding::disable_global_array(), cgv::render::attribute_array_binding::enable(), cgv::render::shader_program::enable(), cgv::render::attribute_array_binding::enable_global_array(), cgv::media::axis_aligned_box< T, N >::get_extent(), cgv::media::axis_aligned_box< T, N >::get_min_pnt(), cgv::render::shader_program::is_linked(), cgv::render::context::mul_modelview_matrix(), cgv::render::context::pop_modelview_matrix(), cgv::render::context::push_modelview_matrix(), cgv::render::context::ref_default_shader_program(), selection, cgv::render::context::set_color(), cgv::render::attribute_array_binding::set_global_attribute_array(), cgv::render::shader_program::set_uniform(), show_selection, cgv::render::context::tesselate_unit_square(), and W.
|
inline |
return the number of loaded subimages
Definition at line 74 of file image_drawable.h.
construct shader program
Reimplemented from cgv::render::drawable.
Definition at line 83 of file image_drawable.cxx.
References cgv::render::shader_program::build_program(), cgv::render::attribute_array_binding::create(), cgv::render::vertex_buffer::create(), cgv::render::attribute_array_binding::enable_array(), and cgv::render::attribute_array_binding::set_attribute_array().
function to read a single image
Definition at line 113 of file image_drawable.cxx.
References cgv::media::axis_aligned_box< T, N >::add_point(), cgv::data::data_format::get_height(), cgv::data::data_format::get_width(), cgv::media::axis_aligned_box< T, N >::invalidate(), cgv::render::drawable::post_redraw(), cgv::render::gl::read_image_to_textures(), selection, and W.
bool cgv::render::gl::image_drawable::read_images | ( | const std::string & | _file_name, |
const std::vector< std::string > & | _files | ||
) |
function to read a list of images
Definition at line 133 of file image_drawable.cxx.
References cgv::media::axis_aligned_box< T, N >::add_point(), cgv::data::data_format::get_height(), cgv::data::data_format::get_width(), cgv::media::axis_aligned_box< T, N >::invalidate(), cgv::render::drawable::post_redraw(), cgv::render::gl::read_image_to_texture(), selection, and W.
function to save all images
Definition at line 162 of file image_drawable.cxx.
References cgv::media::axis_aligned_box< T, N >::get_extent(), cgv::media::axis_aligned_box< T, N >::get_max_pnt(), cgv::media::axis_aligned_box< T, N >::get_min_pnt(), cgv::data::data_view_impl< D, P >::get_ptr(), cgv::data::data_view_base::get_step_size(), selection, and W.
timer event that can be used for animation, connect this to some animation trigger
Definition at line 49 of file image_drawable.cxx.
References cgv::render::drawable::post_redraw().
|
protected |
Definition at line 24 of file image_drawable.h.
|
protected |
Definition at line 27 of file image_drawable.h.
|
protected |
Definition at line 30 of file image_drawable.h.
|
protected |
Definition at line 28 of file image_drawable.h.
|
protected |
Definition at line 49 of file image_drawable.h.
|
protected |
Definition at line 20 of file image_drawable.h.
|
protected |
Definition at line 49 of file image_drawable.h.
|
protected |
Definition at line 49 of file image_drawable.h.
|
protected |
Definition at line 19 of file image_drawable.h.
|
protected |
Definition at line 21 of file image_drawable.h.
|
protected |
Definition at line 22 of file image_drawable.h.
|
protected |
Definition at line 47 of file image_drawable.h.
|
protected |
Definition at line 43 of file image_drawable.h.
|
protected |
Definition at line 49 of file image_drawable.h.
|
protected |
Definition at line 49 of file image_drawable.h.
|
protected |
Definition at line 49 of file image_drawable.h.
|
protected |
Definition at line 49 of file image_drawable.h.
|
protected |
Definition at line 49 of file image_drawable.h.
|
protected |
Definition at line 49 of file image_drawable.h.
|
protected |
Definition at line 46 of file image_drawable.h.
|
protected |
Definition at line 45 of file image_drawable.h.
|
protected |
Definition at line 54 of file image_drawable.h.
|
protected |
Definition at line 53 of file image_drawable.h.
|
protected |
Definition at line 49 of file image_drawable.h.
|
protected |
Definition at line 49 of file image_drawable.h.
|
protected |
Definition at line 58 of file image_drawable.h.
|
protected |
Definition at line 61 of file image_drawable.h.
|
protected |
Definition at line 49 of file image_drawable.h.
|
protected |
Definition at line 59 of file image_drawable.h.
|
protected |
extent selection box
Definition at line 37 of file image_drawable.h.
Referenced by draw(), image_drawable(), read_image(), read_images(), and save_images().
|
protected |
whether to show the selection rectangle
Definition at line 40 of file image_drawable.h.
Referenced by draw(), and image_drawable().
|
protected |
Definition at line 57 of file image_drawable.h.
|
protected |
Definition at line 26 of file image_drawable.h.
|
protected |
Definition at line 34 of file image_drawable.h.
|
protected |
Definition at line 18 of file image_drawable.h.
|
protected |
Definition at line 31 of file image_drawable.h.
|
protected |
Definition at line 52 of file image_drawable.h.
|
protected |
Definition at line 23 of file image_drawable.h.
|
protected |
extent of image
Definition at line 43 of file image_drawable.h.
Referenced by draw(), image_drawable(), read_image(), read_images(), and save_images().
|
protected |
Definition at line 32 of file image_drawable.h.