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
00083
00088 typedef void SoSceneManagerRenderCB(void *userData, SoSceneManager *mgr);
00089
00094 typedef SbBool SoAbortRenderCB(SoAction*,void *userData);
00095
00096 #if defined(_WIN32)
00097 #pragma warning( push )
00098 #pragma warning( disable: 4251 ) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
00099 #endif
00100
00102
00103
00104
00105
00106
00107
00109
00133 class SoSceneManager
00134 {
00135 public:
00136
00138 SoSceneManager(int nb = 1);
00139
00141 virtual ~SoSceneManager();
00142
00198 virtual void render(SbBool clearWindow = TRUE, SbBool clearZbuffer = TRUE
00199 #ifndef HIDDEN_FROM_DOC
00200 , int id = 0, bool force = false
00201 #endif
00202 );
00203
00208 virtual SbBool processEvent(const SoEvent *event);
00209
00214 void reinitialize();
00215
00220 void scheduleRedraw();
00221
00227 virtual void setSceneGraph(SoNode *newScene);
00228
00233 virtual SoNode* getSceneGraph() const;
00234
00240 void setWindowSize(const SbVec2s &newSize, const float &newScale = 1.0);
00241
00245 const SbVec2s& getWindowSize() const;
00246
00251 void setSize(const SbVec2s &newSize, const float &newScale = 1.0);
00252
00256 const SbVec2s& getSize() const;
00257
00263 void setOrigin(const SbVec2s &newOrigin);
00264
00268 const SbVec2s& getOrigin() const;
00269
00274 void setViewportRegion(const SbViewportRegion &newRegion);
00275
00279 const SbViewportRegion &getViewportRegion() const;
00280
00294 void setBackgroundColor(const SbColor &c);
00295
00299 const SbColor& getBackgroundColor() const;
00300
00311 void setBackgroundColorRGBA(const SbColorRGBA &color);
00312
00316 SbColorRGBA getBackgroundColorRGBA() const;
00317
00323 void setBackgroundIndex(int index);
00324
00328 int getBackgroundIndex() const;
00329
00337 void setRGBMode(SbBool onOrOff);
00338
00342 SbBool isRGBMode() const;
00343
00351 void setClearDepth(float depth);
00352
00356 float getClearDepth() const;
00357
00364 virtual void activate();
00365
00372 virtual void deactivate();
00373
00384 void setAutoInteractiveMode(SbBool flag);
00385
00391 SbBool isAutoInteractiveMode() const;
00392
00402 void setInteractive(SbBool flag);
00403
00425 void setRenderCallback( SoSceneManagerRenderCB *f, void *userData = NULL );
00426
00430 SbBool isAutoRedraw() const;
00431
00437 void setRedrawPriority(uint32_t priority);
00438
00442 uint32_t getRedrawPriority() const;
00443
00447 static uint32_t getDefaultRedrawPriority() { return 10000; }
00448
00453 static void enableRealTimeUpdate(SbBool flag);
00454
00458 static SbBool isRealTimeUpdateEnabled();
00459
00466 void setShareContext(SbGLShareContext sc, SbBool issc = TRUE);
00467
00473 enum AntialiasingMode
00474 {
00479 AUTO,
00480
00485 FXAA,
00486
00492 SMAA,
00493
00503 FSAA,
00504
00510 SUPERSAMPLING,
00511 SoDEPRECATED
00516 ACCUM_BUFFERS = SUPERSAMPLING,
00517
00518 #ifndef HIDDEN_FROM_DOC
00519 NUM_ANTIALIASING_MODE,
00520 #endif
00521
00525 NO_ANTIALIASING
00526 };
00527
00537 void setStillSuperSampling(float quality, float delay);
00538
00542 float getStillSuperSamplingQuality();
00543
00547 float getStillSuperSamplingDelay();
00548
00565 void setAntialiasing(const float quality, const AntialiasingMode mode = AUTO);
00566
00586 void setAntialiasing(SoAntialiasingParameters* advancedParameters);
00587
00594 float getAntialiasingQuality() const;
00595
00603 SoAntialiasingParameters* getAntialiasingParameters() const;
00604
00612 AntialiasingMode getAntialiasingMode() const;
00613
00624 void setAntialiasingEventListener(SiAntialiasingEventListener* listener);
00625
00631 SiAntialiasingEventListener* getAntialiasingEventListener() const;
00632
00641 void setHandleEventAction(SoHandleEventAction *hea);
00642
00648 SoHandleEventAction *getHandleEventAction() const;
00649
00657 void setGLRenderAction(SoGLRenderAction *ra);
00658
00664 SoGLRenderAction* getGLRenderAction() const;
00665
00676 void setAbortRenderCallback( SoAbortRenderCB *callback, void *userData = NULL );
00677
00678 #if 1 SoDEPRECATED
00696 void setAntialiasing(SbBool smoothing, int numPasses);
00697 SoDEPRECATED
00702 void getAntialiasing(SbBool &smoothing, int &numPasses) const;
00703
00704 #endif
00706 private:
00707
00708 void updateRealTimeSensor();
00709
00710
00711 void setGLRenderAction(SoGLRenderAction *ra, int i);
00712 SoGLRenderAction* getGLRenderAction(int i) const;
00713
00714 private:
00715
00725 SbBool shouldAbortRender(SoAction* action) const;
00726
00727 void setFloatingColorBuffer(SbBool enable, int size);
00728
00729 bool needToSetViewport( const int id = 0 );
00730
00731 void setNeedToSetViewport( const int id = 0 );
00732
00733
00735 static void scheduleRedraw(SoNode* node);
00736
00738 void scheduleForcedRedraw();
00739
00740 SoSceneManagerImpl* getImpl() const;
00741
00742 SoINTERNAL private:
00743
00744 bool isActive() const;
00745
00746
00747 void redraw();
00748 void fastEditRenderSceneRules(SoSensor *sensor);
00749
00750 private:
00751
00752 SoSceneManagerImpl* m_impl;
00753
00754 friend class SoGuiRenderArea;
00755 friend class SoRenderAreaCoreImpl;
00756
00757 };
00758
00759 #if defined(_WIN32)
00760 #pragma warning( pop )
00761 #endif
00762
00763 #endif // _SO_SCENE_MANAGER_
00764
00765