cgv
Loading...
Searching...
No Matches
cgv::render::gl::image_drawable Class Reference

base class of drawables that show static or animated images More...

#include <image_drawable.h>

Inheritance diagram for cgv::render::gl::image_drawable:
cgv::render::drawable cgv::base::traverse_policy

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
 
- Public Member Functions inherited from cgv::render::drawable
 drawable ()
 default construction
 
void hide ()
 hide the drawable
 
void show ()
 show the drawable
 
bool is_visible () const
 check whether the drawable is visible
 
contextget_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
 
viewfind_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
 
- 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
 

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
 
- Protected Attributes inherited from cgv::base::traverse_policy
TraversePolicy policy
 
bool active
 
int focus
 

Detailed Description

base class of drawables that show static or animated images

Definition at line 15 of file image_drawable.h.

Constructor & Destructor Documentation

◆ image_drawable()

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.

Member Function Documentation

◆ clear()

void cgv::render::gl::image_drawable::clear ( context ctx)
virtual

◆ draw()

◆ get_nr_images()

unsigned cgv::render::gl::image_drawable::get_nr_images ( ) const
inline

return the number of loaded subimages

Definition at line 74 of file image_drawable.h.

◆ init()

◆ read_image()

◆ read_images()

bool cgv::render::gl::image_drawable::read_images ( const std::string &  _file_name,
const std::vector< std::string > &  _files 
)

◆ save_images()

◆ timer_event()

void cgv::render::gl::image_drawable::timer_event ( double  t,
double  dt 
)

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().

Member Data Documentation

◆ aab

cgv::render::attribute_array_binding cgv::render::gl::image_drawable::aab
protected

Definition at line 24 of file image_drawable.h.

◆ anim_time

double cgv::render::gl::image_drawable::anim_time
protected

Definition at line 27 of file image_drawable.h.

◆ animate

bool cgv::render::gl::image_drawable::animate
protected

Definition at line 30 of file image_drawable.h.

◆ aspect

double cgv::render::gl::image_drawable::aspect
protected

Definition at line 28 of file image_drawable.h.

◆ checker_lambda

float cgv::render::gl::image_drawable::checker_lambda
protected

Definition at line 49 of file image_drawable.h.

◆ current_image

unsigned cgv::render::gl::image_drawable::current_image
protected

Definition at line 20 of file image_drawable.h.

◆ cx

float cgv::render::gl::image_drawable::cx
protected

Definition at line 49 of file image_drawable.h.

◆ cy

float cgv::render::gl::image_drawable::cy
protected

Definition at line 49 of file image_drawable.h.

◆ durations

std::vector<float> cgv::render::gl::image_drawable::durations
protected

Definition at line 19 of file image_drawable.h.

◆ file_name

std::string cgv::render::gl::image_drawable::file_name
protected

Definition at line 21 of file image_drawable.h.

◆ files

std::vector<std::string> cgv::render::gl::image_drawable::files
protected

Definition at line 22 of file image_drawable.h.

◆ gamma4

vec4 cgv::render::gl::image_drawable::gamma4
protected

Definition at line 47 of file image_drawable.h.

◆ H

int cgv::render::gl::image_drawable::H
protected

Definition at line 43 of file image_drawable.h.

◆ k1

float cgv::render::gl::image_drawable::k1
protected

Definition at line 49 of file image_drawable.h.

◆ k2

float cgv::render::gl::image_drawable::k2
protected

Definition at line 49 of file image_drawable.h.

◆ k3

float cgv::render::gl::image_drawable::k3
protected

Definition at line 49 of file image_drawable.h.

◆ k4

float cgv::render::gl::image_drawable::k4
protected

Definition at line 49 of file image_drawable.h.

◆ k5

float cgv::render::gl::image_drawable::k5
protected

Definition at line 49 of file image_drawable.h.

◆ k6

float cgv::render::gl::image_drawable::k6
protected

Definition at line 49 of file image_drawable.h.

◆ max_value

vec4 cgv::render::gl::image_drawable::max_value
protected

Definition at line 46 of file image_drawable.h.

◆ min_value

vec4 cgv::render::gl::image_drawable::min_value
protected

Definition at line 45 of file image_drawable.h.

◆ mix_param

float cgv::render::gl::image_drawable::mix_param
protected

Definition at line 54 of file image_drawable.h.

◆ mix_with

unsigned cgv::render::gl::image_drawable::mix_with
protected

Definition at line 53 of file image_drawable.h.

◆ p1

float cgv::render::gl::image_drawable::p1
protected

Definition at line 49 of file image_drawable.h.

◆ p2

float cgv::render::gl::image_drawable::p2
protected

Definition at line 49 of file image_drawable.h.

◆ pan_tilt

vec2 cgv::render::gl::image_drawable::pan_tilt
protected

Definition at line 58 of file image_drawable.h.

◆ prog

cgv::render::shader_program cgv::render::gl::image_drawable::prog
protected

Definition at line 61 of file image_drawable.h.

◆ s

float cgv::render::gl::image_drawable::s
protected

Definition at line 49 of file image_drawable.h.

◆ scale

float cgv::render::gl::image_drawable::scale
protected

Definition at line 59 of file image_drawable.h.

◆ selection

ibox2 cgv::render::gl::image_drawable::selection
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().

◆ show_selection

bool cgv::render::gl::image_drawable::show_selection
protected

whether to show the selection rectangle

Definition at line 40 of file image_drawable.h.

Referenced by draw(), and image_drawable().

◆ spherical

bool cgv::render::gl::image_drawable::spherical
protected

Definition at line 57 of file image_drawable.h.

◆ start_time

double cgv::render::gl::image_drawable::start_time
protected

Definition at line 26 of file image_drawable.h.

◆ tess_level

float cgv::render::gl::image_drawable::tess_level
protected

Definition at line 34 of file image_drawable.h.

◆ tex_ids

std::vector<unsigned> cgv::render::gl::image_drawable::tex_ids
protected

Definition at line 18 of file image_drawable.h.

◆ use_blending

bool cgv::render::gl::image_drawable::use_blending
protected

Definition at line 31 of file image_drawable.h.

◆ use_mixing

bool cgv::render::gl::image_drawable::use_mixing
protected

Definition at line 52 of file image_drawable.h.

◆ vbo

cgv::render::vertex_buffer cgv::render::gl::image_drawable::vbo
protected

Definition at line 23 of file image_drawable.h.

◆ W

int cgv::render::gl::image_drawable::W
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().

◆ wireframe

bool cgv::render::gl::image_drawable::wireframe
protected

Definition at line 32 of file image_drawable.h.


The documentation for this class was generated from the following files: