Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SceneInteractor.h
1#ifndef _SceneInteractor_
2#define _SceneInteractor_
3
4#include <Inventor/nodes/SoSeparator.h>
5#include <Inventor/nodes/SoSwitch.h>
6#include <Inventor/nodes/SoRotation.h>
7#include <Inventor/SbViewportRegion.h>
8#include <Inventor/ViewerComponents/SoCameraInteractor.h>
9
12class SoKeyboardEvent;
15class SoTouchEvent;
19class SoCamera;
20class SoEventCallback;
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
110
115 {
117 ORTHOGRAPHIC
118 };
119
124
129
133 void enableHeadLight(bool enabled);
134
139
140private:
141 SoRef<SoEventCallback> m_eventCallBack;
142 SoCameraInteractor* m_cameraInteractor;
143
144 virtual void mouseWheelMoved( SoMouseWheelEvent* wheelEvent, SoHandleEventAction* action );
145 virtual void mouseMoved( SoLocation2Event* mouseEvent, SoHandleEventAction* action );
146 virtual void mousePressed( SoMouseButtonEvent* mouseEvent, SoHandleEventAction* action );
147 virtual void mouseReleased( SoMouseButtonEvent* mouseEvent, SoHandleEventAction* action );
148 virtual void keyPressed( SoKeyboardEvent* keyEvent, SoHandleEventAction* action );
149 virtual void keyReleased( SoKeyboardEvent* keyEvent, SoHandleEventAction* action );
150 virtual void touch( SoTouchEvent* touchEvent, SoHandleEventAction* action );
151 virtual void zoom( SoScaleGestureEvent* scaleEvent, SoHandleEventAction* action );
152 virtual void rotate( SoRotateGestureEvent* rotateEvent, SoHandleEventAction* action );
153 virtual void doubleTap(SoDoubleTapGestureEvent* doubleTapEvent, SoHandleEventAction* action);
154 virtual void longTap(SoLongTapGestureEvent* longTapEvent, SoHandleEventAction* action);
155
156 // Events callbacks
157 static void mouseMoveCB(void * userdata, SoEventCallback * node);
158 static void mouseCB(void * userdata, SoEventCallback * node);
159 static void keyboardCB(void * userdata, SoEventCallback * node);
160 static void touchCB(void * userdata, SoEventCallback * node);
161 static void zoomCB(void * userdata, SoEventCallback * node);
162 static void rotateCB(void * userdata, SoEventCallback * node);
163 static void doubleTapCB(void * userdata, SoEventCallback * node);
164 static void longTapCB(void * userdata, SoEventCallback * node);
165 static void wheelCB(void * userdata, SoEventCallback * node);
166
167private:
168 SoRef<SoRotation> m_headlightRot;
169 SoRef<SoSwitch> m_cameraSwitch;
170 SoRef<SoSwitch> m_headlightSwitch;
171
172 SoRef<SoCameraInteractor> m_perspInteractor;
173 SoRef<SoCameraInteractor> m_orthoInteractor;
174
175};
176
177#endif // _SceneInteractor_
3D vector class.
Definition SbVec.h:932
Class for representing a viewport.
Base class for building a basic OpenInventor application without using the classic viewer classes.
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:188
<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.
Group node that saves and restores traversal state.
Base class for touch events.