libigl v2.5.0
|
Basic class of the 3D mesh viewer. More...
#include <ViewerCore.h>
Public Types | |
enum | RotationType { ROTATION_TYPE_TRACKBALL = 0 , ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP = 1 , ROTATION_TYPE_NO_ROTATION = 2 , NUM_ROTATION_TYPES = 3 } |
Type of user interface for changing the view rotation based on the mouse draggin. More... | |
using | GLuint = MeshGL::GLuint |
Public Member Functions | |
ViewerCore () | |
void | init () |
Initialization. | |
void | shut () |
Shutdown. | |
void | InitSerialization () |
Serialization code. | |
void | align_camera_center (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) |
Adjust the view to see the entire model. | |
void | align_camera_center (const Eigen::MatrixXd &V) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | get_scale_and_shift_to_fit_mesh (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, float &zoom, Eigen::Vector3f &shift) |
Determines how much to zoom and shift such that the mesh fills the unit box (centered at the origin) | |
void | get_scale_and_shift_to_fit_mesh (const Eigen::MatrixXd &V, float &zoom, Eigen::Vector3f &shift) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | clear_framebuffers () |
Clear the frame buffers. | |
void | draw (ViewerData &data, bool update_matrices=true) |
Draw everything. | |
void | initialize_shadow_pass () |
initialize shadow pass | |
void | deinitialize_shadow_pass () |
deinitialize shadow pass | |
void | draw_shadow_pass (ViewerData &data, bool update_matrices=true) |
Draw everything to shadow map. | |
void | draw_buffer (ViewerData &data, bool update_matrices, Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &R, Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &G, Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &B, Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &A) |
Render given ViewerData to a buffer. | |
void | draw_labels (ViewerData &data, const igl::opengl::MeshGL::TextGL &labels) |
Draw the text lables. | |
void | set_rotation_type (const RotationType &value) |
Set the current rotation type. | |
void | set (unsigned int &property_mask, bool value=true) const |
Set a ViewerData visualization option for this viewport. | |
void | unset (unsigned int &property_mask) const |
Unset a ViewerData visualization option for this viewport. | |
void | toggle (unsigned int &property_mask) const |
Toggle a ViewerData visualization option for this viewport. | |
bool | is_set (unsigned int property_mask) const |
Check whether a ViewerData visualization option is set for this viewport. | |
void | delete_shadow_buffers () |
delete the shadow buffers | |
void | generate_shadow_buffers () |
generate the shadow buffers | |
Public Attributes | |
unsigned int | id = 1u |
Unique identifier. | |
Eigen::Vector4f | background_color |
Background color as RGBA. | |
Eigen::Vector3f | light_position |
Light position (or direction to light) | |
bool | is_directional_light |
Whether to treat light_position as a point or direction. | |
bool | is_shadow_mapping |
Whether shadow mapping is on. | |
GLuint | shadow_width |
Width of the shadow map. | |
GLuint | shadow_height |
Height of the shadow map. | |
GLuint | shadow_depth_tex |
Shadow map depth texture. | |
GLuint | shadow_depth_fbo |
Shadow map depth framebuffer object. | |
GLuint | shadow_color_rbo |
Shadow map color render buffer object. | |
float | lighting_factor |
Factor of lighting (0: no lighting, 1: full lighting) | |
RotationType | rotation_type |
Type of rotation interaction. | |
Eigen::Quaternionf | trackball_angle |
View rotation as quaternion. | |
float | camera_base_zoom |
Base zoom of camera. | |
float | camera_zoom |
Current zoom of camera. | |
bool | orthographic |
Whether camera is orthographic (or perspective) | |
Eigen::Vector3f | camera_base_translation |
Base translation of camera. | |
Eigen::Vector3f | camera_translation |
Current translation of camera. | |
Eigen::Vector3f | camera_eye |
Current "eye" / origin position of camera. | |
Eigen::Vector3f | camera_up |
Current "up" vector of camera. | |
Eigen::Vector3f | camera_center |
Current "look at" position of camera. | |
float | camera_view_angle |
Current view angle of camera. | |
float | camera_dnear |
Near plane of camera. | |
float | camera_dfar |
Far plane of camera. | |
bool | depth_test |
Whether testing for depth is enabled. | |
bool | is_animating |
Whether "animating" (continuous drawing) is enabled. | |
double | animation_max_fps |
Max fps of animation loop (e.g. 30fps or 60fps) | |
float | object_scale |
Caches the two-norm between the min/max point of the bounding box. | |
Eigen::Vector4f | viewport |
Viewport size. | |
Eigen::Matrix4f | view |
OpenGL view transformation matrix on last render pass. | |
Eigen::Matrix4f | proj |
OpenGL proj transformation matrix on last render pass. | |
Eigen::Matrix4f | norm |
OpenGL norm transformation matrix on last render pass. | |
Eigen::Matrix4f | shadow_view |
OpenGL shadow_view transformation matrix on last render pass. | |
Eigen::Matrix4f | shadow_proj |
OpenGL shadow_proj transformation matrix on last render pass. | |
Basic class of the 3D mesh viewer.
Type of user interface for changing the view rotation based on the mouse draggin.
igl::opengl::ViewerCore::ViewerCore | ( | ) |
void igl::opengl::ViewerCore::init | ( | ) |
Initialization.
void igl::opengl::ViewerCore::shut | ( | ) |
Shutdown.
void igl::opengl::ViewerCore::InitSerialization | ( | ) |
Serialization code.
void igl::opengl::ViewerCore::align_camera_center | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F | ||
) |
Adjust the view to see the entire model.
[in] | V | #V by 3 list of vertex positions |
[in] | F | #F by 3 list of triangle indices into V |
void igl::opengl::ViewerCore::align_camera_center | ( | const Eigen::MatrixXd & | V | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void igl::opengl::ViewerCore::get_scale_and_shift_to_fit_mesh | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F, | ||
float & | zoom, | ||
Eigen::Vector3f & | shift | ||
) |
Determines how much to zoom and shift such that the mesh fills the unit box (centered at the origin)
[in] | V | #V by 3 list of vertex positions |
[in] | F | #F by 3 list of triangle indices into V |
[out] | zoom | zoom factor |
[out] | shift | 3d shift |
void igl::opengl::ViewerCore::get_scale_and_shift_to_fit_mesh | ( | const Eigen::MatrixXd & | V, |
float & | zoom, | ||
Eigen::Vector3f & | shift | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void igl::opengl::ViewerCore::clear_framebuffers | ( | ) |
Clear the frame buffers.
void igl::opengl::ViewerCore::draw | ( | ViewerData & | data, |
bool | update_matrices = true |
||
) |
Draw everything.
[in] | data | which ViewerData to draw |
[in] | update_matrices | whether to update view, proj, and norm matrices in shaders |
void igl::opengl::ViewerCore::initialize_shadow_pass | ( | ) |
initialize shadow pass
void igl::opengl::ViewerCore::deinitialize_shadow_pass | ( | ) |
deinitialize shadow pass
void igl::opengl::ViewerCore::draw_shadow_pass | ( | ViewerData & | data, |
bool | update_matrices = true |
||
) |
Draw everything to shadow map.
[in] | data | which ViewerData to draw |
[in] | update_matrices | whether to update view, proj, and norm |
void igl::opengl::ViewerCore::draw_buffer | ( | ViewerData & | data, |
bool | update_matrices, | ||
Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > & | R, | ||
Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > & | G, | ||
Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > & | B, | ||
Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > & | A | ||
) |
Render given ViewerData to a buffer.
The width and height are determined by non-zeros dimensions of R (and G,B,A should match) or – if both are zero — are set to this core's viewport sizes.
[in] | data | which ViewerData to draw |
[in] | update_matrices | whether to update view, proj, and norm matrices in shaders |
[out] | R | width by height red pixel color values |
[out] | G | width by height green pixel color values |
[out] | B | width by height blue pixel color values |
[out] | A | width by height alpha pixel color values |
void igl::opengl::ViewerCore::draw_labels | ( | ViewerData & | data, |
const igl::opengl::MeshGL::TextGL & | labels | ||
) |
Draw the text lables.
[in] | data | which ViewerData to draw |
[in] | labels | text labels to draw |
void igl::opengl::ViewerCore::set_rotation_type | ( | const RotationType & | value | ) |
Set the current rotation type.
[in] | value | the new rotation type |
void igl::opengl::ViewerCore::set | ( | unsigned int & | property_mask, |
bool | value = true |
||
) | const |
Set a ViewerData visualization option for this viewport.
[in] | property_mask | a bit mask of visualization option |
[in] | value | whether to set or unset the property |
void igl::opengl::ViewerCore::unset | ( | unsigned int & | property_mask | ) | const |
Unset a ViewerData visualization option for this viewport.
[in] | property_mask | a bit mask of visualization option |
void igl::opengl::ViewerCore::toggle | ( | unsigned int & | property_mask | ) | const |
Toggle a ViewerData visualization option for this viewport.
[in] | property_mask | a bit mask of visualization option |
bool igl::opengl::ViewerCore::is_set | ( | unsigned int | property_mask | ) | const |
Check whether a ViewerData visualization option is set for this viewport.
[in] | property_mask | a bit mask of visualization option |
void igl::opengl::ViewerCore::delete_shadow_buffers | ( | ) |
delete the shadow buffers
void igl::opengl::ViewerCore::generate_shadow_buffers | ( | ) |
generate the shadow buffers
unsigned int igl::opengl::ViewerCore::id = 1u |
Unique identifier.
Eigen::Vector4f igl::opengl::ViewerCore::background_color |
Background color as RGBA.
Eigen::Vector3f igl::opengl::ViewerCore::light_position |
Light position (or direction to light)
bool igl::opengl::ViewerCore::is_directional_light |
Whether to treat light_position
as a point or direction.
bool igl::opengl::ViewerCore::is_shadow_mapping |
Whether shadow mapping is on.
GLuint igl::opengl::ViewerCore::shadow_width |
Width of the shadow map.
GLuint igl::opengl::ViewerCore::shadow_height |
Height of the shadow map.
GLuint igl::opengl::ViewerCore::shadow_depth_tex |
Shadow map depth texture.
GLuint igl::opengl::ViewerCore::shadow_depth_fbo |
Shadow map depth framebuffer object.
GLuint igl::opengl::ViewerCore::shadow_color_rbo |
Shadow map color render buffer object.
float igl::opengl::ViewerCore::lighting_factor |
Factor of lighting (0: no lighting, 1: full lighting)
RotationType igl::opengl::ViewerCore::rotation_type |
Type of rotation interaction.
Eigen::Quaternionf igl::opengl::ViewerCore::trackball_angle |
View rotation as quaternion.
float igl::opengl::ViewerCore::camera_base_zoom |
Base zoom of camera.
float igl::opengl::ViewerCore::camera_zoom |
Current zoom of camera.
bool igl::opengl::ViewerCore::orthographic |
Whether camera is orthographic (or perspective)
Eigen::Vector3f igl::opengl::ViewerCore::camera_base_translation |
Base translation of camera.
Eigen::Vector3f igl::opengl::ViewerCore::camera_translation |
Current translation of camera.
Eigen::Vector3f igl::opengl::ViewerCore::camera_eye |
Current "eye" / origin position of camera.
Eigen::Vector3f igl::opengl::ViewerCore::camera_up |
Current "up" vector of camera.
Eigen::Vector3f igl::opengl::ViewerCore::camera_center |
Current "look at" position of camera.
float igl::opengl::ViewerCore::camera_view_angle |
Current view angle of camera.
float igl::opengl::ViewerCore::camera_dnear |
Near plane of camera.
float igl::opengl::ViewerCore::camera_dfar |
Far plane of camera.
bool igl::opengl::ViewerCore::depth_test |
Whether testing for depth is enabled.
bool igl::opengl::ViewerCore::is_animating |
Whether "animating" (continuous drawing) is enabled.
double igl::opengl::ViewerCore::animation_max_fps |
Max fps of animation loop (e.g. 30fps or 60fps)
float igl::opengl::ViewerCore::object_scale |
Caches the two-norm between the min/max point of the bounding box.
Eigen::Vector4f igl::opengl::ViewerCore::viewport |
Viewport size.
Eigen::Matrix4f igl::opengl::ViewerCore::view |
OpenGL view transformation matrix on last render pass.
Eigen::Matrix4f igl::opengl::ViewerCore::proj |
OpenGL proj transformation matrix on last render pass.
Eigen::Matrix4f igl::opengl::ViewerCore::norm |
OpenGL norm transformation matrix on last render pass.
Eigen::Matrix4f igl::opengl::ViewerCore::shadow_view |
OpenGL shadow_view transformation matrix on last render pass.
Eigen::Matrix4f igl::opengl::ViewerCore::shadow_proj |
OpenGL shadow_proj transformation matrix on last render pass.