|
@@ -8,15 +8,15 @@
|
|
|
|
|
|
#include "ViewerData.h"
|
|
#include "ViewerData.h"
|
|
|
|
|
|
-#include "per_face_normals.h"
|
|
|
|
-#include "material_colors.h"
|
|
|
|
-#include "parula.h"
|
|
|
|
-#include "per_vertex_normals.h"
|
|
|
|
|
|
+#include "../per_face_normals.h"
|
|
|
|
+#include "../material_colors.h"
|
|
|
|
+#include "../parula.h"
|
|
|
|
+#include "../per_vertex_normals.h"
|
|
|
|
|
|
#include <iostream>
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
-IGL_INLINE igl::ViewerData::ViewerData()
|
|
|
|
|
|
+IGL_INLINE igl::opengl::ViewerData::ViewerData()
|
|
: dirty(DIRTY_ALL),
|
|
: dirty(DIRTY_ALL),
|
|
show_faces(true),
|
|
show_faces(true),
|
|
show_lines(true),
|
|
show_lines(true),
|
|
@@ -34,7 +34,7 @@ IGL_INLINE igl::ViewerData::ViewerData()
|
|
clear();
|
|
clear();
|
|
};
|
|
};
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::set_face_based(bool newvalue)
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::set_face_based(bool newvalue)
|
|
{
|
|
{
|
|
if (face_based != newvalue)
|
|
if (face_based != newvalue)
|
|
{
|
|
{
|
|
@@ -44,7 +44,7 @@ IGL_INLINE void igl::ViewerData::set_face_based(bool newvalue)
|
|
}
|
|
}
|
|
|
|
|
|
// Helpers that draws the most common meshes
|
|
// Helpers that draws the most common meshes
|
|
-IGL_INLINE void igl::ViewerData::set_mesh(
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::set_mesh(
|
|
const Eigen::MatrixXd& _V, const Eigen::MatrixXi& _F)
|
|
const Eigen::MatrixXd& _V, const Eigen::MatrixXi& _F)
|
|
{
|
|
{
|
|
using namespace std;
|
|
using namespace std;
|
|
@@ -86,14 +86,14 @@ IGL_INLINE void igl::ViewerData::set_mesh(
|
|
dirty |= DIRTY_FACE | DIRTY_POSITION;
|
|
dirty |= DIRTY_FACE | DIRTY_POSITION;
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::set_vertices(const Eigen::MatrixXd& _V)
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::set_vertices(const Eigen::MatrixXd& _V)
|
|
{
|
|
{
|
|
V = _V;
|
|
V = _V;
|
|
assert(F.size() == 0 || F.maxCoeff() < V.rows());
|
|
assert(F.size() == 0 || F.maxCoeff() < V.rows());
|
|
dirty |= DIRTY_POSITION;
|
|
dirty |= DIRTY_POSITION;
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::set_normals(const Eigen::MatrixXd& N)
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::set_normals(const Eigen::MatrixXd& N)
|
|
{
|
|
{
|
|
using namespace std;
|
|
using namespace std;
|
|
if (N.rows() == V.rows())
|
|
if (N.rows() == V.rows())
|
|
@@ -111,7 +111,7 @@ IGL_INLINE void igl::ViewerData::set_normals(const Eigen::MatrixXd& N)
|
|
dirty |= DIRTY_NORMAL;
|
|
dirty |= DIRTY_NORMAL;
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::set_colors(const Eigen::MatrixXd &C)
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::set_colors(const Eigen::MatrixXd &C)
|
|
{
|
|
{
|
|
using namespace std;
|
|
using namespace std;
|
|
using namespace Eigen;
|
|
using namespace Eigen;
|
|
@@ -179,7 +179,7 @@ IGL_INLINE void igl::ViewerData::set_colors(const Eigen::MatrixXd &C)
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::set_uv(const Eigen::MatrixXd& UV)
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::set_uv(const Eigen::MatrixXd& UV)
|
|
{
|
|
{
|
|
using namespace std;
|
|
using namespace std;
|
|
if (UV.rows() == V.rows())
|
|
if (UV.rows() == V.rows())
|
|
@@ -192,7 +192,7 @@ IGL_INLINE void igl::ViewerData::set_uv(const Eigen::MatrixXd& UV)
|
|
dirty |= DIRTY_UV;
|
|
dirty |= DIRTY_UV;
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::set_uv(const Eigen::MatrixXd& UV_V, const Eigen::MatrixXi& UV_F)
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::set_uv(const Eigen::MatrixXd& UV_V, const Eigen::MatrixXi& UV_F)
|
|
{
|
|
{
|
|
set_face_based(true);
|
|
set_face_based(true);
|
|
V_uv = UV_V.block(0,0,UV_V.rows(),2);
|
|
V_uv = UV_V.block(0,0,UV_V.rows(),2);
|
|
@@ -201,7 +201,7 @@ IGL_INLINE void igl::ViewerData::set_uv(const Eigen::MatrixXd& UV_V, const Eigen
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::set_texture(
|
|
|
|
|
|
+IGL_INLINE 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>& R,
|
|
const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,
|
|
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>& B)
|
|
@@ -213,7 +213,7 @@ IGL_INLINE void igl::ViewerData::set_texture(
|
|
dirty |= DIRTY_TEXTURE;
|
|
dirty |= DIRTY_TEXTURE;
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::set_texture(
|
|
|
|
|
|
+IGL_INLINE 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>& R,
|
|
const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,
|
|
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>& B,
|
|
@@ -226,7 +226,7 @@ IGL_INLINE void igl::ViewerData::set_texture(
|
|
dirty |= DIRTY_TEXTURE;
|
|
dirty |= DIRTY_TEXTURE;
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::set_points(
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::set_points(
|
|
const Eigen::MatrixXd& P,
|
|
const Eigen::MatrixXd& P,
|
|
const Eigen::MatrixXd& C)
|
|
const Eigen::MatrixXd& C)
|
|
{
|
|
{
|
|
@@ -235,7 +235,7 @@ IGL_INLINE void igl::ViewerData::set_points(
|
|
add_points(P,C);
|
|
add_points(P,C);
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::add_points(const Eigen::MatrixXd& P, const Eigen::MatrixXd& C)
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::add_points(const Eigen::MatrixXd& P, const Eigen::MatrixXd& C)
|
|
{
|
|
{
|
|
Eigen::MatrixXd P_temp;
|
|
Eigen::MatrixXd P_temp;
|
|
|
|
|
|
@@ -256,7 +256,7 @@ IGL_INLINE void igl::ViewerData::add_points(const Eigen::MatrixXd& P, const Eig
|
|
dirty |= DIRTY_OVERLAY_POINTS;
|
|
dirty |= DIRTY_OVERLAY_POINTS;
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::set_edges(
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::set_edges(
|
|
const Eigen::MatrixXd& P,
|
|
const Eigen::MatrixXd& P,
|
|
const Eigen::MatrixXi& E,
|
|
const Eigen::MatrixXi& E,
|
|
const Eigen::MatrixXd& C)
|
|
const Eigen::MatrixXd& C)
|
|
@@ -279,7 +279,7 @@ IGL_INLINE void igl::ViewerData::set_edges(
|
|
dirty |= DIRTY_OVERLAY_LINES;
|
|
dirty |= DIRTY_OVERLAY_LINES;
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::add_edges(const Eigen::MatrixXd& P1, const Eigen::MatrixXd& P2, const Eigen::MatrixXd& C)
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::add_edges(const Eigen::MatrixXd& P1, const Eigen::MatrixXd& P2, const Eigen::MatrixXd& C)
|
|
{
|
|
{
|
|
Eigen::MatrixXd P1_temp,P2_temp;
|
|
Eigen::MatrixXd P1_temp,P2_temp;
|
|
|
|
|
|
@@ -305,7 +305,7 @@ IGL_INLINE void igl::ViewerData::add_edges(const Eigen::MatrixXd& P1, const Eige
|
|
dirty |= DIRTY_OVERLAY_LINES;
|
|
dirty |= DIRTY_OVERLAY_LINES;
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::add_label(const Eigen::VectorXd& P, const std::string& str)
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::add_label(const Eigen::VectorXd& P, const std::string& str)
|
|
{
|
|
{
|
|
Eigen::RowVectorXd P_temp;
|
|
Eigen::RowVectorXd P_temp;
|
|
|
|
|
|
@@ -324,7 +324,7 @@ IGL_INLINE void igl::ViewerData::add_label(const Eigen::VectorXd& P, const std:
|
|
labels_strings.push_back(str);
|
|
labels_strings.push_back(str);
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::clear()
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::clear()
|
|
{
|
|
{
|
|
V = Eigen::MatrixXd (0,3);
|
|
V = Eigen::MatrixXd (0,3);
|
|
F = Eigen::MatrixXi (0,3);
|
|
F = Eigen::MatrixXi (0,3);
|
|
@@ -351,14 +351,14 @@ IGL_INLINE void igl::ViewerData::clear()
|
|
face_based = false;
|
|
face_based = false;
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::compute_normals()
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::compute_normals()
|
|
{
|
|
{
|
|
igl::per_face_normals(V, F, F_normals);
|
|
igl::per_face_normals(V, F, F_normals);
|
|
igl::per_vertex_normals(V, F, F_normals, V_normals);
|
|
igl::per_vertex_normals(V, F, F_normals, V_normals);
|
|
dirty |= DIRTY_NORMAL;
|
|
dirty |= DIRTY_NORMAL;
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::uniform_colors(
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::uniform_colors(
|
|
const Eigen::Vector3d& ambient,
|
|
const Eigen::Vector3d& ambient,
|
|
const Eigen::Vector3d& diffuse,
|
|
const Eigen::Vector3d& diffuse,
|
|
const Eigen::Vector3d& specular)
|
|
const Eigen::Vector3d& specular)
|
|
@@ -374,7 +374,7 @@ IGL_INLINE void igl::ViewerData::uniform_colors(
|
|
uniform_colors(ambient4,diffuse4,specular4);
|
|
uniform_colors(ambient4,diffuse4,specular4);
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::uniform_colors(
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::uniform_colors(
|
|
const Eigen::Vector4d& ambient,
|
|
const Eigen::Vector4d& ambient,
|
|
const Eigen::Vector4d& diffuse,
|
|
const Eigen::Vector4d& diffuse,
|
|
const Eigen::Vector4d& specular)
|
|
const Eigen::Vector4d& specular)
|
|
@@ -403,7 +403,7 @@ IGL_INLINE void igl::ViewerData::uniform_colors(
|
|
dirty |= DIRTY_SPECULAR | DIRTY_DIFFUSE | DIRTY_AMBIENT;
|
|
dirty |= DIRTY_SPECULAR | DIRTY_DIFFUSE | DIRTY_AMBIENT;
|
|
}
|
|
}
|
|
|
|
|
|
-IGL_INLINE void igl::ViewerData::grid_texture()
|
|
|
|
|
|
+IGL_INLINE void igl::opengl::ViewerData::grid_texture()
|
|
{
|
|
{
|
|
// Don't do anything for an empty mesh
|
|
// Don't do anything for an empty mesh
|
|
if(V.rows() == 0)
|
|
if(V.rows() == 0)
|