Open Inventor Release 2024.1.1
 
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-2020 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
275 bool renderToFile( const SbString& filename, OutputFormat outputFormat = RGB ) const;
276
277
295 bool renderToBuffer( SoBufferObject* buffer, OutputFormat outputFormat = RGB ) const;
296
319 void setTile(SbVec2i32 size, int numEdgePixels);
320
325
329 int getNumEdgePixels() const;
330
335
343 virtual void setClearPolicy(ClearPolicy policy);
344
353 virtual void setClearColor(const SbColorRGBA& color);
354
358 virtual SbColorRGBA getClearColor() const;
359
368 virtual void setClearDepth(float depth);
369
373 virtual float getClearDepth() const;
374
378 virtual void setSize(const SbVec2i32& size);
379
383 virtual SbVec2i32 getSize() const;
384
388 virtual void setGLRenderAction( SoGLRenderAction* glAction );
389
394
399
404
410
415
421 virtual void setAntialiasingQuality(float quality);
422
426 virtual float getAntialiasingQuality() const;
427
433
438 struct EventArg : public SbEventArg
439 {
440 public:
441
446
450 int getNumTiles() const;
451
455 const SbVec2i32& getOrigin() const;
456
461 const SbRasterImage& getTile() const;
462
463 private:
465
467 EventArg(const SoOffscreenRenderArea* renderarea, int numTiles, SoBufferObject* buffer);
468 ~EventArg();
469
470 const SoOffscreenRenderArea* m_renderarea;
471 SbVec2i32 m_origin;
472 int m_numTiles;
473 SbRasterImage* m_tile;
474 };
475
480
481private:
482
489 virtual RenderStatus render( const SbVec4i32& window );
490
491 #if 1 SoDEPRECATED
499 virtual RenderStatus render( const SbVec4s &window )
500 {
501 return render( SbVec4i32( window ) );
502 }
503 #endif /* 1 /** @DEPRECATED_BEGIN */ */
504
505};
506
507
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.