|
@@ -230,91 +230,6 @@ namespace igl
|
|
|
|
|
|
ngui->layout();
|
|
|
|
|
|
- // Create a tweak bar
|
|
|
- /*bar = TwNewBar("libIGL-Viewer");
|
|
|
- TwDefine(" libIGL-Viewer help='This is a simple 3D mesh viewer.' "); // Message added to the help bar->
|
|
|
- TwDefine(" libIGL-Viewer size='200 685'"); // change default tweak bar size
|
|
|
- TwDefine(" libIGL-Viewer color='76 76 127' "); // change default tweak bar color
|
|
|
- TwDefine(" libIGL-Viewer refresh=0.5"); // change refresh rate
|
|
|
-
|
|
|
- // ---------------------- LOADING ----------------------
|
|
|
-
|
|
|
- #ifdef ENABLE_SERIALIZATION
|
|
|
- TwAddButton(bar,"Load Scene", load_scene_cb, this, "group='Workspace'");
|
|
|
- TwAddButton(bar,"Save Scene", save_scene_cb, this, "group='Workspace'");
|
|
|
- #endif
|
|
|
-
|
|
|
- #ifdef ENABLE_IO
|
|
|
- TwAddButton(bar,"Load Mesh", open_dialog_mesh, this, "group='Mesh' key=o");
|
|
|
- #endif
|
|
|
-
|
|
|
- // ---------------------- SCENE ----------------------
|
|
|
-
|
|
|
- TwAddButton(bar,"Center object", align_camera_center_cb, this,
|
|
|
- " group='Viewing Options'"
|
|
|
- " label='Center object' key=A help='Set the center of the camera to the mesh center.'");
|
|
|
- TwAddVarRW(bar, "Zoom", TW_TYPE_FLOAT, &(core.camera_zoom),
|
|
|
- " min=0.05 max=50 step=0.1 keyIncr=+ keyDecr=- help='Scale the object (1=original size).' group='Scene'");
|
|
|
- TwAddButton(bar,"SnapView", snap_to_canonical_quaternion_cb, this,
|
|
|
- " group='Scene'"
|
|
|
- " label='Snap to canonical view' key=Z "
|
|
|
- " help='Snaps view to nearest canonical view.'");
|
|
|
- TwAddVarRW(bar,"LightDir", TW_TYPE_DIR3F, core.light_position.data(),
|
|
|
- " group='Scene'"
|
|
|
- " label='Light direction' open help='Change the light direction.' ");
|
|
|
-
|
|
|
- // ---------------------- DRAW OPTIONS ----------------------
|
|
|
- TwAddVarRW(bar, "ToggleOrthographic", TW_TYPE_BOOLCPP, &(core.orthographic),
|
|
|
- " group='Viewing Options'"
|
|
|
- " label='Orthographic view' "
|
|
|
- " help='Toggles orthographic / perspective view. Default: perspective.'");
|
|
|
- TwAddVarRW(bar, "Rotation", TW_TYPE_QUAT4F, &(core.trackball_angle),
|
|
|
- " group='Viewing Options'"
|
|
|
- " label='Rotation'"
|
|
|
- " help='Rotates view.'");
|
|
|
- TwAddVarCB(bar,"Face-based Normals/Colors", TW_TYPE_BOOLCPP, set_face_based_cb, get_face_based_cb, this,
|
|
|
- " group='Draw options'"
|
|
|
- " label='Face-based' key=T help='Toggle per face shading/colors.' ");
|
|
|
-
|
|
|
- TwAddVarRW(bar,"Show texture", TW_TYPE_BOOLCPP, &(core.show_texture),
|
|
|
- " group='Draw options'");
|
|
|
-
|
|
|
- TwAddVarCB(bar,"Invert Normals", TW_TYPE_BOOLCPP, set_invert_normals_cb, get_invert_normals_cb, this,
|
|
|
- " group='Draw options'"
|
|
|
- " label='Invert normals' key=i help='Invert normal directions for inside out meshes.' ");
|
|
|
-
|
|
|
- TwAddVarRW(bar,"ShowOverlay", TW_TYPE_BOOLCPP, &(core.show_overlay),
|
|
|
- " group='Draw options'"
|
|
|
- " label='Show overlay' key=o help='Show the overlay layers.' ");
|
|
|
- TwAddVarRW(bar,"ShowOverlayDepth", TW_TYPE_BOOLCPP, &(core.show_overlay_depth),
|
|
|
- " group='Draw options'"
|
|
|
- " label='Show overlay depth test' help='Enable the depth test for overlay layer.' ");
|
|
|
- TwAddVarRW(bar,"Background color", TW_TYPE_COLOR3F,
|
|
|
- core.background_color.data(),
|
|
|
- " help='Select a background color' colormode=hls group='Draw options'");
|
|
|
- TwAddVarRW(bar, "LineColor", TW_TYPE_COLOR3F,
|
|
|
- core.line_color.data(),
|
|
|
- " label='Line color' help='Select a outline color' group='Draw options'");
|
|
|
- TwAddVarRW(bar,"Shininess",TW_TYPE_FLOAT,&core.shininess," group='Draw options'"
|
|
|
- " min=1 max=128");
|
|
|
-
|
|
|
- // ---------------------- Overlays ----------------------
|
|
|
-
|
|
|
- TwAddVarRW(bar,"Wireframe", TW_TYPE_BOOLCPP, &(core.show_lines),
|
|
|
- " group='Overlays'"
|
|
|
- " label='Wireframe' key=l help='Toggle wire frame of mesh'");
|
|
|
- TwAddVarRW(bar,"Fill", TW_TYPE_BOOLCPP, &(core.show_faces),
|
|
|
- " group='Overlays'"
|
|
|
- " label='Fill' key=t help='Display filled polygons of mesh'");
|
|
|
- TwAddVarRW(bar,"ShowVertexId", TW_TYPE_BOOLCPP, &(core.show_vertid),
|
|
|
- " group='Overlays'"
|
|
|
- " label='Show Vertex Labels' key=';' help='Toggle vertex indices'");
|
|
|
- TwAddVarRW(bar,"ShowFaceId", TW_TYPE_BOOLCPP, &(core.show_faceid),
|
|
|
- " group='Overlays'"
|
|
|
- " label='Show Faces Labels' key='CTRL+;' help='Toggle face"
|
|
|
- " indices'");
|
|
|
- */
|
|
|
-
|
|
|
core.init();
|
|
|
|
|
|
if (callback_init)
|
|
@@ -514,21 +429,21 @@ namespace igl
|
|
|
|
|
|
char k = key;
|
|
|
|
|
|
- if(key == GLFW_KEY_S && modifiers == GLFW_MOD_SHIFT)
|
|
|
- mouse_scroll(1);
|
|
|
-
|
|
|
- if(key == GLFW_KEY_A && modifiers == GLFW_MOD_SHIFT)
|
|
|
- mouse_scroll(-1);
|
|
|
-
|
|
|
- // Why aren't these handled via AntTweakBar?
|
|
|
- if(key == GLFW_KEY_Z) // Don't use 'Z' because that clobbers snap_to_canonical_view_quat
|
|
|
- core.trackball_angle << 0.0f, 0.0f, 0.0f, 1.0f;
|
|
|
-
|
|
|
- if(key == GLFW_KEY_Y)
|
|
|
- core.trackball_angle << -sqrt(2.0f)/2.0f, 0.0f, 0.0f, sqrt(2.0f)/2.0f;
|
|
|
-
|
|
|
- if(key == GLFW_KEY_X)
|
|
|
- core.trackball_angle << -0.5f, -0.5f, -0.5f, 0.5f;
|
|
|
+ // if(key == GLFW_KEY_S && modifiers == GLFW_MOD_SHIFT)
|
|
|
+ // mouse_scroll(1);
|
|
|
+ //
|
|
|
+ // if(key == GLFW_KEY_A && modifiers == GLFW_MOD_SHIFT)
|
|
|
+ // mouse_scroll(-1);
|
|
|
+
|
|
|
+ // // Why aren't these handled via AntTweakBar?
|
|
|
+ // if(key == GLFW_KEY_Z) // Don't use 'Z' because that clobbers snap_to_canonical_view_quat
|
|
|
+ // core.trackball_angle << 0.0f, 0.0f, 0.0f, 1.0f;
|
|
|
+ //
|
|
|
+ // if(key == GLFW_KEY_Y)
|
|
|
+ // core.trackball_angle << -sqrt(2.0f)/2.0f, 0.0f, 0.0f, sqrt(2.0f)/2.0f;
|
|
|
+ //
|
|
|
+ // if(key == GLFW_KEY_X)
|
|
|
+ // core.trackball_angle << -0.5f, -0.5f, -0.5f, 0.5f;
|
|
|
|
|
|
|
|
|
return false;
|