OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
coVR3DTransRotInteractor.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef _CO_VR_3D_TRANSROT_INTERACTOR_H
9 #define _CO_VR_3D_TRANSROT_INTERACTOR_H
10 
12 #include <vrbclient/SharedStateSerializer.h>
13 #include <cover/MatrixSerializer.h>
14 #include <net/tokenbuffer.h>
15 namespace opencover
16 {
17 
18 class PLUGIN_UTILEXPORT coVR3DTransRotInteractor : public coVRIntersectionInteractor
19 {
20 
21 private:
22  bool _rotateOnly = false, _translateOnly = false;
23  osg::Matrix _interMat_o, _oldHandMat;
24  osg::Matrix _invOldHandMat_o;
25  osg::Matrix _oldInteractorXformMat_o;
26 
27  osg::Geometry *createLine(osg::Vec3 pos1, osg::Vec3 pos2, osg::Vec4 c);
28  osg::ref_ptr<osg::MatrixTransform> axisTransform;
29  osg::ref_ptr<osg::MatrixTransform> xrTransform;
30  osg::ref_ptr<osg::MatrixTransform> yrTransform;
31  osg::ref_ptr<osg::MatrixTransform> zrTransform;
32  osg::ref_ptr<osg::MatrixTransform> xlTransform;
33  osg::ref_ptr<osg::MatrixTransform> ylTransform;
34  osg::ref_ptr<osg::MatrixTransform> zlTransform;
35  osg::ref_ptr<osg::Geode> sphereGeode;
36  osg::ref_ptr<osg::Geode> rotateGeode;
37  osg::ref_ptr<osg::Geode> translateGeode;
38 
39  float _distance = 0;
40  osg::Vec3 _diff;
41 
42 protected:
43  virtual void createGeometry() override;
44  void updateSharedState() override;
46 public:
47  coVR3DTransRotInteractor(osg::Matrix m, float s, coInteraction::InteractionType type, const char *iconName, const char *interactorName, coInteraction::InteractionPriority priority);
48 
49  // delete scene graph
50  virtual ~coVR3DTransRotInteractor();
51 
52  // start the interaction (grab pointer, set selected hl, store dcsmat)
53  virtual void startInteraction() override;
54  virtual void doInteraction() override;
55 
56  virtual void updateTransform(osg::Matrix m);
57 
58  const osg::Matrix &getMatrix() const
59  {
60  return _interMat_o;
61  }
62  void setShared(bool state) override;
63 };
64 }
65 #endif
Definition: coVRIntersectionInteractor.h:55
const osg::Matrix & getMatrix() const
Definition: coVR3DTransRotInteractor.h:58
vrb::SharedState< osg::Matrix > SharedMatrix
Definition: coVR3DTransRotInteractor.h:45
Definition: coVR3DTransRotInteractor.h:18