8 #ifndef COVR_NAVIGATION_MANAGER_H
9 #define COVR_NAVIGATION_MANAGER_H
24 #include <util/common.h>
40 #include <osg/MatrixTransform>
41 #include <osg/Geometry>
90 bool keyEvent(
int type,
int keySym,
int mod);
92 void doWalkMoveToFloor();
93 void processHotKeys(
int keymask);
94 void adjustFloorHeight();
101 void setMenuMode(
bool state);
103 void updateHandMat(osg::Matrix &mat);
104 void setHandType(
int pt);
105 void setNavMode(NavMode mode,
bool updateGroup=
true);
110 ui::ButtonGroup *navGroup()
const;
113 return navMode != NavNone;
121 return isViewerPosRotation;
125 isViewerPosRotation = b;
128 void saveCurrentBaseMatAsOldBaseMat();
129 bool avoidCollision(osg::Vec3 &glideVec);
132 float getDriveSpeed();
133 void setDriveSpeed(
float speed);
134 bool isSnapping()
const;
135 bool isDegreeSnapping()
const;
136 float snappingDegrees()
const;
137 void enableSnapping(
bool enable);
138 void enableDegreeSnapping(
bool enable,
float degree);
139 bool restrictOn()
const;
141 void setStepSize(
float stepsize);
142 float getStepSize()
const;
143 void doGuiScale(
float scale);
144 void doGuiRotate(
float x,
float y,
float z);
145 void doGuiTranslate(
float x,
float y,
float z);
147 int readConfigFile();
149 void toggleShowName(
bool state);
150 void toggleInteractors(
bool state);
151 void toggleCollide(
bool state);
171 void doMouseScale(
float);
174 void startMouseNav();
175 void startShowName();
182 void toggleSelectInteract(
bool state);
183 void startSelectInteract();
184 void doSelectInteract();
185 void stopSelectInteract(
bool mouse);
188 void doXformRotate();
189 void doXformTranslate();
191 void highlightSelectedNode(osg::Node *selectedNode);
192 double speedFactor(
double delta)
const;
193 osg::Vec3 applySpeedFactor(osg::Vec3 vec)
const;
195 void getHandWorldPosition(
float *,
float *,
float *);
197 float getPhi(
float relCoord1,
float width1);
199 float getPhiZHori(
float x2,
float x1,
float y2,
float widthY,
float widthX);
200 float getPhiZVerti(
float y2,
float y1,
float x2,
float widthX,
float widthY);
201 void makeRotate(
float heading,
float pitch,
float roll,
int headingBool,
int pitchBool,
int rollBool);
205 rotationPoint =
false;
209 rotationAxis =
false;
213 return rotationPoint;
219 void setRotationPoint(
float x,
float y,
float z,
float size = 1.f);
220 void setRotationPointVisible(
bool visible);
225 void setRotationAxis(
float x,
float y,
float z);
228 guiTranslateFactor = f;
233 int mouseNavButtonRotate, mouseNavButtonScale, mouseNavButtonTranslate;
235 double menuButtonStartTime;
236 double menuButtonQuitInterval;
239 bool ignoreCollision;
245 bool shiftEnabled, shiftMouseNav;
246 bool isViewerPosRotation;
249 osg::Matrix invBaseMatrix;
250 osg::Matrix oldInvBaseMatrix;
251 osg::Node *oldFloorNode =
nullptr;
252 osg::Matrix oldFloorMatrix;
253 osg::NodePath oldNodePath;
256 float currentVelocity;
258 osg::Matrix old_mat, old_dcs_mat;
259 osg::Matrix old_xform_mat;
261 osg::Vec3 startHandPos;
262 osg::Vec3 startHandDir;
263 osg::Vec3 handPos, oldHandPos;
264 osg::Vec3 handDir, oldHandDir;
265 osg::Vec3 transformVec;
266 osg::Vec3 rotationVec;
268 bool rotationPointVisible;
270 float guiTranslateFactor;
272 float actScaleFactor;
274 float x0, y0, relx0, rely0;
275 float oldRotx, newRotx, oldRoty, newRoty;
276 float modifiedVSize, modifiedHSize, yValViewer, yValObject;
277 float transXRel, transYRel, transZRel;
278 float originX, originY;
282 osg::Node *oldSelectedNode_;
284 float oldDcsScaleFactor;
286 osg::Vec3 currentLeftPos;
287 osg::Vec3 currentRightPos;
288 osg::Vec3 oldLeftPos;
289 osg::Vec3 oldRightPos;
292 int jsZeroPosX, jsZeroPosY, jsOffsetX, jsOffsetY, jsXmax, jsYmax, jsXmin, jsYmin;
295 bool visensoJoystick;
321 bool m_restrict =
false;
324 bool animationWasRunning=
false;
327 osg::Node *oldShowNamesNode_ =
nullptr;
331 ui::Menu *navMenu_ =
nullptr;
332 ui::Action *m_viewAll=
nullptr, *m_resetView=
nullptr;
333 ui::Group *navModes_ =
nullptr;
334 ui::ButtonGroup *navGroup_ =
nullptr;
335 ui::Button *noNavButton_=
nullptr;
336 ui::Button *xformButton_=
nullptr, *scaleButton_=
nullptr, *flyButton_=
nullptr, *walkButton_=
nullptr, *driveButton_=
nullptr;
337 ui::Button *xformRotButton_=
nullptr, *xformTransButton_=
nullptr, *selectButton_=
nullptr, *showNameButton_=
nullptr;
338 ui::Button *selectInteractButton_=
nullptr;
339 ui::Button *measureButton_=
nullptr, *traverseInteractorButton_=
nullptr;
340 ui::Button *collisionButton_=
nullptr, *snapButton_=
nullptr;
341 ui::Slider *driveSpeedSlider_=
nullptr;
342 ui::Action *scaleUpAction_=
nullptr, *scaleDownAction_=
nullptr;
343 ui::Slider *scaleSlider_=
nullptr;
345 osg::Vec3 rotPointVec;
346 osg::ref_ptr<osg::MatrixTransform> rotPoint;
348 std::vector<coMeasurement *> measurements;
350 void initInteractionDevice();
352 void initHandDeviceGeometry();
359 osg::Vec3 getCenter()
const;
361 osg::Vec3 mouseNavCenter;
Definition: coVRNavigationManager.h:65
NavMode getMode()
Definition: coVRNavigationManager.h:106
Definition: coButtonMenuItem.h:30
Definition: coVRNavigationManager.h:69
osg::Vec3 getRotationPoint()
Definition: coVRNavigationManager.h:221
Definition: coVRNavigationManager.h:67
Definition: coVRNavigationManager.h:74
Definition: coVRNavigationManager.h:66
Definition: coNavInteraction.h:17
Definition: coVRNavigationManager.h:76
void setTranslateFactor(float f)
Definition: coVRNavigationManager.h:226
Definition: coVRNavigationManager.h:70
bool mouseNav()
Definition: coVRNavigationManager.h:115
bool getRotationAxisAcitve()
Definition: coVRNavigationManager.h:215
Definition: coVRNavigationManager.h:72
float AnalogY
Definition: coVRNavigationManager.h:82
double OSGVRUIEXPORT mod(double a, double b)
bool getRotationPointActive()
Definition: coVRNavigationManager.h:211
bool isNavigationEnabled()
Definition: coVRNavigationManager.h:111
bool isViewerPosRotationEnabled()
Definition: coVRNavigationManager.h:119
bool getCollision()
Definition: coVRNavigationManager.h:95
Definition: coRowMenu.h:36
void disableRotationAxis()
Definition: coVRNavigationManager.h:207
Definition: coVRNavigationManager.h:78
Definition: coVRNavigationManager.h:77
void disableRotationPoint()
Definition: coVRNavigationManager.h:203
Definition: coVRLabel.h:51
Definition: coRelativeInputInteraction.h:16
Definition: coVRNavigationManager.h:56
NavMode
Definition: coVRNavigationManager.h:62
Definition: coVRNavigationManager.h:75
Definition: coMouseButtonInteraction.h:19
Definition: coVRNavigationManager.h:73
Definition: coVRNavigationManager.h:68
void enableViewerPosRotation(bool b)
Definition: coVRNavigationManager.h:123
Definition: coVRNavigationManager.h:71