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 class SoCallbackList;
00052 class SoBaseColor;
00053 class SoCamera;
00054 class SoComplexity;
00055 class SoDirectionalLight;
00056 class SoDrawStyle;
00057 class SoGetBoundingBoxAction;
00058 class SoGroup;
00059 class SoLightModel;
00060 class SoMaterialBinding;
00061 class SoNode;
00062 class SoPolygonOffset;
00063 class SoSensor;
00064 class SoSeparator;
00065 class SoSwitch;
00066 class SoTimerSensor;
00067
00068 class SoQtViewer;
00069
00070 typedef void SoQtViewerCB(void * data, SoQtViewer * viewer);
00071 typedef void SoQtViewerFPSCB(float fps, void * data, SoQtViewer * viewer);
00072
00073 typedef SbVec2f SoQtAutoClippingCB(void * data, const SbVec2f & nearfar);
00074
00075
00076
00077 class SOQT_DLL_API SoQtViewer : public SoQtRenderArea {
00078 SOQT_OBJECT_ABSTRACT_HEADER(SoQtViewer, SoQtRenderArea);
00079
00080 public:
00081 enum Type {
00082 BROWSER,
00083 EDITOR
00084 };
00085
00086 enum DrawStyle {
00087 VIEW_AS_IS,
00088 VIEW_HIDDEN_LINE,
00089 VIEW_NO_TEXTURE,
00090 VIEW_LOW_COMPLEXITY,
00091 VIEW_LINE,
00092 VIEW_POINT,
00093 VIEW_BBOX,
00094 VIEW_LOW_RES_LINE,
00095 VIEW_LOW_RES_POINT,
00096 VIEW_SAME_AS_STILL,
00097 VIEW_WIREFRAME_OVERLAY
00098 };
00099
00100 enum DrawType {
00101 STILL = 0,
00102 INTERACTIVE
00103 };
00104
00105 enum BufferType {
00106 BUFFER_SINGLE,
00107 BUFFER_DOUBLE,
00108 BUFFER_INTERACTIVE
00109 };
00110
00111 enum AutoClippingStrategy {
00112 VARIABLE_NEAR_PLANE,
00113 CONSTANT_NEAR_PLANE
00114 };
00115
00116 virtual void setCamera(SoCamera * camera);
00117 SoCamera * getCamera(void) const;
00118
00119 virtual void setCameraType(SoType type);
00120 SoType getCameraType(void) const;
00121
00122 virtual void toggleCameraType(void);
00123
00124 virtual void viewAll(void);
00125
00126 virtual void saveHomePosition(void);
00127 virtual void resetToHomePosition(void);
00128
00129 virtual void setHeadlight(SbBool enable);
00130 SbBool isHeadlight(void) const;
00131 SoDirectionalLight * getHeadlight(void) const;
00132
00133 virtual void setDrawStyle(SoQtViewer::DrawType type, SoQtViewer::DrawStyle style);
00134 SoQtViewer::DrawStyle getDrawStyle(const SoQtViewer::DrawType type) const;
00135
00136 virtual void setBufferingType(SoQtViewer::BufferType type);
00137 SoQtViewer::BufferType getBufferingType(void) const;
00138
00139 virtual void setViewing(SbBool enable);
00140 SbBool isViewing(void) const;
00141
00142 virtual void setCursorEnabled(SbBool enable);
00143 SbBool isCursorEnabled(void) const;
00144
00145 void setAutoClipping(SbBool enable);
00146 SbBool isAutoClipping(void) const;
00147
00148 void setAutoClippingStrategy(const AutoClippingStrategy strategy,
00149 const float value = 0.6f,
00150 SoQtAutoClippingCB * cb = NULL,
00151 void * cbuserdata = NULL);
00152
00153 virtual void setStereoViewing(SbBool enable);
00154 SbBool isStereoViewing(void) const;
00155
00156 virtual void setStereoOffset(const float dist);
00157 float getStereoOffset(void) const;
00158
00159 void setDetailSeek(const SbBool enable);
00160 SbBool isDetailSeek(void) const;
00161
00162 void setSeekTime(const float seconds);
00163 float getSeekTime(void) const;
00164
00165 void addStartCallback(SoQtViewerCB * func, void * data = NULL);
00166 void addFinishCallback(SoQtViewerCB * func, void * data = NULL);
00167 void removeStartCallback(SoQtViewerCB * func, void * data = NULL);
00168 void removeFinishCallback(SoQtViewerCB * func, void * data = NULL);
00169
00170 void setWireframeOverlayColor(const SbColor & color);
00171 const SbColor & getWireframeOverlayColor(void) const;
00172
00173 virtual void setDoubleBuffer(const SbBool enable);
00174
00175 virtual void setSceneGraph(SoNode * root);
00176 virtual SoNode * getSceneGraph(void);
00177
00178 protected:
00179 SoQtViewer(QWidget * parent,
00180 const char * name,
00181 SbBool embed,
00182 Type type,
00183 SbBool build);
00184 ~SoQtViewer();
00185
00186 virtual void sizeChanged(const SbVec2s & size);
00187 virtual void setSeekMode(SbBool enable);
00188 SbBool isSeekMode(void) const;
00189 SbBool seekToPoint(const SbVec2s screenpos);
00190 virtual void computeSeekFinalOrientation(void);
00191
00192 virtual void actualRedraw(void);
00193 virtual SbBool processSoEvent(const SoEvent * const event);
00194
00195 void interactiveCountInc(void);
00196 void interactiveCountDec(void);
00197 int getInteractiveCount(void) const;
00198
00199 void setSeekDistance(const float distance);
00200 float getSeekDistance(void) const;
00201 void setSeekValueAsPercentage(const SbBool on);
00202 SbBool isSeekValuePercentage(void) const;
00203
00204 virtual void changeCameraValues(SoCamera * camera);
00205
00206 void addSuperimposition(SoNode * scene);
00207 void removeSuperimposition(SoNode * scene);
00208 void setSuperimpositionEnabled(SoNode * scene, const SbBool enable);
00209 SbBool getSuperimpositionEnabled(SoNode * scene) const;
00210
00211 private:
00212 class SoQtViewerP * pimpl;
00213 #ifndef DOXYGEN_SKIP_THIS
00214 friend class SoQtViewerP;
00215 #endif // DOXYGEN_SKIP_THIS
00216 };
00217
00218
00219
00220 #endif // ! SOQT_VIEWER_H