Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoGuiViewer.h
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-2020 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : T.MEHAMLI (Jun 2007)
22**=======================================================================*/
23
24#ifndef SO_GUI_VIEWER
25#define SO_GUI_VIEWER
26
28//
29// Class: SoGuiViewer
30//
31// SoXXViewer implementation class
32//
33//
35
36#include <Inventor/Gui/SoGuiRenderArea.h>
37#include <Inventor/SbElapsedTime.h>
38#include <Inventor/fields/SoSFEnum.h>
39#include <Inventor/fields/SoSFBitMask.h>
40#include <Inventor/components/stereo/SoStereoViewer.h>
41
42class SoCallbackList;
43
44// classes
45class SoNode;
47class SoGroup;
48class SoRotation;
49class SoCamera;
50class SoDrawStyle;
51class SoLightModel;
52class SoFieldSensor;
53class SoGuiViewer;
55class SoSeparator;
56class SoShadowGroup;
57class SoSwitch;
58class SoComplexity;
59class SoColorMask;
61class SoSFTime;
62class SoNodeSensor;
64class SoBaseStereo;
65class SoDepthBuffer;
66class SoPerfCounter;
67
68#ifndef HIDDEN_FROM_DOC
69// callback function prototypes
70typedef void SoGuiViewerCB( void* userData, void* viewer );
71typedef void SoGuiViewerCameraTypeChangeCB( void* userData, SoCamera* camera, void* viewer );
72
73// Large Model Viewing notification callbacks for
74// frames per second and decimation percentage:
75typedef void SoGuiViewerFPSCB( float fps, void* userData, void* viewer );
76typedef void SoGuiViewerDecimationPercentageCB( float percentage, void* userData, void* viewer );
77#endif
78
79
80class SoGuiViewer : public SoGuiRenderArea, virtual public SoStereoViewer
81{
82#ifndef HIDDEN_FROM_DOC
83 SO_FIELDCONTAINER_HEADER( SoGuiViewer );
84#endif
85
86private:
87 SoSFBool stereoActive;
88 SoSFEnum stereoType;
89 SoSFBitMask stereoColorMask;
90 SoSFBool hiddenLine;
91
92 enum StereoViewType
93 {
94 // Monoscopic viewing
95 NO_STEREO_VIEW = 0,
96 // Two views interlaced in a single image
97 INTERLACED_STEREO = 1,
98 // Each view displayed in a half screen
99 HALF_SCREEN_STEREO = 2,
100 // Two views superimposed on a single image
101 RAW_STEREO = 3,
102 // Ditto
103 OPENGL_STEREO = 3,
104 // Each view is displayed through a color filter
105 ANAGLYPH_STEREO = 4,
106 // Ditto
107 ANAGLYPH = 4,
108#ifndef HIDDEN_FROM_DOC
109 // Uses the SSDI library to set the stereo
110 SSDI_STEREO = 5,
111#endif
112
113 PASSIVE_STEREO = 6
114 };
115
116
117 enum Color
118 {
119 RED = 0x01,
120 GREEN = 0x02,
121 BLUE = 0x04
122 };
123
124 // An EDITOR viewer will create a camera under the user supplied scene
125 // graph (specified in setSceneGraph()) if it cannot find one in the
126 // scene and will leave the camera behind when supplied with a new scene.
127 //
128 // A BROWSER viewer will also create a camera if it cannot find one in
129 // the scene, but will place it above the scene graph node (camera will
130 // not appear in the user supplied scene graph), and will automatically
131 // remove it when another scene is supplied to the viewer.
132 enum Type
133 {
137 BROWSER,
141 EDITOR
142 };
143
144 //
145 // list of possible drawing styles
146 //
147 // Note: Refer to the SoXxViewer man pages for a complete
148 // description of those draw styles.
149 //
150 enum DrawStyle
151 {
155 VIEW_AS_IS,
159 VIEW_HIDDEN_LINE,
163 VIEW_NO_TEXTURE,
167 VIEW_LOW_COMPLEXITY,
171 VIEW_LINE,
175 VIEW_POINT,
179 VIEW_BBOX,
183 VIEW_LOW_RES_LINE,
187 VIEW_LOW_RES_POINT,
191 VIEW_SAME_AS_STILL
192 };
193
194 enum DrawType
195 {
199 STILL,
203 INTERACTIVE
204 };
205
206 //
207 // list of different buffering types
208 //
209 enum BufferType
210 {
214 BUFFER_SINGLE,
218 BUFFER_DOUBLE,
222 BUFFER_INTERACTIVE
223 };
224
225 //
226 // list of decimation strategies
227 //
228 enum DecimationStrategy
229 {
233 NORMAL,
237 FIXED_NUM_TRIANGLES,
241 FRAMES_PER_SECOND,
245 FIXED_PERCENTAGE
246 };
247
248 // Classic cursors are all white and tend to disappear over white
249 // geometry or white background. New styles avoid that problem
250 enum CursorStyle
251 {
255 CLASSIC,
259 XOR,
263 SHADOW
264 };
265
266 // Arrow key direction enum
267 enum Direction
268 {
269 AKP_UP,
270 AKP_DOWN,
271 AKP_RIGHT,
272 AKP_LEFT
273 };
274
278 SoGuiViewer();
279
288 virtual void setSceneGraph( SoNode* newScene );
289
293 virtual SoNode* getSceneGraph();
294
300 virtual void setCamera( SoCamera* newCamera );
301
305 SoCamera* getCamera();
306
312 SoNONUNICODE SbBool saveSceneGraph( const char* fileName );
313
314
319 SbBool saveSceneGraph( const SbString& fileName );
320
329 virtual void setCameraType( SoType type );
330
335 SoType getCameraType();
336
342 virtual void setPreserveCameraHeightAngle( SbBool flag );
343
349 virtual SbBool isCameraHeightAnglePreserved() const;
350
355 virtual void enableSeekWithOrtho( SbBool flag );
356
361 virtual SbBool isSeekWithOrthoEnabled() const;
362
367 virtual void viewAll();
368
372 virtual void saveHomePosition();
373
377 virtual void resetToHomePosition();
378
385 virtual void setHeadlight( SbBool insertFlag );
386
390 SbBool isHeadlight();
391
395 SoDirectionalLight* getHeadlight();
396
445 virtual void setDrawStyle( DrawType type, DrawStyle style );
446
450 SoGuiViewer::DrawStyle getDrawStyle( SoGuiViewer::DrawType type );
451
456 virtual void setBufferingType( BufferType type );
457
461 SoGuiViewer::BufferType getBufferingType();
462
475 virtual void setViewing( SbBool flag );
476
480 SbBool isViewing() const;
481
492 virtual void setCursorEnabled( SbBool flag );
493
498 SbBool isCursorEnabled() const;
499
510 void setAutoClipping( SbBool flag );
511
516 virtual SbBool isStereoViewing();
517
521 SbBool isAutoClipping() const;
522
526 void setStereoOffset( float dist );
527
531 float getStereoOffset();
532
540 void setDetailSeek( SbBool onOrOff );
541
545 SbBool isDetailSeek();
546
559 void setSeekTime( float seconds );
560
564 float getSeekTime();
565
572 virtual void recomputeSceneSize();
573
574 // --- Large Model Viewing additions:
575
581 void setDecimationStrategy( DecimationStrategy strategy );
585 DecimationStrategy getDecimationStrategy() const;
586
594 void setGoalNumberOfTriangles( int32_t goal );
595
599 int32_t getGoalNumberOfTriangles();
600
608 void setGoalFramesPerSecond( float goal );
609
613 float getGoalFramesPerSecond();
614
622 void setFixedPercentage( float percent );
623
627 float getFixedPercentage();
628
637 void enableFullRenderingWhenStill( SbBool onOff );
638
643 SbBool isFullRenderingWhenStill();
644
645 void setStill( SbBool isStill );
649 SbBool isStillNow();
650
656 void setNumSamples( int numFrames );
657
662 int getNumSamples();
663
667 float getCurrentDecimationPercentage();
668
669 // Implementing methods from the pure virtual class from SoStereoViewer
670 virtual void setStereoActive(SbBool activate);
671 virtual SbBool isStereoActive();
672 virtual void actualRendering();
673 virtual SoCamera* getViewerCamera();
674 virtual const SbVec2s& getSize();
675 virtual const SbVec2s& getTopLeft();
676 virtual const SbVec2s& getBottomRight();
677 virtual SbBool isViewerDoubleBuffer();
678 virtual void setStereoViewType( SoBaseStereo* stereo );
679 virtual SoBaseStereo* getStereoViewType();
680 virtual void reverseStereoView( SbBool reverse );
681 virtual SbBool isStereoViewReversed();
682 virtual void setStereoAbsoluteAdjustments( SbBool absolute );
683 virtual SbBool isStereoAbsoluteAdjustments() const;
684 virtual void setStereoBalance( float balance, SbBool nearFrac = false );
685 virtual float getStereoBalance();
686 virtual SbBool isStereoBalanceNearFrac();
687 virtual void setViewport( short left, short bottom, short width, short height );
688 virtual void getViewport(short& left, short& bottom, short& width, short& height);
689 virtual SoGLContext* getViewerContext() { return NULL; }
690 virtual SoSceneManager* getViewerSceneManager() { return this->getSceneManager(); }
691
692 SoSeparator* getSceneRoot();
693 bool getFirstRedrawFlag() const
694 { return m_isFirstRedraw; }
695 void setFirstRedrawFlag(bool value)
696 { m_isFirstRedraw = value; }
697
698
713 virtual void setCursorStyle( CursorStyle style );
714
718 CursorStyle getCursorStyle() const;
719
729 void setAutoClipTolerance ( float tolerance );
730
734 float getAutoClipTolerance () const;
735
757 virtual void setCameraSceneGraph( SoNode* cameraSceneGraph );
758
762 SoNode* getCameraSceneGraph();
763
768 void enableShadows( bool onOrOff );
769
773 SbBool isEnableShadows();
774
778 SoShadowGroup* getShadowGroup();
779
785 void enableMouseWheelDolly( SbBool onOff );
786 SbBool isMouseWheelEnabled() const;
787
788 SbBool isInteractive() const;
789
790 // This routine will toggle the current camera from perspective to
791 // orthographic, and from orthographic back to perspective.
792 virtual void toggleCameraType();
793
802 virtual void setSeekMode( SbBool flag );
803 SbBool isSeekMode() const;
804
805 // Accessor and mutator for the member m_interactiveFlag
806 void setInteractiveFlag( SbBool flag );
807 SbBool getInteractiveFlag() const;
808
809 // Accessor and mutator for the member m_stillDrawStyle
810 void setStillDrawStyle( DrawStyle style );
811 DrawStyle getStillDrawStyle() const;
812
813 // Accessor and mutator for the member m_interactiveDrawStyle
814 void setInteractiveDrawStyle( DrawStyle style );
815 DrawStyle getInteractiveDrawStyle() const;
816
817 // Accessor and mutator for the member m_seekStartTime
818 void setSeekStartTime( SbTime seekTime );
819 SbTime getSeekStartTime() const;
820
821 // Accessor and mutator for the member m_newCamOrientation
822 void setNewCamOrientation( SbRotation newOrientation );
823 SbRotation getNewCamOrientation() const;
824
825 // Accessor and mutator for the member m_newCamOrientation
826 void setSeekPoint( SbVec3f newOrientation );
827 SbVec3f getSeekPoint() const;
828
829 // Accessor and mutator for the member m_viewerSpeed
830 void setViewerSpeed( float speed );
831 float getViewerSpeed() const;
832
833 // Mutator for the member m_headlightFlag
834 void setHeadLightFlag( SbBool flag );
835
836 // Accessor and Mutator for the member m_createdCursors
837 void setCreatedCursors( SbBool flag );
838 SbBool getCreatedCursors() const;
839
840 // Mutator for the member m_interactiveCount
841 void setInteractiveCount( int count );
842
843 // Accessor for the member m_finishCBList
844 SoCallbackList* getFinishCBList();
845
846 // Accessor and mutator for the member m_checkForDrawStyle
847 void setCheckForDrawStyle( SbBool flag );
848 SbBool getCheckForDrawStyle() const;
849
850 // Accessor and mutator for the member m_type
851 void setType( Type type );
852 Type getType() const;
853
854 // Accessor and mutator for the member m_viewerRealTime
855 void setRealTime( SoSFTime* type );
856 SoSFTime* getRealTime() const;
857
858 // Accessor and mutator for the member m_seekDistance
859 void setSeekDistance( float seekDistance );
860 float getSeekDistance();
861
862 // Accessor and mutator for the member m_sceneSize
863 void setSceneSize( float size );
864 float getSceneSize();
865
866 // Retro compatibility accessors
867 SbBool getComputeSeekVariables() const { return m_computeSeekVariables; }
868 float getPreviousHeightAngle() { return m_previousHeightAngle; }
869 SbVec3f getSeekNormal() { return m_seekNormal; }
870 SbVec3f getNewCamPosition() { return m_newCamPosition; }
871
872 // Seek sensor accessors
873 void setSeekSensor( SoFieldSensor* s );
874 SoFieldSensor* getSeekSensor() const;
875
876 // Accessor for the member m_createdCamera
877 SbBool getCreatedCamera() const;
878
879 void setViewer( void* viewer );
880
881 // redefine this to call the viewer setBufferingType() method instead.
882 virtual SbBool setDoubleBuffer( SbBool flag );
883
884 // Writes to file the scene graph
885 //
886 // @UNICODE_WARNING
887 SoNONUNICODE static void writeScene( SoNode* node, const char* filename );
888
889 // Writes to file the scene graph
890 static void writeScene( SoNode* node, const SbString& filename );
891
892 // Callbacks
893 void setCameraTypeChangeCallback( SoGuiViewerCameraTypeChangeCB* callback, void* userdata );
894 void addStartCallback( SoGuiViewerCB* f, void* userData = NULL );
895 void addFinishCallback( SoGuiViewerCB* f, void* userData = NULL );
896 void removeStartCallback( SoGuiViewerCB* f, void* userData = NULL );
897 void removeFinishCallback( SoGuiViewerCB* f, void* userData = NULL );
898
903 void setFramesPerSecondCallback( SoGuiViewerFPSCB* callback, void* userData = NULL );
904
909 void setDecimationPercentageCallback( SoGuiViewerDecimationPercentageCB* callback, void* userData = NULL );
910
911 SbBool isZBufferOff();
912
913 void arrowKeyPressed( Direction direction );
914
915 SbBool getDepthValue(int x, int y, float &depth);
916 //Inner public class
917 class CameraFields {
918 public:
919 CameraFields();
920 SbBool isModified( SoCamera* cam );
921 void setCameraFields( SoCamera* cam );
922 static bool stereoDataMatchViewerState( SoCamera* cam, SoGuiViewer* viewer );
923 static void setViewerStereoData( SoCamera* cam, SoGuiViewer* viewer );
924 static void setCameraStereoData( SoCamera* cam, SoGuiViewer* viewer );
925
926 private:
927 int m_viewportMapping;
928 SbVec3f m_position;
929 SbRotation m_orientation;
930 float m_aspectRatio;
931 float m_nearDistance;
932 float m_farDistance;
933 float m_focalDistance;
934 float m_height;
935 //stereo data
936 bool m_stereoAbsoluteAdjustments;
937 float m_stereoAdjustment;
938 float m_balanceAdjustment;
939 int m_stereoMode;
940 bool m_balanceNearFrac;
941 };
942
943 // ----------------------- Extension usage -----------------------------------
944
945 virtual void afterRealizeHook();
946
947 virtual void adjustCameraClippingPlanes();
948
949 // Invokes the start and finish viewing callbacks. Subclasses NEED to call
950 // those routines when they start and finish doing interactive viewing
951 // operations so that correct interactive drawing style and buffering
952 // types, as well as application callbacks, gets set and called properly.
953 //
954 // Those routines simply increment and decrement a counter. When the counter
955 // changes from 0->1 the start viewing callbacks are called. When the counter
956 // changes back from 1->0 the finish viewing callbacks are called.
957 // The counter approach enables different parts of a viewer to call those
958 // routines withough having to know about each others (which is not
959 void interactiveCountInc();
960 void interactiveCountDec();
961 int getInteractiveCount();
962
963 //
964 // This routine is used by subclasses to initiate the seek animation. Given a
965 // screen mouse location, this routine will return the picked point
966 // and the normal at that point. It will also schedule the sensor to animate
967 // if necessary. The routine returns TRUE if something got picked...
968 //
969 // Note: if detailSeek is on, the point and normal correspond to the exact
970 // 3D location under the cursor.
971 // if detailSeek if off, the object bbox center and the camera
972 // orientation are instead returned.
973 //
974 // @param mouseLocation screen mouse location.
975 // @param allowChangeOrientation if true, allows change of camera orientation.
976 // @param allowChangeDistance if true, allows change of camera distance or height.
977 SbBool seekToPoint( const SbVec2s& mouseLocation, SbBool allowChangeOrientation=TRUE, SbBool allowChangeDistance=TRUE );
978
979 // This routine is used by subclasses to initiate the seek animation.
980 // Given a target world point location and a world normal (at that point).
981 // It will also schedule the sensor to animate if necessary.
982 // The routine returns TRUE unless there a camera is defined
983 //
984 // @param worldPoint world point location.
985 // @param worldNormal world normal.
986 // @param allowChangeOrientation if true, allows change of camera orientation.
987 // @param allowChangeDistance if true, allows change of camera distance or height.
988 SbBool seekToPoint( const SbVec3f& worldPoint, const SbVec3f& worldNormal, SbBool allowChangeOrientation=TRUE, SbBool allowChangeDistance=TRUE );
989
990 // Subclasses CAN redefine this to interpolate camera position/orientation
991 // while the seek animation is going on (called by animation sensor).
992 // The parameter t is a [0,1] value corresponding to the animation percentage
993 // completion. (i.e. a value of 0.25 means that animation is only 1/4 of the way
994 // through).
995 virtual void interpolateSeekAnimation( float t );
996 virtual void computeSeekFinalOrientation();
997
998 // redefine this routine to adjust the camera clipping planes just
999 // before doing a redraw. The sensor will be unschedule after the camera
1000 // is changed in the base class to prevent a second redraw from occurring.
1001 virtual void actualRedraw();
1002
1003 // This is called during a paste.
1004 // Subclasses may wish to redefine this in a way that
1005 // keeps their viewing paradigm intact.
1006 virtual void changeCameraValues( SoCamera* newCamera );
1007
1008 // Override redraw() in order to calculate render time including
1009 // frame buffer switch
1010 virtual void preViewerRedraw();
1011 virtual void postViewerRedraw();
1012
1013 // Subclasses may override this function to change way that
1014 // viewer tries to calculate decimation percentage for
1015 // DecimationStrategy FRAMES_PER_SECOND.
1016 // Given goal frames per second, timeTaken in last render,
1017 // and last decimation value used, this function should return
1018 // decimation percentage value to use in next render.
1019 virtual float decimationForFramesPerSecond( float fps,
1020 double lasttime,
1021 float lastDec );
1022 // Subclasses may override this function to change way that
1023 // viewer tries to calculate decimation percentage for
1024 // DecimationStrategy FIXED_NUM_TRIANGLES.
1025 // Given goal number of triangles to reach, this function
1026 // should return decimation percentage value to use.
1027 virtual float decimationForNumTriangles( uint32_t numTris );
1028
1029 // Convenience routines which subclasses can use when drawing viewer
1030 // feedback which may be common across multiple viewers. There is for
1031 // example a convenience routine which sets an orthographics projection
1032 // and a method to draw common feedback like the roll anchor (used by
1033 // a couple of viewers).
1034 //
1035 // All drawing routines assume that the window and projection is
1036 // already set by the caller.
1037 //
1038 // set an ortho projection of the glx window size - this also turns
1039 // zbuffering off and lighting off (if necessary).
1040 static void setFeedbackOrthoProjection( const SbVec2s& size );
1041 // restores the zbuffer and lighting state that was changed when
1042 // setFeedbackOrthoProjection() was last called.
1043 static void restoreGLStateAfterFeedback();
1044 // draws a simple 2 colored cross at given position
1045 static void drawViewerCrossFeedback( SbVec2s loc );
1046 // draws the anchor feedback given center of rotation and mouse location
1047 static void drawViewerRollFeedback( SbVec2s center, SbVec2s loc );
1048
1049 void setCurrentDrawStyle( SoGuiViewer::DrawStyle style );
1050
1051 void doBoxZoom( int x1, int y1, int x2, int y2 );
1052 void setZoomMode( SbBool zoomMode );
1053 SbBool isZoomModeEnabled() const;
1054 void setSeekDistAsPercentage( SbBool seekDist );
1055
1056#if 1 SoDEPRECATED
1058 virtual void adjustClippingPlanes();SoDEPRECATED
1060 virtual HDC getCurrentDC();
1061#endif
1063private:
1064
1068 virtual ~SoGuiViewer();
1069
1070 SoShadowGroup* getShadowGroup() const { return m_shadowGroup; };
1071
1072 SoGetBoundingBoxAction* m_sceneSizeBBoxAction;
1073 static void seekAnimationSensorCB( void* p, SoSensor* sensor );
1074
1075 void* getViewer() { return (void*)this; }
1076
1077 // ----------------------- Private usage -------------------------------------
1078
1079private:
1080
1081 void doRendering();
1082 static void drawStyleStartCallback( void* userData, void* v );
1083 static void drawStyleFinishCallback( void* userData, void* v );
1084 static void changeCB( void* thisp, SoSensor* sensor );
1085 void changeSensorCalled();
1086
1087 void setStereoOffsetP( float dist );
1088 void setStereoBalanceP( float balance, SbBool nearFrac );
1089 void setStereoAbsoluteAdjustmentsP( SbBool absolute );
1090
1091 // local tree variables
1092 SoSeparator* m_sceneRoot; // root node given to the RA
1093 SoNode* m_sceneGraph; // user supplied scene graph
1094 void* m_viewerPtr;
1095
1096 // global vars
1097 SoNode* m_cameraSceneGraph;
1098 SoType m_cameraType;
1099 SoCamera* m_camera; // camera being edited
1100 SoGuiViewer::Type m_type;
1101 SbBool m_viewingFlag; // FALSE when the viewer is off
1102 SbBool m_interactiveFlag; // TRUE while doing interactive work
1103 BufferType m_bufferType;
1104 SbBool m_cursorEnabledFlag;
1105 float m_sceneSize; // the larger of the X,Y,Z scene BBox
1106 static SoSFTime* m_viewerRealTime; // pointer to "realTime" global field
1107 SbBool m_firstLeftRender;
1108 float m_viewerSpeed;
1109
1110 // camera original values, used to restore the camera
1111 SbBool m_createdCamera;
1112 SbVec3f m_origPosition;
1113 SbRotation m_origOrientation;
1114 float m_origNearDistance;
1115 float m_origFarDistance;
1116 float m_origFocalDistance;
1117 float m_origHeight;
1118
1119 // headlight variables
1120 SbBool m_headlightFlag; // true when headlight in turned on
1121 SoGroup* m_headlightGroup;
1122 SoDirectionalLight* m_headlightNode;
1123 SoRotation* m_headlightRot;
1124
1125 // current state vars
1126 SbBool m_preserveHeightAngle;
1127 SbBool m_seekWithOrtho;
1128 SbBool m_mouseWheelEnable;
1129 float m_previousHeightAngle;
1130 CameraFields* m_prevCam;
1131 SoBaseStereo* m_stereoViewType;
1132 double m_farDistS;
1133 double m_nearDistS;
1134
1135 // draw style vars
1136 SbBool m_checkForDrawStyle;
1137 DrawStyle m_stillDrawStyle, m_interactiveDrawStyle;
1138 SoSwitch* m_drawStyleSwitch; // on/off draw styles
1139 SoDrawStyle* m_drawStyleNode; // LINE vs POINT
1140 SoLightModel* m_lightModelNode; // BASE_COLOR vs PHONG
1141 SoComplexity* m_complexityNode; // low complexity & texture off
1142 SoColorMask* m_colorMaskNode; // hidden line first pass
1143 SoMaterialBinding *m_matBindingNode; // hidden line first pass
1144 SoDepthBuffer *m_depthBuffer ; // depth buffer parameters
1145
1146 // shadows
1147 SoShadowGroup* m_shadowGroup;
1148 bool m_shadowGroupCurrState;
1149
1150 // auto clipping vars and routines
1151 SbBool m_autoClipFlag;
1152 float m_minimumNearPlane; // minimum near plane as percentage of far
1153 SoGetBoundingBoxAction* m_autoClipBboxAction;
1154 bool m_autoClipPlaneViewVolumeCulling; // true to clip scene bbox with viewVolume when adjusting auto clipplane.
1155
1156 // seek animation vars
1157 SbBool m_detailSeekFlag;
1158 float m_seekAnimTime;
1159 SbBool m_seekModeFlag; // TRUE when seek turned on externally
1160 SbBool m_seekAllowChangeOrientation; // if true allow change of camera orientation
1161 SbBool m_seekAllowChangeDistance; // if true allow change of camera distance or height
1162 SoFieldSensor* m_seekAnimationSensor;
1163
1164 // Decimation strategy additions
1165 DecimationStrategy m_decStrategy;
1166 SbBool m_isStill, m_doFullRendering, m_wasStill;
1167 int32_t m_goalTris; // Goal Number of Triangles
1168 float m_goalFps; // Goal Frames Per Second
1169 float m_decPercentage; // Fixed percentage
1170 float m_lastDecimationValue; // Last decimation value and render time
1171 double m_lastRenderTime; // used when (strategy==FRAMES_PER_SECOND)
1172
1173 SoPerfCounter* m_fpsCounter;
1174
1175 int m_lastDirection;
1176 SoGetPrimitiveCountAction* m_primCountAction;
1177 SoNodeSensor* m_motionSensor;
1178
1179 // Frames per second calculating:
1180 int m_numSamples;
1181 SoGuiViewerFPSCB* m_fpsUserCallback;
1182 void* m_fpsUserData;
1183
1184 // For release 2.6 we added the concept of cursor "style", at least
1185 // on Windows, and moved the definition variables and methods up to
1186 // this class (protected not private!) so subclasses can override
1187 // the cursor definitions if they need/want to.
1188 //
1189 // We now have "classic", XOR and "shadow" style cursors (new in v2.6)
1190 SoGuiViewer::CursorStyle m_cursorStyle;
1191 // Previously declared in subclasses (before v2.6)
1192 // Note that each subclass viewer uses a subset of these standard
1193 // cursor names. Note that the Fly and Walk viewers used slightly
1194 // different names (that were too generic) for their specific cursors
1195 // (the last two in the list) prior to v2.6.
1196 SbBool m_createdCursors;
1197
1198 // interactive viewing callbacks
1199 SoCallbackList* m_startCBList;
1200 SoCallbackList* m_finishCBList;
1201
1202 // variables used for interpolating seek animations
1203 SbVec3f m_seekPoint, m_seekNormal;
1204 SbBool m_computeSeekVariables;
1205 SbTime m_seekStartTime;
1206 SbRotation m_oldCamOrientation, m_newCamOrientation;
1207 SbVec3f m_oldCamPosition, m_newCamPosition;
1208 float m_seekDistance;
1209 SbBool m_seekDistAsPercentage; // percentage/absolute flag
1210
1211 // flag indicating whether a render traversal is in
1212 // progress.
1213 SbBool m_isWinRedrawing;
1214
1215 // Camera type change callback
1216 SoGuiViewerCameraTypeChangeCB* m_viewerCameraTypeChangeCallback;
1217 void* m_viewerCameraTypeChangeCallbackUserData;
1218
1219 // Decimation Percentage callback
1220 SoGuiViewerDecimationPercentageCB* m_decimationUserCallback;
1221 void* m_decimationUserData;
1222
1223 SbBool m_zoomMode;
1224 static bool s_enableIgnoreScreenSpaceBBox;
1225
1226 bool m_isFirstRedraw;
1227};
1228
1229#endif // SO_GUI_VIEWER
1230
1231
Class for representing a rotation.
Definition SbRotation.h:126
Class for smart character strings.
Definition SbString.h:202
Class for representation of a time.
Definition SbTime.h:91
2D vector class.
Definition SbVec.h:700
3D vector class.
Definition SbVec.h:932
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class for stereo...
Manages a list of callbacks and associated data.
Abstract base class for camera nodes.
Definition SoCamera.h:188
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Enable and disab...
Definition SoColorMask.h:61
Shape complexity node.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Depth buffer par...
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
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.
Abstract base class for Performance Counter.
Node representing a 3D rotation about an arbitrary axis.
Definition SoRotation.h:98
Single-value field containing a set of bit flags.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an enumerated value.
Definition SoSFEnum.h:89
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> Shadow casting g...
<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
int SbBool
Boolean type.
Definition SbBase.h:87