Open Inventor Release 2024.2.0
 
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;
71class SoState;
74class SoNode;
75class SoSceneManager;
76class SoSceneManagerImpl;
77class SoSensor;
78class SoSFTime;
79class SoOneShotSensor;
80class SoGLRenderFromPBuffer;
81class SoGLContext;
82class SoSceneManagerSync;
83
85namespace inventor
86{
87 namespace impl
88 {
89 class SoRenderAreaCoreImpl;
90 }
91}
94using inventor::impl::SoRenderAreaCoreImpl;
95
96// callback function prototypes
104typedef void SoSceneManagerRenderCB(void *userData, SoSceneManager *mgr);
105
113typedef SbBool SoAbortRenderCB(SoAction*,void *userData);
114
115#if defined(_WIN32)
116#pragma warning( push )
117#pragma warning( disable: 4251 ) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
118#endif
119
121//
122// Class: SoSceneManager
123//
124// Class which performs Inventor rendering and event handling
125// on a scene graph.
126//
128
152{
153 public:
154
155#if 1 SoDEPRECATED
159#endif
165
168
219 virtual void render();
220
221#if 1 SoDEPRECATED
227 virtual void render(SbBool clearWindow, SbBool clearZbuffer = TRUE
228#ifndef HIDDEN_FROM_DOC // internal undocumented parameters.
229 , int id = 0, bool force = false
230#endif
231 );
232
233#endif
240 virtual SbBool processEvent(const SoEvent *event);
241
247
253
259 virtual void setSceneGraph(SoNode *newScene);
260
264 virtual SoNode* getSceneGraph() const;
265
271 void setWindowSize(const SbVec2s &newSize, const float &newScale = 1.0);
272
276 const SbVec2s& getWindowSize() const;
277
282 void setSize(const SbVec2s &newSize, const float &newScale = 1.0);
283
287 const SbVec2s& getSize() const;
288
294 void setOrigin(const SbVec2s &newOrigin);
295
299 const SbVec2s& getOrigin() const;
300
305 void setViewportRegion(const SbViewportRegion &newRegion);
306
311
326
331
343
348
354 void setBackgroundIndex(int index);
355
360
368 void setRGBMode(SbBool onOrOff);
369
374
381 void setClearDepth(float depth);
382
386 float getClearDepth() const;
387
394 virtual void activate();
395
402 virtual void deactivate();
403
415
422
433
455 void setRenderCallback( SoSceneManagerRenderCB *f, void *userData = NULL );
456
461
467 void setRedrawPriority(uint32_t priority);
468
472 uint32_t getRedrawPriority() const;
473
477 static uint32_t getDefaultRedrawPriority() { return 10000; }
478
483 static void enableRealTimeUpdate(SbBool flag);
484
489
497
504 {
510
516
523
534
541SoDEPRECATED
547
548#ifndef HIDDEN_FROM_DOC
549 NUM_ANTIALIASING_MODE,
550#endif
551
556 };
557
567 void setStillSuperSampling(float quality, float delay);
568
573
578
595 void setAntialiasing(const float quality, const AntialiasingMode mode = AUTO);
596
619 void setAntialiasing(SoAntialiasingParameters* advancedParameters);
620
628
637
646
658
665
675
682
691
698
709 void setAbortRenderCallback( SoAbortRenderCB *callback, void *userData = NULL );
710
711#if 1 SoDEPRECATED
729 void setAntialiasing(SbBool smoothing, int numPasses);
730SoDEPRECATED
735 void getAntialiasing(SbBool &smoothing, int &numPasses) const;
736
737#endif
739private:
740
741 void updateRealTimeSensor();
742
743 //Multi GLWidget case
744 void setGLRenderAction(SoGLRenderAction *ra, int i);
746
747private:
748
758 SbBool shouldAbortRender(SoAction* action) const;
759
760 void setFloatingColorBuffer(SbBool enable, int size);
761
762 bool needToSetViewport( const int id = 0 );
763
764 void setNeedToSetViewport( const int id = 0 );
765
766
768 static void scheduleRedraw(SoNode* node);
769
771 void scheduleForcedRedraw();
772
773 SoSceneManagerImpl* getImpl() const;
774
778 bool canGPUPick(SoState* state);
779
780 enum Components
781 {
782 RGB,
783 RGBA,
784 };
785
786 bool saveSnapshot(const SbString& filename, Components components = RGBA) const;
787
788private:
789
790 SoSceneManagerImpl* m_impl;
791
792 friend class SoGuiRenderArea;
794
795};
796
797#if defined(_WIN32)
798#pragma warning( pop )
799#endif
800
801#endif // _SO_SCENE_MANAGER_
802
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
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87