Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoSceneManager.h
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>
56#include <Inventor/SbColorRGBA.h>
57#include <Inventor/SbViewportRegion.h>
58#include <Inventor/SoType.h>
59#include <Inventor/antialiasing/SoAntialiasingParameters.h>
60#include <Inventor/helpers/SbGlContextHelper.h>
61#include <Inventor/helpers/SbGlContextHelper.h>
62#include <Inventor/STL/vector>
63#include <Inventor/STL/set>
64#include <Inventor/threads/SbThreadSpinlock.h>
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
103typedef void SoSceneManagerRenderCB(void *userData, SoSceneManager *mgr);
104
112typedef SbBool SoAbortRenderCB(SoAction*,void *userData);
113
114#if defined(_WIN32)
115#pragma warning( push )
116#pragma warning( disable: 4251 ) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
117#endif
118
120//
121// Class: SoSceneManager
122//
123// Class which performs Inventor rendering and event handling
124// on a scene graph.
125//
127
151{
152 public:
153
154#if 1 SoDEPRECATED
158#endif
164
167
218 virtual void render();
219
220#if 1 SoDEPRECATED
226 virtual void render(SbBool clearWindow, SbBool clearZbuffer = TRUE
227#ifndef HIDDEN_FROM_DOC // internal undocumented parameters.
228 , int id = 0, bool force = false
229#endif
230 );
231
232#endif
239 virtual SbBool processEvent(const SoEvent *event);
240
246
252
258 virtual void setSceneGraph(SoNode *newScene);
259
263 virtual SoNode* getSceneGraph() const;
264
270 void setWindowSize(const SbVec2s &newSize, const float &newScale = 1.0);
271
275 const SbVec2s& getWindowSize() const;
276
281 void setSize(const SbVec2s &newSize, const float &newScale = 1.0);
282
286 const SbVec2s& getSize() const;
287
293 void setOrigin(const SbVec2s &newOrigin);
294
298 const SbVec2s& getOrigin() const;
299
304 void setViewportRegion(const SbViewportRegion &newRegion);
305
310
325
330
342
347
353 void setBackgroundIndex(int index);
354
359
367 void setRGBMode(SbBool onOrOff);
368
373
380 void setClearDepth(float depth);
381
385 float getClearDepth() const;
386
393 virtual void activate();
394
401 virtual void deactivate();
402
414
421
432
454 void setRenderCallback( SoSceneManagerRenderCB *f, void *userData = NULL );
455
460
466 void setRedrawPriority(uint32_t priority);
467
471 uint32_t getRedrawPriority() const;
472
476 static uint32_t getDefaultRedrawPriority() { return 10000; }
477
482 static void enableRealTimeUpdate(SbBool flag);
483
488
496
503 {
509
515
522
533
540SoDEPRECATED
546
547#ifndef HIDDEN_FROM_DOC
548 NUM_ANTIALIASING_MODE,
549#endif
550
555 };
556
566 void setStillSuperSampling(float quality, float delay);
567
572
577
594 void setAntialiasing(const float quality, const AntialiasingMode mode = AUTO);
595
618 void setAntialiasing(SoAntialiasingParameters* advancedParameters);
619
627
636
645
657
664
674
681
690
697
708 void setAbortRenderCallback( SoAbortRenderCB *callback, void *userData = NULL );
709
710#if 1 SoDEPRECATED
728 void setAntialiasing(SbBool smoothing, int numPasses);
729SoDEPRECATED
734 void getAntialiasing(SbBool &smoothing, int &numPasses) const;
735
736#endif
738private:
739
740 void updateRealTimeSensor();
741
742 //Multi GLWidget case
743 void setGLRenderAction(SoGLRenderAction *ra, int i);
745
746private:
747
757 SbBool shouldAbortRender(SoAction* action) const;
758
759 void setFloatingColorBuffer(SbBool enable, int size);
760
761 bool needToSetViewport( const int id = 0 );
762
763 void setNeedToSetViewport( const int id = 0 );
764
765
767 static void scheduleRedraw(SoNode* node);
768
770 void scheduleForcedRedraw();
771
772 SoSceneManagerImpl* getImpl() const;
773
774 enum Components
775 {
776 RGB,
777 RGBA,
778 };
779
780 bool saveSnapshot(const SbString& filename, Components components = RGBA) const;
781
782private:
783
784 SoSceneManagerImpl* m_impl;
785
786 friend class SoGuiRenderArea;
788
789};
790
791#if defined(_WIN32)
792#pragma warning( pop )
793#endif
794
795#endif // _SO_SCENE_MANAGER_
796
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 SoSceneManagerRenderCB(void *userData, SoSceneManager *mgr)
This typedef defines the calling sequence for setRenderCallback() callbacks.
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.
SbBool SoAbortRenderCB(SoAction *, void *userData)
This typedef defines the calling sequence for setAbortRenderCallback() callbacks.
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:100
int SbBool
Boolean type.
Definition SbBase.h:87