OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ViewDependentShadowTechnique.h
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 <osgShadow/ShadowTechnique>
21 #include <map>
22 #include <osgShadow/Export>
23 
24 namespace osgShadow {
31 #define META_ViewDependentShadowTechniqueData( ShadowTechnique, TechniqueData )\
32 virtual ViewDependentShadowTechnique::ViewData * initViewDependentData \
33 ( osgUtil::CullVisitor *cv, ViewDependentShadowTechnique::ViewData * vd ) \
34 { \
35  TechniqueData* td = dynamic_cast<TechniqueData*>( vd ); \
36  if ( !td ) td = new TechniqueData; \
37  td->init( this, cv ); \
38  return td; \
39 }
40 
106 {
107  public:
114 
117  const ViewDependentShadowTechnique& vdst,
118  const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY );
119 
120 
123 
125  virtual void dirty();
126 
128  virtual void init();
129 
131  virtual void update(osg::NodeVisitor& nv);
132 
134  virtual void cull(osgUtil::CullVisitor& cv);
135 
137  virtual void cleanSceneGraph();
138 
140  virtual void traverse(osg::NodeVisitor& nv);
141 
142  protected:
145 
152  {
153  virtual const char* className() const { return "ViewData"; }
154 
158  virtual void init
160 
165  virtual void cull();
166 
171  virtual void dirty( bool flag );
172 
176  ViewData(): _dirty( true ), _cv( NULL ), _st( NULL ) { };
177 
182  OpenThreads::Mutex _mutex;
183 
187  bool _dirty;
188 
193 
198 
199  };
200 
206  typedef std::map< osg::ref_ptr< osgUtil::CullVisitor >,
208 
209  ViewDataMap _viewDataMap;
210 
211 
216 
218  virtual ViewDependentShadowTechnique::ViewData * getViewDependentData( osgUtil::CullVisitor * cv );
219 
221  virtual void setViewDependentData( osgUtil::CullVisitor * cv, ViewDependentShadowTechnique::ViewData * data );
222 
227 };
228 
229 
230 } // namespace osgShadow
231 
232 #endif
#define NULL
Definition: Export.h:59
This class provides an object-oriented thread mutex interface.
Definition: Mutex.h:31
#define META_ViewDependentShadowTechniqueData(ShadowTechnique, TechniqueData)
std::map< osg::ref_ptr< osgUtil::CullVisitor >, osg::ref_ptr< ViewData > > ViewDataMap
#define OSGSHADOW_EXPORT
Definition: Export.h:39
#define META_Object(library, name)
Definition: Object.h:42
osg::observer_ptr< ViewDependentShadowTechnique > _st