Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoWinViewer.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24
25#ifndef _SO_WIN_VIEWER_
26#define _SO_WIN_VIEWER_
27
29
30#include <Inventor/SoType.h>
36
38
39// classes
40class SoFieldSensor;
41class SoNode;
43class SoGroup;
44class SoRotation;
45class SoCamera;
46class SoDrawStyle;
47class SoLightModel;
48class SoTimerSensor;
49class SoWinClipboard;
50class SoWinViewer;
52class SbPList;
53class SoSeparator;
54class SoSwitch;
55class SoComplexity;
56class SoPackedColor;
58class SoBaseColor;
59class SoSFTime;
60class SoAlarmSensor;
61class SoNodeSensor;
63class SoStereoViewer;
64class SoBaseStereo;
65
66class SoType;
67class SbEventWrapperList;
68
69class ScRayPickAction;
70
71// callback function prototypes
72
73typedef void SoWinViewerCB( void* userData, SoWinViewer* viewer );
74
75typedef void SoWinViewerCameraTypeChangeCB( void* userData, SoCamera* camera, SoWinViewer* viewer );
76
81typedef void SoWinViewerFPSCB( float fps, void* userData, SoWinViewer* viewer );
82
83typedef void SoWinViewerDecimationPercentageCB( float percentage, void* userData, SoWinViewer* viewer );
84
86//
87// Class: SoWinViewer
88//
89// The Viewer component is the abstract base class for all viewers.
90// It is subclassed from renderArea, adding viewing semantics to Inventor
91// rendering.
92//
94
166
167 public:
168
179 enum Type
180 {
188 EDITOR
189 };
190
198 {
239 };
252
253
270
271
292
313
322 virtual void setSceneGraph( SoNode* newScene );
323
328
329#ifndef HIDDEN_FROM_DOC
330 void saveSceneGraph( const char* fileName ) ;
331#endif //HIDDEN_FROM_DOC
332
338 virtual void setCamera(SoCamera *cam);
339
346 SoCamera* getCamera() { return m_guiViewer->getCamera(); }
347
356 virtual void setCameraType(SoType type);
357
362 SoType getCameraType() { return m_guiViewer->getCameraType(); }
363
370 { m_guiViewer->setPreserveCameraHeightAngle( flag ); }
371
378 { return m_guiViewer->isCameraHeightAnglePreserved(); }
379
384 virtual void enableSeekWithOrtho( SbBool flag ) { m_guiViewer->enableSeekWithOrtho( flag ); }
385
390 virtual SbBool isSeekWithOrthoEnabled() const { return m_guiViewer->isSeekWithOrthoEnabled(); }
391
410 virtual void viewAll();
411
415 virtual void saveHomePosition();
416
420 virtual void resetToHomePosition();
421
427
434 void setHeadlight( SbBool onOrOff );
435
439 SbBool isHeadlight() { return m_guiViewer->isHeadlight(); }
440
444 SoDirectionalLight* getHeadlight() { return m_guiViewer->getHeadlight(); }
445
495
500
506
511 { return (SoWinViewer::BufferType)m_guiViewer->getBufferingType(); }
512
525 virtual void setViewing( SbBool onOrOff );
526
530 SbBool isViewing() const { return m_guiViewer->isViewing(); }
531
540 virtual void setSeekMode(SbBool onOrOff);
541
546 SbBool isSeekMode() { return m_guiViewer->isSeekMode(); }
547
559 virtual void setCursorEnabled( SbBool onOrOff );
560
566 SbBool isCursorEnabled() const { return m_guiViewer->isCursorEnabled(); }
567
577 void setAutoClipping( SbBool onOrOff );
578
582 SbBool isAutoClipping() const { return m_guiViewer->isAutoClipping(); }
583
609 virtual void setStereoViewing( SbBool onOrOff );
610
616
620 void setStereoOffset( float dist );
621
626
634 void setDetailSeek( SbBool onOrOff ) { m_guiViewer->setDetailSeek( onOrOff ); }
635
639 SbBool isDetailSeek() { return m_guiViewer->isDetailSeek(); }
640
653 void setSeekTime( float seconds ) { m_guiViewer->setSeekTime( seconds ); }
654
658 float getSeekTime() { return m_guiViewer->getSeekTime(); }
659
669 void addStartCallback( SoWinViewerCB* f, void* userData = NULL )
670 { m_guiViewer->addStartCallback( (SoGuiViewerCB*)f, userData ); }
671
681 void addFinishCallback( SoWinViewerCB* f, void* userData = NULL )
682 { m_guiViewer->addFinishCallback( (SoGuiViewerCB*)f, userData ); }
683
690 void removeStartCallback( SoWinViewerCB* f, void* userData = NULL )
691 { m_guiViewer->removeStartCallback( (SoGuiViewerCB*)f, userData ); }
692
699 void removeFinishCallback( SoWinViewerCB *f, void* userData = NULL )
700 { m_guiViewer->removeFinishCallback( (SoGuiViewerCB*)f, userData ); }
701
707 void copyView( Time eventTime );
708
714 void pasteView( Time eventTime );
715
716 // redefine this routine to also correctly set the buffering type
717 // on the viewer.
718 virtual void setNormalVisual( XVisualInfo* i );
719
726 virtual void recomputeSceneSize();
727
728 // --- Large Model Viewing additions:
729
736
741 { return (SoWinViewer::DecimationStrategy)m_guiViewer->getDecimationStrategy(); }
742
750 void setGoalNumberOfTriangles(int32_t goal);
751
755 int32_t getGoalNumberOfTriangles() { return m_guiViewer->getGoalNumberOfTriangles(); }
756
764 void setGoalFramesPerSecond( float goal );
765
769 float getGoalFramesPerSecond() { return m_guiViewer->getGoalFramesPerSecond(); }
770
778 void setFixedPercentage( float percent );
779
783 float getFixedPercentage() { return m_guiViewer->getFixedPercentage(); }
784
794
799 SbBool isFullRenderingWhenStill() { return m_guiViewer->isFullRenderingWhenStill(); }
800
804 SbBool isStillNow() { return m_guiViewer->isStillNow(); }
805
809 void setFramesPerSecondCallback( SoWinViewerFPSCB* callback, void* userData = NULL );
810
815 void setNumSamples( int numFrames );
816
821 int getNumSamples() { return m_guiViewer->getNumSamples(); }
822
827 void* userData = NULL );
828
833
838 void enableMouseWheelDolly( SbBool onOff ) { m_guiViewer->enableMouseWheelDolly( onOff ); }
839
840
850 void setPickRadius( float radius );
851
855 float getPickRadius() const;
856
857public:
858
863
868
875 virtual void actualRendering();
876
881 virtual const SbVec2s& getSize();
882
890 virtual const SbVec2s& getTopLeft() ;
891
899 virtual const SbVec2s& getBottomRight() ;
900
908
913
917 void reverseStereoView( SbBool reverse );
918
923
927 virtual void setStereoAbsoluteAdjustments( SbBool absolute );
928
932 virtual SbBool isStereoAbsoluteAdjustments() const { return m_guiViewer->isStereoAbsoluteAdjustments(); }
933
938 virtual void setStereoBalance( float balance, SbBool nearFrac = false );
939
943 virtual float getStereoBalance();
944
950
955 virtual void setStereoActive( SbBool activate ) ;
956
961
965 void setViewport( short left, short bottom, short width, short height ) ;
966
970 void getViewport( short& left, short& bottom, short& width, short& height ) ;
971
987
992 { return (SoWinViewer::CursorStyle)m_guiViewer->getCursorStyle(); }
993
1003 void setAutoClipTolerance ( float tolerance ) { m_guiViewer->setAutoClipTolerance( tolerance ); }
1004
1008 float getAutoClipTolerance () const { return m_guiViewer->getAutoClipTolerance(); }
1009
1034 virtual void setCameraSceneGraph( SoNode* cameraSceneGraph );
1035
1040
1050 virtual void toggleCameraType();
1051
1052#if 1 SoDEPRECATED
1059 virtual void adjustClippingPlanes();
1060
1061#endif
1069 SbBool getDepthValue(int x, int y, float &depth)
1070 {
1071 return m_guiViewer->getDepthValue(x, y, depth);
1072 }
1073
1074 private:
1075
1076 virtual ~SoWinViewer();
1077
1082 float getAntoClipTolerance() const { return m_guiViewer->getAutoClipTolerance(); }
1083
1084 SoSeparator* getSceneRoot() { return m_guiViewer->getSceneRoot(); }
1085
1086 virtual SbBool isInteractive() const;
1087
1088 SoGuiViewer* getGuiViewer() const;
1089
1090 // These members are public only for retro compatibility purposes.
1091 // They should not be called directly. Use their accessors instead.
1092 SoCamera* camera;
1093 SbBool createdCursors, viewingFlag;
1094 CursorStyle cursorStyle;
1095 SoSeparator* sceneRoot;
1096 float sceneSize;
1097 SoBaseStereo* stereoViewType;
1098 SbBool m_seekWithOrtho, m_preserveHeightAngle, cursorEnabledFlag, seekDistAsPercentage, computeSeekVariables;
1099 float m_previousHeightAngle, viewerSpeed, seekDistance;
1100 SoWinViewer::Type type;
1101 SoNode* sceneGraph;
1102 SbVec3f seekPoint, seekNormal, oldCamPosition, newCamPosition;
1103 SbRotation oldCamOrientation, newCamOrientation;
1104
1105 virtual SoGLContext* getViewerContext() { return getNormalSoContext(); }
1106 virtual SoSceneManager* getViewerSceneManager() { return getSceneManager(); }
1107
1108 private:
1109
1110 virtual void adjustCameraClippingPlanes();
1111
1112 // list of new Binding
1113 SbEventWrapperList* m_eventWrapperList;
1114
1115 void windowsKeyArrayConvert();
1116 SoKeyboardEvent::Key* m_windowsKeyArray;
1117
1119 SoKeyboardEvent::Key keyCodeToEnum(WPARAM param);
1120
1121 // Constructor/Destructor
1122 SoWinViewer( SoWidget parent,
1123 const char* name,
1124 SbBool buildInsideParent,
1125 SoWinViewer::Type type, // Removed class qualifier from enum --mmh 1/12/95
1126 SbBool buildNow,
1127 SbBool sync );
1128
1129 SoWinViewer( SoWidget parent,
1130 const char* name,
1131 SbBool buildInsideParent,
1132 SoWinViewer::Type type,
1133 SbBool buildNow,
1134 SbBool sync,
1135 SoGuiViewer* guiViewer );
1136
1137 // global vars new in v2.1
1138 SbBool altSwitchBack; // flag to return to PICK after an Alt release
1139
1140 // Previously declared in subclasses (before v2.6)
1141 // Note that each subclass viewer uses a subset of these standard
1142 // cursor names. Note that the Fly and Walk viewers used slightly
1143 // different names (that were too generic) for their specific cursors
1144 // (the last two in the list) prior to v2.6.
1145 HCURSOR normalCursor, // std arrow
1146 dollyCursor, panCursor, rollCursor, seekCursor,
1147 spinCursor, upCursor, flyCursor, walkCursor,
1148 pickCursor, manipCursor; // => For constrained viewer.
1149
1150 // Load cursor definitions from resource file.
1151 // previously declared in subclasses (before v2.6).
1152 // Subclasses may override, but are not required to do so
1153 // unless they need more or different cursor definitions.
1154 virtual void defineCursors();
1155
1156 // Subclasses should (and do) override this method! (new in v2.6)
1157 // (The setCursorStyle method calls this to force a dynamic change)
1158 virtual void updateCursor() {};
1159
1160 // Subclasses can call this routine to handle a common set of events. A Boolean
1161 // is returned to specify whether the event was handled by the base class.
1162 // Currently handled events and functions are :
1163 // 'Esc' key - toggles viewing on/off
1164 // When viewing OFF - send all events down the scene graph
1165 // When camera == NULL - Discard all viewing events
1166 // 'home' Key - calls resetToHomePosition()
1167 // 's' Key - toggles seek on/off
1168 // Arrow Keys - moves the camera up/down/right/left in the viewing plane
1169 SbBool processCommonEvents(XAnyEvent *xe);
1170
1171 // Invokes the start and finish viewing callbacks. Subclasses NEED to call
1172 // those routines when they start and finish doing interactive viewing
1173 // operations so that correct interactive drawing style and buffering
1174 // types, as well as application callbacks, gets set and called properly.
1175 //
1176 // Those routines simply increment and decrement a counter. When the counter
1177 // changes from 0->1 the start viewing callbacks are called. When the counter
1178 // changes back from 1->0 the finish viewing callbacks are called.
1179 // The counter approach enables different parts of a viewer to call those
1180 // routines withough having to know about each others (which is not
1181 //
1182 void interactiveCountInc();
1183 void interactiveCountDec();
1184 int getInteractiveCount() { return m_guiViewer->getInteractiveCount(); }
1185
1186 //
1187 // This routine is used by subclasses to initiate the seek animation. Given a
1188 // screen mouse location, this routine will return the picked point
1189 // and the normal at that point. It will also schedule the sensor to animate
1190 // if necessary. The routine retuns TRUE if something got picked...
1191 //
1192 // Note: if detailSeek is on, the point and normal correspond to the exact
1193 // 3D location under the cursor.
1194 // if detailSeek if off, the object bbox center and the camera
1195 // orientation are instead returned.
1196 SbBool seekToPoint(const SbVec2s &mouseLocation);
1197
1198 //
1199 // Subclasses CAN redefine this to interpolate camera position/orientation
1200 // while the seek animation is going on (called by animation sensor).
1201 // The parameter t is a [0,1] value corresponding to the animation percentage
1202 // completion. (i.e. a value of 0.25 means that animation is only 1/4 of the way
1203 // through).
1204 //
1205 virtual void interpolateSeekAnimation(float t);
1206 virtual void computeSeekFinalOrientation();
1207
1208 // redefine this routine to adjust the camera clipping planes just
1209 // before doing a redraw. The sensor will be unschedule after the camera
1210 // is changed in the base class to prevent a second redraw from occuring.
1211 virtual void actualRedraw();
1212
1213 // This is called during a paste.
1214 // Subclasses may wish to redefine this in a way that
1215 // keeps their viewing paradigm intact.
1216 virtual void changeCameraValues( SoCamera* newCamera );
1217
1218 //
1219 // Convenience routines which subclasses can use when drawing viewer
1220 // feedback which may be common across multiple viewers. There is for
1221 // example a convenience routine which sets an orthographics projection
1222 // and a method to draw common feedback like the roll anchor (used by
1223 // a couple of viewers).
1224 //
1225 // All drawing routines assume that the window and projection is
1226 // already set by the caller.
1227 //
1228 // set an ortho projection of the glx window size - this also turns
1229 // zbuffering off and lighting off (if necessary).
1230 static void setFeedbackOrthoProjection( const SbVec2s& glxSize );
1231 // restores the zbuffer and lighting state that was changed when
1232 // setFeedbackOrthoProjection() was last called.
1233 static void restoreGLStateAfterFeedback();
1234 // draws a simple 2 colored cross at given position
1235 static void drawViewerCrossFeedback( SbVec2s loc );
1236 // draws the anchor feedback given center of rotation and mouse location
1237 static void drawViewerRollFeedback( SbVec2s center, SbVec2s loc );
1238
1239 //
1240 // set the right zbuffer state (based on the current draw style) whenever
1241 // the window changes.
1242 //
1243 // HACK: redefines this routine from SoWinRenderArea to also check to make
1244 // sure that SoWinViewer::setBufferingType() is updated if users call
1245 // SoWinGLWidget::setDoubleBuffer() instead.
1246 //
1247 virtual void widgetChanged( SoWidget );
1248
1249 // redefine this for a better default draw style (need to wait for context)
1250 virtual void afterRealizeHook();
1251
1252 // Override redraw() in order to calculate render time including
1253 // frame buffer switch
1254 virtual void redraw();
1255
1256 // Subclasses may override this function to change way that
1257 // viewer tries to calculate decimation percentage for
1258 // DecimationStrategy FRAMES_PER_SECOND.
1259 // Given goal frames per second, timeTaken in last render,
1260 // and last decimation value used, this function should return
1261 // decimation percentage value to use in next render.
1262 virtual float decimationForFramesPerSecond( float fps, double timeTaken, float decimation );
1263
1264 // Subclasses may override this function to change way that
1265 // viewer tries to calculate decimation percentage for
1266 // DecimationStrategy FIXED_NUM_TRIANGLES.
1267 // Given goal number of triangles to reach, this function
1268 // should return decimation percentage value to use.
1269 virtual float decimationForNumTriangles(uint32_t numTris);
1270
1271 void setCurrentDrawStyle(SoWinViewer::DrawStyle style);
1272
1273 private:
1274
1275 void constructorCommon( SoWinViewer::Type t, SbBool buildNow );
1276 void constructorCommon2( SoWinViewer::Type t, SbBool buildNow );
1277
1278 SoGuiViewer* m_guiViewer; // Implementation class for SoXxViewer
1279
1280 SbBool m_firstRealize;
1281
1282 // copy and paste support
1283 SoWinClipboard* clipboard;
1284 static void pasteDoneCB( void* userData, SoPathList* pathList );
1285
1286 // headlight variables
1287 SoFieldSensor* headlightSensor; // attached to camera
1288 static void headlightSensorCB( void* v, SoSensor* s );
1289
1290 // Attach/detach headlightSensor.
1291 static void visibilityChangeCB( void* pt, SbBool visible );
1292
1293 // set the zbuffer on current window to correct state
1294 void setZbufferState();
1295 SbBool isZbufferOff();
1296 void arrowKeyPressed( KeySym key );
1297
1298 // Decimation strategy additions:
1299 SoAlarmSensor* stillSensor;
1300 static void alarmCB( void* thisp, SoSensor* s );
1301 void stillSensorCalled();
1302
1303 // Seek animation
1304 static void seekAnimationSensorCB( void* p, SoSensor* sensor );
1305
1306 // PoViews
1322 static SbBool viewingEventCB( SoWinViewer* viewer, XAnyEvent* anyEvent );
1323
1324private:
1325 void* getViewer() { return (void*)this; }
1326 };
1327
1328inline void
1329SoWinViewer::alarmCB( void* thisp, SoSensor* )
1330{
1331 ((SoWinViewer*)thisp)->stillSensorCalled();
1332}
1333
1335
1336#endif /* _SO_WIN_VIEWER_ */
1337
1338
1339
1340
#define SoWidget
Definition SoQtDef.h:40
#define KeySym
Definition SoWinDef.h:57
#define XVisualInfo
Definition SoWinDef.h:141
#define XAnyEvent
Definition SoWinDef.h:100
#define Time
Definition SoWinDef.h:93
void SoWinViewerCB(void *userData, SoWinViewer *viewer)
Definition SoWinViewer.h:73
void SoWinViewerCameraTypeChangeCB(void *userData, SoCamera *camera, SoWinViewer *viewer)
Definition SoWinViewer.h:75
void SoWinViewerDecimationPercentageCB(float percentage, void *userData, SoWinViewer *viewer)
Definition SoWinViewer.h:83
void SoWinViewerFPSCB(float fps, void *userData, SoWinViewer *viewer)
Large Model Viewing notification callbacks for frames per second and decimation percentage.
Definition SoWinViewer.h:81
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.
Node that defines an object's base color.
Definition SoBaseColor.h:95
<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...
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
Key
The keyboard keys.
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:97
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:167
Sensor that triggers repeatedly at regular intervals.
Stores runtime type information.
Definition SoType.h:98
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Supports copy/pa...
virtual SoGLContext * getNormalSoContext()
<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.
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.
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_AS_IS
Unchanged.
@ 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.
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.
DrawType
DrawType.
@ 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.
int SbBool
Boolean type.
Definition SbBase.h:87