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 namespace inventor
00084 {
00085 namespace impl
00086 {
00087 class SoRenderAreaCoreImpl;
00088 }
00089 }
00090
00091 using inventor::impl::SoRenderAreaCoreImpl;
00092
00093
00098 typedef void SoSceneManagerRenderCB(void *userData, SoSceneManager *mgr);
00099
00104 typedef SbBool SoAbortRenderCB(SoAction*,void *userData);
00105
00106 #if defined(_WIN32)
00107 #pragma warning( push )
00108 #pragma warning( disable: 4251 ) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
00109 #endif
00110
00112
00113
00114
00115
00116
00117
00119
00142 class SoSceneManager
00143 {
00144 public:
00145
00147 SoSceneManager(int nb = 1);
00148
00150 virtual ~SoSceneManager();
00151
00202 virtual void render();
00203
00204 #if 1 SoDEPRECATED
00210 virtual void render(SbBool clearWindow, SbBool clearZbuffer = TRUE
00211 #ifndef HIDDEN_FROM_DOC
00212 , int id = 0, bool force = false
00213 #endif
00214 );
00215
00216 #endif
00223 virtual SbBool processEvent(const SoEvent *event);
00224
00229 void reinitialize();
00230
00235 void scheduleRedraw();
00236
00242 virtual void setSceneGraph(SoNode *newScene);
00243
00247 virtual SoNode* getSceneGraph() const;
00248
00254 void setWindowSize(const SbVec2s &newSize, const float &newScale = 1.0);
00255
00259 const SbVec2s& getWindowSize() const;
00260
00265 void setSize(const SbVec2s &newSize, const float &newScale = 1.0);
00266
00270 const SbVec2s& getSize() const;
00271
00277 void setOrigin(const SbVec2s &newOrigin);
00278
00282 const SbVec2s& getOrigin() const;
00283
00288 void setViewportRegion(const SbViewportRegion &newRegion);
00289
00293 const SbViewportRegion &getViewportRegion() const;
00294
00308 void setBackgroundColor(const SbColor &c);
00309
00313 SbColor getBackgroundColor() const;
00314
00325 void setBackgroundColorRGBA(const SbColorRGBA &color);
00326
00330 SbColorRGBA getBackgroundColorRGBA() const;
00331
00337 void setBackgroundIndex(int index);
00338
00342 int getBackgroundIndex() const;
00343
00351 void setRGBMode(SbBool onOrOff);
00352
00356 SbBool isRGBMode() const;
00357
00364 void setClearDepth(float depth);
00365
00369 float getClearDepth() const;
00370
00377 virtual void activate();
00378
00385 virtual void deactivate();
00386
00397 void setAutoInteractiveMode(SbBool flag);
00398
00404 SbBool isAutoInteractiveMode() const;
00405
00415 void setInteractive(SbBool flag);
00416
00438 void setRenderCallback( SoSceneManagerRenderCB *f, void *userData = NULL );
00439
00443 SbBool isAutoRedraw() const;
00444
00450 void setRedrawPriority(uint32_t priority);
00451
00455 uint32_t getRedrawPriority() const;
00456
00460 static uint32_t getDefaultRedrawPriority() { return 10000; }
00461
00466 static void enableRealTimeUpdate(SbBool flag);
00467
00471 static SbBool isRealTimeUpdateEnabled();
00472
00479 void setShareContext(SbGLShareContext sc, SbBool issc = TRUE);
00480
00486 enum AntialiasingMode
00487 {
00492 AUTO,
00493
00498 FXAA,
00499
00505 SMAA,
00506
00516 FSAA,
00517
00523 SUPERSAMPLING,
00524 SoDEPRECATED
00529 ACCUM_BUFFERS = SUPERSAMPLING,
00530
00531 #ifndef HIDDEN_FROM_DOC
00532 NUM_ANTIALIASING_MODE,
00533 #endif
00534
00538 NO_ANTIALIASING
00539 };
00540
00550 void setStillSuperSampling(float quality, float delay);
00551
00555 float getStillSuperSamplingQuality();
00556
00560 float getStillSuperSamplingDelay();
00561
00578 void setAntialiasing(const float quality, const AntialiasingMode mode = AUTO);
00579
00602 void setAntialiasing(SoAntialiasingParameters* advancedParameters);
00603
00610 float getAntialiasingQuality() const;
00611
00619 SoAntialiasingParameters* getAntialiasingParameters() const;
00620
00628 AntialiasingMode getAntialiasingMode() const;
00629
00640 void setAntialiasingEventListener(SiAntialiasingEventListener* listener);
00641
00647 SiAntialiasingEventListener* getAntialiasingEventListener() const;
00648
00657 void setHandleEventAction(SoHandleEventAction *hea);
00658
00664 SoHandleEventAction *getHandleEventAction() const;
00665
00673 void setGLRenderAction(SoGLRenderAction *ra);
00674
00680 SoGLRenderAction* getGLRenderAction() const;
00681
00692 void setAbortRenderCallback( SoAbortRenderCB *callback, void *userData = NULL );
00693
00694 #if 1 SoDEPRECATED
00712 void setAntialiasing(SbBool smoothing, int numPasses);
00713 SoDEPRECATED
00718 void getAntialiasing(SbBool &smoothing, int &numPasses) const;
00719
00720 #endif
00722 private:
00723
00724 void updateRealTimeSensor();
00725
00726
00727 void setGLRenderAction(SoGLRenderAction *ra, int i);
00728 SoGLRenderAction* getGLRenderAction(int i) const;
00729
00730 private:
00731
00741 SbBool shouldAbortRender(SoAction* action) const;
00742
00743 void setFloatingColorBuffer(SbBool enable, int size);
00744
00745 bool needToSetViewport( const int id = 0 );
00746
00747 void setNeedToSetViewport( const int id = 0 );
00748
00749
00751 static void scheduleRedraw(SoNode* node);
00752
00754 void scheduleForcedRedraw();
00755
00756 SoSceneManagerImpl* getImpl() const;
00757
00758 private:
00759
00760 SoSceneManagerImpl* m_impl;
00761
00762 friend class SoGuiRenderArea;
00763 friend class SoRenderAreaCoreImpl;
00764
00765 };
00766
00767 #if defined(_WIN32)
00768 #pragma warning( pop )
00769 #endif
00770
00771 #endif // _SO_SCENE_MANAGER_
00772
00773