OpenSceneGraph 3.6.5
ViewDependentShadowTechnique
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 * ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski
14 * Thanks to to my company http://www.ai.com.pl for allowing me free this work.
15*/
16
17#ifndef OSGSHADOW_VIEWDEPENDENTSHADOWTECHINIQUE
18#define OSGSHADOW_VIEWDEPENDENTSHADOWTECHINIQUE 1
19
20#include <osg/Identifier>
22#include <osgShadow/Export>
23#include <map>
24
25namespace osgShadow {
32#define META_ViewDependentShadowTechniqueData( ShadowTechnique, TechniqueData )\
33virtual ViewDependentShadowTechnique::ViewData * initViewDependentData \
34( osgUtil::CullVisitor *cv, ViewDependentShadowTechnique::ViewData * vd ) \
35{ \
36 TechniqueData* td = dynamic_cast<TechniqueData*>( vd ); \
37 if ( !td ) td = new TechniqueData; \
38 td->init( this, cv ); \
39 return td; \
40}
41
107{
108 public:
112
115
120
121
124
126 virtual void dirty();
127
129 virtual void init();
130
132 virtual void update(osg::NodeVisitor& nv);
133
135 virtual void cull(osgUtil::CullVisitor& cv);
136
138 virtual void cleanSceneGraph();
139
141 virtual void traverse(osg::NodeVisitor& nv);
142
143
145 virtual void resizeGLObjectBuffers(unsigned int maxSize);
146
150 virtual void releaseGLObjects(osg::State* = 0) const;
151
152protected:
155
162 {
163 virtual const char* className() const { return "ViewData"; }
164
168 virtual void init
170
175 virtual void cull();
176
181 virtual void dirty( bool flag );
182
186 ViewData(): _dirty( true ), _cv( NULL ), _st( NULL ) { };
187
192 OpenThreads::Mutex _mutex;
193
197 bool _dirty;
198
203
208
209 virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {}
210
214 virtual void releaseGLObjects(osg::State* = 0) const {}
215 };
216
221
222 typedef std::map< osg::ref_ptr< osg::Identifier >,
224
226
227
231 OpenThreads::Mutex _viewDataMapMutex;
232
235
238
243};
244
245
246} // namespace osgShadow
247
248#endif
#define META_ViewDependentShadowTechniqueData(ShadowTechnique, TechniqueData)
META_ViewDependentShadowTechniqueData macro defines initViewDependentData method used by derived shad...
Definition ViewDependentShadowTechnique:32
The osgShadow library is a NodeKit that extends the core scene graph to add support for a range of sh...
Definition ConvexPolyhedron:33
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
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Base class for providing reference counted objects.
Definition Referenced:44
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
ShadowTechnique is the base class for different shadow implementations.
Definition ShadowTechnique:32
virtual void update(osg::NodeVisitor &nv)
Run the update traversal of the ShadowedScene and update any local cached data structures.
ViewDependentShadowTechnique(void)
osgShadow::ShadowTechnique equivalent methods for view dependent techniques
~ViewDependentShadowTechnique(void)
Classic protected OSG destructor.
virtual void cull(osgUtil::CullVisitor &cv)
Run the cull traversal of the ShadowedScene and set up the rendering for this ShadowTechnique.
virtual void init()
Initialize the ShadowedScene and some data structures.
ViewDataMap _viewDataMap
Definition ViewDependentShadowTechnique:225
std::map< osg::ref_ptr< osg::Identifier >, osg::ref_ptr< ViewData > > ViewDataMap
Map of view dependent data per view cull visitor (CVs are used as indices) ViewDependentShadowTechniq...
Definition ViewDependentShadowTechnique:223
OpenThreads::Mutex _viewDataMapMutex
Mutex used to serialize accesses to ViewDataMap.
Definition ViewDependentShadowTechnique:231
virtual void dirty()
Dirty view data bits and force update of view data resources.
virtual void setViewDependentData(osgUtil::CullVisitor *cv, ViewDependentShadowTechnique::ViewData *data)
Define view dependent data for the cull visitor.
ViewDependentShadowTechnique(const ViewDependentShadowTechnique &vdst, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Classic OSG cloning constructor.
virtual void traverse(osg::NodeVisitor &nv)
Traverse shadow scene graph.
virtual void cleanSceneGraph()
Clean scene graph from any shadow technique specific nodes, state and drawables.
virtual ViewDependentShadowTechnique::ViewData * getViewDependentData(osgUtil::CullVisitor *cv)
Return view dependent data for the cull visitor.
META_Object(osgShadow, ViewDependentShadowTechnique)
Declaration of standard OSG object methods.
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
virtual void releaseGLObjects(osg::State *=0) const
If State is non-zero, this function releases any associated OpenGL objects for the specified graphics...
Base container class for view dependent shadow resources.
Definition ViewDependentShadowTechnique:162
virtual void cull()
Method called by ViewDependentShadowTechnique to allow ViewData do the hard work computing shadows fo...
virtual void dirty(bool flag)
Dirty is called by parent ViewDependentShadowTechnique to force update of resources after some of the...
virtual void resizeGLObjectBuffers(unsigned int)
Definition ViewDependentShadowTechnique:209
bool _dirty
Dirty flag tells this instance to update its resources.
Definition ViewDependentShadowTechnique:197
virtual void releaseGLObjects(osg::State *=0) const
If State is non-zero, this function releases any associated OpenGL objects for the specified graphics...
Definition ViewDependentShadowTechnique:214
ViewData()
Simple constructor zeroing all variables.
Definition ViewDependentShadowTechnique:186
OpenThreads::Mutex _mutex
Mutex used to guard _dirty flag from override in case when parent technique calls dirty() simultaneou...
Definition ViewDependentShadowTechnique:192
virtual const char * className() const
Definition ViewDependentShadowTechnique:163
virtual void init(ViewDependentShadowTechnique *st, osgUtil::CullVisitor *cv)
Method called upon ViewData instance to initialize internal variables.
osg::observer_ptr< osgUtil::CullVisitor > _cv
View's CullVisitor associated with this ViewData instance.
Definition ViewDependentShadowTechnique:202
osg::observer_ptr< ViewDependentShadowTechnique > _st
Parent ViewDependentShadowTechnique.
Definition ViewDependentShadowTechnique:207
Basic NodeVisitor implementation for rendering a scene.
Definition CullVisitor:49
#define NULL
Definition Export:55
#define OSGSHADOW_EXPORT
Definition Export:39

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.