libigl v2.5.0
|
Object being drawn (i.e., mesh and its accessories) by the ViewerCore. More...
#include <ViewerData.h>
Public Member Functions | |
ViewerData () | |
void | clear () |
Empty all fields. | |
void | set_face_based (bool newvalue) |
Change whether drawing per-vertex or per-face; invalidating cache if necessary. | |
void | set_mesh (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) |
Set the current mesh. | |
void | set_vertices (const Eigen::MatrixXd &V) |
Set just the vertices. | |
void | set_normals (const Eigen::MatrixXd &N) |
Set the normals of a mesh. | |
void | set_visible (bool value, unsigned int core_id=1) |
Set whether this object is visible. | |
void | set_colors (const Eigen::MatrixXd &C) |
Set the diffuse color of the mesh. | |
void | set_uv (const Eigen::MatrixXd &UV) |
Set per-vertex UV coordinates. | |
void | set_uv (const Eigen::MatrixXd &UV_V, const Eigen::MatrixXi &UV_F) |
Set per-corner UV coordinates. | |
void | set_texture (const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &R, const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &G, const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &B, const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &A) |
Set the texture associated with the mesh. | |
void | set_texture (const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &R, const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &G, const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > &B) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | set_data (const Eigen::VectorXd &D, double caxis_min, double caxis_max, igl::ColorMapType cmap=igl::COLOR_MAP_TYPE_VIRIDIS, int num_steps=21) |
Set pseudo-color-able scalar data associated with the mesh. | |
void | set_data (const Eigen::VectorXd &D, igl::ColorMapType cmap=igl::COLOR_MAP_TYPE_VIRIDIS, int num_steps=21) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | set_colormap (const Eigen::MatrixXd &CM) |
Not to be confused with set_colors, this creates a texture that will be referenced to pseudocolor according to the scalar field passed to set_data. | |
void | set_points (const Eigen::MatrixXd &P, const Eigen::MatrixXd &C) |
Sets points given a list of point vertices. | |
void | add_points (const Eigen::MatrixXd &P, const Eigen::MatrixXd &C) |
Add points given a list of point vertices. | |
void | clear_points () |
Clear the point data. | |
void | set_edges (const Eigen::MatrixXd &P, const Eigen::MatrixXi &E, const Eigen::MatrixXd &C) |
Sets edges given a list of edge vertices and edge indices. | |
void | add_edges (const Eigen::MatrixXd &P1, const Eigen::MatrixXd &P2, const Eigen::MatrixXd &C) |
Add edges given a list of edge start and end positions and colors. | |
void | set_edges_from_vector_field (const Eigen::MatrixXd &P, const Eigen::MatrixXd &V, const Eigen::MatrixXd &C) |
Sets edges given a list of points and eminating vectors. | |
void | clear_edges () |
Clear the edge data. | |
void | set_labels (const Eigen::MatrixXd &P, const std::vector< std::string > &str) |
Sets / Adds text labels at the given positions in 3D. | |
void | add_label (const Eigen::VectorXd &P, const std::string &str) |
Sets / Adds text labels at the given positions in 3D. | |
void | clear_labels () |
Clear the label data. | |
void | compute_normals () |
Computes the normals of the mesh. | |
void | uniform_colors (const Eigen::Vector3d &ambient, const Eigen::Vector3d &diffuse, const Eigen::Vector3d &specular) |
Assigns uniform colors to all faces/vertices. | |
void | uniform_colors (const Eigen::Vector4d &ambient, const Eigen::Vector4d &diffuse, const Eigen::Vector4d &specular) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | normal_matcap () |
Generate a normal image matcap. | |
void | grid_texture () |
Generates a default grid texture (without uvs) | |
void | copy_options (const ViewerCore &from, const ViewerCore &to) |
Copy visualization options from one viewport to another. | |
void | update_labels (igl::opengl::MeshGL::TextGL &GL_labels, const Eigen::MatrixXd &positions, const std::vector< std::string > &strings) |
Update contents from a 'Data' instance. | |
void | updateGL (const igl::opengl::ViewerData &data, const bool invert_normals, igl::opengl::MeshGL &meshgl) |
Update the meshgl object. | |
Public Attributes | |
Eigen::MatrixXd | V |
Vertices of the current mesh (V x 3) | |
Eigen::MatrixXi | F |
Faces of the mesh (F x 3) | |
Eigen::MatrixXd | F_normals |
One normal per face. | |
Eigen::MatrixXd | F_material_ambient |
Per face ambient color. | |
Eigen::MatrixXd | F_material_diffuse |
Per face diffuse color. | |
Eigen::MatrixXd | F_material_specular |
Per face specular color. | |
Eigen::MatrixXd | V_normals |
One normal per vertex. | |
Eigen::MatrixXd | V_material_ambient |
Per vertex ambient color. | |
Eigen::MatrixXd | V_material_diffuse |
Per vertex diffuse color. | |
Eigen::MatrixXd | V_material_specular |
Per vertex specular color. | |
Eigen::MatrixXd | V_uv |
UV vertices. | |
Eigen::MatrixXi | F_uv |
optional faces for UVs | |
Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > | texture_R |
Texture red colors. | |
Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > | texture_G |
Texture green colors. | |
Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > | texture_B |
Texture blue colors. | |
Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > | texture_A |
Texture alpha values. | |
Eigen::MatrixXd | lines |
Lines plotted over the scene (Every row contains 9 doubles in the following format S_x, S_y, S_z, T_x, T_y, T_z, C_r, C_g, C_b),. | |
Eigen::MatrixXd | points |
Points plotted over the scene (Every row contains 6 doubles in the following format P_x, P_y, P_z, C_r, C_g, C_b), with P the position in global coordinates of the center of the point, and C the color in floating point rgb format. | |
Eigen::MatrixXd | vertex_labels_positions |
Text positions of vertices. | |
Eigen::MatrixXd | face_labels_positions |
Text positions of faces. | |
Eigen::MatrixXd | labels_positions |
Text positions of labels. | |
std::vector< std::string > | vertex_labels_strings |
Text strings of labels at vertices. | |
std::vector< std::string > | face_labels_strings |
Text strings of labels at faces. | |
std::vector< std::string > | labels_strings |
Text strings of labels. | |
uint32_t | dirty |
Marks dirty buffers that need to be uploaded to OpenGL. | |
bool | face_based |
Enable per-face or per-vertex properties. | |
bool | double_sided |
Enable double-sided lighting on faces. | |
bool | invert_normals |
Invert mesh normals. | |
unsigned int | is_visible |
Visualization options Each option is a binary mask specifying on which viewport each option is set. | |
unsigned int | show_custom_labels |
unsigned int | show_face_labels |
unsigned int | show_faces |
unsigned int | show_lines |
unsigned int | show_overlay |
unsigned int | show_overlay_depth |
unsigned int | show_texture |
unsigned int | show_vertex_labels |
unsigned int | use_matcap |
float | point_size |
Point size / line width. | |
float | line_width |
line_width is NOT SUPPORTED on Mac OS and Windows | |
float | label_size |
Size of lables. | |
Eigen::Matrix< float, 4, 1, Eigen::DontAlign > | line_color |
Color of lines. | |
Eigen::Matrix< float, 4, 1, Eigen::DontAlign > | label_color |
Color of labels. | |
float | shininess |
Shape material shininess. | |
int | id |
Unique identifier. | |
igl::opengl::MeshGL | meshgl |
OpenGL representation of the mesh. | |
Object being drawn (i.e., mesh and its accessories) by the ViewerCore.
Eigen::Matrix<float, 4, 1, Eigen::DontAlign>
), in order to avoid alignment issues further down the line (esp. if the structure are stored in a std::vector).See this thread for a more detailed discussion: https://github.com/libigl/libigl/pull/1029
igl::opengl::ViewerData::ViewerData | ( | ) |
void igl::opengl::ViewerData::clear | ( | ) |
Empty all fields.
void igl::opengl::ViewerData::set_face_based | ( | bool | newvalue | ) |
Change whether drawing per-vertex or per-face; invalidating cache if necessary.
[in] | newvalue | whether face based |
void igl::opengl::ViewerData::set_mesh | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F | ||
) |
void igl::opengl::ViewerData::set_vertices | ( | const Eigen::MatrixXd & | V | ) |
Set just the vertices.
Call this if just the vertices are changing. You may need to call compute_normals to update the lighting correctly.
[in] | V | V by 3 list of mesh vertex positions |
void igl::opengl::ViewerData::set_normals | ( | const Eigen::MatrixXd & | N | ) |
void igl::opengl::ViewerData::set_visible | ( | bool | value, |
unsigned int | core_id = 1 |
||
) |
Set whether this object is visible.
[in] | value | true iff this object is visible |
[in] | core_id | Index of the core to set (default is 0) |
void igl::opengl::ViewerData::set_colors | ( | const Eigen::MatrixXd & | C | ) |
void igl::opengl::ViewerData::set_uv | ( | const Eigen::MatrixXd & | UV | ) |
Set per-vertex UV coordinates.
[in] | UV | V by 2 list of UV coordinates (indexed by F) |
void igl::opengl::ViewerData::set_uv | ( | const Eigen::MatrixXd & | UV_V, |
const Eigen::MatrixXi & | UV_F | ||
) |
Set per-corner UV coordinates.
[in] | UV_V | #UV by 2 list of UV coordinates |
[in] | UV_F | F by 3 list of UV indices into UV_V |
void igl::opengl::ViewerData::set_texture | ( | const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > & | R, |
const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > & | G, | ||
const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > & | B, | ||
const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > & | A | ||
) |
Set the texture associated with the mesh.
[in] | R | width by height image matrix of red channel |
[in] | G | width by height image matrix of green channel |
[in] | B | width by height image matrix of blue channel |
[in] | A | width by height image matrix of alpha channel |
void igl::opengl::ViewerData::set_texture | ( | const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > & | R, |
const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > & | G, | ||
const Eigen::Matrix< unsigned char, Eigen::Dynamic, Eigen::Dynamic > & | B | ||
) |
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::ViewerData::set_data | ( | const Eigen::VectorXd & | D, |
double | caxis_min, | ||
double | caxis_max, | ||
igl::ColorMapType | cmap = igl::COLOR_MAP_TYPE_VIRIDIS , |
||
int | num_steps = 21 |
||
) |
void igl::opengl::ViewerData::set_data | ( | const Eigen::VectorXd & | D, |
igl::ColorMapType | cmap = igl::COLOR_MAP_TYPE_VIRIDIS , |
||
int | num_steps = 21 |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Use min(D) and max(D) to set caxis.
void igl::opengl::ViewerData::set_colormap | ( | const Eigen::MatrixXd & | CM | ) |
Not to be confused with set_colors, this creates a texture that will be referenced to pseudocolor according to the scalar field passed to set_data.
[in] | CM | #CM by 3 list of colors |
void igl::opengl::ViewerData::set_points | ( | const Eigen::MatrixXd & | P, |
const Eigen::MatrixXd & | C | ||
) |
Sets points given a list of point vertices.
In constrast to add_points
this will (purposefully) clober existing points.
[in] | P | #P by 3 list of vertex positions |
[in] | C | #P|1 by 3 color(s) |
void igl::opengl::ViewerData::add_points | ( | const Eigen::MatrixXd & | P, |
const Eigen::MatrixXd & | C | ||
) |
Add points given a list of point vertices.
[in] | P | #P by 3 list of vertex positions |
[in] | C | #P|1 by 3 color(s) |
void igl::opengl::ViewerData::clear_points | ( | ) |
Clear the point data.
void igl::opengl::ViewerData::set_edges | ( | const Eigen::MatrixXd & | P, |
const Eigen::MatrixXi & | E, | ||
const Eigen::MatrixXd & | C | ||
) |
Sets edges given a list of edge vertices and edge indices.
In constrast to add_edges
this will (purposefully) clober existing edges.
[in] | P | #P by 3 list of vertex positions |
[in] | E | #E by 2 list of edge indices into P |
[in] | C | #E|1 by 3 color(s) |
void igl::opengl::ViewerData::add_edges | ( | const Eigen::MatrixXd & | P1, |
const Eigen::MatrixXd & | P2, | ||
const Eigen::MatrixXd & | C | ||
) |
Add edges given a list of edge start and end positions and colors.
[in] | P1 | #P by 3 list of edge start positions |
[in] | P2 | #P by 3 list of edge end positions |
[in] | C | #P|1 by 3 color(s) |
void igl::opengl::ViewerData::set_edges_from_vector_field | ( | const Eigen::MatrixXd & | P, |
const Eigen::MatrixXd & | V, | ||
const Eigen::MatrixXd & | C | ||
) |
Sets edges given a list of points and eminating vectors.
[in] | P | #P by 3 list of vertex positions |
[in] | V | #P by 3 list of eminating vectors |
[in] | C | #P|1 by 3 color(s) |
void igl::opengl::ViewerData::clear_edges | ( | ) |
Clear the edge data.
void igl::opengl::ViewerData::set_labels | ( | const Eigen::MatrixXd & | P, |
const std::vector< std::string > & | str | ||
) |
Sets / Adds text labels at the given positions in 3D.
[in] | P | #P by 3 list of vertex positions |
[in] | str | #P list of text labels |
void igl::opengl::ViewerData::add_label | ( | const Eigen::VectorXd & | P, |
const std::string & | str | ||
) |
Sets / Adds text labels at the given positions in 3D.
[in] | P | 3D position of the label |
[in] | str | text label |
void igl::opengl::ViewerData::clear_labels | ( | ) |
Clear the label data.
void igl::opengl::ViewerData::compute_normals | ( | ) |
Computes the normals of the mesh.
void igl::opengl::ViewerData::uniform_colors | ( | const Eigen::Vector3d & | ambient, |
const Eigen::Vector3d & | diffuse, | ||
const Eigen::Vector3d & | specular | ||
) |
Assigns uniform colors to all faces/vertices.
[in] | ambient | ambient color |
[in] | diffuse | diffuse color |
[in] | specular | specular color |
void igl::opengl::ViewerData::uniform_colors | ( | const Eigen::Vector4d & | ambient, |
const Eigen::Vector4d & | diffuse, | ||
const Eigen::Vector4d & | specular | ||
) |
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::ViewerData::normal_matcap | ( | ) |
Generate a normal image matcap.
void igl::opengl::ViewerData::grid_texture | ( | ) |
Generates a default grid texture (without uvs)
void igl::opengl::ViewerData::copy_options | ( | const ViewerCore & | from, |
const ViewerCore & | to | ||
) |
Copy visualization options from one viewport to another.
[in] | from | source viewport |
[in] | to | destination viewport |
void igl::opengl::ViewerData::update_labels | ( | igl::opengl::MeshGL::TextGL & | GL_labels, |
const Eigen::MatrixXd & | positions, | ||
const std::vector< std::string > & | strings | ||
) |
Update contents from a 'Data' instance.
[in,out] | GL_labels | labels to be updated |
[in] | positions | positions of the labels |
[in] | strings | strings of the labels |
void igl::opengl::ViewerData::updateGL | ( | const igl::opengl::ViewerData & | data, |
const bool | invert_normals, | ||
igl::opengl::MeshGL & | meshgl | ||
) |
Update the meshgl object.
[in] | data | data to be used for the update |
[in] | invert_normals | whether to invert normals |
[in,out] | meshgl | mesh to be updated |
Eigen::MatrixXd igl::opengl::ViewerData::V |
Vertices of the current mesh (V x 3)
Eigen::MatrixXi igl::opengl::ViewerData::F |
Faces of the mesh (F x 3)
Eigen::MatrixXd igl::opengl::ViewerData::F_normals |
One normal per face.
Eigen::MatrixXd igl::opengl::ViewerData::F_material_ambient |
Per face ambient color.
Eigen::MatrixXd igl::opengl::ViewerData::F_material_diffuse |
Per face diffuse color.
Eigen::MatrixXd igl::opengl::ViewerData::F_material_specular |
Per face specular color.
Eigen::MatrixXd igl::opengl::ViewerData::V_normals |
One normal per vertex.
Eigen::MatrixXd igl::opengl::ViewerData::V_material_ambient |
Per vertex ambient color.
Eigen::MatrixXd igl::opengl::ViewerData::V_material_diffuse |
Per vertex diffuse color.
Eigen::MatrixXd igl::opengl::ViewerData::V_material_specular |
Per vertex specular color.
Eigen::MatrixXd igl::opengl::ViewerData::V_uv |
UV vertices.
Eigen::MatrixXi igl::opengl::ViewerData::F_uv |
optional faces for UVs
Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic> igl::opengl::ViewerData::texture_R |
Texture red colors.
Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic> igl::opengl::ViewerData::texture_G |
Texture green colors.
Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic> igl::opengl::ViewerData::texture_B |
Texture blue colors.
Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic> igl::opengl::ViewerData::texture_A |
Texture alpha values.
Eigen::MatrixXd igl::opengl::ViewerData::lines |
Lines plotted over the scene (Every row contains 9 doubles in the following format S_x, S_y, S_z, T_x, T_y, T_z, C_r, C_g, C_b),.
Eigen::MatrixXd igl::opengl::ViewerData::points |
Points plotted over the scene (Every row contains 6 doubles in the following format P_x, P_y, P_z, C_r, C_g, C_b), with P the position in global coordinates of the center of the point, and C the color in floating point rgb format.
Eigen::MatrixXd igl::opengl::ViewerData::vertex_labels_positions |
Text positions of vertices.
Eigen::MatrixXd igl::opengl::ViewerData::face_labels_positions |
Text positions of faces.
Eigen::MatrixXd igl::opengl::ViewerData::labels_positions |
Text positions of labels.
std::vector<std::string> igl::opengl::ViewerData::vertex_labels_strings |
Text strings of labels at vertices.
std::vector<std::string> igl::opengl::ViewerData::face_labels_strings |
Text strings of labels at faces.
std::vector<std::string> igl::opengl::ViewerData::labels_strings |
Text strings of labels.
uint32_t igl::opengl::ViewerData::dirty |
Marks dirty buffers that need to be uploaded to OpenGL.
bool igl::opengl::ViewerData::face_based |
Enable per-face or per-vertex properties.
bool igl::opengl::ViewerData::double_sided |
Enable double-sided lighting on faces.
bool igl::opengl::ViewerData::invert_normals |
Invert mesh normals.
unsigned int igl::opengl::ViewerData::is_visible |
Visualization options Each option is a binary mask specifying on which viewport each option is set.
When using a single viewport, standard boolean can still be used for simplicity.
unsigned int igl::opengl::ViewerData::show_custom_labels |
unsigned int igl::opengl::ViewerData::show_face_labels |
unsigned int igl::opengl::ViewerData::show_faces |
unsigned int igl::opengl::ViewerData::show_lines |
unsigned int igl::opengl::ViewerData::show_overlay |
unsigned int igl::opengl::ViewerData::show_overlay_depth |
unsigned int igl::opengl::ViewerData::show_texture |
unsigned int igl::opengl::ViewerData::show_vertex_labels |
unsigned int igl::opengl::ViewerData::use_matcap |
float igl::opengl::ViewerData::point_size |
Point size / line width.
float igl::opengl::ViewerData::line_width |
line_width is NOT SUPPORTED on Mac OS and Windows
float igl::opengl::ViewerData::label_size |
Size of lables.
Eigen::Matrix<float, 4, 1, Eigen::DontAlign> igl::opengl::ViewerData::line_color |
Color of lines.
Eigen::Matrix<float, 4, 1, Eigen::DontAlign> igl::opengl::ViewerData::label_color |
Color of labels.
float igl::opengl::ViewerData::shininess |
Shape material shininess.
int igl::opengl::ViewerData::id |
Unique identifier.
igl::opengl::MeshGL igl::opengl::ViewerData::meshgl |
OpenGL representation of the mesh.