Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoOffscreenRenderArea.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-2024 BY FEI S.A.S, ***
17*** BORDEAUX, FRANCE ***
18*** ALL RIGHTS RESERVED ***
19*/
20
21#pragma once
22
23#include <Inventor/misc/SoRefCounter.h>
24#include <Inventor/actions/SoGLRenderAction.h>
25#include <Inventor/SbColorRGBA.h>
26#include <Inventor/SbVec.h>
27#include <Inventor/SbString.h>
28#include <Inventor/SbViewportRegion.h>
29#include <Inventor/SbEventHandler.h>
30#include <Inventor/SbEventArg.h>
31#include <Inventor/SbPImpl.h>
32#include <Inventor/image/SbRasterImage.h>
33#include <Inventor/ViewerComponents/SiRenderArea.h>
34#include <Inventor/ViewerComponents/SiRenderAreaAntialiasing.h>
35#include <Inventor/ViewerComponents/SiRenderAreaTransparency.h>
36
37class SoGLContext;
38class SoBufferObject;
40class SoNode;
41class SoSceneManager;
42
43
44SO_PIMPL_BASE_PUBLIC_DECLARATION(SoOffscreenRenderArea);
45
161{
162 SO_PIMPL_BASE_PUBLIC_HEADER(SoOffscreenRenderArea);
163
164 public:
171
176
182
187
191 virtual void setSceneGraph(SoNode *newScene);
192
196 virtual SoNode* getSceneGraph() const;
197
201 void setViewportRegion(const SbViewportRegion &newRegion);
202
207
218
223
228
231 {
234
236 RGBA
237 };
238
272 bool renderToFile( const SbString& filename, OutputFormat outputFormat = RGB ) const;
273
274
292 bool renderToBuffer( SoBufferObject* buffer, OutputFormat outputFormat = RGB ) const;
293
316 void setTile(SbVec2i32 size, int numEdgePixels);
317
322
326 int getNumEdgePixels() const;
327
332
340 virtual void setClearPolicy(ClearPolicy policy);
341
350 virtual void setClearColor(const SbColorRGBA& color);
351
355 virtual SbColorRGBA getClearColor() const;
356
365 virtual void setClearDepth(float depth);
366
370 virtual float getClearDepth() const;
371
375 virtual void setSize(const SbVec2i32& size);
376
380 virtual SbVec2i32 getSize() const;
381
385 virtual void setGLRenderAction( SoGLRenderAction* glAction );
386
391
396
401
407
412
418 virtual void setAntialiasingQuality(float quality);
419
423 virtual float getAntialiasingQuality() const;
424
430
435 struct EventArg : public SbEventArg
436 {
437 public:
438
443
447 int getNumTiles() const;
448
452 const SbVec2i32& getOrigin() const;
453
458 const SbRasterImage& getTile() const;
459
460 private:
462
464 EventArg(const SoOffscreenRenderArea* renderarea, int numTiles, SoBufferObject* buffer);
465 ~EventArg();
466
467 const SoOffscreenRenderArea* m_renderarea;
468 SbVec2i32 m_origin;
469 int m_numTiles;
470 SbRasterImage* m_tile;
471 };
472
477
478private:
479
486 virtual RenderStatus render( const SbVec4i32& window );
487
488 #if 1 SoDEPRECATED
496 virtual RenderStatus render( const SbVec4s &window )
497 {
498 return render( SbVec4i32( window ) );
499 }
500 #endif /* 1 /** @DEPRECATED_BEGIN */ */
501
502};
503
504
ColorRGBA vector class.
Definition SbColorRGBA.h:61
Base class for all event arguments.
Definition SbEventArg.h:41
Class representing an event.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class encapsulat...
Class for smart character strings.
Definition SbString.h:202
2D vector class.
Definition SbVec.h:517
4D vector class.
Definition SbVec.h:2639
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4D vector class.
Definition SbVec.h:2824
Class for representing a viewport.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> RenderArea antia...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> RenderArea inter...
RenderStatus
Returned by the render method.
ClearPolicy
Policy values to clear color and depth buffers beforing rendering.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> RenderArea trans...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
<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.
TransparencyType
Transparency rendering algorithm.
Abstract base class for all database nodes.
Definition SoNode.h:145
Render to an off-screen buffer for printing or generating textures.
virtual float getClearDepth() const
virtual void setGLRenderAction(SoGLRenderAction *glAction)
Defines the render action used for rendering.
SbEventHandler< EventArg & > onTileRendered
Event raised when a tile has been rendered.
SbViewportRegion getViewportRegion() const
virtual void setClearPolicy(ClearPolicy policy)
Defines the color buffer and depth buffer clear policy.
void setTile(SbVec2i32 size, int numEdgePixels)
Defines the maximum sub-image (tile) size for rendering and the number of pixels on the border of eac...
virtual SbVec2i32 getSize() const
SbVec2i32 getTileSize() const
virtual ClearPolicy getClearPolicy() const
~SoOffscreenRenderArea()
Destructor.
virtual void setTransparencyType(SoGLRenderAction::TransparencyType type)
Defines the algorithm for rendering transparent objects.
int getNumEdgePixels() const
virtual float getAntialiasingQuality() const
bool renderToBuffer(SoBufferObject *buffer, OutputFormat outputFormat=RGB) const
Render the given scene graph and save the result in the given buffer.
SoOffscreenRenderArea(SoGLContext *glContex)
Builds a new offscreen render area by sharing the given SoGlContext.
virtual SbColorRGBA getClearColor() const
OutputFormat
Describes the format of the rendering output.
@ RGB
3 components: red, green and blue
@ RGBA
4 components: red, green, blue and alpha
SoOffscreenRenderArea()
Default constructor.
virtual SoSceneManager::AntialiasingMode getAntialiasingMode() const
void setViewportRegion(const SbViewportRegion &newRegion)
Defines viewport region (within the image) to use for rendering.
virtual void setClearDepth(float depth)
Defines the depth value used when the depth buffer is cleared.
virtual SbEventHandler< RenderEventArg & > & onStartRender()
Returns the event handler that raises when a new render starts.
bool renderToFile(const SbString &filename, OutputFormat outputFormat=RGB) const
Render the given scene graph and save the result in the given file.
virtual RenderStatus render()
Calling the render() method is useless and does nothing.
virtual void setAntialiasingQuality(float quality)
Define the antialiasing quality value.
virtual SoNode * getSceneGraph() const
SoOffscreenRenderArea(SoRenderAreaCore *renderAreaCore)
Builds a new offscreen render area by using the given renderAreaCore.
virtual void setClearColor(const SbColorRGBA &color)
Defines the RGBA value used when the color buffer is cleared.
SoSceneManager * getSceneManager() const
Returns the encapsulated scene manager.
virtual void setAntialiasingMode(SoSceneManager::AntialiasingMode mode)
Define the antialiasing mode.
virtual SoGLRenderAction::TransparencyType getTransparencyType() const
virtual SoGLRenderAction * getGLRenderAction() const
Returns the render action used for rendering.
static SbVec2i32 getMaxTileSize()
Gets the maximum subimage (tile) size for rendering.
virtual void setSize(const SbVec2i32 &size)
Defines the image size to use for rendering.
virtual void setSceneGraph(SoNode *newScene)
Defines the scene graph which will be traversed for rendering.
Base class for ref-counted objects.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> (Preview feature...
Manages scene graph rendering and event handling.
AntialiasingMode
Enum which indicates the desired antialiasing algorithm.
Event that can be sent to the application for each tile rendered.
friend class inventor::impl::SoOffscreenRenderAreaImpl
const SoOffscreenRenderArea * getSource() const
Returns the SoOffscreenRenderArea that raised this event.
const SbRasterImage & getTile() const
Returns the image of the rendered tile.
int getNumTiles() const
Returns the number of tiles used to generate the entire image.
const SbVec2i32 & getOrigin() const
Returns the origin of the tile in the entire image.