13#ifndef ML_OFFSCREEN_RENDER_H
14#define ML_OFFSCREEN_RENDER_H
20#include "mlModuleIncludes.h"
26#include <Inventor/actions/SoGLRenderAction.h>
32class SoGLRenderAction;
33class SoGLFramebufferObject;
35class SoGLRenderbuffer;
59 SCREEN_DOOR = SoGLRenderAction::SCREEN_DOOR,
60 ADD = SoGLRenderAction::ADD,
61 DELAYED_ADD = SoGLRenderAction::DELAYED_ADD,
62 SORTED_OBJECT_ADD = SoGLRenderAction::SORTED_OBJECT_ADD,
63 BLEND = SoGLRenderAction::BLEND,
64 DELAYED_BLEND = SoGLRenderAction::DELAYED_BLEND,
65 SORTED_OBJECT_BLEND = SoGLRenderAction::SORTED_OBJECT_BLEND,
66 NUM_TRANSPARENCY_TYPES
76 static const char *ImageTypeStrings[NUM_IMAGE_TYPES];
79 static const char *TransparencyTypeStrings[NUM_TRANSPARENCY_TYPES];
82 static const char *BufferTypeStrings[NUM_BUFFER_TYPES];
148 SoRef<SoOffscreenViewerProxyNode>
_root;
#define MLOFFSCREENRENDER_EXPORT
Defines macro needed for Windows (export of classes from this DLL)
SoOffscreenViewerProxyNode will put a SoViewerElement with the given SoOffscreenViewerProxy into the ...
This class implements access to the state of the SoOffscreenRenderer viewer.
OpenInventor Scenes can be rendered to the OffscreenRender who outputs an MLImage.
int _mode
The mode of the pBuffer.
SoRef< SoOffscreenViewerProxyNode > _root
SoSeparator node to use as root of the scene, so that the render state is reset after each rendering.
SoGLTexture * _colorTextureBuffer
Pointer to the color buffer.
NotifyField * _updateFld
Triggers update.
ImageType
Macro for declaring methods for the runtime system, defined in mlRuntimeSubClass.h.
OffscreenRenderer(ImageType imgType=IMG_RGB, const Vector2 &size=Vector2(64., 64.), int numInputImages=0, int numOutputImages=1)
Constructor.
void _setMode()
Sets the mode of the pixel buffer according to _curImgType.
bool _createFBO(const SbVec2s &)
Creates the FBO.
bool _pBufferSupportsNonPowerOfTwoDimensions
EnumField * _transparencyTypeFld
Specifies the image type of the output image.
EnumField * _imageTypeFld
Specifies the image type of the output image.
SoGLFramebufferObject * _msaaFbo
SoOffscreenViewerProxy * _offscreenProxy
Proxy node that can be queried during traversal.
unsigned char * _memImage
Pointer to memory allocated to hold the content of the offscreen buffer.
bool _render(bool &hasSceneAndUpdatedBuffer)
Calls _renderToOutImage().
bool _fboSupportsNonPowerOfTwoDimensions
void calculateOutputSubImage(SubImage *outSubImg, int outIndex, SubImage *inSubImgs) override
Called when a page is calculated.
void calculateOutputImageProperties(int outputIndex, PagedImage *outputImage) override
Determine properties of output image.
SoGLRenderbuffer * _msaaColorBuffer
BoolField * _createStencilBufferFld
Specifies whether to create a stencil buffer.
ColorField * _bgColorFld
Background color.
~OffscreenRenderer() override
Destructor:
unsigned int _memImgBytes
Number of bytes of the _memImage.
BoolField * _supportedFld
Field variables.
bool _createOffscreenBuffer()
void * takeMemoryImage()
Returns the current memory image and creates a new one. The ownership is passed to the caller.
bool _bufferUpToDate
Member variables.
SoGLRenderbuffer * _depthRenderBuffer
Pointer to the depth buffer.
void _deactivateOffscreenBuffer()
bool _frameBufferCompletionTested
Flag that indicates that the current color/depth/stencil buffer configuration has been checked and wo...
void handleNotification(Field *) override
Called when input changes.
bool _renderToOutImage(bool &hasSceneAndUpdatedBuffer)
Render the scene and write it to a main memory buffer. Returns true on success, false otherwise.
bool _createPBuffer(const SbVec2s &)
Creates the pixel buffer.
SoNodeField * _sceneGraphFld
Root node of scene graph to be rendered offscreen.
void activateAttachments() override
Initialize buffer type.
SoPBuffer * _pBuffer
The pBuffer object.
SoGLFramebufferObject * _fbo
The frame buffer object, is used instead of the pBuffer if available.
GLuint _depthComponent
The depth component actually used. May differ from requested, cause gfx card does not support it.
EnumField * _bufferTypeFld
Specifies the buffer type.
void _resetOffscreenBuffer()
IntField * _multiSampling
Sets number of samples.
Vector2Field * _sizeFld
Size of the output image.
bool _activateOffscreenBuffer()
BoolField * _enableMultiSampling
Enables multi sampling.
ImageType _curImgType
The image type of the pBuffer. This is not necessarily identical to the value of _imageTypeFld!
SoGLRenderAction * _glRenderAction
The GL render action needed to traverse the scene attached to this module.
FloatField * _pixelScaleFld
Scale factor for pixel size.