OpenWalnut
1.5.0dev
|
This type of node basically is a convenience class for managing and creating offscreen renderings. More...
#include <WGEOffscreenRenderNode.h>
Public Types | |
typedef osg::ref_ptr< WGEOffscreenRenderNode > | RefPtr |
Convenience typedef for an osg::ref_ptr. More... | |
typedef osg::ref_ptr< const WGEOffscreenRenderNode > | ConstRefPtr |
Convenience typedef for an osg::ref_ptr; const. More... | |
Public Types inherited from WGEGroupNode | |
typedef WPredicateHelper::ArbitraryPredicateBase< osg::ref_ptr< osg::Node > const > | NodePredicate |
The base type of predicate. More... | |
Public Member Functions | |
WGEOffscreenRenderNode (osg::ref_ptr< WGECamera > reference, size_t width=2048, size_t height=2048, bool noHud=false) | |
Create a new managing instance. More... | |
virtual | ~WGEOffscreenRenderNode () |
Destructor. More... | |
osg::ref_ptr< WGETextureHud > | getTextureHUD () const |
Returns the instance of the texture HUD. More... | |
virtual osg::ref_ptr< WGEOffscreenRenderPass > | addGeometryRenderPass (osg::ref_ptr< osg::Node > node, std::string name="Unnamed") |
Creates a new offscreen-render-pass coupled with the reference camera which renders a specified OSG graph to a texture. More... | |
virtual osg::ref_ptr< WGEOffscreenRenderPass > | addGeometryRenderPass (osg::ref_ptr< osg::Node > node, osg::ref_ptr< WGEShader > shader, std::string name="Unnamed") |
Creates a new offscreen-render-pass coupled with the reference camera which renders a specified OSG graph to a texture. More... | |
virtual osg::ref_ptr< WGEOffscreenTexturePass > | addTextureProcessingPass (std::string name="Unnamed") |
Creates a new offscreen-render-pass coupled with the reference camera which simply processes textures. More... | |
virtual osg::ref_ptr< WGEOffscreenTexturePass > | addTextureProcessingPass (osg::ref_ptr< WGEShader > shader, std::string name="Unnamed") |
Creates a new offscreen-render-pass coupled with the reference camera which simply processes textures. More... | |
virtual osg::ref_ptr< WGEOffscreenFinalPass > | addFinalOnScreenPass (std::string name="Unnamed") |
Creates a new render pass which can be seen as put-textures-back-on-screen-pass. More... | |
virtual osg::ref_ptr< WGEOffscreenFinalPass > | addFinalOnScreenPass (osg::ref_ptr< WGEShader > shader, std::string name="Unnamed") |
Creates a new render pass which can be seen as put-textures-back-on-screen-pass. More... | |
template<typename T > | |
osg::ref_ptr< T > | addRenderPass (std::string name="Unnamed") |
Creates a new offscreen-render-pass coupled with the reference camera. More... | |
size_t | getTextureWidth () const |
Get FBO texture width. More... | |
size_t | getTextureHeight () const |
Get FBO texture height. More... | |
void | setLinkViewportToTextureSize (bool vp=true) |
If true, the viewport has the size of the resulting texture. More... | |
bool | getLinkViewportToTextureSize () const |
The flag denotes whether the viewport is linked to the texture size or the reference camera. More... | |
Public Member Functions inherited from WGEGroupNode | |
WGEGroupNode () | |
Default constructor. More... | |
void | insert (osg::ref_ptr< osg::Node > node) |
Adds the specified node to the child list of this node in a safe manner. More... | |
void | remove (osg::ref_ptr< osg::Node > node) |
Removes the specified node from this group in a thread safe manner. More... | |
void | remove_if (std::shared_ptr< WGEGroupNode::NodePredicate > predicate) |
Removes a node if the specified predicate evaluates to true. More... | |
void | clear () |
Removes all children from this node. More... | |
Private Attributes | |
osg::ref_ptr< WGECamera > | m_referenceCamera |
The camera to which is used for setting this camera up. More... | |
osg::ref_ptr< WGETextureHud > | m_hud |
The pointer to the hud used to render all used texture buffers. More... | |
size_t | m_textureWidth |
The width of each texture in this offscreen rendering. More... | |
size_t | m_textureHeight |
The height of each texture in this offscreen rendering. More... | |
size_t | m_nextPassNum |
The number of the next pass getting added. More... | |
bool | m_forceViewportTextureSize |
Flag denotes whether the viewport is coupled to the reference camera or the texture size. More... | |
Additional Inherited Members | |
Protected Types inherited from WGEGroupNode | |
enum | ChildOperationType { INSERT = 0 , REMOVE , REMOVE_IF , CLEAR } |
The type of operation to perform. More... | |
Protected Member Functions inherited from WGEGroupNode | |
virtual | ~WGEGroupNode () |
Destructor. More... | |
Protected Attributes inherited from WGEGroupNode | |
osg::ref_ptr< SafeUpdaterCallback > | m_nodeUpdater |
Node callback used to update this root node. More... | |
std::queue< std::shared_ptr< ChildOperation > > | m_childOperationQueue |
Queue of childs that need to be added/removed during the next update cycle. More... | |
std::shared_mutex | m_childOperationQueueLock |
Lock used for inserting and removing childs into the child insertion/removal queue. More... | |
bool | m_childOperationQueueDirty |
Flag denoting whether the m_childOperationQueue should be considered during the next update of the node. More... | |
bool | m_removeAll |
True whenever all child nodes should be removed. More... | |
This type of node basically is a convenience class for managing and creating offscreen renderings.
The children of this node should be of type WGEOffscreenRenderPass. This class provides factories to create offscreen-render-pass instances with proper sizes with a coupling to a reference camera. This is useful to provide automatic viewport scaling etc. to each render-pass. You do not explicitly need this class to create offscreen-renderings at all. You can manually manage multiple WGEOffscreenRenderPass instances.
It is important to understand, that the graph (your scene) must not be a children of this node. This node can be placed somewhere in your scene. The OSG collects all the cameras (and offscreen-cameras) and render then independently from their position in the graph (except for transformations inherited from others).
Definition at line 55 of file WGEOffscreenRenderNode.h.
typedef osg::ref_ptr< const WGEOffscreenRenderNode > WGEOffscreenRenderNode::ConstRefPtr |
Convenience typedef for an osg::ref_ptr; const.
Definition at line 66 of file WGEOffscreenRenderNode.h.
typedef osg::ref_ptr< WGEOffscreenRenderNode > WGEOffscreenRenderNode::RefPtr |
Convenience typedef for an osg::ref_ptr.
Definition at line 61 of file WGEOffscreenRenderNode.h.
WGEOffscreenRenderNode::WGEOffscreenRenderNode | ( | osg::ref_ptr< WGECamera > | reference, |
size_t | width = 2048 , |
||
size_t | height = 2048 , |
||
bool | noHud = false |
||
) |
Create a new managing instance.
It uses the specified camera as reference to all created offscreen-render-pass instances. Especially viewport, clear-mask and clear-color get used. The default texture resolution is 2048x2048 which is more than full-HD resolution. So it should be enough.
reference | camera used as reference |
width | the width of the textures used in this rendering. Must be in [8,4096] and a power of two. |
height | the height of the textures used in this rendering. Must be in [8,4096] and a power of two. |
noHud | If true, no hud gets displayed showing the created and used textures. |
Definition at line 44 of file WGEOffscreenRenderNode.cpp.
References WGEGroupNode::insert(), m_hud, and m_referenceCamera.
|
virtual |
Destructor.
Definition at line 65 of file WGEOffscreenRenderNode.cpp.
|
virtual |
Creates a new render pass which can be seen as put-textures-back-on-screen-pass.
It renders a full-screen quad to the on-screen frame-buffer. An optional shader can be used for final processing (most commonly clipping, blending, color-mapping and so on).
shader | the shader to add |
name | the name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud. |
Definition at line 125 of file WGEOffscreenRenderNode.cpp.
|
virtual |
Creates a new render pass which can be seen as put-textures-back-on-screen-pass.
It renders a full-screen quad to the on-screen frame-buffer. An optional shader can be used for final processing (most commonly clipping, blending, color-mapping and so on).
name | the name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud. |
Definition at line 119 of file WGEOffscreenRenderNode.cpp.
|
virtual |
Creates a new offscreen-render-pass coupled with the reference camera which renders a specified OSG graph to a texture.
node | the node which represents the subgraph. |
name | the name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud. |
shader | the shader to add. |
Definition at line 87 of file WGEOffscreenRenderNode.cpp.
|
virtual |
Creates a new offscreen-render-pass coupled with the reference camera which renders a specified OSG graph to a texture.
node | the node which represents the subgraph. |
name | the name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud. |
Definition at line 70 of file WGEOffscreenRenderNode.cpp.
References wge::generateDynamicCullProxy(), and WGEGroupNode::insert().
osg::ref_ptr< T > WGEOffscreenRenderNode::addRenderPass | ( | std::string | name = "Unnamed" | ) |
Creates a new offscreen-render-pass coupled with the reference camera.
This pass actually does nothing. The method is useful for custom variants of WGEOffscreenRenderPass.
name | the name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud. |
T | the type of pass to create. |
Definition at line 246 of file WGEOffscreenRenderNode.h.
References WGEGroupNode::insert(), m_forceViewportTextureSize, m_hud, m_nextPassNum, m_referenceCamera, m_textureHeight, and m_textureWidth.
|
virtual |
Creates a new offscreen-render-pass coupled with the reference camera which simply processes textures.
All the in- and output textures have to be specified manually.
name | the name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud. |
shader | the shader to add. |
Definition at line 112 of file WGEOffscreenRenderNode.cpp.
|
virtual |
Creates a new offscreen-render-pass coupled with the reference camera which simply processes textures.
All the in- and output textures have to be specified manually.
name | the name of the render pass. You should specify it to enable the nice debugging feature of WGETextureHud. |
Definition at line 106 of file WGEOffscreenRenderNode.cpp.
bool WGEOffscreenRenderNode::getLinkViewportToTextureSize | ( | ) | const |
The flag denotes whether the viewport is linked to the texture size or the reference camera.
See setLinkViewportToTextureSize for details.
Definition at line 152 of file WGEOffscreenRenderNode.cpp.
References m_forceViewportTextureSize.
size_t WGEOffscreenRenderNode::getTextureHeight | ( | ) | const |
Get FBO texture height.
Definition at line 142 of file WGEOffscreenRenderNode.cpp.
References m_textureHeight.
osg::ref_ptr< WGETextureHud > WGEOffscreenRenderNode::getTextureHUD | ( | ) | const |
Returns the instance of the texture HUD.
Definition at line 132 of file WGEOffscreenRenderNode.cpp.
References m_hud.
size_t WGEOffscreenRenderNode::getTextureWidth | ( | ) | const |
Get FBO texture width.
Definition at line 137 of file WGEOffscreenRenderNode.cpp.
References m_textureWidth.
void WGEOffscreenRenderNode::setLinkViewportToTextureSize | ( | bool | vp = true | ) |
If true, the viewport has the size of the resulting texture.
This is very interesting if you want to force large scale renderings and want to decouple your offscreen pass from the reference camera viewport.
vp | if true, viewport is forced to be the whole texture size |
Definition at line 147 of file WGEOffscreenRenderNode.cpp.
References m_forceViewportTextureSize.
|
private |
Flag denotes whether the viewport is coupled to the reference camera or the texture size.
Definition at line 242 of file WGEOffscreenRenderNode.h.
Referenced by addRenderPass(), getLinkViewportToTextureSize(), and setLinkViewportToTextureSize().
|
private |
The pointer to the hud used to render all used texture buffers.
This can be NULL. It gets distributed to all created render-pass instances.
Definition at line 222 of file WGEOffscreenRenderNode.h.
Referenced by addRenderPass(), getTextureHUD(), and WGEOffscreenRenderNode().
|
private |
The number of the next pass getting added.
Definition at line 237 of file WGEOffscreenRenderNode.h.
Referenced by addRenderPass().
|
private |
The camera to which is used for setting this camera up.
Definition at line 216 of file WGEOffscreenRenderNode.h.
Referenced by addRenderPass(), and WGEOffscreenRenderNode().
|
private |
The height of each texture in this offscreen rendering.
Definition at line 232 of file WGEOffscreenRenderNode.h.
Referenced by addRenderPass(), and getTextureHeight().
|
private |
The width of each texture in this offscreen rendering.
Definition at line 227 of file WGEOffscreenRenderNode.h.
Referenced by addRenderPass(), and getTextureWidth().