OpenSceneGraph 3.6.5
OverlayNode
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGSIM_OVERLAYNODE
15#define OSGSIM_OVERLAYNODE 1
16
17#include <osg/buffered_value>
18#include <osg/Camera>
19#include <osg/Texture2D>
20#include <osg/TexGenNode>
21#include <osg/Geode>
22
23#include <osgUtil/CullVisitor>
24
25#include <osgSim/Export>
26
27namespace osgSim {
28
32{
33 public :
34
41
43
45
47
48 virtual void traverse(osg::NodeVisitor& nv);
49
50
53
56
59
60 template<class T> void setOverlaySubgraph(const osg::ref_ptr<T>& node) { setOverlaySubgraph(node.get()); }
61
64
66 const osg::Node* getOverlaySubgraph() const { return _overlaySubgraph.get(); }
67
68
71
73 void setContinuousUpdate(bool update) { _continuousUpdate = update; }
74
76 bool getContinuousUpdate() const { return _continuousUpdate; }
77
83 void setOverlayBaseHeight(double baseHeight) { _overlayBaseHeight = baseHeight; }
84
86 double getOverlayBaseHeight() const { return _overlayBaseHeight; }
87
89 void setOverlayClearColor(const osg::Vec4& color) { _overlayClearColor = color; }
90
93
95 void setTexEnvMode(GLenum mode);
96
98 GLenum getTexEnvMode() const { return _texEnvMode; }
99
101 void setOverlayTextureUnit(unsigned int unit);
102
104 unsigned int getOverlayTextureUnit() const { return _textureUnit; }
105
107 void setOverlayTextureSizeHint(unsigned int size);
108
110 unsigned int getOverlayTextureSizeHint() const { return _textureSizeHint; }
111
112
114 virtual void setThreadSafeRefUnref(bool threadSafe);
115
117 virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/);
118
122 virtual void releaseGLObjects(osg::State* = 0) const;
123
124 protected :
125
126 virtual ~OverlayNode() {}
127
128 void init();
132
136
137
139
141
143
145
146
147 // overlay subgraph is render to a texture
149
152
153 // texture to render to, and to read from.
155 unsigned int _textureUnit;
156 unsigned int _textureSizeHint;
158
162
164
185
186 typedef std::map<osgUtil::CullVisitor*, osg::ref_ptr<OverlayData> > OverlayDataMap;
187
188 OpenThreads::Mutex _overlayDataMapMutex;
190
192
193};
194
195}
196
197#endif
Vec4f Vec4
Definition Vec4:21
The osgSim library is a NodeKit that extends the core scene graph to support nodes and drawables that...
Definition BlinkSequence:27
RenderTargetImplementation
Definition Camera:290
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
General group node which maintains a list of children.
Definition Group:29
Base class for all internal nodes in the scene graph.
Definition Node:72
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
A Polytope class for representing convex clipping volumes made up of a set of planes.
Definition Polytope:26
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
Base class for providing reference counted objects.
Definition Referenced:44
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
osg::Vec4 _overlayClearColor
Definition OverlayNode:157
osg::Camera::RenderTargetImplementation _renderTargetImpl
Definition OverlayNode:163
void traverse_OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeVisitor &nv)
void setOverlayBaseHeight(double baseHeight)
Set the base height that the overlay subgraph will be projected down to.
Definition OverlayNode:83
OverlayDataMap _overlayDataMap
Definition OverlayNode:189
void init_VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY()
void init_VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY()
void setContinuousUpdate(bool update)
Set whether the OverlayNode should update the overlay texture on every frame.
Definition OverlayNode:73
void setOverlaySubgraph(osg::Node *node)
Set the overlay subgraph which will be rendered to texture.
OverlayNode(const OverlayNode &es, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
GLenum _texEnvMode
Definition OverlayNode:154
void setOverlayTextureUnit(unsigned int unit)
Set the texture unit that the texture should be assigned to.
virtual void releaseGLObjects(osg::State *=0) const
If State is non-zero, this function releases any associated OpenGL objects for the specified graphics...
void setOverlayClearColor(const osg::Vec4 &color)
Set the clear color to use when rendering the overlay subgraph.
Definition OverlayNode:89
void traverse_VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY(osg::NodeVisitor &nv)
void setTexEnvMode(GLenum mode)
Set the TexEnv mode used to combine the overlay texture with the base color/texture of the OverlayNod...
double _overlayBaseHeight
Definition OverlayNode:160
osg::Node * getOverlaySubgraph()
Get the overlay subgraph which will be rendered to texture.
Definition OverlayNode:63
void setOverlayTechnique(OverlayTechnique technique)
OverlayNode::OverlayData * getOverlayData(osgUtil::CullVisitor *cv)
void dirtyOverlayTexture()
Inform the OverlayNode that the overlay texture needs to be updated.
void setOverlaySubgraph(const osg::ref_ptr< T > &node)
Definition OverlayNode:60
GLenum getTexEnvMode() const
Get the TexEnv mode used to combine the overlay texture with the base color/texture of the OverlayNod...
Definition OverlayNode:98
const osg::Vec4 & getOverlayClearColor() const
Get the clear color to use when rendering the overlay subgraph.
Definition OverlayNode:92
bool getContinuousUpdate() const
Get whether the OverlayNode should update the overlay texture on every frame.
Definition OverlayNode:76
void setOverlayTextureSizeHint(unsigned int size)
Set the texture size hint.
unsigned int getOverlayTextureSizeHint() const
Get the texture size hint.
Definition OverlayNode:110
bool _updateCamera
Definition OverlayNode:161
META_Node(osgSim, OverlayNode)
void traverse_VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeVisitor &nv)
osg::buffered_value< int > TextureObjectValidList
Definition OverlayNode:140
osg::ref_ptr< osg::Node > _overlaySubgraph
Definition OverlayNode:148
OverlayTechnique _overlayTechnique
Definition OverlayNode:144
void init_OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY()
OpenThreads::Mutex _overlayDataMapMutex
Definition OverlayNode:188
virtual void traverse(osg::NodeVisitor &nv)
Traverse downwards : calls children's accept method with NodeVisitor.
bool _continuousUpdate
Definition OverlayNode:159
unsigned int _textureUnit
Definition OverlayNode:155
unsigned int _textureSizeHint
Definition OverlayNode:156
osg::ref_ptr< osg::StateSet > _mainStateSet
Definition OverlayNode:151
void setRenderTargetImplementation(osg::Camera::RenderTargetImplementation impl)
Set the implementation to be used when creating the overlay texture.
const osg::Node * getOverlaySubgraph() const
Get the const overlay subgraph which will be render to texture.
Definition OverlayNode:66
osg::ref_ptr< osg::StateSet > _overlayStateSet
Definition OverlayNode:150
double getOverlayBaseHeight() const
Get the base height that the overlay subgraph will be projected down to.
Definition OverlayNode:86
OverlayTechnique getOverlayTechnique() const
Definition OverlayNode:52
TextureObjectValidList _textureObjectValidList
Definition OverlayNode:142
virtual void resizeGLObjectBuffers(unsigned int)
Resize any per context GLObject buffers to specified size.
OverlayTechnique
Definition OverlayNode:36
@ OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY
Definition OverlayNode:37
@ VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY
Definition OverlayNode:38
@ VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY
Definition OverlayNode:39
virtual ~OverlayNode()
Definition OverlayNode:126
unsigned int getOverlayTextureUnit() const
Get the texture unit that the texture should be assigned to.
Definition OverlayNode:104
std::map< osgUtil::CullVisitor *, osg::ref_ptr< OverlayData > > OverlayDataMap
Definition OverlayNode:186
void updateMainSubgraphStateSet()
OverlayNode(OverlayTechnique technique=OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY)
virtual void setThreadSafeRefUnref(bool threadSafe)
Set whether to use a mutex to ensure ref() and unref() are thread safe.
Definition OverlayNode:166
osg::ref_ptr< osg::StateSet > _mainSubgraphStateSet
Definition OverlayNode:174
void setThreadSafeRefUnref(bool threadSafe)
Deprecated, Referenced is always theadsafe so there method now has no effect and does not need to be ...
void releaseGLObjects(osg::State *state=0) const
void resizeGLObjectBuffers(unsigned int maxSize)
osg::ref_ptr< osg::Uniform > _y0
Definition OverlayNode:182
osg::ref_ptr< osg::Uniform > _lightingEnabled
Definition OverlayNode:183
osg::ref_ptr< osg::Geode > _geode
Definition OverlayNode:178
osg::ref_ptr< osg::TexGenNode > _texgenNode
Definition OverlayNode:175
osg::ref_ptr< osg::StateSet > _overlayStateSet
Definition OverlayNode:173
osg::ref_ptr< osg::Texture2D > _texture
Definition OverlayNode:176
osg::ref_ptr< osg::Camera > _camera
Definition OverlayNode:172
osg::ref_ptr< osg::Program > _mainSubgraphProgram
Definition OverlayNode:180
osg::Polytope _textureFrustum
Definition OverlayNode:177
Basic NodeVisitor implementation for rendering a scene.
Definition CullVisitor:49
#define OSGSIM_EXPORT
Definition Export:38

osg logo
Generated at Sun Jul 20 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.