ProjectStore.hpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #pragma once
  2. // Include modules
  3. #include "lib3mf_implicit.hpp"
  4. #include "OptiTrackPoint.hpp"
  5. #include "TrackSystemSettingsStructs.hpp"
  6. // Include dependencies
  7. #include <string>
  8. #include <nlohmann/json.hpp>
  9. using json = nlohmann::json;
  10. class ProjectStore {
  11. public:
  12. // Create an empty project
  13. ProjectStore();
  14. // Destructor
  15. ~ProjectStore();
  16. // Load a mesh
  17. void loadMesh(std::string meshFile);
  18. // Load a project
  19. bool loadProject(std::string projectFile);
  20. // Save the project to the loaded file
  21. bool saveProject();
  22. // Save the project to a new file
  23. bool saveProject(std::string projectFile);
  24. // Export the project
  25. bool exportProject(std::string path, ExportSettings settings);
  26. // NORMAL MODIFIER
  27. // Update normal modifier
  28. void updateNormalModifier(osg::Vec3 modifier);
  29. // Return normal modifier
  30. osg::Vec3 getNormalModifier();
  31. // OPTITRACK
  32. // Get all OptiTrack points
  33. std::vector<OptiTrackPoint*> getOptiTrackPoints();
  34. // Add an OptiTrack point
  35. void addOptiTrackPoint(osg::Vec3 point, osg::Vec3 normal);
  36. // Remove an OptiTrack point
  37. void removeOptiTrackPoint();
  38. // Update actual OptiTrack settings
  39. void updateOptiTrackSettings(OptiTrackSettings optiTrackSettings);
  40. // Return OptiTrack settings
  41. OptiTrackSettings getOptiTrackSettings();
  42. private:
  43. bool _projectLoaded;
  44. bool _projectModified;
  45. Lib3MF::PWrapper _wrapper;
  46. Lib3MF::PModel _project;
  47. std::string _projectFile;
  48. std::vector<OptiTrackPoint*> _optiTrackPoints;
  49. OptiTrackSettings _optiTrackSettings = OptiTrackSettings {OPTITRACK_DEFAULT_LENGTH, OPTITRACK_DEFAULT_RADIUS};
  50. EMFTrackSettings _emfTrackSettings;
  51. SteamVRTrackSettings _steamVrTrackSettings;
  52. osg::Vec3 _normalModifier = osg::Vec3(0.0f, 0.0f, 0.0f);
  53. void load3mfLib();
  54. void render3MFMesh();
  55. void updateMetaData();
  56. void loadMetaData();
  57. std::vector<float> osgVecToStdVec(osg::Vec3f input);
  58. osg::Vec3f stdVecToOsgVec(std::vector<float> input);
  59. };