ProjectStore.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #pragma once
  2. // Include modules
  3. #include "lib3mf_implicit.hpp"
  4. #include "OptiTrackPoint.hpp"
  5. #include "SteamVRTrackPoint.hpp"
  6. #include "TrackSystemSettingsStructs.hpp"
  7. #include "OpenScadRenderer.hpp"
  8. #include "enums.hpp"
  9. // Include dependencies
  10. #include <string>
  11. #include <nlohmann/json.hpp>
  12. using json = nlohmann::json;
  13. class ProjectStore {
  14. public:
  15. // Create an empty project
  16. ProjectStore();
  17. // Destructor
  18. ~ProjectStore();
  19. // Load a mesh
  20. void loadMesh(std::string meshFile);
  21. // Load a project
  22. bool loadProject(std::string projectFile);
  23. // Save the project to the loaded file
  24. bool saveProject();
  25. // Save the project to a new file
  26. bool saveProject(std::string projectFile);
  27. // Export the project
  28. bool exportProject(std::string path, ExportSettings settings);
  29. // UNIVERSAL
  30. // Get trackpoint
  31. TrackPoint* getTrackPointById(int id, ActiveTrackingSystem activeTrackingSystem);
  32. // Add trackpoint
  33. void addTrackPoint(osg::Vec3 point, osg::Vec3 normal, ActiveTrackingSystem activeTrackingSystem);
  34. // Count trackpoints
  35. int getCount(ActiveTrackingSystem activeTrackingSystem);
  36. // Remove trackpoint
  37. void removeTrackPoint(int id, ActiveTrackingSystem activeTrackingSystem);
  38. // NORMAL MODIFIER
  39. // Update normal modifier
  40. void updateNormalModifier(osg::Vec3 modifier);
  41. // Return normal modifier
  42. osg::Vec3 getNormalModifier();
  43. // OPTITRACK
  44. // Get all OptiTrack points
  45. std::vector<OptiTrackPoint*> getOptiTrackPoints();
  46. // Update actual OptiTrack settings
  47. void updateOptiTrackSettings(OptiTrackSettings optiTrackSettings);
  48. // Return OptiTrack settings
  49. OptiTrackSettings getOptiTrackSettings();
  50. // STEAM VR TRACK
  51. // Get all SteamVRTrack points
  52. std::vector<SteamVRTrackPoint*> getSteamVRTrackPoints();
  53. // Update actual SteamVRTrack settings
  54. void updateSteamVRTrackSettings(SteamVRTrackSettings steamVrTrackSettings);
  55. // Return SteamVRTrack settings
  56. SteamVRTrackSettings getSteamVRTrackSettings();
  57. // ACTION POINTS
  58. // Get all Action points
  59. std::vector<TrackPoint*> getActionPoints();
  60. private:
  61. bool _projectLoaded;
  62. bool _projectModified;
  63. Lib3MF::PWrapper _wrapper;
  64. Lib3MF::PModel _project;
  65. std::string _projectFile;
  66. std::vector<OptiTrackPoint*> _optiTrackPoints;
  67. std::vector<SteamVRTrackPoint*> _steamVrTrackPoints;
  68. std::vector<TrackPoint*> _actionPoints;
  69. OptiTrackSettings _optiTrackSettings = OptiTrackSettings {OPTITRACK_DEFAULT_LENGTH, OPTITRACK_DEFAULT_RADIUS};
  70. EMFTrackSettings _emfTrackSettings;
  71. SteamVRTrackSettings _steamVrTrackSettings = SteamVRTrackSettings {STEAMVR_DEFAULT_LENGTH};
  72. osg::Vec3 _normalModifier = osg::Vec3(0.0f, 0.0f, 0.0f);
  73. void load3mfLib();
  74. void render3MFMesh();
  75. void updateMetaData();
  76. void loadMetaData();
  77. std::vector<float> osgVecToStdVec(osg::Vec3f input);
  78. osg::Vec3f stdVecToOsgVec(std::vector<float> input);
  79. };