瀏覽代碼

Remove model matrix from the viewer.

Former-commit-id: a9d3ef9d063d1a1b9f4a80f4872fcf90fb5d51a3
Jérémie Dumas 7 年之前
父節點
當前提交
f229319830

+ 5 - 9
include/igl/opengl/MeshGL.cpp

@@ -166,7 +166,6 @@ IGL_INLINE void igl::opengl::MeshGL::init()
   is_initialized = true;
   is_initialized = true;
   std::string mesh_vertex_shader_string =
   std::string mesh_vertex_shader_string =
   "#version 150\n"
   "#version 150\n"
-  "uniform mat4 model;"
   "uniform mat4 view;"
   "uniform mat4 view;"
   "uniform mat4 proj;"
   "uniform mat4 proj;"
   "in vec3 position;"
   "in vec3 position;"
@@ -184,10 +183,10 @@ IGL_INLINE void igl::opengl::MeshGL::init()
 
 
   "void main()"
   "void main()"
   "{"
   "{"
-  "  position_eye = vec3 (view * model * vec4 (position, 1.0));"
-  "  normal_eye = vec3 (view * model * vec4 (normal, 0.0));"
+  "  position_eye = vec3 (view * vec4 (position, 1.0));"
+  "  normal_eye = vec3 (view * vec4 (normal, 0.0));"
   "  normal_eye = normalize(normal_eye);"
   "  normal_eye = normalize(normal_eye);"
-  "  gl_Position = proj * vec4 (position_eye, 1.0);" //proj * view * model * vec4(position, 1.0);"
+  "  gl_Position = proj * vec4 (position_eye, 1.0);" //proj * view * vec4(position, 1.0);"
   "  Kai = Ka;"
   "  Kai = Ka;"
   "  Kdi = Kd;"
   "  Kdi = Kd;"
   "  Ksi = Ks;"
   "  Ksi = Ks;"
@@ -196,13 +195,12 @@ IGL_INLINE void igl::opengl::MeshGL::init()
 
 
   std::string mesh_fragment_shader_string =
   std::string mesh_fragment_shader_string =
   "#version 150\n"
   "#version 150\n"
-  "uniform mat4 model;"
   "uniform mat4 view;"
   "uniform mat4 view;"
   "uniform mat4 proj;"
   "uniform mat4 proj;"
   "uniform vec4 fixed_color;"
   "uniform vec4 fixed_color;"
   "in vec3 position_eye;"
   "in vec3 position_eye;"
   "in vec3 normal_eye;"
   "in vec3 normal_eye;"
-  "uniform vec3 light_position_world;"
+  "uniform vec3 light_position_eye;"
   "vec3 Ls = vec3 (1, 1, 1);"
   "vec3 Ls = vec3 (1, 1, 1);"
   "vec3 Ld = vec3 (1, 1, 1);"
   "vec3 Ld = vec3 (1, 1, 1);"
   "vec3 La = vec3 (1, 1, 1);"
   "vec3 La = vec3 (1, 1, 1);"
@@ -219,7 +217,6 @@ IGL_INLINE void igl::opengl::MeshGL::init()
   "{"
   "{"
   "vec3 Ia = La * vec3(Kai);"    // ambient intensity
   "vec3 Ia = La * vec3(Kai);"    // ambient intensity
 
 
-  "vec3 light_position_eye = vec3 (view * vec4 (light_position_world, 1.0));"
   "vec3 vector_to_light_eye = light_position_eye - position_eye;"
   "vec3 vector_to_light_eye = light_position_eye - position_eye;"
   "vec3 direction_to_light_eye = normalize (vector_to_light_eye);"
   "vec3 direction_to_light_eye = normalize (vector_to_light_eye);"
   "float dot_prod = dot (direction_to_light_eye, normal_eye);"
   "float dot_prod = dot (direction_to_light_eye, normal_eye);"
@@ -239,7 +236,6 @@ IGL_INLINE void igl::opengl::MeshGL::init()
 
 
   std::string overlay_vertex_shader_string =
   std::string overlay_vertex_shader_string =
   "#version 150\n"
   "#version 150\n"
-  "uniform mat4 model;"
   "uniform mat4 view;"
   "uniform mat4 view;"
   "uniform mat4 proj;"
   "uniform mat4 proj;"
   "in vec3 position;"
   "in vec3 position;"
@@ -248,7 +244,7 @@ IGL_INLINE void igl::opengl::MeshGL::init()
 
 
   "void main()"
   "void main()"
   "{"
   "{"
-  "  gl_Position = proj * view * model * vec4 (position, 1.0);"
+  "  gl_Position = proj * view * vec4 (position, 1.0);"
   "  color_frag = color;"
   "  color_frag = color;"
   "}";
   "}";
 
 

+ 14 - 34
include/igl/opengl/ViewerCore.cpp

@@ -26,7 +26,7 @@ IGL_INLINE void igl::opengl::ViewerCore::align_camera_center(
   if(V.rows() == 0)
   if(V.rows() == 0)
     return;
     return;
 
 
-  get_scale_and_shift_to_fit_mesh(V,F,model_zoom,model_translation);
+  get_scale_and_shift_to_fit_mesh(V,F,camera_base_zoom,camera_translation);
   // Rather than crash on empty mesh...
   // Rather than crash on empty mesh...
   if(V.size() > 0)
   if(V.size() > 0)
   {
   {
@@ -60,7 +60,7 @@ IGL_INLINE void igl::opengl::ViewerCore::align_camera_center(
   if(V.rows() == 0)
   if(V.rows() == 0)
     return;
     return;
 
 
-  get_scale_and_shift_to_fit_mesh(V,model_zoom,model_translation);
+  get_scale_and_shift_to_fit_mesh(V,camera_base_zoom,camera_translation);
   // Rather than crash on empty mesh...
   // Rather than crash on empty mesh...
   if(V.size() > 0)
   if(V.size() > 0)
   {
   {
@@ -122,16 +122,18 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
 
 
   if(update_matrices)
   if(update_matrices)
   {
   {
-    model = Eigen::Matrix4f::Identity();
     view  = Eigen::Matrix4f::Identity();
     view  = Eigen::Matrix4f::Identity();
     proj  = Eigen::Matrix4f::Identity();
     proj  = Eigen::Matrix4f::Identity();
 
 
-    // Set view
-    look_at( camera_eye, camera_center, camera_up, view);
-
     float width  = viewport(2);
     float width  = viewport(2);
     float height = viewport(3);
     float height = viewport(3);
 
 
+    // Set view
+    look_at( camera_eye, camera_center, camera_up, view);
+    view = view
+      * (trackball_angle * Eigen::Scaling(camera_zoom * camera_base_zoom)
+      * Eigen::Translation3f(camera_translation)).matrix();
+
     // Set projection
     // Set projection
     if (orthographic)
     if (orthographic)
     {
     {
@@ -145,40 +147,24 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
       float fW = fH * (double)width/(double)height;
       float fW = fH * (double)width/(double)height;
       frustum(-fW, fW, -fH, fH, camera_dnear, camera_dfar,proj);
       frustum(-fW, fW, -fH, fH, camera_dnear, camera_dfar,proj);
     }
     }
-    // end projection
-
-    // Set model transformation
-    float mat[16];
-    igl::quat_to_mat(trackball_angle.coeffs().data(), mat);
-
-    for (unsigned i=0;i<4;++i)
-      for (unsigned j=0;j<4;++j)
-        model(i,j) = mat[i+4*j];
-
-    // Why not just use Eigen::Transform<double,3,Projective> for model...?
-    model.topLeftCorner(3,3)*=camera_zoom;
-    model.topLeftCorner(3,3)*=model_zoom;
-    model.col(3).head(3) += model.topLeftCorner(3,3)*model_translation;
   }
   }
 
 
   // Send transformations to the GPU
   // Send transformations to the GPU
-  GLint modeli = glGetUniformLocation(data.meshgl.shader_mesh,"model");
   GLint viewi  = glGetUniformLocation(data.meshgl.shader_mesh,"view");
   GLint viewi  = glGetUniformLocation(data.meshgl.shader_mesh,"view");
   GLint proji  = glGetUniformLocation(data.meshgl.shader_mesh,"proj");
   GLint proji  = glGetUniformLocation(data.meshgl.shader_mesh,"proj");
-  glUniformMatrix4fv(modeli, 1, GL_FALSE, model.data());
   glUniformMatrix4fv(viewi, 1, GL_FALSE, view.data());
   glUniformMatrix4fv(viewi, 1, GL_FALSE, view.data());
   glUniformMatrix4fv(proji, 1, GL_FALSE, proj.data());
   glUniformMatrix4fv(proji, 1, GL_FALSE, proj.data());
 
 
   // Light parameters
   // Light parameters
   GLint specular_exponenti    = glGetUniformLocation(data.meshgl.shader_mesh,"specular_exponent");
   GLint specular_exponenti    = glGetUniformLocation(data.meshgl.shader_mesh,"specular_exponent");
-  GLint light_position_worldi = glGetUniformLocation(data.meshgl.shader_mesh,"light_position_world");
+  GLint light_position_eyei = glGetUniformLocation(data.meshgl.shader_mesh,"light_position_eye");
   GLint lighting_factori      = glGetUniformLocation(data.meshgl.shader_mesh,"lighting_factor");
   GLint lighting_factori      = glGetUniformLocation(data.meshgl.shader_mesh,"lighting_factor");
   GLint fixed_colori          = glGetUniformLocation(data.meshgl.shader_mesh,"fixed_color");
   GLint fixed_colori          = glGetUniformLocation(data.meshgl.shader_mesh,"fixed_color");
   GLint texture_factori       = glGetUniformLocation(data.meshgl.shader_mesh,"texture_factor");
   GLint texture_factori       = glGetUniformLocation(data.meshgl.shader_mesh,"texture_factor");
 
 
   glUniform1f(specular_exponenti, data.shininess);
   glUniform1f(specular_exponenti, data.shininess);
   Vector3f rev_light = -1.*light_position;
   Vector3f rev_light = -1.*light_position;
-  glUniform3fv(light_position_worldi, 1, rev_light.data());
+  glUniform3fv(light_position_eyei, 1, rev_light.data());
   glUniform1f(lighting_factori, lighting_factor); // enables lighting
   glUniform1f(lighting_factori, lighting_factor); // enables lighting
   glUniform4f(fixed_colori, 0.0, 0.0, 0.0, 0.0);
   glUniform4f(fixed_colori, 0.0, 0.0, 0.0, 0.0);
 
 
@@ -197,8 +183,8 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
     if (data.show_lines)
     if (data.show_lines)
     {
     {
       glLineWidth(data.line_width);
       glLineWidth(data.line_width);
-      glUniform4f(fixed_colori, 
-        data.line_color[0], 
+      glUniform4f(fixed_colori,
+        data.line_color[0],
         data.line_color[1],
         data.line_color[1],
         data.line_color[2], 1.0f);
         data.line_color[2], 1.0f);
       data.meshgl.draw_mesh(false);
       data.meshgl.draw_mesh(false);
@@ -216,11 +202,9 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
     if (data.lines.rows() > 0)
     if (data.lines.rows() > 0)
     {
     {
       data.meshgl.bind_overlay_lines();
       data.meshgl.bind_overlay_lines();
-      modeli = glGetUniformLocation(data.meshgl.shader_overlay_lines,"model");
       viewi  = glGetUniformLocation(data.meshgl.shader_overlay_lines,"view");
       viewi  = glGetUniformLocation(data.meshgl.shader_overlay_lines,"view");
       proji  = glGetUniformLocation(data.meshgl.shader_overlay_lines,"proj");
       proji  = glGetUniformLocation(data.meshgl.shader_overlay_lines,"proj");
 
 
-      glUniformMatrix4fv(modeli, 1, GL_FALSE, model.data());
       glUniformMatrix4fv(viewi, 1, GL_FALSE, view.data());
       glUniformMatrix4fv(viewi, 1, GL_FALSE, view.data());
       glUniformMatrix4fv(proji, 1, GL_FALSE, proj.data());
       glUniformMatrix4fv(proji, 1, GL_FALSE, proj.data());
       // This must be enabled, otherwise glLineWidth has no effect
       // This must be enabled, otherwise glLineWidth has no effect
@@ -233,11 +217,9 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
     if (data.points.rows() > 0)
     if (data.points.rows() > 0)
     {
     {
       data.meshgl.bind_overlay_points();
       data.meshgl.bind_overlay_points();
-      modeli = glGetUniformLocation(data.meshgl.shader_overlay_points,"model");
       viewi  = glGetUniformLocation(data.meshgl.shader_overlay_points,"view");
       viewi  = glGetUniformLocation(data.meshgl.shader_overlay_points,"view");
       proji  = glGetUniformLocation(data.meshgl.shader_overlay_points,"proj");
       proji  = glGetUniformLocation(data.meshgl.shader_overlay_points,"proj");
 
 
-      glUniformMatrix4fv(modeli, 1, GL_FALSE, model.data());
       glUniformMatrix4fv(viewi, 1, GL_FALSE, view.data());
       glUniformMatrix4fv(viewi, 1, GL_FALSE, view.data());
       glUniformMatrix4fv(proji, 1, GL_FALSE, proj.data());
       glUniformMatrix4fv(proji, 1, GL_FALSE, proj.data());
       glPointSize(data.point_size);
       glPointSize(data.point_size);
@@ -363,16 +345,14 @@ IGL_INLINE igl::opengl::ViewerCore::ViewerCore()
   trackball_angle = Eigen::Quaternionf::Identity();
   trackball_angle = Eigen::Quaternionf::Identity();
   set_rotation_type(ViewerCore::ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP);
   set_rotation_type(ViewerCore::ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP);
 
 
-  // Defalut model viewing parameters
-  model_zoom = 1.0f;
-  model_translation << 0,0,0;
-
   // Camera parameters
   // Camera parameters
+  camera_base_zoom = 1.0f;
   camera_zoom = 1.0f;
   camera_zoom = 1.0f;
   orthographic = false;
   orthographic = false;
   camera_view_angle = 45.0;
   camera_view_angle = 45.0;
   camera_dnear = 1.0;
   camera_dnear = 1.0;
   camera_dfar = 100.0;
   camera_dfar = 100.0;
+  camera_translation << 0,0,0;
   camera_eye << 0, 0, 5;
   camera_eye << 0, 0, 5;
   camera_center << 0, 0, 0;
   camera_center << 0, 0, 0;
   camera_up << 0, 1, 0;
   camera_up << 0, 1, 0;

+ 5 - 19
include/igl/opengl/ViewerCore.h

@@ -101,20 +101,13 @@ public:
   float lighting_factor;
   float lighting_factor;
 
 
   RotationType rotation_type;
   RotationType rotation_type;
-
   Eigen::Quaternionf trackball_angle;
   Eigen::Quaternionf trackball_angle;
 
 
-  // Model viewing parameters
-  float model_zoom;
-  Eigen::Vector3f model_translation;
-
-  // Model viewing parameters (uv coordinates)
-  float model_zoom_uv;
-  Eigen::Vector3f model_translation_uv;
-
   // Camera parameters
   // Camera parameters
+  float camera_base_zoom;
   float camera_zoom;
   float camera_zoom;
   bool orthographic;
   bool orthographic;
+  Eigen::Vector3f camera_translation;
   Eigen::Vector3f camera_eye;
   Eigen::Vector3f camera_eye;
   Eigen::Vector3f camera_up;
   Eigen::Vector3f camera_up;
   Eigen::Vector3f camera_center;
   Eigen::Vector3f camera_center;
@@ -134,10 +127,8 @@ public:
   // Viewport size
   // Viewport size
   Eigen::Vector4f viewport;
   Eigen::Vector4f viewport;
 
 
-  // Save the OpenGL transformation matrices used for the previous rendering
-  // pass
+  // Save the OpenGL transformation matrices used for the previous rendering pass
   Eigen::Matrix4f view;
   Eigen::Matrix4f view;
-  Eigen::Matrix4f model;
   Eigen::Matrix4f proj;
   Eigen::Matrix4f proj;
   public:
   public:
       EIGEN_MAKE_ALIGNED_OPERATOR_NEW
       EIGEN_MAKE_ALIGNED_OPERATOR_NEW
@@ -161,14 +152,10 @@ namespace igl {
       SERIALIZE_MEMBER(trackball_angle);
       SERIALIZE_MEMBER(trackball_angle);
       SERIALIZE_MEMBER(rotation_type);
       SERIALIZE_MEMBER(rotation_type);
 
 
-      SERIALIZE_MEMBER(model_zoom);
-      SERIALIZE_MEMBER(model_translation);
-
-      SERIALIZE_MEMBER(model_zoom_uv);
-      SERIALIZE_MEMBER(model_translation_uv);
-
+      SERIALIZE_MEMBER(camera_base_zoom);
       SERIALIZE_MEMBER(camera_zoom);
       SERIALIZE_MEMBER(camera_zoom);
       SERIALIZE_MEMBER(orthographic);
       SERIALIZE_MEMBER(orthographic);
+      SERIALIZE_MEMBER(camera_translation);
       SERIALIZE_MEMBER(camera_view_angle);
       SERIALIZE_MEMBER(camera_view_angle);
       SERIALIZE_MEMBER(camera_dnear);
       SERIALIZE_MEMBER(camera_dnear);
       SERIALIZE_MEMBER(camera_dfar);
       SERIALIZE_MEMBER(camera_dfar);
@@ -184,7 +171,6 @@ namespace igl {
 
 
       SERIALIZE_MEMBER(viewport);
       SERIALIZE_MEMBER(viewport);
       SERIALIZE_MEMBER(view);
       SERIALIZE_MEMBER(view);
-      SERIALIZE_MEMBER(model);
       SERIALIZE_MEMBER(proj);
       SERIALIZE_MEMBER(proj);
     }
     }
 
 

+ 5 - 5
include/igl/opengl/glfw/Viewer.cpp

@@ -597,7 +597,7 @@ namespace glfw
 
 
     down = true;
     down = true;
 
 
-    down_translation = core.model_translation;
+    down_translation = core.camera_translation;
 
 
 
 
     // Initialization code for the trackball
     // Initialization code for the trackball
@@ -613,7 +613,7 @@ namespace glfw
     Eigen::Vector3f coord =
     Eigen::Vector3f coord =
       igl::project(
       igl::project(
         Eigen::Vector3f(center(0),center(1),center(2)),
         Eigen::Vector3f(center(0),center(1),center(2)),
-        (core.view * core.model).eval(),
+        core.view,
         core.proj,
         core.proj,
         core.viewport);
         core.viewport);
     down_mouse_z = coord[2];
     down_mouse_z = coord[2];
@@ -720,11 +720,11 @@ namespace glfw
         case MouseMode::Translation:
         case MouseMode::Translation:
         {
         {
           //translation
           //translation
-          Eigen::Vector3f pos1 = igl::unproject(Eigen::Vector3f(mouse_x, core.viewport[3] - mouse_y, down_mouse_z), (core.view * core.model).eval(), core.proj, core.viewport);
-          Eigen::Vector3f pos0 = igl::unproject(Eigen::Vector3f(down_mouse_x, core.viewport[3] - down_mouse_y, down_mouse_z), (core.view * core.model).eval(), core.proj, core.viewport);
+          Eigen::Vector3f pos1 = igl::unproject(Eigen::Vector3f(mouse_x, core.viewport[3] - mouse_y, down_mouse_z), core.view, core.proj, core.viewport);
+          Eigen::Vector3f pos0 = igl::unproject(Eigen::Vector3f(down_mouse_x, core.viewport[3] - down_mouse_y, down_mouse_z), core.view, core.proj, core.viewport);
 
 
           Eigen::Vector3f diff = pos1 - pos0;
           Eigen::Vector3f diff = pos1 - pos0;
-          core.model_translation = down_translation + Eigen::Vector3f(diff[0],diff[1],diff[2]);
+          core.camera_translation = down_translation + Eigen::Vector3f(diff[0],diff[1],diff[2]);
 
 
           break;
           break;
         }
         }

+ 2 - 3
include/igl/opengl/glfw/imgui/ImGuiMenu.cpp

@@ -339,10 +339,9 @@ IGL_INLINE void ImGuiMenu::draw_labels(const igl::opengl::ViewerData &data)
 
 
 IGL_INLINE void ImGuiMenu::draw_text(Eigen::Vector3d pos, Eigen::Vector3d normal, const std::string &text)
 IGL_INLINE void ImGuiMenu::draw_text(Eigen::Vector3d pos, Eigen::Vector3d normal, const std::string &text)
 {
 {
-  Eigen::Matrix4f view_matrix = viewer->core.view * viewer->core.model;
   pos += normal * 0.005f * viewer->core.object_scale;
   pos += normal * 0.005f * viewer->core.object_scale;
   Eigen::Vector3f coord = igl::project(Eigen::Vector3f(pos.cast<float>()),
   Eigen::Vector3f coord = igl::project(Eigen::Vector3f(pos.cast<float>()),
-    view_matrix, viewer->core.proj, viewer->core.viewport);
+    viewer->core.view, viewer->core.proj, viewer->core.viewport);
 
 
   // Draw text labels slightly bigger than normal text
   // Draw text labels slightly bigger than normal text
   ImDrawList* drawList = ImGui::GetWindowDrawList();
   ImDrawList* drawList = ImGui::GetWindowDrawList();
@@ -375,4 +374,4 @@ IGL_INLINE float ImGuiMenu::hidpi_scaling()
 } // end namespace
 } // end namespace
 } // end namespace
 } // end namespace
 } // end namespace
 } // end namespace
-} // end namespace
+} // end namespace

+ 6 - 16
python/modules/py_igl_opengl_glfw.cpp

@@ -241,7 +241,7 @@ py::class_<igl::opengl::ViewerCore> viewercore_class(me, "ViewerCore");
     })
     })
 
 
     .def_readwrite("lighting_factor",&igl::opengl::ViewerCore::lighting_factor)
     .def_readwrite("lighting_factor",&igl::opengl::ViewerCore::lighting_factor)
-    .def_readwrite("model_zoom",&igl::opengl::ViewerCore::model_zoom)
+    .def_readwrite("camera_base_zoom",&igl::opengl::ViewerCore::camera_base_zoom)
 
 
     .def_property("trackball_angle",
     .def_property("trackball_angle",
     [](const igl::opengl::ViewerCore& core) {return Eigen::Quaterniond(core.trackball_angle.cast<double>());},
     [](const igl::opengl::ViewerCore& core) {return Eigen::Quaterniond(core.trackball_angle.cast<double>());},
@@ -250,22 +250,12 @@ py::class_<igl::opengl::ViewerCore> viewercore_class(me, "ViewerCore");
       core.trackball_angle = Eigen::Quaternionf(q.cast<float>());
       core.trackball_angle = Eigen::Quaternionf(q.cast<float>());
     })
     })
 
 
-    .def_property("model_translation",
-    [](const igl::opengl::ViewerCore& core) {return Eigen::MatrixXd(core.model_translation.cast<double>());},
+    .def_property("camera_translation",
+    [](const igl::opengl::ViewerCore& core) {return Eigen::MatrixXd(core.camera_translation.cast<double>());},
     [](igl::opengl::ViewerCore& core, const Eigen::MatrixXd& v)
     [](igl::opengl::ViewerCore& core, const Eigen::MatrixXd& v)
     {
     {
-      assert_is_Vector3("model_translation",v);
-      core.model_translation = Eigen::Vector3f(v.cast<float>());
-    })
-
-    .def_readwrite("model_zoom_uv",&igl::opengl::ViewerCore::model_zoom_uv)
-
-    .def_property("model_translation_uv",
-    [](const igl::opengl::ViewerCore& core) {return Eigen::MatrixXd(core.model_translation_uv.cast<double>());},
-    [](igl::opengl::ViewerCore& core, const Eigen::MatrixXd& v)
-    {
-      assert_is_Vector3("model_translation_uv",v);
-      core.model_translation_uv = Eigen::Vector3f(v.cast<float>());
+      assert_is_Vector3("camera_translation",v);
+      core.camera_translation = Eigen::Vector3f(v.cast<float>());
     })
     })
 
 
     .def_readwrite("camera_zoom",&igl::opengl::ViewerCore::camera_zoom)
     .def_readwrite("camera_zoom",&igl::opengl::ViewerCore::camera_zoom)
@@ -380,7 +370,7 @@ py::class_<igl::opengl::ViewerCore> viewercore_class(me, "ViewerCore");
     viewer_class
     viewer_class
     .def(py::init<>())
     .def(py::init<>())
     //.def_readwrite("data", &igl::opengl::glfw::Viewer::data)
     //.def_readwrite("data", &igl::opengl::glfw::Viewer::data)
-   
+
     // .def_property("data",
     // .def_property("data",
     // [](igl::opengl::glfw::Viewer& viewer) {return viewer.data();},
     // [](igl::opengl::glfw::Viewer& viewer) {return viewer.data();},
     // [](igl::opengl::glfw::Viewer& viewer, const igl::opengl::ViewerData& data)
     // [](igl::opengl::glfw::Viewer& viewer, const igl::opengl::ViewerData& data)

+ 1 - 1
python/tutorial/708_Picking.py

@@ -24,7 +24,7 @@ def mouse_down(viewer, a, b):
     # Cast a ray in the view direction starting from the mouse position
     # Cast a ray in the view direction starting from the mouse position
     fid = igl.eigen.MatrixXi([-1])
     fid = igl.eigen.MatrixXi([-1])
     coord = igl.eigen.MatrixXd([viewer.current_mouse_x, viewer.core.viewport[3] - viewer.current_mouse_y])
     coord = igl.eigen.MatrixXd([viewer.current_mouse_x, viewer.core.viewport[3] - viewer.current_mouse_y])
-    hit = igl.unproject_onto_mesh(coord, viewer.core.view * viewer.core.model,
+    hit = igl.unproject_onto_mesh(coord, viewer.core.view,
       viewer.core.proj, viewer.core.viewport, V, F, fid, bc)
       viewer.core.proj, viewer.core.viewport, V, F, fid, bc)
     if hit:
     if hit:
         # paint hit red
         # paint hit red

+ 2 - 2
tutorial/708_Picking/main.cpp

@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
   // Initialize white
   // Initialize white
   C = Eigen::MatrixXd::Constant(F.rows(),3,1);
   C = Eigen::MatrixXd::Constant(F.rows(),3,1);
   igl::opengl::glfw::Viewer viewer;
   igl::opengl::glfw::Viewer viewer;
-  viewer.callback_mouse_down = 
+  viewer.callback_mouse_down =
     [&V,&F,&C](igl::opengl::glfw::Viewer& viewer, int, int)->bool
     [&V,&F,&C](igl::opengl::glfw::Viewer& viewer, int, int)->bool
   {
   {
     int fid;
     int fid;
@@ -24,7 +24,7 @@ int main(int argc, char *argv[])
     // Cast a ray in the view direction starting from the mouse position
     // Cast a ray in the view direction starting from the mouse position
     double x = viewer.current_mouse_x;
     double x = viewer.current_mouse_x;
     double y = viewer.core.viewport(3) - viewer.current_mouse_y;
     double y = viewer.core.viewport(3) - viewer.current_mouse_y;
-    if(igl::unproject_onto_mesh(Eigen::Vector2f(x,y), viewer.core.view * viewer.core.model,
+    if(igl::unproject_onto_mesh(Eigen::Vector2f(x,y), viewer.core.view,
       viewer.core.proj, viewer.core.viewport, V, F, fid, bc))
       viewer.core.proj, viewer.core.viewport, V, F, fid, bc))
     {
     {
       // paint hit red
       // paint hit red