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
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #ifndef _SO_SCENE_MANAGER_
00053 #define _SO_SCENE_MANAGER_
00054
00055 #include <Inventor/SbColor.h>
00056 #include <Inventor/SbColorRGBA.h>
00057 #include <Inventor/SbViewportRegion.h>
00058 #include <Inventor/SoType.h>
00059 #include <Inventor/antialiasing/SoAntialiasingParameters.h>
00060 #include <Inventor/helpers/SbGlContextHelper.h>
00061 #include <Inventor/helpers/SbGlContextHelper.h>
00062 #include <Inventor/STL/vector>
00063 #include <Inventor/STL/set>
00064 #include <Inventor/threads/SbThreadSpinlock.h>
00065 #include <SoDeprecationRules.h>
00066
00067 class SiAntialiasingEventListener;
00068 class SoNodeSensor;
00069 class SoEvent;
00070 class SoAction;
00071 class SoHandleEventAction;
00072 class SoGLRenderAction;
00073 class SoNode;
00074 class SoSceneManager;
00075 class SoSceneManagerImpl;
00076 class SoSensor;
00077 class SoSFTime;
00078 class SoOneShotSensor;
00079 class SoGLRenderFromPBuffer;
00080 class SoGLContext;
00081 class SoSceneManagerSync;
00082
00084 namespace inventor
00085 {
00086 namespace impl
00087 {
00088 class SoRenderAreaCoreImpl;
00089 }
00090 }
00093 using inventor::impl::SoRenderAreaCoreImpl;
00094
00095
00100 typedef void SoSceneManagerRenderCB(void *userData, SoSceneManager *mgr);
00101
00106 typedef SbBool SoAbortRenderCB(SoAction*,void *userData);
00107
00108 #if defined(_WIN32)
00109 #pragma warning( push )
00110 #pragma warning( disable: 4251 ) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
00111 #endif
00112
00114
00115
00116
00117
00118
00119
00121
00144 class SoSceneManager
00145 {
00146 public:
00147
00149 SoSceneManager(int nb = 1);
00150
00152 virtual ~SoSceneManager();
00153
00204 virtual void render();
00205
00206 #if 1 SoDEPRECATED
00212 virtual void render(SbBool clearWindow, SbBool clearZbuffer = TRUE
00213 #ifndef HIDDEN_FROM_DOC
00214 , int id = 0, bool force = false
00215 #endif
00216 );
00217
00218 #endif
00225 virtual SbBool processEvent(const SoEvent *event);
00226
00231 void reinitialize();
00232
00237 void scheduleRedraw();
00238
00244 virtual void setSceneGraph(SoNode *newScene);
00245
00249 virtual SoNode* getSceneGraph() const;
00250
00256 void setWindowSize(const SbVec2s &newSize, const float &newScale = 1.0);
00257
00261 const SbVec2s& getWindowSize() const;
00262
00267 void setSize(const SbVec2s &newSize, const float &newScale = 1.0);
00268
00272 const SbVec2s& getSize() const;
00273
00279 void setOrigin(const SbVec2s &newOrigin);
00280
00284 const SbVec2s& getOrigin() const;
00285
00290 void setViewportRegion(const SbViewportRegion &newRegion);
00291
00295 const SbViewportRegion &getViewportRegion() const;
00296
00310 void setBackgroundColor(const SbColor &c);
00311
00315 SbColor getBackgroundColor() const;
00316
00327 void setBackgroundColorRGBA(const SbColorRGBA &color);
00328
00332 SbColorRGBA getBackgroundColorRGBA() const;
00333
00339 void setBackgroundIndex(int index);
00340
00344 int getBackgroundIndex() const;
00345
00353 void setRGBMode(SbBool onOrOff);
00354
00358 SbBool isRGBMode() const;
00359
00366 void setClearDepth(float depth);
00367
00371 float getClearDepth() const;
00372
00379 virtual void activate();
00380
00387 virtual void deactivate();
00388
00399 void setAutoInteractiveMode(SbBool flag);
00400
00406 SbBool isAutoInteractiveMode() const;
00407
00417 void setInteractive(SbBool flag);
00418
00440 void setRenderCallback( SoSceneManagerRenderCB *f, void *userData = NULL );
00441
00445 SbBool isAutoRedraw() const;
00446
00452 void setRedrawPriority(uint32_t priority);
00453
00457 uint32_t getRedrawPriority() const;
00458
00462 static uint32_t getDefaultRedrawPriority() { return 10000; }
00463
00468 static void enableRealTimeUpdate(SbBool flag);
00469
00473 static SbBool isRealTimeUpdateEnabled();
00474
00481 void setShareContext(SbGLShareContext sc, SbBool issc = TRUE);
00482
00488 enum AntialiasingMode
00489 {
00494 AUTO,
00495
00500 FXAA,
00501
00507 SMAA,
00508
00518 FSAA,
00519
00525 SUPERSAMPLING,
00526 SoDEPRECATED
00531 ACCUM_BUFFERS = SUPERSAMPLING,
00532
00533 #ifndef HIDDEN_FROM_DOC
00534 NUM_ANTIALIASING_MODE,
00535 #endif
00536
00540 NO_ANTIALIASING
00541 };
00542
00552 void setStillSuperSampling(float quality, float delay);
00553
00557 float getStillSuperSamplingQuality();
00558
00562 float getStillSuperSamplingDelay();
00563
00580 void setAntialiasing(const float quality, const AntialiasingMode mode = AUTO);
00581
00604 void setAntialiasing(SoAntialiasingParameters* advancedParameters);
00605
00612 float getAntialiasingQuality() const;
00613
00621 SoAntialiasingParameters* getAntialiasingParameters() const;
00622
00630 AntialiasingMode getAntialiasingMode() const;
00631
00642 void setAntialiasingEventListener(SiAntialiasingEventListener* listener);
00643
00649 SiAntialiasingEventListener* getAntialiasingEventListener() const;
00650
00659 void setHandleEventAction(SoHandleEventAction *hea);
00660
00666 SoHandleEventAction *getHandleEventAction() const;
00667
00675 void setGLRenderAction(SoGLRenderAction *ra);
00676
00682 SoGLRenderAction* getGLRenderAction() const;
00683
00694 void setAbortRenderCallback( SoAbortRenderCB *callback, void *userData = NULL );
00695
00696 #if 1 SoDEPRECATED
00714 void setAntialiasing(SbBool smoothing, int numPasses);
00715 SoDEPRECATED
00720 void getAntialiasing(SbBool &smoothing, int &numPasses) const;
00721
00722 #endif
00724 private:
00725
00726 void updateRealTimeSensor();
00727
00728
00729 void setGLRenderAction(SoGLRenderAction *ra, int i);
00730 SoGLRenderAction* getGLRenderAction(int i) const;
00731
00732 private:
00733
00743 SbBool shouldAbortRender(SoAction* action) const;
00744
00745 void setFloatingColorBuffer(SbBool enable, int size);
00746
00747 bool needToSetViewport( const int id = 0 );
00748
00749 void setNeedToSetViewport( const int id = 0 );
00750
00751
00753 static void scheduleRedraw(SoNode* node);
00754
00756 void scheduleForcedRedraw();
00757
00758 SoSceneManagerImpl* getImpl() const;
00759
00760 enum Components
00761 {
00762 RGB,
00763 RGBA,
00764 };
00765
00766 bool saveSnapshot(const SbString& filename, Components components = RGBA) const;
00767
00768 private:
00769
00770 SoSceneManagerImpl* m_impl;
00771
00772 friend class SoGuiRenderArea;
00773 friend class SoRenderAreaCoreImpl;
00774
00775 };
00776
00777 #if defined(_WIN32)
00778 #pragma warning( pop )
00779 #endif
00780
00781 #endif // _SO_SCENE_MANAGER_
00782
00783