Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoCameraInteractor.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-2020 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20
21#ifndef SO_CAMERA_INTERACTOR
22#define SO_CAMERA_INTERACTOR
23
24#include <Inventor/SbBox.h>
25#include <Inventor/projectors/SbSphereSheetProjector.h>
26#include <Inventor/misc/SoRefCounter.h>
27#include <Inventor/STL/stack>
28#include <Inventor/SbVec.h>
29#include <Inventor/SbPImpl.h>
30
31class SoCamera;
33class SbViewVolume;
34class SoCameraInteractorImpl;
35
122{
123public:
124
131
138
159 virtual void zoom( float zoom );
160
187 virtual void dolly( float scaleFactor );
188
198 virtual void changeViewVolume( float height, float aspect );
199
204
205#if 1 SoDEPRECATED
217
218#endif
233
239 void setPosition( const SbVec3f& pos );
240
248 void setPosition( const SbVec2f& pos, float distFromEye, const SbViewportRegion& vpRegion );
249
255 void translate( const SbVec3f& trans );
256
263 void translate( const SbVec2f& displacement, const SbViewportRegion& vpRegion );
264
273 void pointAt( const SbVec3f& targetPoint );
274
286 SbRotation lookAt( const SbVec3f& position, const SbVec3f& target, const SbVec3f& up );
287
292
301 void roll( float angle );
302
311 void pivot( float angle );
312
321 void tilt( float angle );
322
330 void rotate( const SbRotation& rot );
331
338 void setOrientation( const SbRotation& rot );
339
346 void setRotationCenter( const SbVec3f& pos );
347
354 void setRotationAxis( const SbVec3f& axis );
355
366 void rotate( float angle );
367
378 void viewAxis( const SbVec3f& direction, const SbVec3f& up );
379
387 void viewX( bool reverse = false );
388
397 void viewY( bool reverse = false );
398
407 void viewZ( bool reverse = false );
408
414 void viewIn( const SbBox3f& bbox );
415
426 void viewIn( SoPath* path, const SbViewportRegion& vpRegion );
427
438 void viewIn( SoNode* node, const SbViewportRegion& vpRegion );
439
447 void viewAll( SoPath* path, const SbViewportRegion& vpRegion );
448
456 void viewAll( SoNode* node, const SbViewportRegion& vpRegion );
457
467 SbVec3f projectToPlane( const SbVec2f& point, float distFromEye, const SbViewportRegion& vpRegion ) const;
468
477 SbVec2f projectToScreen( const SbVec3f& point, const SbViewportRegion& vpRegion ) const;
478
484 void adjustClippingPlanes( SoNode* sceneRoot, const SbViewportRegion& vpRegion );
485
500 void zoomInWindow( const SbVec2f& topLeftCorner, const SbVec2f& bottomRightCorner, const SbViewportRegion& vpRegion);
501
515 void dollyInWindow( const SbVec2f& topLeftCorner, const SbVec2f& bottomRightCorner, const SbViewportRegion& vpRegion );
516
528 void dollyWithZoomCenter( const SbVec2f& centerPos, float scaleFactor, const SbViewportRegion& vpRegion );
529
541 void activatePanning( const SbVec2f& initPos, const SbViewportRegion& vpRegion );
542
553 void pan( const SbVec2f& newPos, const SbViewportRegion& vpRegion );
554
570 void activateOrbiting( const SbVec2f& startPos );
571
588 void orbit( const SbRotation& rotation );
589
601 void orbit( const SbVec2f& newPos );
602
608
615
621 void synchronize( SoCamera* camera );
622
623private:
624
625 SoCameraInteractorImpl* m_impl;
626
627private:
628
634
636
637};
638
639#endif // SO_CAMERA_INTERACTOR
3D box class.
Definition SbBox.h:649
Class for representing a rotation.
Definition SbRotation.h:126
2D vector class.
Definition SbVec.h:76
3D vector class.
Definition SbVec.h:932
3D viewing volume class.
Class for representing a viewport.
Abstract base class for camera nodes.
Definition SoCamera.h:188
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Utility class to...
void setPosition(const SbVec2f &pos, float distFromEye, const SbViewportRegion &vpRegion)
Move camera to the specified position.
void pan(const SbVec2f &newPos, const SbViewportRegion &vpRegion)
Pan the camera based on offset from starting point.
void viewIn(const SbBox3f &bbox)
Move camera to the center of the specified box.
SoDEPRECATED SbVec3f getViewportCenter() const
Returns the viewport center.
void dollyWithZoomCenter(const SbVec2f &centerPos, float scaleFactor, const SbViewportRegion &vpRegion)
Modifies the camera to ajust the view around the specified point.
void activatePanning(const SbVec2f &initPos, const SbViewportRegion &vpRegion)
Set the starting point for interactive panning.
SoCameraInteractor(SoCamera *camera)
Create a SoCameraInteractor for the specified camera.
SbVec3f projectToPlane(const SbVec2f &point, float distFromEye, const SbViewportRegion &vpRegion) const
Project specified 2D point on the plane parallel to the near plane that is at distFromEye units fro...
SbBool popCamera()
Restore saved camera.
void orbit(const SbVec2f &newPos)
Orbit the camera based on offset from the previous screen position.
void pivot(float angle)
Pivot the camera.
SbVec2f projectToScreen(const SbVec3f &point, const SbViewportRegion &vpRegion) const
Map a 3D point in world coordinates to a 2D point in normalized screen coordinates (0 <= x,...
static SoCameraInteractor * getNewInstance(SoCamera *camera)
Create an instance for the specified camera.
void synchronize(SoCamera *camera)
Copy field values from the specified camera to the camera of this interactor.
void dollyInWindow(const SbVec2f &topLeftCorner, const SbVec2f &bottomRightCorner, const SbViewportRegion &vpRegion)
Moves the camera forward or backward along the view vector to view the region defined by the given co...
virtual void zoom(float zoom)
Zoom - Makes the scene appear larger or smaller.
void pushCamera()
Save current camera.
virtual void dolly(float scaleFactor)
Dolly - Makes the scene appear larger or smaller.
void viewX(bool reverse=false)
NOTE: The camera position is not changed, so the camera may not be looking toward the scene.
void setRotationAxis(const SbVec3f &axis)
Set the axis of rotation.
void activateOrbiting(const SbVec2f &startPos)
Set the starting point for interactive orbiting.
void translate(const SbVec2f &displacement, const SbViewportRegion &vpRegion)
Move camera by the specified 2D displacement.
void viewAxis(const SbVec3f &direction, const SbVec3f &up)
Moves and rotates the camera to be aligned with the given direction vector while keeping the up direc...
void tilt(float angle)
Tilt the camera.
void viewIn(SoPath *path, const SbViewportRegion &vpRegion)
Move camera to the center of the scene defined by the specified path.
void zoomInWindow(const SbVec2f &topLeftCorner, const SbVec2f &bottomRightCorner, const SbViewportRegion &vpRegion)
Zooms to the region defined by the given corners in normalized screen coordinates.
void viewY(bool reverse=false)
Rotate camera to look parallel to the Y axis with +Z up.
void pointAt(const SbVec3f &targetPoint)
Sets the orientation of the camera so that it points toward the given target point while keeping the ...
SbRotation lookAt(const SbVec3f &position, const SbVec3f &target, const SbVec3f &up)
Returns the rotation needed to point a camera at position toward the given target point while keeping...
void rotate(float angle)
Rotate the camera around the center specified by setRotationCenter() and the axis specified by setRot...
SoCamera * getCamera() const
Returns the associated camera.
SbVec3f getDirectionVector() const
Returns the direction vector of the camera.
void orbit(const SbRotation &rotation)
Orbit the camera by the specified rotation.
void adjustClippingPlanes(SoNode *sceneRoot, const SbViewportRegion &vpRegion)
Adjust near and far clipping planes to minimize clipping of objects in the scene.
void viewAll(SoNode *node, const SbViewportRegion &vpRegion)
Move the camera to view the scene defined by the given node.
virtual void changeViewVolume(float height, float aspect)
Change camera's view volume.
void setPosition(const SbVec3f &pos)
Move camera to the specified position.
void viewAll(SoPath *path, const SbViewportRegion &vpRegion)
Move the camera to view the scene defined by the given path.
void setOrientation(const SbRotation &rot)
Set the orientation of the camera.
void roll(float angle)
Roll the camera.
void viewZ(bool reverse=false)
Rotate camera to look parallel to the Z axis with +Y up.
void rotate(const SbRotation &rot)
Rotate the camera.
void translate(const SbVec3f &trans)
Move camera by the specified 3D displacement.
void setRotationCenter(const SbVec3f &pos)
Set the center of rotation.
void viewIn(SoNode *node, const SbViewportRegion &vpRegion)
Move camera to the center of the scene defined by the specified node.
SbVec3f getFocalPoint() const
Returns the camera's "focal point", located focalDistance units from the camera position along the ...
Abstract base class for all database nodes.
Definition SoNode.h:145
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Base class for ref-counted objects.
int SbBool
Boolean type.
Definition SbBase.h:87