|
@@ -6,6 +6,8 @@
|
|
|
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
|
|
// obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
+// Must defined this before including Viewer.h
|
|
|
+#define IGL_VIEWER_VIEWER_CPP
|
|
|
#include "Viewer.h"
|
|
|
|
|
|
#ifdef _WIN32
|
|
@@ -273,6 +275,33 @@ namespace viewer
|
|
|
|
|
|
IGL_INLINE Viewer::Viewer()
|
|
|
{
|
|
|
+ // This mess is to help debug problems arising when compiling
|
|
|
+ // libiglviewer.a with(without) IGL_STATIC_LIBRARY defined and including
|
|
|
+ // Viewer.h without(with) IGL_STATIC_LIBRARY defined.
|
|
|
+#ifdef IGL_STATIC_LIBRARY
|
|
|
+ std::cout<<"igl_with_nanogui_defined_consistently: "<<igl_with_nanogui_defined_consistently()<<std::endl;
|
|
|
+ std::cout<<"igl_with_nanogui_defined_at_compile: "<< igl_with_nanogui_defined_at_compile() <<std::endl;
|
|
|
+ std::cout<<"igl_with_nanogui_defined_at_include: "<< igl_with_nanogui_defined_at_include() <<std::endl;
|
|
|
+ // First try to first assert
|
|
|
+ assert(igl_with_nanogui_defined_consistently() &&
|
|
|
+ "Must compile and include with IGL_VIEWER_WITH_NANOGUI defined consistently");
|
|
|
+#ifdef NDEBUG
|
|
|
+ // Second print warning since it's hopeless that this will run if wrong.
|
|
|
+ if(!igl_with_nanogui_defined_consistently())
|
|
|
+ {
|
|
|
+ std::cerr<<
|
|
|
+ "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<std::endl<<std::endl<<
|
|
|
+ "WARNING: Seems that IGL_WITH_NANOGUI " <<
|
|
|
+ (igl_with_nanogui_defined_at_compile() ? "was" : "was not") <<
|
|
|
+ " defined"<<std::endl<<"during compilation of Viewer.cpp and "<<
|
|
|
+ (igl_with_nanogui_defined_at_include() ? "was" : "was not") <<
|
|
|
+ " defined"<<std::endl<<"during inclusion of Viewer.h"<<std::endl <<
|
|
|
+ "You're about to get some nasty memory errors."<<std::endl<<std::endl<<
|
|
|
+ "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<std::endl;
|
|
|
+ }
|
|
|
+#endif
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef IGL_VIEWER_WITH_NANOGUI
|
|
|
ngui = nullptr;
|
|
|
screen = nullptr;
|
|
@@ -318,6 +347,10 @@ namespace viewer
|
|
|
Z Snap to canonical view
|
|
|
[,] Toggle between rotation control types (e.g. trackball, two-axis
|
|
|
valuator with fixed up)
|
|
|
+#ifdef IGL_VIEWER_WITH_NANOGUI
|
|
|
+ ; Toggle vertex labels
|
|
|
+ : Toggle face labels
|
|
|
+#endif
|
|
|
|
|
|
)");
|
|
|
std::cout<<usage;
|
|
@@ -530,6 +563,14 @@ namespace viewer
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
+#ifdef IGL_VIEWER_WITH_NANOGUI
|
|
|
+ case ';':
|
|
|
+ core.show_vertid = !core.show_vertid;
|
|
|
+ return true;
|
|
|
+ case ':':
|
|
|
+ core.show_faceid = !core.show_faceid;
|
|
|
+ return true;
|
|
|
+#endif
|
|
|
default: break;//do nothing
|
|
|
}
|
|
|
return false;
|
|
@@ -1003,5 +1044,20 @@ namespace viewer
|
|
|
launch_shut();
|
|
|
return EXIT_SUCCESS;
|
|
|
}
|
|
|
+ IGL_INLINE bool Viewer::igl_with_nanogui_defined_at_compile()
|
|
|
+ {
|
|
|
+#ifdef IGL_VIEWER_WITH_NANOGUI
|
|
|
+ return true;
|
|
|
+#else
|
|
|
+ return false;
|
|
|
+#endif
|
|
|
+ }
|
|
|
+ IGL_INLINE bool Viewer::igl_with_nanogui_defined_consistently()
|
|
|
+ {
|
|
|
+ return
|
|
|
+ igl_with_nanogui_defined_at_compile() ==
|
|
|
+ igl_with_nanogui_defined_at_include();
|
|
|
+ }
|
|
|
} // end namespace
|
|
|
}
|
|
|
+
|