cgv
cgv::render::clipped_view Class Reference

#include <clipped_view.h>

Inheritance diagram for cgv::render::clipped_view:
cgv::render::view cgv::render::stereo_view

Public Member Functions

 clipped_view ()
 construct a parallel view with focus in the world origin looking in negative z-direction and the y-direction as up-direction with an extent of +-1
 
void compute_clipping_planes (double &z_near_derived, double &z_far_derived, bool clip_relative_to_extent=false) const
 compute clipping planes adapted to the current scene extent, z_near_derived is at least z_near and as large as possible to include the scene, similarly z_far_derived is as small as possible

 
void compute_clipping_planes (const view &view, double &z_near_derived, double &z_far_derived, bool clip_relative_to_extent=false) const
 compute clipping planes according to given view adapted to the current scene extent, z_near_derived is at least z_near and as large as possible to include the scene, similarly z_far_derived is as small as possible

 
void compute_clipping_planes (const dvec3 &eye, const dvec3 &view_dir, double &z_near_derived, double &z_far_derived, bool clip_relative_to_extent=false) const
 compute clipping planes according to given view adapted to the current scene extent, z_near_derived is at least z_near and as large as possible to include the scene, similarly z_far_derived is as small as possible

 

Protected Attributes

dvec3 focus
 focus of the view
 

getter and setter methods

double get_z_near () const
 return the currently set z-value for the z-near clipping plane
 
virtual void set_z_near (double z)
 set the z-value for the z-near clipping plane
 
double get_z_far () const
 return the currently set z-value for the z-far clipping plane
 
virtual void set_z_far (double z)
 set the z-value for the z-far clipping plane
 
virtual void set_scene_extent (const dbox3 &_box)
 set the extent of the scene in world coordinates used by the compute_clipping_planes functions to adapt the clipping planes to the scene
 
dbox3 get_scene_extent () const
 return the currently set scene extent
 
virtual void set_default_view ()
 reset view with focus and y-extent based on current scene extent
 
static double get_z_D (double z_eye, double z_near, double z_far)
 transform a z value in eye-coordinates (should be negative!) to device coordinate
 

viewport splitting

virtual void enable_viewport_splitting (unsigned nr_cols, unsigned nr_rows)
 call this function before a drawing process to support viewport splitting inside the draw call via the activate/deactivate functions
 
virtual bool is_viewport_splitting_enabled (unsigned *nr_cols_ptr=0, unsigned *nr_rows_ptr=0) const
 check whether viewport splitting is activated and optionally set the number of columns and rows if corresponding pointers are passed
 
virtual void disable_viewport_splitting ()
 disable viewport splitting
 
virtual void activate_split_viewport (context &ctx, unsigned col_index, unsigned row_index)
 inside the drawing process activate the sub-viewport with the given column and row indices, always terminate an activated viewport with deactivate_split_viewport
 
virtual void deactivate_split_viewport (context &ctx)
 deactivate the previously split viewport
 
virtual void enable_viewport_individual_view (unsigned col_index, unsigned row_index, bool enable=true)
 make a viewport manage its own view
 
virtual bool does_viewport_use_individual_view (unsigned col_index, unsigned row_index) const
 check whether viewport manage its own view
 
virtual viewref_viewport_view (unsigned col_index, unsigned row_index)
 access the view of a given viewport
 
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 a mouse location and the pixel extent of the context, return the modelview_projection_window matrix for unprojection More...
 
 DEPRECATED ("deprecated, use get_modelview_projection_window_matrices() instead.") virtual int get_modelview_projection_device_matrices(int x
 
double get_z_and_unproject (context &ctx, int x, int y, vec3 &p)
 given a pixel location x,y return the z-value from the depth buffer, which ranges from 0.0 at z_near to 1.0 at z_far and a point in world coordinates More...
 
void compute_screen_rectangle (std::vector< dvec3 > &rect, double depth, double aspect) const
 fill rect with four points covering the screen rectangle at given depth from eye with given aspect ratio More...
 
void compute_screen_rectangle (std::vector< vec3 > &rect, double depth, double aspect) const
 
int y
 
int int width
 
int int int height
 
int int int const dmat4 ** MVPD_pptr
 
int int int const dmat4 const dmat4 ** MVPD_other_pptr = 0
 
int int int const dmat4 const dmat4 int * x_other_ptr = 0
 
int int int const dmat4 const dmat4 int int * y_other_ptr = 0
 
int int int const dmat4 const dmat4 int int int * vp_col_idx_ptr = 0
 
int int int const dmat4 const dmat4 int int int int * vp_row_idx_ptr = 0
 
int int int const dmat4 const dmat4 int int int int int * vp_width_ptr = 0
 
int int int const dmat4 const dmat4 int int int int int int * vp_height_ptr = 0
 
int int int const dmat4 const dmat4 int int int int int int int * vp_center_x_ptr = 0
 
int int int const dmat4 const dmat4 int int int int int int int int * vp_center_y_ptr = 0
 
int int int const dmat4 const dmat4 int int int int int int int int int * vp_center_x_other_ptr = 0
 
int int int const dmat4 const dmat4 int int int int int int int int int int * vp_center_y_other_ptr
 

Detailed Description

extends the view class with information on z clipping planes and scene extent and supports clipping plane computation from scene extent.

Member Function Documentation

◆ compute_axis_and_angle()

int cgv::render::view::compute_axis_and_angle ( const dvec3 target_view_dir,
const dvec3 target_view_up_dir,
dvec3 axis,
double &  angle 
)
inherited

compute axis and angle of a rotation that the current view_dir and view_up_dir to the given target_view_dir and target_view_up_dir

returns the result of the function cgv::math::decompose_rotation_to_axis_and_angle()

◆ compute_screen_rectangle()

void cgv::render::view::compute_screen_rectangle ( std::vector< dvec3 > &  rect,
double  depth,
double  aspect 
) const
inherited

fill rect with four points covering the screen rectangle at given depth from eye with given aspect ratio

fill the given vector with four points covering the screen rectangle

◆ get_eye()

const view::dvec3 cgv::render::view::get_eye ( ) const
inherited

query the eye point, which is computed from focus, view dir, y extent at focus and y view angle

With the y view angle approaching 0, the eye point moves infinitely far away. To avoid numerical problems, the eye point is computed with an y view angle no less than 0.1.

◆ get_modelview_projection_window_matrices()

int cgv::render::view::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
virtualinherited

given a mouse location and the pixel extent of the context, return the modelview_projection_window matrix for unprojection

In stereo modes with split viewport, the returned MPW is the one the mouse pointer is on. The return value is in this case -1 or 1 and tells if MPW corresponds to the left (-1) or right (1) viewport. Furthermore, the MPW of the corresponding mouse location in the other eye is returned through MPW_other_ptr and the mouse location in x_other_ptr and y_other_ptr. In anaglyph or quad buffer stereo mode the other mouse location is identical to the incoming x and y location and 0 is returned. In mono mode, the other MPW and mouse locations are set to values identical to MPW and x,y and also 0 is returned.

In case the viewport splitting was enabled during the last drawing process, the MPW and MPW_other matrices are set to the one valid in the panel that the mouse position x,y is in. The panel column and row indices are passed to the vp_col_idx and vp_row_idx pointers. In case that viewport splitting was disabled, 0 is passed to the panel location index pointers.

Finally, the vp_width, vp_height, vp_center_x, and vp_center_y pointers are set to the viewport size and center mouse location of the panel panel that the mouse pointer is in.

All pointer arguments starting with MPW_other_ptr can be set to the null pointer.

◆ get_z_and_unproject()

double cgv::render::view::get_z_and_unproject ( context ctx,
int  x,
int  y,
vec3 p 
)
inherited

given a pixel location x,y return the z-value from the depth buffer, which ranges from 0.0 at z_near to 1.0 at z_far and a point in world coordinates

in case of stereo rendering two z-values exist that can be unprojected to two points in world coordinates. In this case the possibility with smaller z value is selected.

◆ put_coordinate_system()

void cgv::render::view::put_coordinate_system ( dvec3 x,
dvec3 y,
dvec3 z 
) const
inherited

construct coordinate system with z in negative view direction and x and y aligned with the right and up direction of the viewed image

If view direction and view up direction are not orthogonal, the y direction will point in the component of the view up direction that is orthogonal to the view direction.

◆ rotate()

void cgv::render::view::rotate ( double  axis_direction_x,
double  axis_direction_y,
double  axis_point_depth 
)
inherited

rotated view around axis by angle

Axis is given by point and direction, where the point is in the image center and the given depth and the axis points into a direction in image plane given through its screen x and screen y coordinate. The length of the axis vector gives the rotation angle in radians. Rotation around screen x direction corresponds to yaw and around screen y direction to gear rotations.

◆ set_eye_keep_extent()

bool cgv::render::view::set_eye_keep_extent ( const dvec3 eye)
inherited

set view dir and y view angle keeping focus and y extent such that get_eye() returns the passed point, return whether this was successful.

Recomputes view up direction to make it orthogonal to view direction. In the case that the eye point is identical to the current focus point the function fails and returns false.

◆ set_eye_keep_view_angle()

bool cgv::render::view::set_eye_keep_view_angle ( const dvec3 eye)
inherited

set the view dir and y extent at focus keeping focus and y view angle such that get_eye() returns the passed point, return whether this was successful.

Recomputes view up direction to make it orthogonal to view direction. In the case that the eye point is identical to the current focus point the function fails and returns false. If the current view angle is < 0.1, the view anlge 0.1 is used for eye point calculation

◆ view_look_at_keep_extent()

void cgv::render::view::view_look_at_keep_extent ( const dvec3 eye,
const dvec3 foc,
const dvec3 vud 
)
inherited

set the view according to the standard view lookat definition from eye, focus and view up direction keeping the y-view angle constant

set the view according to the standard view lookat definition from eye, focus and view up direction.

◆ view_look_at_keep_view_angle()

void cgv::render::view::view_look_at_keep_view_angle ( const dvec3 eye,
const dvec3 foc,
const dvec3 vud 
)
inherited

set the view according to the standard view lookat definition from eye, focus and view up direction keeping the y-extent at the focus point constant

set the view according to the standard view lookat definition from eye, focus and view up direction.


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