Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoWinConstrainedViewer.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24
25
26#ifndef _SO_WIN_CONSTRAINED_VIEWER_
27#define _SO_WIN_CONSTRAINED_VIEWER_
28
29#include <Inventor/Win/SoWinBeginStrict.h>
30
31#include <Inventor/Win/viewers/SoWinFullViewer.h>
32#include <Inventor/SbBox.h>
33
34#include <Inventor/Gui/viewers/SoGuiConstrainedViewer.h>
35
37//
38// Class: SoWinConstrainedViewer
39//
41
64{
65 public:
66
72 void setUpDirection( const SbVec3f& newUpDirection );
73
77 SbVec3f getUpDirection() { return m_guiConstViewer->getUpDirection(); }
78
79 //
80 // redefine these to add constrained viewer functionality
81 //
82 virtual void setCamera( SoCamera *newCam );
83 virtual void saveHomePosition();
84 virtual void resetToHomePosition();
85 virtual void recomputeSceneSize();
86
87 private:
88
89 SoGuiConstrainedViewer* getGuiConstrainedViewer() const;
90
91 SoWinConstrainedViewer( SoWidget parent,
92 const char* name,
93 SbBool buildInsideParent,
96 SbBool buildNow,
97 SbBool sync = TRUE );
98
99 // Retro compatibility only
100 SbVec3f upDirection;
101 float sceneHeight, sceneSize;
102
103 private:
104
105 SoWinConstrainedViewer( SoWidget parent,
106 const char* name,
107 SbBool buildInsideParent,
109 SoWinViewer::Type type,
110 SbBool buildNow,
111 SbBool sync,
112 SoGuiConstrainedViewer* guiConstViewer );
113
115
116 // Tilts the camera, restraining it to 180 degree rotation from the
117 // up direction. A positive angle tilts the camera up.
118 virtual void tiltCamera( float deltaAngle );
119
120 // Moves the camera forward by the given amount
121 virtual void dollyCamera( float dist );
122
123 // Redefine these to do constrained viewing tasks.
124 // The bottom wheel rotates the camera around the up direction, the
125 // left wheel tilts the camera up/down constraning to 180 degree from
126 // the up direction. The right wheel moves the camera forward/backward
127 // withough constrain (taking the scene size into account).
128 virtual void bottomWheelMotion( float newVal );
129 virtual void leftWheelMotion( float newVal );
130 virtual void rightWheelMotion( float newVal );
131 virtual void mouseWheelMotion( float newVal );
132
133 // This is called during a paste.
134 // We redefine this to keep the right vector of the camera
135 // in a parallel plane.
136 virtual void changeCameraValues( SoCamera* newCamera );
137
138 // this routine is called by subclasses to find and set the new
139 // up direction given the current mouse position. If something is
140 // picked, the normal to the object picked will be used to specify
141 // the new up direction.
142 void findUpDirection( const SbVec2s& mouseLocation );
143
144 // this routine checks the camera orientation and makes sure that the
145 // current right vector and the ideal right vector (cross between the
146 // view vector and world up direction) are the same (i.e. no unwanted
147 // roll), else it fixes it. This keeps the up direction valid.
148 void checkForCameraUpConstrain();
149
150 // Redefine this to keep the up vector when seeking
151 virtual void computeSeekFinalOrientation();
152
153 private:
154
155 void constructorCommon( SbBool buildNow );
156
157 SoGuiConstrainedViewer* m_guiConstViewer; // Implementation class of SoXxConstrainedViewer
158};
159
160#include <Inventor/Win/SoWinEndStrict.h>
161
162#endif /* _SO_WIN_CONSTRAINED_VIEWER_ */
163
2D vector class.
Definition SbVec.h:700
3D vector class.
Definition SbVec.h:932
Abstract base class for camera nodes.
Definition SoCamera.h:188
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Base viewer clas...
virtual void resetToHomePosition()
Restores the camera values.
void setUpDirection(const SbVec3f &newUpDirection)
Specifies the upward direction of the viewer.
virtual void recomputeSceneSize()
This can be used to let the viewer know that the scene graph has changed so that the viewer can recom...
virtual void setCamera(SoCamera *newCam)
Sets the camera that will be controlled by the viewer.
SbVec3f getUpDirection()
Returns the upward direction of the viewer.
virtual void saveHomePosition()
Saves the camera values.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Base viewer clas...
BuildFlag
This specifies what should be build by default in the constructor.
Type
An EDITOR viewer will create a camera under the user supplied scene graph (specified in setSceneGraph...
int SbBool
Boolean type.
Definition SbBase.h:87