00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef SOQT_VIEWER_H
00027 #define SOQT_VIEWER_H
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include <math.h>
00044
00045 #include <Inventor/SbTime.h>
00046 #include <Inventor/SoType.h>
00047 #include <Inventor/SbLinear.h>
00048
00049 #include <Inventor/Qt/SoQtRenderArea.h>
00050
00051 #ifndef SOQT_INTERNAL
00052 #include <Inventor/events/SoKeyboardEvent.h>
00053 #endif // SOQT_INTERNAL
00054
00055 class SoCallbackList;
00056 class SoBaseColor;
00057 class SoCamera;
00058 class SoComplexity;
00059 class SoDirectionalLight;
00060 class SoDrawStyle;
00061 class SoGetBoundingBoxAction;
00062 class SoGroup;
00063 class SoLightModel;
00064 class SoMaterialBinding;
00065 class SoNode;
00066 class SoPolygonOffset;
00067 class SoSensor;
00068 class SoSeparator;
00069 class SoSwitch;
00070 class SoTimerSensor;
00071
00072 class SoQtViewer;
00073
00074 typedef void SoQtViewerCB(void * data, SoQtViewer * viewer);
00075 typedef void SoQtViewerFPSCB(float fps, void * data, SoQtViewer * viewer);
00076
00077 typedef SbVec2f SoQtAutoClippingCB(void * data, const SbVec2f & nearfar);
00078
00079
00080
00081 class SOQT_DLL_API SoQtViewer : public SoQtRenderArea {
00082 SOQT_OBJECT_ABSTRACT_HEADER(SoQtViewer, SoQtRenderArea);
00083
00084 public:
00085 enum Type {
00086 BROWSER,
00087 EDITOR
00088 };
00089
00090 enum DrawStyle {
00091 VIEW_AS_IS,
00092 VIEW_HIDDEN_LINE,
00093 VIEW_NO_TEXTURE,
00094 VIEW_LOW_COMPLEXITY,
00095 VIEW_LINE,
00096 VIEW_POINT,
00097 VIEW_BBOX,
00098 VIEW_LOW_RES_LINE,
00099 VIEW_LOW_RES_POINT,
00100 VIEW_SAME_AS_STILL,
00101 VIEW_WIREFRAME_OVERLAY
00102 };
00103
00104 enum DrawType {
00105 STILL = 0,
00106 INTERACTIVE
00107 };
00108
00109 enum BufferType {
00110 BUFFER_SINGLE,
00111 BUFFER_DOUBLE,
00112 BUFFER_INTERACTIVE
00113 };
00114
00115 enum AutoClippingStrategy {
00116 VARIABLE_NEAR_PLANE,
00117 CONSTANT_NEAR_PLANE
00118 };
00119
00120 virtual void setCamera(SoCamera * camera);
00121 SoCamera * getCamera(void) const;
00122
00123 virtual void setCameraType(SoType type);
00124 SoType getCameraType(void) const;
00125
00126 virtual void toggleCameraType(void);
00127
00128 virtual void viewAll(void);
00129
00130 virtual void saveHomePosition(void);
00131 virtual void resetToHomePosition(void);
00132
00133 virtual void setHeadlight(SbBool enable);
00134 SbBool isHeadlight(void) const;
00135 SoDirectionalLight * getHeadlight(void) const;
00136
00137 virtual void setDrawStyle(SoQtViewer::DrawType type, SoQtViewer::DrawStyle style);
00138 SoQtViewer::DrawStyle getDrawStyle(const SoQtViewer::DrawType type) const;
00139
00140 virtual void setBufferingType(SoQtViewer::BufferType type);
00141 SoQtViewer::BufferType getBufferingType(void) const;
00142
00143 virtual void setViewing(SbBool enable);
00144 SbBool isViewing(void) const;
00145
00146 virtual void setCursorEnabled(SbBool enable);
00147 SbBool isCursorEnabled(void) const;
00148
00149 void setAutoClipping(SbBool enable);
00150 SbBool isAutoClipping(void) const;
00151
00152 void setAutoClippingStrategy(const AutoClippingStrategy strategy,
00153 const float value = 0.6f,
00154 SoQtAutoClippingCB * cb = NULL,
00155 void * cbuserdata = NULL);
00156
00157 virtual void setStereoViewing(SbBool enable);
00158 SbBool isStereoViewing(void) const;
00159
00160 virtual void setStereoOffset(const float dist);
00161 float getStereoOffset(void) const;
00162
00163 enum StereoType {
00164 STEREO_NONE, STEREO_ANAGLYPH, STEREO_QUADBUFFER,
00165 STEREO_INTERLEAVED_ROWS, STEREO_INTERLEAVED_COLUMNS
00166 };
00167
00168 SbBool setStereoType(SoQtViewer::StereoType s);
00169 SoQtViewer::StereoType getStereoType(void) const;
00170
00171 void setAnaglyphStereoColorMasks(const SbBool left[3], const SbBool right[3]);
00172 void getAnaglyphStereoColorMasks(SbBool left[3], SbBool right[3]);
00173
00174 void setDetailSeek(const SbBool enable);
00175 SbBool isDetailSeek(void) const;
00176
00177 void setSeekTime(const float seconds);
00178 float getSeekTime(void) const;
00179
00180 void addStartCallback(SoQtViewerCB * func, void * data = NULL);
00181 void addFinishCallback(SoQtViewerCB * func, void * data = NULL);
00182 void removeStartCallback(SoQtViewerCB * func, void * data = NULL);
00183 void removeFinishCallback(SoQtViewerCB * func, void * data = NULL);
00184
00185 void setWireframeOverlayColor(const SbColor & color);
00186 const SbColor & getWireframeOverlayColor(void) const;
00187
00188 virtual void setDoubleBuffer(const SbBool enable);
00189
00190 virtual void setSceneGraph(SoNode * root);
00191 virtual SoNode * getSceneGraph(void);
00192
00193 protected:
00194 SoQtViewer(QWidget * parent,
00195 const char * name,
00196 SbBool embed,
00197 Type type,
00198 SbBool build);
00199 ~SoQtViewer();
00200
00201 virtual void sizeChanged(const SbVec2s & size);
00202 virtual void setSeekMode(SbBool enable);
00203 SbBool isSeekMode(void) const;
00204 SbBool seekToPoint(const SbVec2s screenpos);
00205 void seekToPoint(const SbVec3f & scenepos);
00206 virtual void computeSeekFinalOrientation(void);
00207
00208 virtual void actualRedraw(void);
00209 virtual SbBool processSoEvent(const SoEvent * const event);
00210
00211 void interactiveCountInc(void);
00212 void interactiveCountDec(void);
00213 int getInteractiveCount(void) const;
00214
00215 void setSeekDistance(const float distance);
00216 float getSeekDistance(void) const;
00217 void setSeekValueAsPercentage(const SbBool on);
00218 SbBool isSeekValuePercentage(void) const;
00219
00220 virtual void changeCameraValues(SoCamera * camera);
00221
00222 void addSuperimposition(SoNode * scene);
00223 void removeSuperimposition(SoNode * scene);
00224 void setSuperimpositionEnabled(SoNode * scene, const SbBool enable);
00225 SbBool getSuperimpositionEnabled(SoNode * scene) const;
00226
00227 private:
00228 class SoQtViewerP * pimpl;
00229 friend class SoQtViewerP;
00230 };
00231
00232
00233
00234 #endif // ! SOQT_VIEWER_H