Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoSceneManager.h
Go to the documentation of this file.
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Author(s) (MMM yyyy)
25** Modified by : David Mott (MMM yyyy)
26** Modified by : Alain Dumesny (MMM yyyy)
27**=======================================================================*/
28/*=======================================================================
29 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
30 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
31 *** ***
32 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
33 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
34 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
35 *** ***
36 *** RESTRICTED RIGHTS LEGEND ***
37 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
38 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
39 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
40 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
41 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
42 *** ***
43 *** COPYRIGHT (C) 1996-2022 BY FEI S.A.S, ***
44 *** BORDEAUX, FRANCE ***
45 *** ALL RIGHTS RESERVED ***
46**=======================================================================*/
47/*=======================================================================
48** Modified by : VSG (MMM YYYY)
49**=======================================================================*/
50
51
52#ifndef _SO_SCENE_MANAGER_
53#define _SO_SCENE_MANAGER_
54
55#include <Inventor/SbColor.h>
58#include <Inventor/SoType.h>
62#include <Inventor/STL/vector>
63#include <Inventor/STL/set>
65#include <SoDeprecationRules.h>
66
68class SoNodeSensor;
69class SoEvent;
70class SoAction;
73class SoNode;
74class SoSceneManager;
75class SoSceneManagerImpl;
76class SoSensor;
77class SoSFTime;
78class SoOneShotSensor;
79class SoGLRenderFromPBuffer;
80class SoGLContext;
81class SoSceneManagerSync;
82
84namespace inventor
85{
86 namespace impl
87 {
88 class SoRenderAreaCoreImpl;
89 }
90}
93using inventor::impl::SoRenderAreaCoreImpl;
94
95// callback function prototypes
100typedef void SoSceneManagerRenderCB(void *userData, SoSceneManager *mgr);
101
106typedef SbBool SoAbortRenderCB(SoAction*,void *userData);
107
108#if defined(_WIN32)
109#pragma warning( push )
110#pragma warning( disable: 4251 ) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
111#endif
112
114//
115// Class: SoSceneManager
116//
117// Class which performs Inventor rendering and event handling
118// on a scene graph.
119//
121
145{
146 public:
147
149 SoSceneManager(int nb = 1);
150
153
204 virtual void render();
205
206#if 1 SoDEPRECATED
212 virtual void render(SbBool clearWindow, SbBool clearZbuffer = TRUE
213#ifndef HIDDEN_FROM_DOC // internal undocumented parameters.
214 , int id = 0, bool force = false
215#endif
216 );
217
218#endif
225 virtual SbBool processEvent(const SoEvent *event);
226
232
238
244 virtual void setSceneGraph(SoNode *newScene);
245
249 virtual SoNode* getSceneGraph() const;
250
256 void setWindowSize(const SbVec2s &newSize, const float &newScale = 1.0);
257
261 const SbVec2s& getWindowSize() const;
262
267 void setSize(const SbVec2s &newSize, const float &newScale = 1.0);
268
272 const SbVec2s& getSize() const;
273
279 void setOrigin(const SbVec2s &newOrigin);
280
284 const SbVec2s& getOrigin() const;
285
290 void setViewportRegion(const SbViewportRegion &newRegion);
291
296
311
316
328
333
339 void setBackgroundIndex(int index);
340
345
353 void setRGBMode(SbBool onOrOff);
354
359
366 void setClearDepth(float depth);
367
371 float getClearDepth() const;
372
379 virtual void activate();
380
387 virtual void deactivate();
388
400
407
418
440 void setRenderCallback( SoSceneManagerRenderCB *f, void *userData = NULL );
441
446
452 void setRedrawPriority(uint32_t priority);
453
457 uint32_t getRedrawPriority() const;
458
462 static uint32_t getDefaultRedrawPriority() { return 10000; }
463
468 static void enableRealTimeUpdate(SbBool flag);
469
474
482
489 {
495
501
508
519
526SoDEPRECATED
532
533#ifndef HIDDEN_FROM_DOC
534 NUM_ANTIALIASING_MODE,
535#endif
536
541 };
542
552 void setStillSuperSampling(float quality, float delay);
553
558
563
580 void setAntialiasing(const float quality, const AntialiasingMode mode = AUTO);
581
604 void setAntialiasing(SoAntialiasingParameters* advancedParameters);
605
613
622
631
643
650
660
667
676
683
694 void setAbortRenderCallback( SoAbortRenderCB *callback, void *userData = NULL );
695
696#if 1 SoDEPRECATED
714 void setAntialiasing(SbBool smoothing, int numPasses);
715SoDEPRECATED
720 void getAntialiasing(SbBool &smoothing, int &numPasses) const;
721
722#endif
724private:
725
726 void updateRealTimeSensor();
727
728 //Multi GLWidget case
729 void setGLRenderAction(SoGLRenderAction *ra, int i);
731
732private:
733
743 SbBool shouldAbortRender(SoAction* action) const;
744
745 void setFloatingColorBuffer(SbBool enable, int size);
746
747 bool needToSetViewport( const int id = 0 );
748
749 void setNeedToSetViewport( const int id = 0 );
750
751
753 static void scheduleRedraw(SoNode* node);
754
756 void scheduleForcedRedraw();
757
758 SoSceneManagerImpl* getImpl() const;
759
760 enum Components
761 {
762 RGB,
763 RGBA,
764 };
765
766 bool saveSnapshot(const SbString& filename, Components components = RGBA) const;
767
768private:
769
770 SoSceneManagerImpl* m_impl;
771
772 friend class SoGuiRenderArea;
774
775};
776
777#if defined(_WIN32)
778#pragma warning( pop )
779#endif
780
781#endif // _SO_SCENE_MANAGER_
782
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
virtual void enable(QWidget *w, XtEventHandler f, XtPointer data, void *unused=NULL)
void SoSceneManagerRenderCB(void *userData, SoSceneManager *mgr)
This typedef defines the calling sequence for setRenderCallback() callbacks.
SbBool SoAbortRenderCB(SoAction *, void *userData)
This typedef defines the calling sequence for setAbortRenderCallback() callbacks.
Color vector class.
Definition SbColor.h:82
ColorRGBA vector class.
Definition SbColorRGBA.h:61
Class encapsulating information about an OpenGL context: a handle on an OpenGL context and its id.
Class for smart character strings.
Definition SbString.h:202
2D vector class.
Definition SbVec.h:700
Class for representing a viewport.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Antialiasing cha...
Abstract base class for all actions.
Definition SoAction.h:132
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Antialiasing par...
Base class for all events.
Definition SoEvent.h:116
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> OpenGL context m...
Renders a scene graph using Open Inventor's Render Engine.
Allows nodes in a graph to receive input events.
Abstract base class for all database nodes.
Definition SoNode.h:145
Sensor class that can be attached to Open Inventor nodes.
Sensor for one-time only callbacks.
Field containing an SbTime.
Definition SoSFTime.h:82
Manages scene graph rendering and event handling.
SoHandleEventAction * getHandleEventAction() const
void setInteractive(SbBool flag)
Indicates that the scene manager is in interactive mode or not.
friend class SoRenderAreaCoreImpl
void setBackgroundIndex(int index)
Defines the window background color when in color index mode.
SoSceneManager(int nb=1)
Constructor.
const SbVec2s & getOrigin() const
void setAntialiasing(SoAntialiasingParameters *advancedParameters)
Enable (or disable) antialiasing with specific parameters.
SiAntialiasingEventListener * getAntialiasingEventListener() const
void setRGBMode(SbBool onOrOff)
Defines the color mode (TRUE - RGB mode, FALSE - color map mode).
float getStillSuperSamplingQuality()
void setStillSuperSampling(float quality, float delay)
Set options for supersampling when "still" (not interacting).
const SbViewportRegion & getViewportRegion() const
static void enableRealTimeUpdate(SbBool flag)
Enables the realTime global field update which normally happen right after a redraw.
virtual void setSceneGraph(SoNode *newScene)
Defines the scene graph which is managed here.
void setShareContext(SbGLShareContext sc, SbBool issc=TRUE)
Sets the OpenGL context to be shared by the scene manager.
const SbVec2s & getWindowSize() const
SoAntialiasingParameters * getAntialiasingParameters() const
Returns the antialiasing parameters set using the setAntialiasing(SoAntialiasingParameters*) method.
SbBool isAutoInteractiveMode() const
void setRedrawPriority(uint32_t priority)
Sets the priority of the redraw sensor.
AntialiasingMode getAntialiasingMode() const
Returns the antialiasing mode set using the setAntialiasing(float,AntialiasingMode) method.
virtual ~SoSceneManager()
Destructor.
void setWindowSize(const SbVec2s &newSize, const float &newScale=1.0)
Defines the size of the window in which the scene manager should render.
AntialiasingMode
Enum which indicates the desired antialiasing algorithm.
@ FXAA
FXAA is a screen space antialiasing algorithm which uses shaders and is applied after the rendering.
@ AUTO
This is the default mode for antialiasing.
@ FSAA
FSAA is a full-screen antialiasing algorithm based on super-sampling.
@ NO_ANTIALIASING
Turn off antialiasing.
@ ACCUM_BUFFERS
Deprecated name of SUPERSAMPLING.
@ SUPERSAMPLING
The advantage of this algorithm is it gives high quality images even on lines.
@ SMAA
SMAA is a screen space antialiasing algorithm which uses shaders and is applied after the rendering.
float getClearDepth() const
void setAutoInteractiveMode(SbBool flag)
Defines the auto interactive mode.
void setOrigin(const SbVec2s &newOrigin)
Defines the origin of the viewport within the window.
void setClearDepth(float depth)
Defines the depth value used when the depth buffer is cleared.
SoDEPRECATED void getAntialiasing(SbBool &smoothing, int &numPasses) const
virtual SoDEPRECATED void render(SbBool clearWindow, SbBool clearZbuffer=TRUE)
SoDEPRECATED void setAntialiasing(SbBool smoothing, int numPasses)
Enables smoothing and/or multi-pass antialiasing for rendering.
void setBackgroundColorRGBA(const SbColorRGBA &color)
Defines the window background color when in RGBA mode.
void setBackgroundColor(const SbColor &c)
Defines the window background color when in RGB mode.
SbBool isAutoRedraw() const
Returns TRUE if there is currently a render callback registered.
void setAbortRenderCallback(SoAbortRenderCB *callback, void *userData=NULL)
Setup a callback that returns TRUE if rendering should be aborted.
void setAntialiasing(const float quality, const AntialiasingMode mode=AUTO)
Enable (or disable) antialiasing with specified quality and mode.
void setAntialiasingEventListener(SiAntialiasingEventListener *listener)
Sets an event listener which is called when the antialiasing configuration is modified.
void reinitialize()
Reinitializes graphics.
void scheduleRedraw()
Schedules a redraw for some time in the near future.
virtual void deactivate()
Deactivates the scene manager.
void setSize(const SbVec2s &newSize, const float &newScale=1.0)
Defines the size of the viewport within the window.
uint32_t getRedrawPriority() const
float getStillSuperSamplingDelay()
SbColorRGBA getBackgroundColorRGBA() const
SbColor getBackgroundColor() const
void setViewportRegion(const SbViewportRegion &newRegion)
Defines current viewport region to use for rendering.
int getBackgroundIndex() const
virtual SoNode * getSceneGraph() const
void setHandleEventAction(SoHandleEventAction *hea)
User supplied handle event action.
virtual void activate()
Activates the scene manager.
SbBool isRGBMode() const
static uint32_t getDefaultRedrawPriority()
Gets the default priority of the redraw sensor.
static SbBool isRealTimeUpdateEnabled()
SoGLRenderAction * getGLRenderAction() const
const SbVec2s & getSize() const
virtual void render()
Applies an SoGLRenderAction to the scene graph managed here.
void setGLRenderAction(SoGLRenderAction *ra)
User supplied render action.
float getAntialiasingQuality() const
Returns the antialiasing quality set using the setAntialiasing(float,AntialiasingMode) method.
void setRenderCallback(SoSceneManagerRenderCB *f, void *userData=NULL)
The render callback provides a mechanism for automatically redrawing the scene in response to changes...
virtual SbBool processEvent(const SoEvent *event)
Processes the passed event by applying an SoHandleEventAction to the scene graph managed here.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:97
int SbBool
Boolean type.
Definition SbBase.h:87
size_t size() const