|
@@ -113,7 +113,7 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
|
|
/* Bind and potentially refresh mesh/line/point data */
|
|
/* Bind and potentially refresh mesh/line/point data */
|
|
if (data.dirty)
|
|
if (data.dirty)
|
|
{
|
|
{
|
|
- opengl.set_data(data, invert_normals);
|
|
|
|
|
|
+ opengl.set_data(data, data.invert_normals);
|
|
data.dirty = ViewerData::DIRTY_NONE;
|
|
data.dirty = ViewerData::DIRTY_NONE;
|
|
}
|
|
}
|
|
opengl.bind_mesh();
|
|
opengl.bind_mesh();
|
|
@@ -177,7 +177,7 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
|
|
GLint fixed_colori = glGetUniformLocation(opengl.shader_mesh,"fixed_color");
|
|
GLint fixed_colori = glGetUniformLocation(opengl.shader_mesh,"fixed_color");
|
|
GLint texture_factori = glGetUniformLocation(opengl.shader_mesh,"texture_factor");
|
|
GLint texture_factori = glGetUniformLocation(opengl.shader_mesh,"texture_factor");
|
|
|
|
|
|
- glUniform1f(specular_exponenti, 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_worldi, 1, rev_light.data());
|
|
glUniform1f(lighting_factori, lighting_factor); // enables lighting
|
|
glUniform1f(lighting_factori, lighting_factor); // enables lighting
|
|
@@ -186,26 +186,28 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
|
|
if (data.V.rows()>0)
|
|
if (data.V.rows()>0)
|
|
{
|
|
{
|
|
// Render fill
|
|
// Render fill
|
|
- if (show_faces)
|
|
|
|
|
|
+ if (data.show_faces)
|
|
{
|
|
{
|
|
// Texture
|
|
// Texture
|
|
- glUniform1f(texture_factori, show_texture ? 1.0f : 0.0f);
|
|
|
|
|
|
+ glUniform1f(texture_factori, data.show_texture ? 1.0f : 0.0f);
|
|
opengl.draw_mesh(true);
|
|
opengl.draw_mesh(true);
|
|
glUniform1f(texture_factori, 0.0f);
|
|
glUniform1f(texture_factori, 0.0f);
|
|
}
|
|
}
|
|
|
|
|
|
// Render wireframe
|
|
// Render wireframe
|
|
- if (show_lines)
|
|
|
|
|
|
+ if (data.show_lines)
|
|
{
|
|
{
|
|
- glLineWidth(line_width);
|
|
|
|
- glUniform4f(fixed_colori, line_color[0], line_color[1],
|
|
|
|
- line_color[2], 1.0f);
|
|
|
|
|
|
+ glLineWidth(data.line_width);
|
|
|
|
+ glUniform4f(fixed_colori,
|
|
|
|
+ data.line_color[0],
|
|
|
|
+ data.line_color[1],
|
|
|
|
+ data.line_color[2], 1.0f);
|
|
opengl.draw_mesh(false);
|
|
opengl.draw_mesh(false);
|
|
glUniform4f(fixed_colori, 0.0f, 0.0f, 0.0f, 0.0f);
|
|
glUniform4f(fixed_colori, 0.0f, 0.0f, 0.0f, 0.0f);
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef IGL_VIEWER_WITH_NANOGUI
|
|
#ifdef IGL_VIEWER_WITH_NANOGUI
|
|
- if (show_vertid)
|
|
|
|
|
|
+ if (data.show_vertid)
|
|
{
|
|
{
|
|
textrenderer.BeginDraw(view*model, proj, viewport, object_scale);
|
|
textrenderer.BeginDraw(view*model, proj, viewport, object_scale);
|
|
for (int i=0; i<data.V.rows(); ++i)
|
|
for (int i=0; i<data.V.rows(); ++i)
|
|
@@ -213,7 +215,7 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
|
|
textrenderer.EndDraw();
|
|
textrenderer.EndDraw();
|
|
}
|
|
}
|
|
|
|
|
|
- if (show_faceid)
|
|
|
|
|
|
+ if (data.show_faceid)
|
|
{
|
|
{
|
|
textrenderer.BeginDraw(view*model, proj, viewport, object_scale);
|
|
textrenderer.BeginDraw(view*model, proj, viewport, object_scale);
|
|
|
|
|
|
@@ -231,9 +233,9 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
- if (show_overlay)
|
|
|
|
|
|
+ if (data.show_overlay)
|
|
{
|
|
{
|
|
- if (show_overlay_depth)
|
|
|
|
|
|
+ if (data.show_overlay_depth)
|
|
glEnable(GL_DEPTH_TEST);
|
|
glEnable(GL_DEPTH_TEST);
|
|
else
|
|
else
|
|
glDisable(GL_DEPTH_TEST);
|
|
glDisable(GL_DEPTH_TEST);
|
|
@@ -250,7 +252,7 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
|
|
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
|
|
glEnable(GL_LINE_SMOOTH);
|
|
glEnable(GL_LINE_SMOOTH);
|
|
- glLineWidth(line_width);
|
|
|
|
|
|
+ glLineWidth(data.line_width);
|
|
|
|
|
|
opengl.draw_overlay_lines();
|
|
opengl.draw_overlay_lines();
|
|
}
|
|
}
|
|
@@ -265,7 +267,7 @@ IGL_INLINE void igl::opengl::ViewerCore::draw(
|
|
glUniformMatrix4fv(modeli, 1, GL_FALSE, model.data());
|
|
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(point_size);
|
|
|
|
|
|
+ glPointSize(data.point_size);
|
|
|
|
|
|
opengl.draw_overlay_points();
|
|
opengl.draw_overlay_points();
|
|
}
|
|
}
|
|
@@ -389,12 +391,8 @@ IGL_INLINE void igl::opengl::ViewerCore::set_rotation_type(
|
|
|
|
|
|
IGL_INLINE igl::opengl::ViewerCore::ViewerCore()
|
|
IGL_INLINE igl::opengl::ViewerCore::ViewerCore()
|
|
{
|
|
{
|
|
- // Default shininess
|
|
|
|
- shininess = 35.0f;
|
|
|
|
-
|
|
|
|
// Default colors
|
|
// Default colors
|
|
background_color << 0.3f, 0.3f, 0.5f, 1.0f;
|
|
background_color << 0.3f, 0.3f, 0.5f, 1.0f;
|
|
- line_color << 0.0f, 0.0f, 0.0f, 1.0f;
|
|
|
|
|
|
|
|
// Default lights settings
|
|
// Default lights settings
|
|
light_position << 0.0f, -0.30f, -5.0f;
|
|
light_position << 0.0f, -0.30f, -5.0f;
|
|
@@ -418,20 +416,8 @@ IGL_INLINE igl::opengl::ViewerCore::ViewerCore()
|
|
camera_center << 0, 0, 0;
|
|
camera_center << 0, 0, 0;
|
|
camera_up << 0, 1, 0;
|
|
camera_up << 0, 1, 0;
|
|
|
|
|
|
- // Default visualization options
|
|
|
|
- show_faces = true;
|
|
|
|
- show_lines = true;
|
|
|
|
- invert_normals = false;
|
|
|
|
- show_overlay = true;
|
|
|
|
- show_overlay_depth = true;
|
|
|
|
- show_vertid = false;
|
|
|
|
- show_faceid = false;
|
|
|
|
- show_texture = false;
|
|
|
|
depth_test = true;
|
|
depth_test = true;
|
|
|
|
|
|
- // Default point size / line width
|
|
|
|
- point_size = 30;
|
|
|
|
- line_width = 0.5f;
|
|
|
|
is_animating = false;
|
|
is_animating = false;
|
|
animation_max_fps = 30.;
|
|
animation_max_fps = 30.;
|
|
|
|
|