Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoXtViewer.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Alain Dumesny (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50
51#ifdef SOQT
52# include <Inventor/Qt/viewers/SoQtViewer.h>
53#elif defined _WIN32
54# include <Inventor/Win/viewers/SoWinViewer.h>
55#else
56
57#ifndef _SO_XT_VIEWER_
58#define _SO_XT_VIEWER_
59
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>
67
68// classes
69class SoNode;
71class SoGroup;
72class SoRotation;
73class SoCamera;
74class SoDrawStyle;
75class SoLightModel;
76class SoFieldSensor;
77class SoXtClipboard;
78class SoXtViewer;
80class SbPList;
81class SoSeparator;
82class SoSwitch;
83class SoComplexity;
84class SoPackedColor;
86class SoSFTime;
87class SoXtInputFocus;
88class SoAlarmSensor;
89class SoNodeSensor;
91class SoStereoViewer;
92class SoBaseStereo;
93class ScRayPickAction;
94
95// callback function prototypes
97typedef void SoXtViewerCB( void* userData, SoXtViewer* viewer );
99typedef void SoXtViewerCameraTypeChangeCB( void* userData, SoCamera* camera, SoXtViewer* viewer );
100
101// Large Model Viewing notification callbacks for
102// frames per second and decimation percentage:
104typedef void SoXtViewerFPSCB( float fps, void* userData, SoXtViewer* viewer );
106typedef void SoXtViewerDecimationPercentageCB( float percentage, void* userData, SoXtViewer* viewer );
107
109//
110// Class: SoXtViewer
111//
112// The Viewer component is the abstract base class for all viewers.
113// It is subclassed from renderArea, adding viewing semantics to Inventor
114// rendering.
115//
117
189{
190 public:
201 enum Type
202 {
210 EDITOR
211 };
212
262
275
292
313
334
335
344 virtual void setSceneGraph(SoNode *newScene);
345
350
356 virtual void setCamera( SoCamera* cam );
357
361 SoCamera* getCamera() { return m_guiViewer->getCamera(); }
362
371 virtual void setCameraType( SoType type );
372
377 SoType getCameraType() { return m_guiViewer->getCameraType(); }
378
385 { m_guiViewer->setPreserveCameraHeightAngle( flag ); }
386
392 virtual SbBool isCameraHeightAnglePreserved() const { return m_guiViewer->isCameraHeightAnglePreserved(); }
393
398 virtual void enableSeekWithOrtho( SbBool flag ) { m_guiViewer->enableSeekWithOrtho( flag ); }
399
404 virtual SbBool isSeekWithOrthoEnabled() const { return m_guiViewer->isSeekWithOrthoEnabled(); }
405
424 virtual void viewAll();
425
429 virtual void saveHomePosition();
430
434 virtual void resetToHomePosition();
435
440 void setCameraTypeChangeCallback( SoXtViewerCameraTypeChangeCB* callback, void* userdata );
441
448 virtual void setHeadlight( SbBool onOrOff );
449
453 SbBool isHeadlight() { return m_guiViewer->isHeadlight(); }
454
458 SoDirectionalLight* getHeadlight() { return m_guiViewer->getHeadlight(); }
459
508 virtual void setDrawStyle( SoXtViewer::DrawType type, SoXtViewer::DrawStyle style );
509
513 SoXtViewer::DrawStyle getDrawStyle( SoXtViewer::DrawType type );
514
519 virtual void setBufferingType( SoXtViewer::BufferType type) ;
520
525 { return (SoXtViewer::BufferType)m_guiViewer->getBufferingType(); }
526
539 virtual void setViewing( SbBool onOrOff );
540
544 SbBool isViewing() const { return m_guiViewer->isViewing(); };
545
556 virtual void setCursorEnabled( SbBool onOrOff );
557
562 SbBool isCursorEnabled() const { return m_guiViewer->isCursorEnabled(); }
563
574 void setAutoClipping( SbBool onOrOff );
575
579 SbBool isAutoClipping() const { return m_guiViewer->isAutoClipping(); }
580
588 virtual void setStereoViewing( SbBool onOrOff );
589
595
599 void setStereoOffset( float dist );
600
605
613 void setDetailSeek( SbBool onOrOff ) { m_guiViewer->setDetailSeek( onOrOff ); };
614
618 SbBool isDetailSeek() { return m_guiViewer->isDetailSeek(); }
619
632 void setSeekTime( float seconds ) { m_guiViewer->setSeekTime( seconds ); }
633
637 float getSeekTime() { return m_guiViewer->getSeekTime(); }
638
647 void addStartCallback( SoXtViewerCB* f, void* userData = NULL )
648 { m_guiViewer->addStartCallback( (SoGuiViewerCB*)f, userData ); }
649
658 void addFinishCallback( SoXtViewerCB* f, void* userData = NULL )
659 { m_guiViewer->addFinishCallback( (SoGuiViewerCB*)f, userData ); }
660
666 void removeStartCallback( SoXtViewerCB* f, void* userData = NULL )
667 { m_guiViewer->removeStartCallback( (SoGuiViewerCB*)f, userData ); }
668
674 void removeFinishCallback( SoXtViewerCB* f, void* userData = NULL )
675 { m_guiViewer->removeFinishCallback( (SoGuiViewerCB*)f, userData ); }
676
682 void copyView( Time eventTime );
683
689 void pasteView( Time eventTime );
690
697 virtual void recomputeSceneSize();
698
699 // --- Large Model Viewing additions:
700
706 void setDecimationStrategy( SoXtViewer::DecimationStrategy strategy );
707
712 { return (SoXtViewer::DecimationStrategy)m_guiViewer->getDecimationStrategy(); }
713
721 void setGoalNumberOfTriangles( int32_t goal );
722
726 int32_t getGoalNumberOfTriangles() { return m_guiViewer->getGoalNumberOfTriangles(); };
727
735 void setGoalFramesPerSecond( float goal );
736
740 float getGoalFramesPerSecond() { return m_guiViewer->getGoalFramesPerSecond(); };
741
749 void setFixedPercentage( float percent );
750
754 float getFixedPercentage() { return m_guiViewer->getFixedPercentage(); };
755
765
770 SbBool isFullRenderingWhenStill() { return m_guiViewer->isFullRenderingWhenStill(); };
771
775 SbBool isStillNow() { return m_guiViewer->isStillNow(); };
776
780 void setFramesPerSecondCallback( SoXtViewerFPSCB* callback, void* userData = NULL );
781
786 void setNumSamples( int numFrames );
791 int getNumSamples() { return m_guiViewer->getNumSamples(); }
792
796 void setDecimationPercentageCallback( SoXtViewerDecimationPercentageCB* callback, void* userData = NULL );
797
802
803 // Implementing methods from the pure virtual class from SoStereoViewer
804
807 virtual void actualRendering();
808 virtual const SbVec2s& getSize();
809 virtual const SbVec2s& getTopLeft() ;
810 virtual const SbVec2s& getBottomRight() ;
813 void reverseStereoView( SbBool reverse );
815 virtual void setStereoAbsoluteAdjustments( SbBool absolute );
816 virtual SbBool isStereoAbsoluteAdjustments() const { return m_guiViewer->isStereoAbsoluteAdjustments(); }
817 virtual void setStereoBalance( float balance, SbBool nearFrac );
818 virtual float getStereoBalance();
820 virtual void setStereoActive( SbBool activate );
822 void setViewport( short left, short bottom, short width, short height );
823 void getViewport( short &left, short &bottom, short &width, short &height );
824
825
840 virtual void setCursorStyle( SoXtViewer::CursorStyle style );
841
846 { return (SoXtViewer::CursorStyle)m_guiViewer->getCursorStyle(); }
847
848
849 SoSeparator* getSceneRoot() { return m_guiViewer->getSceneRoot(); }
850
860 void setAutoClipTolerance ( float tolerance ) { m_guiViewer->setAutoClipTolerance( tolerance ); };
861
865 float getAutoClipTolerance () const { return m_guiViewer->getAutoClipTolerance(); };
866
891 virtual void setCameraSceneGraph( SoNode* cameraSceneGraph );
892
897
907 virtual void toggleCameraType();
908
916 virtual void setSeekMode( SbBool onOrOff );
917
927 void setPickRadius( float radius );
928
932 float getPickRadius() const;
933
934#if 1 SoDEPRECATED
937 virtual void adjustClippingPlanes();
938
939#endif
946 SbBool getDepthValue(int x, int y, float &depth)
947 {
948 return m_guiViewer->getDepthValue(x, y, depth);
949 }
950
951 private:
952 virtual ~SoXtViewer();
953
954 // redefine this routine to also correctly set the buffering type
955 // on the viewer.
956 virtual void setNormalVisual( XVisualInfo* v );
957
958#ifndef HIDDEN_FROM_DOC
959 void saveSceneGraph( const char* fileName ) ;
960#endif //HIDDEN_FROM_DOC
961
962 SbBool isInteractive() const;
963
964 SoGuiViewer* getGuiViewer() const;
965
966 // These members are public only for retro compatibility purposes.
967 // They should not be called directly. Use their accessors instead.
968 SoCamera* camera;
969 SbBool createdCursors, viewingFlag;
970 CursorStyle cursorStyle;
971 SoSeparator* sceneRoot;
972 float sceneSize;
973 SoBaseStereo* stereoViewType;
974 SbBool m_seekWithOrtho, m_preserveHeightAngle, cursorEnabledFlag, seekDistAsPercentage, computeSeekVariables;
975 float m_previousHeightAngle, viewerSpeed, seekDistance;
976 SoXtViewer::Type type;
977 SoNode* sceneGraph;
978 SbVec3f seekPoint, seekNormal, oldCamPosition, newCamPosition;
979 SbRotation oldCamOrientation, newCamOrientation;
980
981 virtual SoGLContext* getViewerContext() { return getNormalSoContext(); }
982 virtual SoSceneManager* getViewerSceneManager() { return getSceneManager(); }
983
984 private:
985
986 // Constructor/Destructor
987 SoXtViewer( SoWidget parent,
988 const char* name,
989 SbBool buildInsideParent,
990 SoXtViewer::Type type,
991 SbBool buildNow,
992 SbBool sync = TRUE );
993
994 SoXtViewer( SoWidget parent,
995 const char* name,
996 SbBool buildInsideParent,
997 SoXtViewer::Type type,
998 SbBool buildNow,
999 SbBool sync,
1000 SoGuiViewer* guiViewer );
1001
1002
1003 // Subclasses should (and do) override this method! (new in v2.6)
1004 // (The setCursorStyle method calls this to force a dynamic change)
1005 virtual void updateCursor() {};
1006
1007 // global vars
1008 SbBool altSwitchBack; // flag to return to PICK after an Alt release
1009
1010 // Subclasses can call this routine to handle a common set of events. A Boolean
1011 // is returned to specify whether the event was handled by the base class.
1012 // Currently handled events and functions are :
1013 // 'Esc' key - toggles viewing on/off
1014 // When viewing OFF - send all events down the scene graph
1015 // When camera == NULL - Discard all viewing events
1016 // 'home' Key - calls resetToHomePosition()
1017 // 's' Key - toggles seek on/off
1018 // Arrow Keys - moves the camera up/down/right/left in the viewing plane
1019 SbBool processCommonEvents( XAnyEvent* xe );
1020
1021 // Invokes the start and finish viewing callbacks. Subclasses NEED to call
1022 // those routines when they start and finish doing interactive viewing
1023 // operations so that correct interactive drawing style and buffering
1024 // types, as well as application callbacks, gets set and called properly.
1025 //
1026 // Those routines simply increment and decrement a counter. When the counter
1027 // changes from 0->1 the start viewing callbacks are called. When the counter
1028 // changes back from 1->0 the finish viewing callbacks are called.
1029 // The counter approach enables different parts of a viewer to call those
1030 // routines withough having to know about each others (which is not
1031 //
1032 void interactiveCountInc();
1033 void interactiveCountDec();
1034 int getInteractiveCount() { return m_guiViewer->getInteractiveCount(); }
1035
1036 //
1037 // This routine is used by subclasses to initiate the seek animation. Given a
1038 // screen mouse location, this routine will return the picked point
1039 // and the normal at that point. It will also schedule the sensor to animate
1040 // if necessary. The routine retuns TRUE if something got picked...
1041 //
1042 // Note: if detailSeek is on, the point and normal correspond to the exact
1043 // 3D location under the cursor.
1044 // if detailSeek if off, the object bbox center and the camera
1045 // orientation are instead returned.
1046 SbBool seekToPoint( const SbVec2s& mouseLocation );
1047
1048 //
1049 // Subclasses CAN redefine this to interpolate camera position/orientation
1050 // while the seek animation is going on (called by animation sensor).
1051 // The parameter t is a [0,1] value corresponding to the animation percentage
1052 // completion. (i.e. a value of 0.25 means that animation is only 1/4 of the way
1053 // through).
1054 //
1055 virtual void interpolateSeekAnimation( float t );
1056 virtual void computeSeekFinalOrientation();
1057
1058 SbBool isSeekMode() { return m_guiViewer->isSeekMode(); }
1059
1060 // redefine this routine to adjust the camera clipping planes just
1061 // before doing a redraw. The sensor will be unschedule after the camera
1062 // is changed in the base class to prevent a second redraw from occuring.
1063 virtual void actualRedraw();
1064
1065 // This is called during a paste.
1066 // Subclasses may wish to redefine this in a way that
1067 // keeps their viewing paradigm intact.
1068 virtual void changeCameraValues( SoCamera* newCamera );
1069
1070 //
1071 // Convenience routines which subclasses can use when drawing viewer
1072 // feedback which may be common across multiple viewers. There is for
1073 // example a convenience routine which sets an orthographics projection
1074 // and a method to draw common feedback like the roll anchor (used by
1075 // a couple of viewers).
1076 //
1077 // All drawing routines assume that the window and projection is
1078 // already set by the caller.
1079 //
1080 // set an ortho projection of the glx window size - this also turns
1081 // zbuffering off and lighting off (if necessary).
1082 static void setFeedbackOrthoProjection( const SbVec2s& glxSize );
1083
1084 // restores the zbuffer and lighting state that was changed when
1085 // setFeedbackOrthoProjection() was last called.
1086 static void restoreGLStateAfterFeedback();
1087
1088 // draws a simple 2 colored cross at given position
1089 static void drawViewerCrossFeedback( SbVec2s loc );
1090
1091 // draws the anchor feedback given center of rotation and mouse location
1092 static void drawViewerRollFeedback( SbVec2s center, SbVec2s loc );
1093
1094 // redefine this for a better default draw style (need to wait for context)
1095 virtual void afterRealizeHook();
1096
1097 virtual void widgetChanged( SoWidget );
1098
1099 // auto clipping vars and routines
1100 SbBool autoClipFlag;
1101 float minimumNearPlane; // minimum near plane as percentage of far
1102 SoGetBoundingBoxAction* autoClipBboxAction;
1103 virtual void adjustCameraClippingPlanes();
1104
1105 // Override redraw() in order to calculate render time including
1106 // frame buffer switch
1107 virtual void redraw();
1108
1109 // Subclasses may override this function to change way that
1110 // viewer tries to calculate decimation percentage for
1111 // DecimationStrategy FRAMES_PER_SECOND.
1112 // Given goal frames per second, timeTaken in last render,
1113 // and last decimation value used, this function should return
1114 // decimation percentage value to use in next render.
1115 virtual float decimationForFramesPerSecond( float fps, double timeTaken, float decimation );
1116
1117 // Subclasses may override this function to change way that
1118 // viewer tries to calculate decimation percentage for
1119 // DecimationStrategy FIXED_NUM_TRIANGLES.
1120 // Given goal number of triangles to reach, this function
1121 // should return decimation percentage value to use.
1122 virtual float decimationForNumTriangles( uint32_t numTris );
1123
1124 // Return a pointer to the XtWidget for stereo
1125 void* getViewer() { return (void*)this; }
1126
1127private:
1128 void constructorCommon( SoXtViewer::Type t, SbBool buildNow );
1129
1130 void constructorCommon2( SoXtViewer::Type t, SbBool buildNow );
1131
1132 SoGuiViewer* m_guiViewer; // Implementation class for SoXxViewer
1133
1134 SbBool m_firstRealize;
1135
1136 // current state vars
1137 SoXtInputFocus* inputFocus;
1138
1139 // draw style vars
1140 void setCurrentDrawStyle( SoXtViewer::DrawStyle style );
1141
1142 // copy and paste support
1143 SoXtClipboard* clipboard;
1144 static void pasteDoneCB( void* userData, SoPathList* pathList );
1145
1146 // set the zbuffer on current window to correct state
1147 void setZbufferState();
1148 SbBool isZbufferOff();
1149 void arrowKeyPressed( KeySym key );
1150
1151 // Decimation strategy additions:
1152 static SoGLRenderAction::AbortCode renderAbortCB( void* data );
1153 SoAlarmSensor* stillSensor;
1154 static void alarmCB( void* thisp, SoSensor* )
1155 { ((SoXtViewer*)thisp)->stillSensorCalled(); }
1156
1157 // PoViews
1173 static SbBool viewingEventCB( SoXtViewer* viewer, XAnyEvent* anyEvent );
1174
1175 void stillSensorCalled();
1176
1177 // Seek animation
1178 static void seekAnimationSensorCB( void* p, SoSensor* sensor );
1179};
1180
1181#endif /* _SO_XT_VIEWER_ */
1182
1183#endif
1184
1185
List of generic (void *) pointers.
Definition SbPList.h:77
Class for representing a rotation.
Definition SbRotation.h:126
2D vector class.
Definition SbVec.h:700
3D vector class.
Definition SbVec.h:932
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.
Definition SoCamera.h:188
Shape complexity node.
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.
Definition SoGroup.h:122
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.
Definition SoNode.h:145
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.
Definition SoPathList.h:81
Node representing a 3D rotation about an arbitrary axis.
Definition SoRotation.h:98
Field containing an SbTime.
Definition SoSFTime.h:82
Manages scene graph rendering and event handling.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
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.
Definition SoSwitch.h:179
Stores runtime type information.
Definition SoType.h:98
Supports copy/paste for Open Inventor using the Xt clipboard.
Reports input focus change events.
Component for rendering Open Inventor scene graphs.
SoSceneManager * getSceneManager() const
Gets the normal scene manager.
Viewer component lowest base class.
Definition SoXtViewer.h:189
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,...
Definition SoXtViewer.h:946
void addStartCallback(SoXtViewerCB *f, void *userData=NULL)
Adds start callback routine on the viewer.
Definition SoXtViewer.h:647
void setAutoClipTolerance(float tolerance)
Sets the auto clipping tolerance value.
Definition SoXtViewer.h:860
float getFixedPercentage()
Gets fixed percentage for the viewer to render (0.0 to 1.0)
Definition SoXtViewer.h:754
SbBool isHeadlight()
Queries if the headlight is on.
Definition SoXtViewer.h:453
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.
Definition SoXtViewer.h:544
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.
Definition SoXtViewer.h:632
virtual void setCameraSceneGraph(SoNode *cameraSceneGraph)
Sets the sub-scene graph to be used for viewAll computation.
BufferType
list of different buffering types
Definition SoXtViewer.h:278
@ BUFFER_DOUBLE
Double buffer.
Definition SoXtViewer.h:286
@ BUFFER_SINGLE
Single buffer.
Definition SoXtViewer.h:282
@ BUFFER_INTERACTIVE
Double buffer while interactive viewing.
Definition SoXtViewer.h:290
virtual SbBool isSeekWithOrthoEnabled() const
Query whether the seek functionality is enabled for an SoOrthographicCamera.
Definition SoXtViewer.h:404
virtual SbBool isStereoActive()
Queries stereo activation.
Type
An EDITOR viewer will create a camera under the user supplied scene graph (specified in setSceneGraph...
Definition SoXtViewer.h:202
@ BROWSER
Camera views scene, but is not added to scene.
Definition SoXtViewer.h:206
@ EDITOR
Camera is added to user's scene.
Definition SoXtViewer.h:210
float getAutoClipTolerance() const
Gets the auto clipping tolerance value.
Definition SoXtViewer.h:865
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.
Definition SoXtViewer.h:775
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.
Definition SoXtViewer.h:791
void setDecimationStrategy(SoXtViewer::DecimationStrategy strategy)
Sets strategy to use to decide on decimation value.
float getSeekTime()
Queries the seek time.
Definition SoXtViewer.h:637
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)
Definition SoXtViewer.h:106
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()
Definition SoXtViewer.h:849
void SoXtViewerCB(void *userData, SoXtViewer *viewer)
Definition SoXtViewer.h:97
virtual SoDEPRECATED void adjustClippingPlanes()
void addFinishCallback(SoXtViewerCB *f, void *userData=NULL)
Adds finish callback routines on the viewer.
Definition SoXtViewer.h:658
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.
Definition SoXtViewer.h:458
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)
Definition SoXtViewer.h:104
DecimationStrategy
list of decimation strategies
Definition SoXtViewer.h:295
@ FIXED_NUM_TRIANGLES
Try to fix number of triangles drawn.
Definition SoXtViewer.h:303
@ FIXED_PERCENTAGE
Use given decimation percentage.
Definition SoXtViewer.h:311
@ NORMAL
Decimation is not changed.
Definition SoXtViewer.h:299
@ FRAMES_PER_SECOND
Try to fix frames per second.
Definition SoXtViewer.h:307
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)
Definition SoXtViewer.h:99
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.
Definition SoXtViewer.h:740
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.
Definition SoXtViewer.h:361
virtual SbBool isCameraHeightAnglePreserved() const
Query whether the SoPerspectiveCamera's heightAngle is preserved if the camera is changed to an SoOrt...
Definition SoXtViewer.h:392
virtual SbBool isStereoAbsoluteAdjustments() const
Queries if the stereo adjustments are absolute.
Definition SoXtViewer.h:816
void setDetailSeek(SbBool onOrOff)
When the viewer is in seek mode, left mouse clicks initiate a pick, and the viewer changes its orient...
Definition SoXtViewer.h:613
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.
Definition SoXtViewer.h:770
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...
Definition SoXtViewer.h:377
SoXtViewer::CursorStyle getCursorStyle()
Returns the cursor style.
Definition SoXtViewer.h:845
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.
Definition SoXtViewer.h:524
SoXtViewer::DecimationStrategy getDecimationStrategy()
Gets strategy to use to decide on decimation value.
Definition SoXtViewer.h:711
virtual void setPreserveCameraHeightAngle(SbBool flag)
If TRUE, an SoPerspectiveCamera's heightAngle is preserved if the camera is changed to an SoOrthograp...
Definition SoXtViewer.h:384
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.
Definition SoXtViewer.h:618
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.
Definition SoXtViewer.h:562
void removeStartCallback(SoXtViewerCB *f, void *userData=NULL)
Removes start callback routine from the viewer.
Definition SoXtViewer.h:666
void setStereoOffset(float dist)
Sets the stereo offset.
CursorStyle
Classic cursors are all white and tend to disappear over white geometry or white background.
Definition SoXtViewer.h:320
@ SHADOW
Improved cursors using "shadow".
Definition SoXtViewer.h:332
@ CLASSIC
Standard Open Inventor cursors.
Definition SoXtViewer.h:324
@ XOR
Improved cursors using XOR.
Definition SoXtViewer.h:328
SbBool isAutoClipping() const
Queries if auto clipping is ON.
Definition SoXtViewer.h:579
virtual void enableSeekWithOrtho(SbBool flag)
If FALSE, the seek functionality is disabled for an SoOrthographicCamera.
Definition SoXtViewer.h:398
DrawType
DrawType.
Definition SoXtViewer.h:265
@ INTERACTIVE
Applies to rendering while interactive viewing.
Definition SoXtViewer.h:273
@ STILL
Applies to static rendering.
Definition SoXtViewer.h:269
virtual void setCamera(SoCamera *cam)
Sets the edited camera.
int32_t getGoalNumberOfTriangles()
Gets goal number of triangles for the viewer to try to render.
Definition SoXtViewer.h:726
void removeFinishCallback(SoXtViewerCB *f, void *userData=NULL)
Removes finish callback routine from the viewer.
Definition SoXtViewer.h:674
DrawStyle
list of possible drawing styles
Definition SoXtViewer.h:220
@ VIEW_LOW_RES_POINT
Low complexity point + no depth clearing.
Definition SoXtViewer.h:256
@ VIEW_LOW_RES_LINE
Low complexity wireframe + no depth clearing.
Definition SoXtViewer.h:252
@ VIEW_BBOX
Bounding box draw style.
Definition SoXtViewer.h:248
@ VIEW_POINT
Point draw style.
Definition SoXtViewer.h:244
@ VIEW_HIDDEN_LINE
Render only the frontmost lines.
Definition SoXtViewer.h:228
@ VIEW_LINE
Wireframe draw style.
Definition SoXtViewer.h:240
@ VIEW_SAME_AS_STILL
Forces the INTERACTIVE draw style to match STILL.
Definition SoXtViewer.h:260
@ VIEW_NO_TEXTURE
Render without textures.
Definition SoXtViewer.h:232
@ VIEW_LOW_COMPLEXITY
Render low complexity and no texture.
Definition SoXtViewer.h:236
@ VIEW_AS_IS
Unchanged.
Definition SoXtViewer.h:224
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.
int SbBool
Boolean type.
Definition SbBase.h:87