|
@@ -21,6 +21,7 @@
|
|
|
|
|
|
#include <Eigen/Core>
|
|
|
#include <igl/viewer/OpenGL_shader.h>
|
|
|
+#include <igl/viewer/ViewerData.h>
|
|
|
|
|
|
namespace igl
|
|
|
{
|
|
@@ -118,72 +119,6 @@ namespace igl
|
|
|
DIRTY_ALL = 0x03FF
|
|
|
};
|
|
|
|
|
|
- class Data
|
|
|
- #ifdef ENABLE_XML_SERIALIZATION
|
|
|
- : public ::igl::XMLSerialization
|
|
|
- #endif
|
|
|
- {
|
|
|
- public:
|
|
|
- Data()
|
|
|
- #ifdef ENABLE_XML_SERIALIZATION
|
|
|
- : XMLSerialization("Data"), dirty(DIRTY_ALL)
|
|
|
- #endif
|
|
|
- {};
|
|
|
-
|
|
|
- void InitSerialization();
|
|
|
-
|
|
|
- Eigen::MatrixXd V; // Vertices of the current mesh (#V x 3)
|
|
|
- Eigen::MatrixXi F; // Faces of the mesh (#F x 3)
|
|
|
-
|
|
|
- // Per face attributes
|
|
|
- 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
|
|
|
-
|
|
|
- // Per vertex attributes
|
|
|
- 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
|
|
|
-
|
|
|
- // UV parametrization
|
|
|
- Eigen::MatrixXd V_uv; // UV vertices
|
|
|
- Eigen::MatrixXi F_uv; // optional faces for UVs
|
|
|
-
|
|
|
- // Texture
|
|
|
- Eigen::Matrix<char,Eigen::Dynamic,Eigen::Dynamic> texture_R;
|
|
|
- Eigen::Matrix<char,Eigen::Dynamic,Eigen::Dynamic> texture_G;
|
|
|
- Eigen::Matrix<char,Eigen::Dynamic,Eigen::Dynamic> texture_B;
|
|
|
-
|
|
|
- // Overlays
|
|
|
-
|
|
|
- // 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),
|
|
|
- // with S and T the coordinates of the two vertices of the line in global coordinates, and C the color in floating point rgb format
|
|
|
- Eigen::MatrixXd lines;
|
|
|
-
|
|
|
- // 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 points;
|
|
|
-
|
|
|
- // Text labels plotted over the scene
|
|
|
- // Textp contains, in the i-th row, the position in global coordinates where the i-th label should be anchored
|
|
|
- // Texts contains in the i-th position the text of the i-th label
|
|
|
- Eigen::MatrixXd labels_positions;
|
|
|
- std::vector<std::string > labels_strings;
|
|
|
-
|
|
|
- // Marks dirty buffers that need to be uploaded to OpenGL
|
|
|
- uint32_t dirty;
|
|
|
-
|
|
|
- // Caches the two-norm between the min/max point of the bounding box
|
|
|
- float object_scale;
|
|
|
- /*********************************/
|
|
|
- };
|
|
|
-
|
|
|
class OpenGL_state
|
|
|
{
|
|
|
public:
|
|
@@ -240,7 +175,7 @@ namespace igl
|
|
|
void init();
|
|
|
|
|
|
// Update contents from a 'Data' instance
|
|
|
- void set_data(const Data &data, bool face_based, bool invert_normals);
|
|
|
+ void set_data(const igl::ViewerData &data, bool face_based, bool invert_normals);
|
|
|
|
|
|
// Bind the underlying OpenGL buffer objects for subsequent mesh draw calls
|
|
|
void bind_mesh();
|
|
@@ -268,12 +203,12 @@ namespace igl
|
|
|
Options options;
|
|
|
|
|
|
// Stores all the data that should be visualized
|
|
|
- Data data;
|
|
|
+ igl::ViewerData data;
|
|
|
|
|
|
// Stores the vbos indices and opengl related settings
|
|
|
OpenGL_state opengl;
|
|
|
|
|
|
- // Pointer to the plugin_manager (usually it will be a global variable)
|
|
|
+ // List of registered plugins
|
|
|
std::vector<Viewer_plugin*> plugins;
|
|
|
void init_plugins();
|
|
|
void shutdown_plugins();
|