25#ifndef _SO_WIN_VIEWER_
26#define _SO_WIN_VIEWER_
28#include <Inventor/Win/SoWinBeginStrict.h>
30#include <Inventor/SoType.h>
31#include <Inventor/Win/SoWinRenderArea.h>
32#include <Inventor/misc/SoCallbackList.h>
33#include <Inventor/SbElapsedTime.h>
34#include <Inventor/events/SoKeyboardEvent.h>
35#include <Inventor/Gui/viewers/SoGuiViewer.h>
37#include <Inventor/components/stereo/SoStereoViewer.h>
67class SbEventWrapperList;
344#ifndef HIDDEN_FROM_DOC
345 void saveSceneGraph(
const char* fileName ) ;
385 { m_guiViewer->setPreserveCameraHeightAngle( flag ); }
393 {
return m_guiViewer->isCameraHeightAnglePreserved(); }
668 void setSeekTime(
float seconds ) { m_guiViewer->setSeekTime( seconds ); }
685 { m_guiViewer->addStartCallback( (SoGuiViewerCB*)f, userData ); }
697 { m_guiViewer->addFinishCallback( (SoGuiViewerCB*)f, userData ); }
706 { m_guiViewer->removeStartCallback( (SoGuiViewerCB*)f, userData ); }
715 { m_guiViewer->removeFinishCallback( (SoGuiViewerCB*)f, userData ); }
842 void* userData = NULL );
980 void setViewport(
short left,
short bottom,
short width,
short height ) ;
985 void getViewport(
short& left,
short& bottom,
short& width,
short& height ) ;
1086 return m_guiViewer->getDepthValue(x, y, depth);
1097 float getAntoClipTolerance()
const {
return m_guiViewer->getAutoClipTolerance(); }
1099 SoSeparator* getSceneRoot() {
return m_guiViewer->getSceneRoot(); }
1101 virtual SbBool isInteractive()
const;
1108 SbBool createdCursors, viewingFlag;
1113 SbBool m_seekWithOrtho, m_preserveHeightAngle, cursorEnabledFlag, seekDistAsPercentage, computeSeekVariables;
1114 float m_previousHeightAngle, viewerSpeed, seekDistance;
1117 SbVec3f seekPoint, seekNormal, oldCamPosition, newCamPosition;
1118 SbRotation oldCamOrientation, newCamOrientation;
1125 virtual void adjustCameraClippingPlanes();
1128 SbEventWrapperList* m_eventWrapperList;
1130 void windowsKeyArrayConvert();
1139 SbBool buildInsideParent,
1146 SbBool buildInsideParent,
1160 HCURSOR normalCursor,
1161 dollyCursor, panCursor, rollCursor, seekCursor,
1162 spinCursor, upCursor, flyCursor, walkCursor,
1163 pickCursor, manipCursor;
1169 virtual void defineCursors();
1173 virtual void updateCursor() {};
1184 SbBool processCommonEvents(XAnyEvent *xe);
1197 void interactiveCountInc();
1198 void interactiveCountDec();
1199 int getInteractiveCount() {
return m_guiViewer->getInteractiveCount(); }
1220 virtual void interpolateSeekAnimation(
float t);
1221 virtual void computeSeekFinalOrientation();
1226 virtual void actualRedraw();
1231 virtual void changeCameraValues(
SoCamera* newCamera );
1245 static void setFeedbackOrthoProjection(
const SbVec2s& glxSize );
1248 static void restoreGLStateAfterFeedback();
1250 static void drawViewerCrossFeedback(
SbVec2s loc );
1252 static void drawViewerRollFeedback(
SbVec2s center,
SbVec2s loc );
1262 virtual void widgetChanged( SoWidget );
1265 virtual void afterRealizeHook();
1269 virtual void redraw();
1277 virtual float decimationForFramesPerSecond(
float fps,
double timeTaken,
float decimation );
1284 virtual float decimationForNumTriangles(uint32_t numTris);
1299 static void pasteDoneCB(
void* userData,
SoPathList* pathList );
1303 static void headlightSensorCB(
void* v,
SoSensor* s );
1306 static void visibilityChangeCB(
void* pt,
SbBool visible );
1309 void setZbufferState();
1311 void arrowKeyPressed( KeySym key );
1315 static void alarmCB(
void* thisp,
SoSensor* s );
1316 void stillSensorCalled();
1319 static void seekAnimationSensorCB(
void* p,
SoSensor* sensor );
1340 void* getViewer() {
return (
void*)
this; }
1344SoWinViewer::alarmCB(
void* thisp,
SoSensor* )
1349#include <Inventor/Win/SoWinEndStrict.h>
List of generic (void *) pointers.
Class for representing a rotation.
Triggers a delegate once sometime in the future.
Node that defines an object's base color.
<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...
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.
Sensor that triggers repeatedly at regular intervals.
Stores runtime type information.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Supports copy/pa...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Component for re...
SoSceneManager * getSceneManager() const
Gets the normal scene manager.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Viewer component...
virtual const SbVec2s & getTopLeft()
Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to par...
virtual void setCursorStyle(SoWinViewer::CursorStyle style)
Sets the cursor style.
void SoWinViewerCB(void *userData, SoWinViewer *viewer)
void SoWinViewerCameraTypeChangeCB(void *userData, SoCamera *camera, SoWinViewer *viewer)
virtual void recomputeSceneSize()
This can be used to let the viewer know that the scene graph has changed so that the viewer can recom...
virtual SbBool isStereoBalanceNearFrac()
Returns TRUE if the stereo balance adjustement is defined as a fraction of the camera near distance.
SoWinViewer::BufferType getBufferingType()
Gets the current buffering type in the main view.
SoNode * getCameraSceneGraph()
Gets the sub-scene graph to be viewed.
virtual SbBool isStereoViewing()
Queries if stereo viewing is on or off on the viewer.
virtual SbBool isViewerDoubleBuffer()
Returns TRUE if viewer is double buffered.
SoBaseStereo * getStereoViewType()
Returns the current stereo implementation.
SoWinViewer::DrawStyle getDrawStyle(SoWinViewer::DrawType type)
Queries the current drawing style in the main view.
virtual const SbVec2s & getSize()
Returns the size of the OpenGL drawing window in absolute screen coordinates (not relative to parent ...
virtual void saveHomePosition()
Saves the camera values.
virtual void setNormalVisual(XVisualInfo *i)
Specifies the exact pixel format descriptor for the normal window.
SoType getCameraType()
Gets the camera type that will be created by the viewer if no cameras are found in the scene graph (s...
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.
virtual SbBool isStereoAbsoluteAdjustments() const
Returns TRUE if stereo absolute adjustments are enabled.
virtual void setPreserveCameraHeightAngle(SbBool flag)
If TRUE, an SoPerspectiveCamera's heightAngle is preserved if the camera is changed to an SoOrthograp...
SoCamera * getCamera()
Gets the camera controlled by the viewer.
void SoWinViewerDecimationPercentageCB(float percentage, void *userData, SoWinViewer *viewer)
SbBool isFullRenderingWhenStill()
Queries if the viewer will render at full resolution when it sits still for a certain period of time.
void removeStartCallback(SoWinViewerCB *f, void *userData=NULL)
Removes start callback routine from the viewer.
SbBool isCursorEnabled() const
Queries whether the viewer is allowed to change the cursor over the renderArea window.
virtual const SbVec2s & getBottomRight()
Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to par...
float getSeekTime()
Queries the seek time.
virtual void toggleCameraType()
This routine will toggle the current camera from perspective to orthographic, and from orthographic b...
SbBool isSeekMode()
Queries whether the seek mode is active.
virtual void setSceneGraph(SoNode *newScene)
Sets the scene graph to render.
SbBool isStillNow()
Returns whether the viewer is currently still.
void reverseStereoView(SbBool reverse)
If TRUE, reverse the left and right eye views.
void addFinishCallback(SoWinViewerCB *f, void *userData=NULL)
Adds finish callback routine on the viewer.
void enableFullRenderingWhenStill(SbBool onOff)
If this flag is set, the viewer will render at full resolution when it sits still for a certain perio...
void setDecimationStrategy(SoWinViewer::DecimationStrategy strategy)
Sets strategy to use to decide on decimation value.
void removeFinishCallback(SoWinViewerCB *f, void *userData=NULL)
Removes finish callback routine from the viewer.
int getNumSamples()
Gets how many frames should be timed before frames per second callback is called.
virtual void viewAll()
Changes the camera position to view the entire scene (the camera zoom or orientation isn't changed).
float getCurrentDecimationPercentage()
Returns the Decimation Percentage the viewer used in its last render.
void setGoalNumberOfTriangles(int32_t goal)
Sets goal number of triangles for the viewer to try to render.
CursorStyle
Classic cursors are all white and tend to disappear over white geometry or white background.
@ XOR
Improved cursors using XOR.
@ SHADOW
Improved cursors using "shadow".
@ CLASSIC
Standard Open Inventor cursors.
void setFixedPercentage(float percent)
Sets fixed percentage for the viewer to render (0.0 to 1.0) Default is 1.0.
DrawStyle
list of possible drawing styles
@ VIEW_BBOX
Bounding box draw style.
@ VIEW_HIDDEN_LINE
Render only the frontmost lines.
@ VIEW_NO_TEXTURE
Render without textures.
@ VIEW_LOW_COMPLEXITY
Render low complexity and no texture.
@ VIEW_LOW_RES_LINE
Low complexity wireframe + no depth clearing.
@ VIEW_SAME_AS_STILL
Forces the INTERACTIVE draw style to match STILL.
@ VIEW_POINT
Point draw style.
@ VIEW_LINE
Wireframe draw style.
@ VIEW_LOW_RES_POINT
Low complexity point + no depth clearing.
SoWinViewer::DecimationStrategy getDecimationStrategy()
Gets strategy to use to decide on decimation value.
float getAutoClipTolerance() const
Returns the auto clipping tolerance value.
void copyView(Time eventTime)
Copies the view.
void setAutoClipping(SbBool onOrOff)
Sets the auto clipping plane.
BufferType
list of different buffering types
@ BUFFER_DOUBLE
Double buffer.
@ BUFFER_SINGLE
Single buffer.
@ BUFFER_INTERACTIVE
Double buffer while interactive viewing.
virtual SoNode * getSceneGraph()
Gets the scene graph to be rendered in this component's window.
SbBool isAutoClipping() const
Queries if auto clipping is ON.
virtual void setStereoAbsoluteAdjustments(SbBool absolute)
If TRUE, use stereo absolute adjustments.
void pasteView(Time eventTime)
Pastes the view.
virtual void actualRendering()
This method is called automatically when the viewer requests that its SoBaseStereo object perform ste...
virtual void setStereoActive(SbBool activate)
If TRUE, stero is activated.
virtual void resetToHomePosition()
Restores the camera values.
virtual SbBool isCameraHeightAnglePreserved() const
Query whether the SoPerspectiveCamera's heightAngle is preserved if the camera is changed to an SoOrt...
void setPickRadius(float radius)
Sets the pick radius, in pixels, used by the viewer for picking and seeking actions.
float getStereoOffset()
Returns the stereo offset.
SbBool isHeadlight()
Queries if the headlight is on.
void setHeadlight(SbBool onOrOff)
Turns the headlight on/off (default on).
virtual void setViewing(SbBool onOrOff)
Sets whether the viewer is turned on or off.
virtual SoDEPRECATED void adjustClippingPlanes()
Along with the manipulation of the camera, SoBaseStereo needs to set the scene appropriately when cha...
SoDirectionalLight * getHeadlight()
Returns the headlight node.
void setCameraTypeChangeCallback(SoWinViewerCameraTypeChangeCB *callback, void *userdata)
Defines a callback which is called each time the camera type has changed (change from SoPerspectiveCa...
void setBufferingType(SoWinViewer::BufferType type)
Sets the current buffering type in the main view (default SoWinViewer::BUFFER_DOUBLE).
SbBool isDetailSeek()
Queries whether detail seek is on.
virtual void setCameraSceneGraph(SoNode *cameraSceneGraph)
Sets the sub-scene graph to be used for viewAll computation.
float getGoalFramesPerSecond()
Gets goal frames per second for the viewer to try to render.
int32_t getGoalNumberOfTriangles()
Gets goal number of triangles for the viewer to try to render.
void setSeekTime(float seconds)
Sets the time a seek takes to change to the new camera location.
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 setStereoViewType(SoBaseStereo *stereo)
Set an implementation of stereo viewing to use.
void SoWinViewerFPSCB(float fps, void *userData, SoWinViewer *viewer)
Large Model Viewing notification callbacks for frames per second and decimation percentage.
virtual void setStereoBalance(float balance, SbBool nearFrac=false)
Sets the stereo balance (the position of the zero parallax plane).
virtual void setStereoViewing(SbBool onOrOff)
Turns stereo viewing on/off on the viewer (default off).
virtual void setCursorEnabled(SbBool onOrOff)
Sets whether the viewer is allowed to change the cursor over the renderArea window.
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.
Type
An EDITOR viewer will create a camera under the user supplied scene graph (specified in setSceneGraph...
@ EDITOR
Camera is added to user's scene.
@ BROWSER
Camera views scene, but is not added to scene.
void getViewport(short &left, short &bottom, short &width, short &height)
Returns viewport region as origin (lower-left corner) and size, given as pixel coordinates.
virtual void enableSeekWithOrtho(SbBool flag)
If FALSE, the seek functionality is disabled for an SoOrthographicCamera.
void setDetailSeek(SbBool onOrOff)
When the viewer is in seek mode, left mouse clicks initiate a pick, and the viewer changes its orient...
virtual float getStereoBalance()
Returns the current stereo balance.
void enableMouseWheelDolly(SbBool onOff)
Enable/disable moving the camera with the mouse wheel, TRUE by default.
virtual SoCamera * getViewerCamera()
Returns the camera so SoBaseStereo can manipulate it to achieve the stereo effect.
float getPickRadius() const
Returns the current pick radius for picking and seeking actions.
@ STILL
Applies to static rendering.
@ INTERACTIVE
Applies to rendering while interactive viewing.
void setDecimationPercentageCallback(SoWinViewerDecimationPercentageCB *callback, void *userData=NULL)
Registers decimation percentage callback.
void setGoalFramesPerSecond(float goal)
Sets goal frames per second for the viewer to try to render.
void setStereoOffset(float dist)
Sets the stereo offset.
virtual void setSeekMode(SbBool onOrOff)
Externally set the viewer into/out off seek mode (default OFF).
virtual SbBool isSeekWithOrthoEnabled() const
Query whether the seek functionality is enabled for an SoOrthographicCamera.
virtual void setCamera(SoCamera *cam)
Sets the camera that will be controlled by the viewer.
SbBool isStereoViewReversed()
Returns TRUE if the left and right eye views are reversed.
SoWinViewer::CursorStyle getCursorStyle()
Returns the cursor style.
void setDrawStyle(SoWinViewer::DrawType type, SoWinViewer::DrawStyle style)
Sets the current drawing style in the main view.
void addStartCallback(SoWinViewerCB *f, void *userData=NULL)
Adds start callback routine on the viewer.
void setNumSamples(int numFrames)
Sets how many frames should be timed before frames per second callback is called,...
float getFixedPercentage()
Gets fixed percentage for the viewer to render (0.0 to 1.0)
SbBool isViewing() const
Queries whether the viewer is turned on or off.
virtual SbBool isStereoActive()
Returns TRUE if stereo is active.
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 setFramesPerSecondCallback(SoWinViewerFPSCB *callback, void *userData=NULL)
Registers frames per second callback.
void setAutoClipTolerance(float tolerance)
Sets the auto clipping tolerance value.