Open Inventor Release 2026.1.1
 
Loading...
Searching...
No Matches
SceneInteractor.h
1#ifndef _SceneInteractor_
2#define _SceneInteractor_
3
4#include <Inventor/nodes/SoEventCallback.h>
5#include <Inventor/nodes/SoSeparator.h>
6#include <Inventor/nodes/SoSwitch.h>
7#include <Inventor/nodes/SoRotation.h>
8#include <Inventor/SbViewportRegion.h>
9#include <Inventor/ViewerComponents/SoCameraInteractor.h>
10
13class SoKeyboardEvent;
16class SoTouchEvent;
20class SoCamera;
21
70class VIEWERCOMPONENTS_API SceneInteractor : public SoSeparator
71{
72public:
73
76
79
86 void adjustClippingPlanes( const SbViewportRegion &vpRegion );
87
92 void viewAll(const SbViewportRegion &viewport);
93
99 void viewAxis( const SbVec3f& direction, const SbVec3f& up );
100
105 {
106 return m_cameraInteractor;
107 }
108
113
122
127
132
136 void enableHeadLight(bool enabled);
137
142
143private:
144 SoRef<SoEventCallback> m_eventCallBack;
145 SoCameraInteractor* m_cameraInteractor;
146
147 virtual void mouseWheelMoved( SoMouseWheelEvent* wheelEvent, SoHandleEventAction* action );
148 virtual void mouseMoved( SoLocation2Event* mouseEvent, SoHandleEventAction* action );
149 virtual void mousePressed( SoMouseButtonEvent* mouseEvent, SoHandleEventAction* action );
150 virtual void mouseReleased( SoMouseButtonEvent* mouseEvent, SoHandleEventAction* action );
151 virtual void keyPressed( SoKeyboardEvent* keyEvent, SoHandleEventAction* action );
152 virtual void keyReleased( SoKeyboardEvent* keyEvent, SoHandleEventAction* action );
153 virtual void touch( SoTouchEvent* touchEvent, SoHandleEventAction* action );
154 virtual void zoom( SoScaleGestureEvent* scaleEvent, SoHandleEventAction* action );
155 virtual void rotate( SoRotateGestureEvent* rotateEvent, SoHandleEventAction* action );
156 virtual void doubleTap(SoDoubleTapGestureEvent* doubleTapEvent, SoHandleEventAction* action);
157 virtual void longTap(SoLongTapGestureEvent* longTapEvent, SoHandleEventAction* action);
158
159 // Events callbacks
160 static void mouseMoveCB(void * userdata, SoEventCallback * node);
161 static void mouseCB(void * userdata, SoEventCallback * node);
162 static void keyboardCB(void * userdata, SoEventCallback * node);
163 static void touchCB(void * userdata, SoEventCallback * node);
164 static void zoomCB(void * userdata, SoEventCallback * node);
165 static void rotateCB(void * userdata, SoEventCallback * node);
166 static void doubleTapCB(void * userdata, SoEventCallback * node);
167 static void longTapCB(void * userdata, SoEventCallback * node);
168 static void wheelCB(void * userdata, SoEventCallback * node);
169
170private:
171 SoRef<SoRotation> m_headlightRot;
172 SoRef<SoSwitch> m_cameraSwitch;
173 SoRef<SoSwitch> m_headlightSwitch;
174
175 SoRef<SoCameraInteractor> m_perspInteractor;
176 SoRef<SoCameraInteractor> m_orthoInteractor;
177
178};
179
180#endif // _SceneInteractor_
3D vector class.
Definition SbVec.h:932
Class for representing a viewport.
virtual void setCameraMode(SceneInteractor::CameraMode mode)
Select perspective or orthographic camera.
void viewAll(const SbViewportRegion &viewport)
Move the camera to view the scene defined by the given path.
SoCamera * getCamera() const
Returns the current camera.
bool isHeadLightEnabled()
Returns if headlight is enabled.
void viewAxis(const SbVec3f &direction, const SbVec3f &up)
Moves the camera to be aligned with the given direction vector while keeping the "up" direction of th...
void enableHeadLight(bool enabled)
Enable or disable headlight.
SceneInteractor::CameraMode getCameraMode()
Returns the current camera mode.
void adjustClippingPlanes(const SbViewportRegion &vpRegion)
Adjust near and far clipping planes to minimize clipping of objects in the scene.
SceneInteractor()
Constructor.
SoCameraInteractor * getCameraInteractor()
Returns the current camera interactor.
CameraMode
Type of camera (perspective or orthographic)
virtual ~SceneInteractor()
Destructor.
Abstract base class for camera nodes.
Definition SoCamera.h:193
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Utility class to...
Class for double-tap gesture events.
Node which invokes callbacks for events.
Allows nodes in a graph to receive input events.
Keyboard key press and release events.
2D location events.
Class for long tap gesture events.
Mouse button press and release events.
Mouse wheel events.
virtual void touch()
Marks an instance as modified, simulating a change to it.
Smart pointer for any class inheriting SoRefCounter.
Definition SoRef.h:90
Class for rotate gesture events.
Class for scale (pinch) gesture events.
SoSeparator()
Creates a separator node with default settings.
Base class for touch events.