00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef SO_GUI_RENDER_AREA_H
00025 #define SO_GUI_RENDER_AREA_H
00026
00028
00029
00030
00031
00032
00033
00035
00036 #include <Inventor/Gui/SoGuiGLWidget.h>
00037 #include <Inventor/nodes/SoCamera.h>
00038 #include <Inventor/nodes/SoFullSceneAntialiasing.h>
00039 #include <Inventor/SbElapsedTime.h>
00040 #include <Inventor/actions/SoGLRenderAction.h>
00041
00042 class SoNode;
00043 class SoFrameGrabber;
00044 class SbThreadSemaphore;
00045 class ScTracking;
00046 class SoSelection;
00047 class SoMPEGRenderer;
00048
00049 #ifndef HIDDEN_FROM_DOC
00050 typedef void (*soSelectionChangeCB)(void *, SoSelection* data);
00051 #endif
00052
00053
00054 class SoGuiRenderArea : public SoGuiGLWidget
00055 {
00056 #ifndef HIDDEN_FROM_DOC
00057 SO_FIELDCONTAINER_HEADER( SoGuiRenderArea );
00058 #endif
00059
00060 private:
00061 SoSFVec2i32 position;
00062 SoSFVec2i32 globalPosition;
00063 SoSFFieldContainer sceneManager;
00064 SoSFBool stereoAbsoluteAdjustments;
00065 SoSFFloat stereoOffset;
00066 SoSFFloat stereoBalance;
00067 SoSFBool stereoNearFrac;
00068 SoSFBool stereoReversed;
00069
00070 SoSFFieldContainer cameraBase;
00071
00075 SoGuiRenderArea();
00076 SoGuiRenderArea( bool sync );
00077
00081 virtual void setSceneGraph( SoNode* newScene );
00082
00086 virtual SoNode* getSceneGraph();
00087
00094 void setBackgroundColor( const SbColor& c );
00095
00099 SbColor getBackgroundColor() const;
00100
00105 void setBackgroundIndex( int index );
00106
00110 int getBackgroundIndex() const;
00111
00115 void setViewportRegion( const SbViewportRegion& newRegion );
00116
00120 const SbViewportRegion& getViewportRegion() const;
00121
00126 void setTransparencyType( SoGLRenderAction::TransparencyType type );
00127
00132 SoGLRenderAction::TransparencyType getTransparencyType() const;
00133
00144 void setFastEditSavePolicy( SoGLRenderAction::FastEditSavePolicy policy,
00145 SbBool fastEditDelayedObjects = FALSE);
00146
00150 SoGLRenderAction::FastEditSavePolicy getFastEditSavePolicy() const;
00151
00167 void setInvalidateCacheMode( SoGLRenderAction::InvalidateCacheMode icm );
00168
00172 SoGLRenderAction::InvalidateCacheMode getInvalidateCacheMode();
00173
00181 void setClearBeforeRender( SbBool trueOrFalse, SbBool zbTrueOrFalse = TRUE );
00182
00186 SbBool isClearBeforeRender() const;
00187
00192 SbBool isClearZBufferBeforeRender() const;
00193
00198 void setAutoRedraw( SbBool trueOrFalse );
00199
00204 SbBool isAutoRedraw() const;
00205
00209 void setRedrawPriority( uint32_t priority );
00210
00214 uint32_t getRedrawPriority() const;
00215
00219 static uint32_t getDefaultRedrawPriority();
00220
00221
00228 void setSceneManager( SoSceneManager* sm );
00229
00236 SoSceneManager* getSceneManager() const;
00237
00243 void setGLRenderAction( SoGLRenderAction* ra );
00244
00250 SoGLRenderAction* getGLRenderAction() const;
00251
00255 static SbVec2s getDefaultSize();
00256
00260 SbBool invokeAppCB( const SoEvent* anyevent );
00261
00265 virtual void notifyRedraw();
00266 virtual void signalRedraw();
00267 virtual void cleanRedraw();
00268
00272 virtual void notify( SoNotList* );
00273
00279 virtual void setMPEGRecorder( SoMPEGRenderer* recorder );
00280
00284 virtual SoMPEGRenderer* getMPEGRecorder() const;
00285
00286
00287
00288 void setStereoMode( SoCamera::StereoMode stMode );
00289 void setStereoElement();
00290
00291 void setRedrawing( SbBool redrawing );
00292 SbBool isRedrawing() const;
00293
00294 SbBool isInteractive() const;
00295
00296 void setStereoOffset( float offset );
00297 float getStereoOffset() const;
00298
00299 void setStereoReversed( SbBool reverse );
00300 SbBool getStereoReversed() const;
00301
00302 void setStereoAbsoluteAdjustments( SbBool absolute );
00303 SbBool getStereoAbsoluteAdjustments() const;
00304
00305 void setStereoBalance( float balance, SbBool nearFrac = false );
00306 float getStereoBalance() const;
00307 SbBool isStereoBalanceNearFrac() const;
00308
00309 virtual void setDoubleBufferRA(SbBool db);
00310
00311 virtual void actualRedraw();
00312
00313 virtual void initGraphic();
00314 void redrawCleanUp();
00315
00316 void activate();
00317 void deactivate();
00318
00319 void posChanged( const SbVec2i32& newPos, const SbVec2i32& newGPos );
00320
00321 void setFrameGrabber( SoFrameGrabber* grabber );
00322 SoFrameGrabber* getFrameGrabber() const;
00323
00327
00328
00332
00333
00334
00335 void preRedraw();
00336
00337
00338 virtual void postRedraw();
00339
00340
00341 void redrawOnSelectionChange( SoSelection* s );
00342
00343
00344
00345 void setRenderAreaHandle(const void *renderAreaHandle, soSelectionChangeCB _selectionChangedCB);
00346 void *m_renderAreaHandle;
00347 soSelectionChangeCB selectionChangeCB;
00348
00349 inline SoFrameGrabber* getGrabber() const;
00350
00352 unsigned int getFPSCount();
00353
00354 private:
00355
00359 virtual ~SoGuiRenderArea();
00360
00361 int m_interactiveCount;
00362 unsigned int m_fpsCount;
00363 SbElapsedTime m_fpsTimer;
00364 double m_previousfpsTime;
00365 bool m_usefpsCallback;
00366
00367
00368 SoMPEGRenderer* m_mpegRenderer;
00369
00370
00371 private:
00372 void commonConstructor();
00373
00374
00375 SoSceneManager* m_sceneMgr;
00376 SbBool m_autoRedraw;
00377 SbBool m_clearFirst;
00378 SbBool m_clearZBufferFirst;
00379 SbBool m_isRedrawing;
00380 SoFrameGrabber* m_grabber;
00381 ScTracking* m_tracking;
00382 SoCamera* m_cameraBase;
00383
00384 SoSelection* selection;
00385
00386
00387 SbBool m_isFloatingPointRendering;
00388 FloatColorBufferSize m_floatingPointRenderingPrecision;
00389
00390
00391 SoCamera::StereoMode m_stereoMode;
00392
00393 SbThreadSemaphore* m_redrawSem;
00394 };
00395
00396 SoFrameGrabber* SoGuiRenderArea::getGrabber() const
00397 {
00398 return m_grabber;
00399 }
00400
00401 inline unsigned int
00402 SoGuiRenderArea::getFPSCount()
00403 {
00404 return m_fpsCount;
00405 }
00406
00407 #endif // SO_GUI_RENDER_AREA_H
00408
00409