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 {
00238 return m_sceneMgr;
00239 }
00240
00246 void setGLRenderAction( SoGLRenderAction* ra );
00247
00253 SoGLRenderAction* getGLRenderAction() const;
00254
00258 static SbVec2s getDefaultSize();
00259
00263 SbBool invokeAppCB( const SoEvent* anyevent );
00264
00268 virtual void notifyRedraw();
00269 virtual void signalRedraw();
00270 virtual void cleanRedraw();
00271
00275 virtual void notify( SoNotList* );
00276
00282 virtual void setMPEGRecorder( SoMPEGRenderer* recorder );
00283
00287 virtual SoMPEGRenderer* getMPEGRecorder() const;
00288
00289
00290
00291 void setStereoMode( SoCamera::StereoMode stMode );
00292 void setStereoElement();
00293
00294 void setRedrawing( SbBool redrawing );
00295 SbBool isRedrawing() const;
00296
00297 SbBool isInteractive() const;
00298
00299 void setStereoOffset( float offset );
00300 float getStereoOffset() const;
00301
00302 void setStereoReversed( SbBool reverse );
00303 SbBool getStereoReversed() const;
00304
00305 void setStereoAbsoluteAdjustments( SbBool absolute );
00306 SbBool getStereoAbsoluteAdjustments() const;
00307
00308 void setStereoBalance( float balance, SbBool nearFrac = false );
00309 float getStereoBalance() const;
00310 SbBool isStereoBalanceNearFrac() const;
00311
00312 virtual void setDoubleBufferRA(SbBool db);
00313
00314 virtual void actualRedraw();
00315
00316 virtual void initGraphic();
00317 void redrawCleanUp();
00318
00319 void activate();
00320 void deactivate();
00321
00322 void posChanged( const SbVec2i32& newPos, const SbVec2i32& newGPos );
00323
00324 void setFrameGrabber( SoFrameGrabber* grabber );
00325 SoFrameGrabber* getFrameGrabber() const;
00326
00330
00331
00335
00336
00337
00338 void preRedraw();
00339
00340
00341 virtual void postRedraw();
00342
00343
00344 void redrawOnSelectionChange( SoSelection* s );
00345
00346
00347
00348 void setRenderAreaHandle(const void *renderAreaHandle, soSelectionChangeCB _selectionChangedCB);
00349 void *m_renderAreaHandle;
00350 soSelectionChangeCB selectionChangeCB;
00351
00352 inline SoFrameGrabber* getGrabber() const;
00353
00355 unsigned int getFPSCount();
00356
00357 private:
00358
00362 virtual ~SoGuiRenderArea();
00363
00364 int m_interactiveCount;
00365 unsigned int m_fpsCount;
00366 SbElapsedTime m_fpsTimer;
00367 double m_previousfpsTime;
00368 bool m_usefpsCallback;
00369
00370
00371 SoMPEGRenderer* m_mpegRenderer;
00372
00373
00374 private:
00375 void commonConstructor();
00376
00377
00378 SoSceneManager* m_sceneMgr;
00379 SbBool m_autoRedraw;
00380 SbBool m_clearFirst;
00381 SbBool m_clearZBufferFirst;
00382 SbBool m_isRedrawing;
00383 SoFrameGrabber* m_grabber;
00384 ScTracking* m_tracking;
00385 SoCamera* m_cameraBase;
00386
00387 SoSelection* selection;
00388
00389
00390 SbBool m_isFloatingPointRendering;
00391 FloatColorBufferSize m_floatingPointRenderingPrecision;
00392
00393
00394 SoCamera::StereoMode m_stereoMode;
00395
00396 SbThreadSemaphore* m_redrawSem;
00397 };
00398
00399 SoFrameGrabber* SoGuiRenderArea::getGrabber() const
00400 {
00401 return m_grabber;
00402 }
00403
00404 inline unsigned int
00405 SoGuiRenderArea::getFPSCount()
00406 {
00407 return m_fpsCount;
00408 }
00409
00410 #endif // SO_GUI_RENDER_AREA_H
00411
00412