Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoGuiRenderArea.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : T.MEHAMLI (Jun 2007)
22**=======================================================================*/
23
24#ifndef SO_GUI_RENDER_AREA_H
25#define SO_GUI_RENDER_AREA_H
26
28//
29// Class: SoGuiRenderArea
30//
31// SoXXRenderArea implementation class
32//
33//
35
36#include <Inventor/Gui/SoGuiGLWidget.h>
37#include <Inventor/nodes/SoCamera.h> // stereo settings
38#include <Inventor/nodes/SoFullSceneAntialiasing.h>
39#include <Inventor/SbElapsedTime.h>
40#include <Inventor/actions/SoGLRenderAction.h>
41
42class SoNode;
43class SoFrameGrabber;
45class ScTracking;
46class SoSelection;
47class SoMPEGRenderer;
48
49#ifndef HIDDEN_FROM_DOC
50typedef void (*soSelectionChangeCB)(void *, SoSelection* data);
51#endif
52
53
55{
56#ifndef HIDDEN_FROM_DOC
57 SO_FIELDCONTAINER_HEADER( SoGuiRenderArea );
58#endif
59
60private:
61 SoSFVec2i32 position;
62 SoSFVec2i32 globalPosition;
63 SoSFFieldContainer sceneManager;
64 SoSFBool stereoAbsoluteAdjustments;
65 SoSFFloat stereoOffset;
66 SoSFFloat stereoBalance;
67 SoSFBool stereoNearFrac;
68 SoSFBool stereoReversed;
69
70 SoSFFieldContainer cameraBase;
71
76 SoGuiRenderArea( bool sync );
77
81 virtual void setSceneGraph( SoNode* newScene );
82
86 virtual SoNode* getSceneGraph();
87
94 void setBackgroundColor( const SbColor& c );
95
99 SbColor getBackgroundColor() const;
100
105 void setBackgroundIndex( int index );
106
110 int getBackgroundIndex() const;
111
115 void setViewportRegion( const SbViewportRegion& newRegion );
116
120 const SbViewportRegion& getViewportRegion() const;
121
126 void setTransparencyType( SoGLRenderAction::TransparencyType type );
127
132 SoGLRenderAction::TransparencyType getTransparencyType() const;
133
144 void setFastEditSavePolicy( SoGLRenderAction::FastEditSavePolicy policy,
145 SbBool fastEditDelayedObjects = FALSE);
146
150 SoGLRenderAction::FastEditSavePolicy getFastEditSavePolicy() const;
151
167 void setInvalidateCacheMode( SoGLRenderAction::InvalidateCacheMode icm );
168
172 SoGLRenderAction::InvalidateCacheMode getInvalidateCacheMode();
173
181 void setClearBeforeRender( SbBool trueOrFalse, SbBool zbTrueOrFalse = TRUE );
182
186 SbBool isClearBeforeRender() const;
187
192 SbBool isClearZBufferBeforeRender() const;
193
198 void setAutoRedraw( SbBool trueOrFalse );
199
204 SbBool isAutoRedraw() const;
205
209 void setRedrawPriority( uint32_t priority );
210
214 uint32_t getRedrawPriority() const;
215
219 static uint32_t getDefaultRedrawPriority();
220
221
228 void setSceneManager( SoSceneManager* sm );
229
236 SoSceneManager* getSceneManager() const
237 {
238 return m_sceneMgr;
239 }
240
246 void setGLRenderAction( SoGLRenderAction* ra );
247
253 SoGLRenderAction* getGLRenderAction() const;
254
258 static SbVec2s getDefaultSize();
259
263 SbBool invokeAppCB( const SoEvent* anyevent );
264
268 virtual void notifyRedraw();
269 virtual void signalRedraw();
270 virtual void cleanRedraw();
271
275 virtual void notify( SoNotList* );
276
282 virtual void setMPEGRecorder( SoMPEGRenderer* recorder );
283
287 virtual SoMPEGRenderer* getMPEGRecorder() const;
288
289 // ----------------------- Extension usage -----------------------------------
290
291 void setStereoMode( SoCamera::StereoMode stMode );
292 void setStereoElement();
293
294 void setRedrawing( SbBool redrawing );
295 SbBool isRedrawing() const;
296
297 SbBool isInteractive() const;
298
299 void setStereoOffset( float offset );
300 float getStereoOffset() const;
301
302 void setStereoReversed( SbBool reverse );
303 SbBool getStereoReversed() const;
304
305 void setStereoAbsoluteAdjustments( SbBool absolute );
306 SbBool getStereoAbsoluteAdjustments() const;
307
308 void setStereoBalance( float balance, SbBool nearFrac = false );
309 float getStereoBalance() const;
310 SbBool isStereoBalanceNearFrac() const;
311
312 virtual void setDoubleBufferRA(SbBool db);
313
314 virtual void actualRedraw();
315
316 virtual void initGraphic();
317 void redrawCleanUp();
318
319 void activate(); // connects the sensor
320 void deactivate(); // disconnects the sensor
321
322 void posChanged( const SbVec2i32& newPos, const SbVec2i32& newGPos );
323
324 void setFrameGrabber( SoFrameGrabber* grabber );
325 SoFrameGrabber* getFrameGrabber() const;
326
330 //static void asyncPaintSensorCB( void *data, SoSensor * );
331
335 //SoOneShotSensor *m_asyncPaintSensor;
336
337 // called at the begining of redraw call
338 void preRedraw();
339
340 // called at the end of redraw call
341 virtual void postRedraw();
342
343 // call when selection changed
344 void redrawOnSelectionChange( SoSelection* s );
345
346
347 // setup system dependent renderArea handles.
348 void setRenderAreaHandle(const void *renderAreaHandle, soSelectionChangeCB _selectionChangedCB);
349 void *m_renderAreaHandle;
350 soSelectionChangeCB selectionChangeCB;
351
352 inline SoFrameGrabber* getGrabber() const;
353
355 unsigned int getFPSCount();
356
357private:
358
362 virtual ~SoGuiRenderArea();
363
364 int m_interactiveCount;
365 unsigned int m_fpsCount;
366 SbElapsedTime m_fpsTimer;
367 double m_previousfpsTime;
368 bool m_usefpsCallback;
369
370 // MPEG recording
371 SoMPEGRenderer* m_mpegRenderer;
372
373// ----------------------- Private usage -------------------------------------
374private:
375 void commonConstructor();
376
377 // these make rendering/redrawing happen
378 SoSceneManager* m_sceneMgr; // this manages rendering and events
379 SbBool m_autoRedraw; // if TRUE, then we automatically redraw
380 SbBool m_clearFirst; // call clear() before rendering
381 SbBool m_clearZBufferFirst; // clear ZBuffer before rendering
382 SbBool m_isRedrawing;
383 SoFrameGrabber* m_grabber;
384 ScTracking* m_tracking;
385 SoCamera* m_cameraBase;
386
387 SoSelection* selection;
388
389 // Floating point rendering
390 SbBool m_isFloatingPointRendering;
391 FloatColorBufferSize m_floatingPointRenderingPrecision;
392
393 // stereo adjustment
394 SoCamera::StereoMode m_stereoMode;
395
396 SbThreadSemaphore* m_redrawSem;
397};
398
399SoFrameGrabber* SoGuiRenderArea::getGrabber() const
400{
401 return m_grabber;
402}
403
404inline unsigned int
405SoGuiRenderArea::getFPSCount()
406{
407 return m_fpsCount;
408}
409
410#endif // SO_GUI_RENDER_AREA_H
411
Color vector class.
Definition SbColor.h:82
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class for measur...
Semaphore management.
2D vector class.
Definition SbVec.h:517
2D vector class.
Definition SbVec.h:700
Class for representing a viewport.
Abstract base class for camera nodes.
Definition SoCamera.h:188
StereoMode
Stereo mode.
Definition SoCamera.h:518
Base class for all events.
Definition SoEvent.h:116
Renders a scene graph using Open Inventor's Render Engine.
FastEditSavePolicy
Fast edit traversal types.
InvalidateCacheMode
Invalidate cache mode.
TransparencyType
Transparency rendering algorithm.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Base class for g...
Abstract base class for all database nodes.
Definition SoNode.h:145
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a two-dimensional vector.
Definition SoSFVec2i32.h:52
Manages scene graph rendering and event handling.
Manages a list of selected objects.
int SbBool
Boolean type.
Definition SbBase.h:87