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
00092 void setOverlaySceneGraph( SoNode* newScene );
00093
00098 SoNode* getOverlaySceneGraph();
00099
00106 void setBackgroundColor( const SbColor& c );
00107
00111 const SbColor& getBackgroundColor() const;
00112
00117 void setBackgroundIndex( int index );
00118
00122 int getBackgroundIndex() const;
00123
00128 void setOverlayBackgroundIndex( int index );
00129
00133 int getOverlayBackgroundIndex() const;
00134
00138 void setViewportRegion( const SbViewportRegion& newRegion );
00139
00143 const SbViewportRegion& getViewportRegion() const;
00144
00149 void setTransparencyType( SoGLRenderAction::TransparencyType type );
00150
00155 SoGLRenderAction::TransparencyType getTransparencyType() const;
00156
00167 void setFastEditSavePolicy( SoGLRenderAction::FastEditSavePolicy policy,
00168 SbBool fastEditDelayedObjects = FALSE);
00169
00173 SoGLRenderAction::FastEditSavePolicy getFastEditSavePolicy() const;
00174
00191 void setSortedTrianglesSortFrequency( int angle );
00192
00197 int getSortedTrianglesSortFrequency();
00198
00211 void setSortedTrianglesNumCaches( int numCaches );
00212
00216 int getSortedTrianglesNumCaches();
00217
00233 void setInvalidateCacheMode( SoGLRenderAction::InvalidateCacheMode icm );
00234
00238 SoGLRenderAction::InvalidateCacheMode getInvalidateCacheMode();
00239
00247 void setClearBeforeRender( SbBool trueOrFalse, SbBool zbTrueOrFalse = TRUE );
00248
00252 SbBool isClearBeforeRender() const;
00253
00258 SbBool isClearZBufferBeforeRender() const;
00259
00264 void setClearBeforeOverlayRender( SbBool trueOrFalse );
00265
00269 SbBool isClearBeforeOverlayRender() const;
00270
00275 void setAutoRedraw( SbBool trueOrFalse );
00276
00281 SbBool isAutoRedraw() const;
00282
00286 void setRedrawPriority( uint32_t priority );
00287
00291 uint32_t getRedrawPriority() const;
00292
00296 static uint32_t getDefaultRedrawPriority();
00297
00298
00305 void setSceneManager( SoSceneManager* sm );
00306
00313 SoSceneManager* getSceneManager() const;
00314
00321 void setOverlaySceneManager( SoSceneManager* sm );
00322
00329 SoSceneManager* getOverlaySceneManager() const;
00330
00336 void setGLRenderAction( SoGLRenderAction* ra );
00337
00343 SoGLRenderAction* getGLRenderAction() const;
00344
00348 void setOverlayGLRenderAction( SoGLRenderAction* ra );
00349
00353 SoGLRenderAction* getOverlayGLRenderAction() const;
00354
00358 static SbVec2s getDefaultSize();
00359
00363 SbBool invokeAppCB( const SoEvent* anyevent );
00364
00368 virtual void notifyRedraw();
00369 virtual void signalRedraw();
00370 virtual void cleanRedraw();
00371
00375 virtual void notify( SoNotList* );
00376
00380 virtual void showDirectVizDialog( SbBool show );
00381
00387 virtual void setMPEGRecorder( SoMPEGRenderer* recorder );
00388
00392 virtual SoMPEGRenderer* getMPEGRecorder() const;
00393
00394
00395
00396 void setStereoMode( SoCamera::StereoMode stMode );
00397 void setStereoElement();
00398
00399 void setRedrawing( SbBool redrawing );
00400 SbBool isRedrawing() const;
00401
00402 SbBool isInteractive() const;
00403
00404 void setStereoOffset( float offset );
00405 float getStereoOffset() const;
00406
00407 void setStereoReversed( SbBool reverse );
00408 SbBool getStereoReversed() const;
00409
00410 void setStereoAbsoluteAdjustments( SbBool absolute );
00411 SbBool getStereoAbsoluteAdjustments() const;
00412
00413 void setStereoBalance( float balance, SbBool nearFrac = false );
00414 float getStereoBalance() const;
00415 SbBool isStereoBalanceNearFrac() const;
00416
00417 virtual void setDoubleBufferRA(SbBool db);
00418
00419 virtual void actualRedraw();
00420 virtual void actualOverlayRedraw();
00421
00422 virtual void initGraphic();
00423 void redrawCleanUp();
00424
00425 void activate();
00426 void deactivate();
00427
00428 void posChanged( const SbVec2i32& newPos, const SbVec2i32& newGPos );
00429
00430 void setFrameGrabber( SoFrameGrabber* grabber );
00431 SoFrameGrabber* getFrameGrabber() const;
00432
00436
00437
00441
00442
00443
00444 void preRedraw();
00445
00446
00447 virtual void postRedraw();
00448
00449
00450 void redrawOnSelectionChange( SoSelection* s );
00451
00452
00453 void redrawOverlayOnSelectionChange( SoSelection* s );
00454
00455
00456
00457 void setRenderAreaHandle(const void *renderAreaHandle, soSelectionChangeCB _selectionChangedCB, soSelectionChangeCB _overlaySelectionChangedCB);
00458 void *m_renderAreaHandle;
00459 soSelectionChangeCB selectionChangeCB;
00460 soSelectionChangeCB overlaySelectionChangeCB;
00461
00462 inline SoFrameGrabber* getGrabber() const;
00463
00465 unsigned int getFPSCount();
00466
00467
00468
00469 SoFieldContainer* remoteNewInstance();
00470 void remoteCreateViewer( bool );
00471 void remoteDeleteViewer();
00472 void remoteIncRequest();
00473 void remoteSetViewport( const SbVec2i32& );
00474 void remoteSetInteraction( bool );
00475 int remoteGetLossyMode();
00476 void remoteChangeColorMask();
00477 void remoteResizeViewer();
00478 void remoteMoveViewer();
00479 void remoteSetComposing( bool );
00480 void remoteExecute( const SbVec4s&, const SbVec4i32&, const SbVec4i32& );
00481 bool remoteIsComposing();
00482 static void remoteApplyVncColorMask( const SbColor& color );
00483 static bool remoteMustDraw();
00484 static bool remoteIsClientConnected();
00485
00486 static int directvizGetShortcutValue();
00487 static bool directvizIsLoadedGui( bool );
00488 static void* directvizGetViewer();
00489 static void directvizSetViewer( void* );
00490 static void directvizShowDialog( bool, SoNode*, SoGuiBase* );
00491 static void directvizHideDialog( bool );
00492 static void directvizDeleteDialog();
00493 static bool directvizCheck();
00494 static SoNode* directvizGetInstance(SoSceneManager*);
00495 static void directvizInternalEnable( SbBool, SoSceneManager*, SoCamera*, SoNode*, SoGuiBase* );
00496 static void directvizSetCamera( SoSceneManager*, SoCamera*, SoNode* );
00497
00498 private:
00499
00503 virtual ~SoGuiRenderArea();
00504
00505 int m_interactiveCount;
00506 unsigned int m_fpsCount;
00507 SbElapsedTime m_fpsTimer;
00508 double m_previousfpsTime;
00509 bool m_usefpsCallback;
00510
00511
00512 SoMPEGRenderer* m_mpegRenderer;
00513
00514
00515 private:
00516 void commonConstructor();
00517
00518
00519 SoSceneManager* m_sceneMgr;
00520 SoSceneManager* m_overlaySceneMgr;
00521 SbBool m_autoRedraw;
00522 SbBool m_clearFirst, m_clearOverlayFirst;
00523 SbBool m_clearZBufferFirst;
00524 SbBool m_isRedrawing;
00525 SoFrameGrabber* m_grabber;
00526 ScTracking* m_tracking;
00527 SoCamera* m_cameraBase;
00528
00529 SoSelection* selection, *overlaySelection;
00530
00531
00532 SbBool m_isFloatingPointRendering;
00533 FloatColorBufferSize m_floatingPointRenderingPrecision;
00534
00535
00536 SoCamera::StereoMode m_stereoMode;
00537
00538 SbThreadSemaphore* m_redrawSem;
00539 };
00540
00541 SoFrameGrabber* SoGuiRenderArea::getGrabber() const
00542 {
00543 return m_grabber;
00544 }
00545
00546 inline unsigned int
00547 SoGuiRenderArea::getFPSCount()
00548 {
00549 return m_fpsCount;
00550 }
00551
00552 #endif // SO_GUI_RENDER_AREA_H
00553
00554