Open Inventor Release 2024.1.0
 
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-2024 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
148#if 1 SoDEPRECATED
152#endif
158
161
212 virtual void render();
213
214#if 1 SoDEPRECATED
220 virtual void render(SbBool clearWindow, SbBool clearZbuffer = TRUE
221#ifndef HIDDEN_FROM_DOC // internal undocumented parameters.
222 , int id = 0, bool force = false
223#endif
224 );
225
226#endif
233 virtual SbBool processEvent(const SoEvent *event);
234
240
246
252 virtual void setSceneGraph(SoNode *newScene);
253
257 virtual SoNode* getSceneGraph() const;
258
264 void setWindowSize(const SbVec2s &newSize, const float &newScale = 1.0);
265
269 const SbVec2s& getWindowSize() const;
270
275 void setSize(const SbVec2s &newSize, const float &newScale = 1.0);
276
280 const SbVec2s& getSize() const;
281
287 void setOrigin(const SbVec2s &newOrigin);
288
292 const SbVec2s& getOrigin() const;
293
298 void setViewportRegion(const SbViewportRegion &newRegion);
299
304
319
324
336
341
347 void setBackgroundIndex(int index);
348
353
361 void setRGBMode(SbBool onOrOff);
362
367
374 void setClearDepth(float depth);
375
379 float getClearDepth() const;
380
387 virtual void activate();
388
395 virtual void deactivate();
396
408
415
426
448 void setRenderCallback( SoSceneManagerRenderCB *f, void *userData = NULL );
449
454
460 void setRedrawPriority(uint32_t priority);
461
465 uint32_t getRedrawPriority() const;
466
470 static uint32_t getDefaultRedrawPriority() { return 10000; }
471
476 static void enableRealTimeUpdate(SbBool flag);
477
482
490
497 {
503
509
516
527
534SoDEPRECATED
540
541#ifndef HIDDEN_FROM_DOC
542 NUM_ANTIALIASING_MODE,
543#endif
544
549 };
550
560 void setStillSuperSampling(float quality, float delay);
561
566
571
588 void setAntialiasing(const float quality, const AntialiasingMode mode = AUTO);
589
612 void setAntialiasing(SoAntialiasingParameters* advancedParameters);
613
621
630
639
651
658
668
675
684
691
702 void setAbortRenderCallback( SoAbortRenderCB *callback, void *userData = NULL );
703
704#if 1 SoDEPRECATED
722 void setAntialiasing(SbBool smoothing, int numPasses);
723SoDEPRECATED
728 void getAntialiasing(SbBool &smoothing, int &numPasses) const;
729
730#endif
732private:
733
734 void updateRealTimeSensor();
735
736 //Multi GLWidget case
737 void setGLRenderAction(SoGLRenderAction *ra, int i);
739
740private:
741
751 SbBool shouldAbortRender(SoAction* action) const;
752
753 void setFloatingColorBuffer(SbBool enable, int size);
754
755 bool needToSetViewport( const int id = 0 );
756
757 void setNeedToSetViewport( const int id = 0 );
758
759
761 static void scheduleRedraw(SoNode* node);
762
764 void scheduleForcedRedraw();
765
766 SoSceneManagerImpl* getImpl() const;
767
768 enum Components
769 {
770 RGB,
771 RGBA,
772 };
773
774 bool saveSnapshot(const SbString& filename, Components components = RGBA) const;
775
776private:
777
778 SoSceneManagerImpl* m_impl;
779
780 friend class SoGuiRenderArea;
782
783};
784
785#if defined(_WIN32)
786#pragma warning( pop )
787#endif
788
789#endif // _SO_SCENE_MANAGER_
790
#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.
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.
SoDEPRECATED SoSceneManager(int nb)
Constructor.
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.
SoSceneManager()
Constructor.
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