Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoXtConstrainedViewer.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Alain Dumesny (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifdef SOQT
51# include <Inventor/Qt/viewers/SoQtConstrainedViewer.h>
52#elif defined _WIN32
53# include <Inventor/Win/viewers/SoWinConstrainedViewer.h>
54#else // _WIN32
55
56#ifndef _SO_XT_CONSTRAINED_VIEWER_
57#define _SO_XT_CONSTRAINED_VIEWER_
58
59#include <Inventor/Xt/viewers/SoXtFullViewer.h>
60#include <Inventor/SbBox.h>
61#include <Inventor/Gui/viewers/SoGuiConstrainedViewer.h>
62
64//
65// Class: SoXtConstrainedViewer
66//
68
91{
92 public:
93
99 void setUpDirection ( const SbVec3f& newUpDirection );
103 SbVec3f getUpDirection() { return m_guiConstViewer->getUpDirection(); }
104
105 //
106 // redefine these to add constrained viewer functionality
107 //
108 virtual void setCamera( SoCamera* newCam );
109 virtual void saveHomePosition();
110 virtual void resetToHomePosition();
111 virtual void recomputeSceneSize();
112
113 private:
114 SoGuiConstrainedViewer* getGuiConstrainedViewer() const;
115
116 // Retro compatibility only
117 SbVec3f upDirection;
118 float sceneHeight, sceneSize;
119
120 private:
121 SoXtConstrainedViewer( SoWidget parent,
122 const char* name,
123 SbBool buildInsideParent,
124 SoXtFullViewer::BuildFlag flag,
125 SoXtViewer::Type type,
126 SbBool buildNow,
127 SbBool sync = TRUE );
128
129 SoXtConstrainedViewer( SoWidget parent,
130 const char* name,
131 SbBool buildInsideParent,
132 SoXtFullViewer::BuildFlag flag,
133 SoXtViewer::Type type,
134 SbBool buildNow,
135 SbBool sync,
136 SoGuiConstrainedViewer* guiConstViewer );
137
139
140 // Tilts the camera, restraining it to 180 degree rotation from the
141 // up direction. A positive angle tilts the camera up.
142 virtual void tiltCamera( float deltaAngle );
143
144 // Redefine these to do constrained viewing tasks.
145 // The bottom wheel rotates the camera around the up direction, the
146 // left wheel tilts the camera up/down constraning to 180 degree from
147 // the up direction.
148 virtual void bottomWheelMotion( float newVal );
149 virtual void leftWheelMotion( float newVal );
150
151 // This is called during a paste.
152 // We redefine this to keep the right vector of the camera
153 // in a parallel plane.
154 virtual void changeCameraValues( SoCamera* newCamera );
155
156 // this routine is called by subclasses to find and set the new
157 // up direction given the current mouse position. If something is
158 // picked, the normal to the object picked will be used to specify
159 // the new up direction.
160 void findUpDirection( const SbVec2s& mouseLocation );
161
162 // this routine checks the camera orientation and makes sure that the
163 // current right vector and the ideal right vector (cross between the
164 // view vector and world up direction) are the same (i.e. no unwanted
165 // roll), else it fixes it. This keeps the up direction valid.
166 void checkForCameraUpConstrain();
167
168 // Redefine this to keep the up vector when seeking
169 virtual void computeSeekFinalOrientation();
170
171 private:
172
173 void constructorCommon( SbBool buildNow );
174 SoGuiConstrainedViewer* m_guiConstViewer; // Implementation class of SoXxConstrainedViewer
175
176};
177
178#endif /* _SO_XT_CONSTRAINED_VIEWER_ */
179
180#endif // _WIN32
181
182
2D vector class.
Definition SbVec.h:700
3D vector class.
Definition SbVec.h:932
Abstract base class for camera nodes.
Definition SoCamera.h:188
Base viewer class which adds camera constraints given a world up direction.
virtual void resetToHomePosition()
Restores the camera values.
virtual void saveHomePosition()
Saves the camera values.
SbVec3f getUpDirection()
Returns the upward direction of the viewer.
void setUpDirection(const SbVec3f &newUpDirection)
Specifies the upward direction of the viewer.
virtual void setCamera(SoCamera *newCam)
Sets the edited camera.
virtual void recomputeSceneSize()
This can be used to let the viewer know that the scene graph has changed so that the viewer can recom...
Base viewer class which adds a decoration around the rendering area.
int SbBool
Boolean type.
Definition SbBase.h:87