ImGuizmoWidget.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef IGL_OPENGL_GFLW_IMGUI_IMGUIZMOPLUGIN_H
  2. #define IGL_OPENGL_GFLW_IMGUI_IMGUIZMOPLUGIN_H
  3. #include "../../../igl_inline.h"
  4. #include "ImGuiMenu.h"
  5. #include <imgui.h>
  6. #include <imgui_internal.h>
  7. #include <ImGuizmo.h>
  8. #include <Eigen/Dense>
  9. namespace igl{ namespace opengl{ namespace glfw{ namespace imgui{
  10. /// Widget for a guizmo (3D transform manipulator)
  11. class ImGuizmoWidget : public ImGuiWidget
  12. {
  13. public:
  14. // callback(T) called when the stored transform T changes
  15. std::function<void(const Eigen::Matrix4f &)> callback;
  16. // Whether to display
  17. bool visible = true;
  18. // whether rotating, translating or scaling
  19. ImGuizmo::OPERATION operation;
  20. // stored transformation
  21. Eigen::Matrix4f T;
  22. // Initilize with rotate operation on an identity transform (at origin)
  23. ImGuizmoWidget():operation(ImGuizmo::ROTATE),T(Eigen::Matrix4f::Identity()){};
  24. IGL_INLINE virtual void init(Viewer *_viewer, ImGuiPlugin *_plugin) override;
  25. IGL_INLINE virtual void draw() override;
  26. };
  27. }}}}
  28. #ifndef IGL_STATIC_LIBRARY
  29. # include "ImGuizmoWidget.cpp"
  30. #endif
  31. #endif