ProjectStore.hpp 1.9 KB

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