1#include <cgv/base/base.h>
2#include <cgv/base/node.h>
3#include <cgv/render/drawable.h>
4#include <cgv/base/find_action.h>
52 std::vector<view*> views;
54 if (views.empty() || view_idx > views.size())
56 return views[view_idx];
65 const dmat4* DPV_ptr, *DPV_other_ptr;
66 int x_other, y_other, vp_col_idx, vp_row_idx, vp_width, vp_height;
67 int eye_panel = V.
get_modelview_projection_window_matrices(x, y, ctx.
get_width(), ctx.
get_height(), &DPV_ptr, &DPV_other_ptr, &x_other, &y_other, &vp_col_idx, &vp_row_idx, &vp_width, &vp_height);
74 if (DPV_ptr->
ncols() != 4)
82 if (DPV_other_ptr->
ncols() != 4)
84 world_location = ctx.
get_model_point(x_other, y_other, z_other, *DPV_other_ptr);
86 *window_z_ptr = z_other;
137 current_render_pass = -1;
138 render_pass_recursion_depth = 0;
143 if (current_render_pass != -1)
151 current_render_pass = rp_idx;
158 current_render_pass = rp_idx;
163 if (current_render_pass == -1)
175 current_render_pass = -1;
The node class keeps a pointer to its parent.
complete implementation of method actions that only call one method when entering a node
matrix of fixed size dimensions
static constexpr unsigned ncols()
number of columns
base class for all drawables, which is independent of the used rendering API.
virtual void render_pass(RenderPass render_pass=RP_MAIN, RenderPassFlags render_pass_flags=RPF_ALL, void *user_data=0)
perform the given render task
vec3 get_model_point(int x_window, int y_window) const
compute model space 3D point from the given opengl pixel location (window location)
virtual unsigned int get_width() const =0
return the width of the window
virtual RenderPassFlags get_render_pass_flags() const
return the current render pass flags
virtual unsigned int get_height() const =0
return the height of the window
virtual double get_window_z(int x_window, int y_window) const =0
read the window z-coordinate from the depth buffer for the given opengl x- and y-coordinates
virtual void * get_render_pass_user_data() const
return the current render pass user data
virtual void force_redraw()=0
the context will be redrawn right now. This method cannot be called inside the following methods of a...
virtual void post_redraw()=0
the context will be redrawn when the system is idle again
unsigned get_render_pass_recursion_depth() const
return current render pass recursion depth
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 po...
context * get_context() const
access the current context. The context will be available latestly in the init method but not in the ...
virtual void init_frame(context &)
this method is called in one pass over all drawables before the draw method
void set_context(context *_ctx)
set the current focus context, this should only be called by the context itself
virtual void finish_draw(context &)
this method is called when the current drawable is left in a tree traversal that calls the draw metho...
virtual void draw(context &)
overload to draw the content of this drawable
void force_redraw()
forces a redraw right now. This cannot be called from init, init_frame, draw, finish_draw,...
virtual void resize(unsigned int w, unsigned int h)
callback to announce resizing of the output window
void hide()
hide the drawable
virtual void after_finish(context &)
this method is called in one pass over all drawables after finish frame
virtual void finish_frame(context &)
this method is called in one pass over all drawables after drawing
drawable()
default construction
virtual bool init(context &)
this method is called after creation or recreation of the context, return whether all necessary funct...
virtual void clear(context &)
clear all objects living in the context like textures or display lists
view * find_view_as_node(size_t view_idx=0) const
convenience function to find the view control in the current hierarchy
void show()
show the drawable
void post_redraw()
posts a redraw event to the current context if one is available
bool is_visible() const
check whether the drawable is visible
bool multi_pass_terminate(const context &ctx)
check in after_finish method, whether this was the terminating render pass
void perform_render_pass(context &ctx, int rp_idx, RenderPass rp=RP_USER_DEFINED, int excluded_flags=RPF_HANDLE_SCREEN_SHOT, int included_flags=0)
call to initiate a render pass in the init_frame method after initiate_render_pass_recursion() has su...
bool initiate_render_pass_recursion(context &ctx)
call in init_frame method to check whether the recursive render passes need to be initiated
bool multi_pass_ignore_finish(const context &ctx)
check in after_finish method, whether this should be directly exited with a return statement
void initiate_terminal_render_pass(int rp_idx)
call after last recursive render pass to use current render pass for last render pass
multi_pass_drawable()
construct to be not inside of a render pass
defines a symmetric view with the following quantities:
virtual int get_modelview_projection_window_matrices(int x, int y, int width, int height, const dmat4 **MPW_pptr, const dmat4 **MPW_other_pptr=0, int *x_other_ptr=0, int *y_other_ptr=0, int *vp_col_idx_ptr=0, int *vp_row_idx_ptr=0, int *vp_width_ptr=0, int *vp_height_ptr=0, int *vp_center_x_ptr=0, int *vp_center_y_ptr=0, int *vp_center_x_other_ptr=0, int *vp_center_y_other_ptr=0) const
given an opengl pixel location and the size in pixels of the opengl window, return the modelview_proj...
RenderPass
Enumeration of different render passes, which can be queried from the context and used to specify a n...
RenderPassFlags
available flags that can be queried from the context and set for a new render pass