OpenCOVER
coVR3DScaleGizmo.h
Go to the documentation of this file.
1
2#ifndef _CO_VR_3D_SCALE_GIZMO
3#define _CO_VR_3D_SCALE_GIZMO
4
5#include "coVR3DGizmoType.h"
6
7
8
9namespace opencover
10{
11class coVR3DGizmo;
12class PLUGIN_UTILEXPORT coVR3DScaleGizmo : public coVR3DGizmoType
13{
14private:
15 bool _scaleXonly{false}, _scaleYonly{false}, _scaleZonly{false}, _scaleAll{false};
16 osg::Vec3 _startHitPos_o;
17 float _scale;
18
19 osg::ref_ptr<osg::MatrixTransform> axisTransform; // all the Geometry
20 osg::ref_ptr<osg::MatrixTransform> xAxisTransform;
21 osg::ref_ptr<osg::MatrixTransform> yAxisTransform;
22 osg::ref_ptr<osg::MatrixTransform> zAxisTransform;
23 osg::ref_ptr<osg::MatrixTransform> xSphereTransform;
24 osg::ref_ptr<osg::MatrixTransform> ySphereTransform;
25 osg::ref_ptr<osg::MatrixTransform> zSphereTransform;
26
27 /*
28 // this was used to visualize scale
29 osg::Matrix _startxAxisMatrix,_startyAxisMatrix, _startzAxisMatrix;
30 osg::ref_ptr<osg::MatrixTransform> tempxAxisTransform;
31 osg::ref_ptr<osg::MatrixTransform> tempyAxisTransform;
32 osg::ref_ptr<osg::MatrixTransform> tempzAxisTransform;
33 */
34
35 osg::ref_ptr<osg::Geode> sphereGeode;
36 osg::ref_ptr<osg::Geode> scaleXaxisGeode;
37 osg::ref_ptr<osg::Geode> scaleYaxisGeode;
38 osg::ref_ptr<osg::Geode> scaleZaxisGeode;
39 osg::ref_ptr<osg::Geode> scaleXSphereGeode;
40 osg::ref_ptr<osg::Geode> scaleYSphereGeode;
41 osg::ref_ptr<osg::Geode> scaleZSphereGeode;
42
43 std::unique_ptr<opencover::coLine> _line;
44
45 osg::Vec3 calculatePointOfShortestDistance(const osg::Vec3& lp0, const osg::Vec3& lp1, osg::Vec3 axis_o) const;
46
47 //osg::Vec3 calculatePointOfShortestDistance(const osg::Vec3& lp0, const osg::Vec3& lp1, osg::Vec3 axis = osg::Vec3(0,0,0)) const;
48
49
50protected:
51 virtual void createGeometry() override;
52 //void updateSharedState() override;
54 int hit(vrui::vruiHit *hit) override;
55 float calcScale(osg::Vec3 axis);
56
57
58public:
59 coVR3DScaleGizmo(osg::Matrix m, float s, coInteraction::InteractionType type, const char *iconName, const char *interactorName, coInteraction::InteractionPriority priority,coVR3DGizmo* gizmoPointer = nullptr);
60
61 // delete scene graph
63
64 // start the interaction (grab pointer, set selected hl, store dcsmat)
65 virtual void startInteraction() override;
66 virtual void doInteraction() override;
67 virtual void stopInteraction() override;
68 virtual void resetState() override;
69
70
71 virtual void updateTransform(osg::Matrix m) override;
72
73 osg::Matrix getMoveMatrix_o() const override;
74 const osg::Matrix &getMatrix() const
75 {
76 return _interMat_o;
77 }
78 //void setShared(bool state) override;
79
80};
81
82
83}
84#endif
Definition: ARToolKit.h:33
Definition: coVR3DGizmo.h:20
Definition: coVR3DGizmoType.h:22
Definition: coVR3DScaleGizmo.h:13
const osg::Matrix & getMatrix() const
Definition: coVR3DScaleGizmo.h:74
int hit(vrui::vruiHit *hit) override
virtual void startInteraction() override
float calcScale(osg::Vec3 axis)
virtual void createGeometry() override
virtual void updateTransform(osg::Matrix m) override
coVR3DScaleGizmo(osg::Matrix m, float s, coInteraction::InteractionType type, const char *iconName, const char *interactorName, coInteraction::InteractionPriority priority, coVR3DGizmo *gizmoPointer=nullptr)
osg::Matrix getMoveMatrix_o() const override
virtual void resetState() override
virtual void doInteraction() override
vrb::SharedState< osg::Matrix > SharedMatrix
Definition: coVR3DScaleGizmo.h:53
virtual void stopInteraction() override
Definition: vruiHit.h:21