52# include <Inventor/Qt/viewers/SoQtViewer.h>
54# include <Inventor/Win/viewers/SoWinViewer.h>
60#include <Inventor/SoType.h>
61#include <Inventor/Xt/SoXtRenderArea.h>
62#include <Inventor/misc/SoCallbackList.h>
63#include <Inventor/SbElapsedTime.h>
64#include <Inventor/events/SoKeyboardEvent.h>
65#include <Inventor/Gui/viewers/SoGuiViewer.h>
66#include <Inventor/components/stereo/SoStereoViewer.h>
385 { m_guiViewer->setPreserveCameraHeightAngle( flag ); }
508 virtual void setDrawStyle( SoXtViewer::DrawType type, SoXtViewer::DrawStyle style );
632 void setSeekTime(
float seconds ) { m_guiViewer->setSeekTime( seconds ); }
648 { m_guiViewer->addStartCallback( (SoGuiViewerCB*)f, userData ); }
659 { m_guiViewer->addFinishCallback( (SoGuiViewerCB*)f, userData ); }
667 { m_guiViewer->removeStartCallback( (SoGuiViewerCB*)f, userData ); }
675 { m_guiViewer->removeFinishCallback( (SoGuiViewerCB*)f, userData ); }
822 void setViewport(
short left,
short bottom,
short width,
short height );
823 void getViewport(
short &left,
short &bottom,
short &width,
short &height );
948 return m_guiViewer->getDepthValue(x, y, depth);
956 virtual void setNormalVisual( XVisualInfo* v );
958#ifndef HIDDEN_FROM_DOC
959 void saveSceneGraph(
const char* fileName ) ;
962 SbBool isInteractive()
const;
969 SbBool createdCursors, viewingFlag;
970 CursorStyle cursorStyle;
974 SbBool m_seekWithOrtho, m_preserveHeightAngle, cursorEnabledFlag, seekDistAsPercentage, computeSeekVariables;
975 float m_previousHeightAngle, viewerSpeed, seekDistance;
976 SoXtViewer::Type type;
978 SbVec3f seekPoint, seekNormal, oldCamPosition, newCamPosition;
979 SbRotation oldCamOrientation, newCamOrientation;
981 virtual SoGLContext* getViewerContext() {
return getNormalSoContext(); }
990 SoXtViewer::Type type,
997 SoXtViewer::Type type,
1005 virtual void updateCursor() {};
1019 SbBool processCommonEvents( XAnyEvent* xe );
1032 void interactiveCountInc();
1033 void interactiveCountDec();
1034 int getInteractiveCount() {
return m_guiViewer->getInteractiveCount(); }
1055 virtual void interpolateSeekAnimation(
float t );
1056 virtual void computeSeekFinalOrientation();
1058 SbBool isSeekMode() {
return m_guiViewer->isSeekMode(); }
1063 virtual void actualRedraw();
1068 virtual void changeCameraValues(
SoCamera* newCamera );
1082 static void setFeedbackOrthoProjection(
const SbVec2s& glxSize );
1086 static void restoreGLStateAfterFeedback();
1089 static void drawViewerCrossFeedback(
SbVec2s loc );
1092 static void drawViewerRollFeedback(
SbVec2s center,
SbVec2s loc );
1095 virtual void afterRealizeHook();
1097 virtual void widgetChanged( SoWidget );
1101 float minimumNearPlane;
1103 virtual void adjustCameraClippingPlanes();
1107 virtual void redraw();
1115 virtual float decimationForFramesPerSecond(
float fps,
double timeTaken,
float decimation );
1122 virtual float decimationForNumTriangles( uint32_t numTris );
1125 void* getViewer() {
return (
void*)
this; }
1128 void constructorCommon( SoXtViewer::Type t,
SbBool buildNow );
1130 void constructorCommon2( SoXtViewer::Type t,
SbBool buildNow );
1140 void setCurrentDrawStyle( SoXtViewer::DrawStyle style );
1144 static void pasteDoneCB(
void* userData,
SoPathList* pathList );
1147 void setZbufferState();
1149 void arrowKeyPressed( KeySym key );
1154 static void alarmCB(
void* thisp,
SoSensor* )
1155 { ((
SoXtViewer*)thisp)->stillSensorCalled(); }
1175 void stillSensorCalled();
1178 static void seekAnimationSensorCB(
void* p,
SoSensor* sensor );
List of generic (void *) pointers.
Class for representing a rotation.
Triggers a delegate once sometime in the future.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class for stereo...
Abstract base class for camera nodes.
Node representing a directional light source.
Node that defines the style to use when rendering.
Sensor class that can be attached to Open Inventor fields.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> OpenGL context m...
AbortCode
Possible return codes from a render abort callback.
Computes bounding box of a scene.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Counts number of...
Base class for all group nodes.
Node that defines the lighting model to use when rendering.
Node that specifies how multiple materials are bound to shapes.
Abstract base class for all database nodes.
Sensor class that can be attached to Open Inventor nodes.
Node that defines base colors using packed representation.
Maintains a list of pointers to paths.
Node representing a 3D rotation about an arbitrary axis.
Field containing an SbTime.
Manages scene graph rendering and event handling.
Abstract base class for Open Inventor sensors.
Group node that saves and restores traversal state.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Pure virtual cla...
Group node that traverses one chosen child.
Stores runtime type information.
Supports copy/paste for Open Inventor using the Xt clipboard.
Component for rendering Open Inventor scene graphs.
SoSceneManager * getSceneManager() const
Gets the normal scene manager.
Viewer component lowest base class.
void copyView(Time eventTime)
Copies the view.
SbBool getDepthValue(int x, int y, float &depth)
Returns the depth value, scaled between 0.0 and 1.0, from the depth buffer at window coordinates x,...
void addStartCallback(SoXtViewerCB *f, void *userData=NULL)
Adds start callback routine on the viewer.
void setAutoClipTolerance(float tolerance)
Sets the auto clipping tolerance value.
float getFixedPercentage()
Gets fixed percentage for the viewer to render (0.0 to 1.0)
SbBool isHeadlight()
Queries if the headlight is on.
virtual void setHeadlight(SbBool onOrOff)
Turns the headlight on/off (default on).
void setDecimationPercentageCallback(SoXtViewerDecimationPercentageCB *callback, void *userData=NULL)
Registers decimation percentage callback.
SbBool isViewing() const
Queries whether the viewer is turned on or off.
void setViewport(short left, short bottom, short width, short height)
Sets viewport region with given origin (lower-left corner) and size, given as pixel coordinates.
void setSeekTime(float seconds)
Sets the time a seek takes to change to the new camera location.
virtual void setCameraSceneGraph(SoNode *cameraSceneGraph)
Sets the sub-scene graph to be used for viewAll computation.
BufferType
list of different buffering types
@ BUFFER_DOUBLE
Double buffer.
@ BUFFER_SINGLE
Single buffer.
@ BUFFER_INTERACTIVE
Double buffer while interactive viewing.
virtual SbBool isSeekWithOrthoEnabled() const
Query whether the seek functionality is enabled for an SoOrthographicCamera.
virtual SbBool isStereoActive()
Queries stereo activation.
Type
An EDITOR viewer will create a camera under the user supplied scene graph (specified in setSceneGraph...
@ BROWSER
Camera views scene, but is not added to scene.
@ EDITOR
Camera is added to user's scene.
float getAutoClipTolerance() const
Gets the auto clipping tolerance value.
virtual SbBool isStereoViewing()
Queries if stereo viewing is on or off on the viewer.
SoNode * getCameraSceneGraph()
Gets the sub-scene graph to be viewed.
void enableFullRenderingWhenStill(SbBool onOff)
If this flag is set, the viewer will render at full resolution when it sits still for a certain perio...
virtual void saveHomePosition()
Saves the camera values.
SbBool isStillNow()
Returns whether the viewer is currently still.
void setGoalNumberOfTriangles(int32_t goal)
Sets goal number of triangles for the viewer to try to render.
virtual SoNode * getSceneGraph()
Gets the scene graph to render.
void setStereoViewType(SoBaseStereo *stereo)
If stereoViewType is NULL, the stereo is inactivated (see setStereoActive).
float getPickRadius() const
Returns the current pick radius for picking and seeking actions.
virtual void recomputeSceneSize()
This can be used to let the viewer know that the scene graph has changed so that the viewer can recom...
int getNumSamples()
Gets how many frames should be timed before frames per second callback is called.
void setDecimationStrategy(SoXtViewer::DecimationStrategy strategy)
Sets strategy to use to decide on decimation value.
float getSeekTime()
Queries the seek time.
virtual void actualRendering()
This method is called automatically when the viewer requests that its SoBaseStereo object perform ste...
virtual void setCursorEnabled(SbBool onOrOff)
Sets whether the viewer is allowed to change the cursor over the renderArea window.
void SoXtViewerDecimationPercentageCB(float percentage, void *userData, SoXtViewer *viewer)
void getViewport(short &left, short &bottom, short &width, short &height)
Returns viewport region with origin (lower-left corner) and size, given as pixel coordinates.
void setAutoClipping(SbBool onOrOff)
Sets the auto clipping plane.
SoXtViewer::DrawStyle getDrawStyle(SoXtViewer::DrawType type)
Queries the current drawing style in the main view.
SoSeparator * getSceneRoot()
void SoXtViewerCB(void *userData, SoXtViewer *viewer)
virtual SoDEPRECATED void adjustClippingPlanes()
void addFinishCallback(SoXtViewerCB *f, void *userData=NULL)
Adds finish callback routines on the viewer.
virtual void setSceneGraph(SoNode *newScene)
Sets the scene graph to render.
virtual void setStereoAbsoluteAdjustments(SbBool absolute)
Specifies if stereo adjustments are absolute.
void reverseStereoView(SbBool reverse)
Sets reversal of the left and right views.
virtual void setCursorStyle(SoXtViewer::CursorStyle style)
Sets the cursor style.
virtual void setSeekMode(SbBool onOrOff)
Externally set the viewer into/out off seek mode (default OFF).
virtual float getStereoBalance()
Queries the stereo balance (the position of the zero parallax plane).
void setGoalFramesPerSecond(float goal)
Sets goal frames per second for the viewer to try to render.
float getStereoOffset()
Returns the stereo offset.
SoDirectionalLight * getHeadlight()
Returns the headlight node.
virtual void toggleCameraType()
This routine will toggle the current camera from perspective to orthographic, and from orthographic b...
virtual const SbVec2s & getTopLeft()
Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to par...
void setFixedPercentage(float percent)
Sets fixed percentage for the viewer to render (0.0 to 1.0) Default is 1.0.
void SoXtViewerFPSCB(float fps, void *userData, SoXtViewer *viewer)
DecimationStrategy
list of decimation strategies
@ FIXED_NUM_TRIANGLES
Try to fix number of triangles drawn.
@ FIXED_PERCENTAGE
Use given decimation percentage.
@ NORMAL
Decimation is not changed.
@ FRAMES_PER_SECOND
Try to fix frames per second.
void setPickRadius(float radius)
Sets the pick radius, in pixels, used by the viewer for picking and seeking actions.
void pasteView(Time eventTime)
Pastes the view.
void setFramesPerSecondCallback(SoXtViewerFPSCB *callback, void *userData=NULL)
Registers frames per second callback.
void SoXtViewerCameraTypeChangeCB(void *userData, SoCamera *camera, SoXtViewer *viewer)
virtual SbBool isStereoBalanceNearFrac()
Returns TRUE when the stereo balance adjustement is defined as a fraction of the camera near distance...
float getGoalFramesPerSecond()
Gets goal frames per second for the viewer to try to render.
virtual const SbVec2s & getBottomRight()
Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to par...
virtual void setViewing(SbBool onOrOff)
Sets whether the viewer is turned on or off.
SoCamera * getCamera()
Gets the edited camera.
virtual SbBool isCameraHeightAnglePreserved() const
Query whether the SoPerspectiveCamera's heightAngle is preserved if the camera is changed to an SoOrt...
virtual SbBool isStereoAbsoluteAdjustments() const
Queries if the stereo adjustments are absolute.
void setDetailSeek(SbBool onOrOff)
When the viewer is in seek mode, left mouse clicks initiate a pick, and the viewer changes its orient...
virtual void setStereoBalance(float balance, SbBool nearFrac)
Sets the stereo balance (the position of the zero parallax plane) and specifies whether the balance v...
SbBool isFullRenderingWhenStill()
Queries if the viewer will render at full resolution when it sits still for a certain period of time.
virtual void setStereoActive(SbBool activate)
Sets stereo activation.
virtual void resetToHomePosition()
Restores the camera values.
SoType getCameraType()
Gets the camera type that will be created by the viewer if no cameras are found in the scene graph (s...
SoXtViewer::CursorStyle getCursorStyle()
Returns the cursor style.
SoBaseStereo * getStereoViewType()
Returns the stereo view type.
virtual void setStereoViewing(SbBool onOrOff)
Turns stereo viewing on/off on the viewer (default off).
float getCurrentDecimationPercentage()
Returns the Decimation Percentage the viewer used in its last render.
SoXtViewer::BufferType getBufferingType()
Gets the current buffering type in the main view.
SoXtViewer::DecimationStrategy getDecimationStrategy()
Gets strategy to use to decide on decimation value.
virtual void setPreserveCameraHeightAngle(SbBool flag)
If TRUE, an SoPerspectiveCamera's heightAngle is preserved if the camera is changed to an SoOrthograp...
virtual SbBool isViewerDoubleBuffer()
Queries if viewer is double buffered.
virtual SoCamera * getViewerCamera()
Returning the camera allows the SoBaseStereo to manipulate it to achieve the stereo effect.
virtual void viewAll()
Changes the camera position to view the entire scene (the camera zoom or orientation isn't changed).
void setNumSamples(int numFrames)
Sets how many frames should be timed before frames per second callback is called, default is 10.
virtual const SbVec2s & getSize()
Returns the size of the OpenGL drawing window in absolute screen coordinates (not relative to parent ...
SbBool isDetailSeek()
Queries whether the viewer is in seek mode.
virtual void setCameraType(SoType type)
Sets the camera type that will be created by the viewer if no cameras are found in the scene graph (s...
void setCameraTypeChangeCallback(SoXtViewerCameraTypeChangeCB *callback, void *userdata)
Defines a callback which is called each time the camera type has changed (change from SoPerspectiveCa...
SbBool isCursorEnabled() const
Queries whether the viewer is allowed to change the cursor over the renderArea window.
void removeStartCallback(SoXtViewerCB *f, void *userData=NULL)
Removes start callback routine from the viewer.
void setStereoOffset(float dist)
Sets the stereo offset.
CursorStyle
Classic cursors are all white and tend to disappear over white geometry or white background.
@ SHADOW
Improved cursors using "shadow".
@ CLASSIC
Standard Open Inventor cursors.
@ XOR
Improved cursors using XOR.
SbBool isAutoClipping() const
Queries if auto clipping is ON.
virtual void enableSeekWithOrtho(SbBool flag)
If FALSE, the seek functionality is disabled for an SoOrthographicCamera.
@ INTERACTIVE
Applies to rendering while interactive viewing.
@ STILL
Applies to static rendering.
virtual void setCamera(SoCamera *cam)
Sets the edited camera.
int32_t getGoalNumberOfTriangles()
Gets goal number of triangles for the viewer to try to render.
void removeFinishCallback(SoXtViewerCB *f, void *userData=NULL)
Removes finish callback routine from the viewer.
DrawStyle
list of possible drawing styles
@ VIEW_LOW_RES_POINT
Low complexity point + no depth clearing.
@ VIEW_LOW_RES_LINE
Low complexity wireframe + no depth clearing.
@ VIEW_BBOX
Bounding box draw style.
@ VIEW_POINT
Point draw style.
@ VIEW_HIDDEN_LINE
Render only the frontmost lines.
@ VIEW_LINE
Wireframe draw style.
@ VIEW_SAME_AS_STILL
Forces the INTERACTIVE draw style to match STILL.
@ VIEW_NO_TEXTURE
Render without textures.
@ VIEW_LOW_COMPLEXITY
Render low complexity and no texture.
SbBool isStereoViewReversed()
Queries reversal of the left and right views.
virtual void setBufferingType(SoXtViewer::BufferType type)
Sets the current buffering type in the main view (default SoXtViewer::BUFFER_DOUBLE).
virtual void setDrawStyle(SoXtViewer::DrawType type, SoXtViewer::DrawStyle style)
Sets the current drawing style in the main view.