ViewDependentShadowTechnique
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*
* ViewDependentShadow codes Copyright (C) 2008 Wojciech Lewandowski
* Thanks to to my company http://www.ai.com.pl for allowing me free this work.
*/
#ifndef OSGSHADOW_VIEWDEPENDENTSHADOWTECHINIQUE
#define OSGSHADOW_VIEWDEPENDENTSHADOWTECHINIQUE 1
#include <osg/Identifier>
#include <osgShadow/ShadowTechnique>
#include <osgShadow/Export>
#include <map>
namespace osgShadow {
#define META_ViewDependentShadowTechniqueData( ShadowTechnique, TechniqueData )\
virtual ViewDependentShadowTechnique::ViewData * initViewDependentData \
( osgUtil::CullVisitor *cv, ViewDependentShadowTechnique::ViewData * vd ) \
{ \
TechniqueData* td = dynamic_cast<TechniqueData*>( vd ); \
if ( !td ) td = new TechniqueData; \
td->init( this, cv ); \
return td; \
}
class OSGSHADOW_EXPORT ViewDependentShadowTechnique
: public osgShadow::ShadowTechnique
{
public:
ViewDependentShadowTechnique( void );
ViewDependentShadowTechnique(
const ViewDependentShadowTechnique& vdst,
const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY );
META_Object( osgShadow, ViewDependentShadowTechnique );
virtual void dirty();
virtual void init();
virtual void update(osg::NodeVisitor& nv);
virtual void cull(osgUtil::CullVisitor& cv);
virtual void cleanSceneGraph();
virtual void traverse(osg::NodeVisitor& nv);
virtual void resizeGLObjectBuffers(unsigned int maxSize);
virtual void releaseGLObjects(osg::State* = 0) const;
protected:
~ViewDependentShadowTechnique( void );
struct OSGSHADOW_EXPORT ViewData: public osg::Referenced
{
virtual const char* className() const { return "ViewData"; }
virtual void init
( ViewDependentShadowTechnique *st, osgUtil::CullVisitor *cv );
virtual void cull();
virtual void dirty( bool flag );
ViewData(): _dirty( true ), _cv( NULL ), _st( NULL ) { };
OpenThreads::Mutex _mutex;
bool _dirty;
osg::observer_ptr< osgUtil::CullVisitor > _cv;
osg::observer_ptr< ViewDependentShadowTechnique > _st;
virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {}
virtual void releaseGLObjects(osg::State* = 0) const {}
};
typedef std::map< osg::ref_ptr< osg::Identifier >,
osg::ref_ptr< ViewData > > ViewDataMap;
ViewDataMap _viewDataMap;
OpenThreads::Mutex _viewDataMapMutex;
virtual ViewDependentShadowTechnique::ViewData * getViewDependentData( osgUtil::CullVisitor * cv );
virtual void setViewDependentData( osgUtil::CullVisitor * cv, ViewDependentShadowTechnique::ViewData * data );
META_ViewDependentShadowTechniqueData( ViewDependentShadowTechnique, ViewData )
};
} // namespace osgShadow
#endif
Identifier
ShadowTechnique
META_ViewDependentShadowTechniqueData
#define META_ViewDependentShadowTechniqueData(ShadowTechnique, TechniqueData)
Definition ViewDependentShadowTechnique:32
OpenThreads::Mutex
This class provides an object-oriented thread mutex interface.
Definition Mutex:31
osgShadow::ShadowTechnique
Definition ShadowTechnique:32
osgShadow::ViewDependentShadowTechnique::update
virtual void update(osg::NodeVisitor &nv)
osgShadow::ViewDependentShadowTechnique::ViewDependentShadowTechnique
ViewDependentShadowTechnique(void)
osgShadow::ViewDependentShadowTechnique::~ViewDependentShadowTechnique
~ViewDependentShadowTechnique(void)
osgShadow::ViewDependentShadowTechnique::cull
virtual void cull(osgUtil::CullVisitor &cv)
osgShadow::ViewDependentShadowTechnique::init
virtual void init()
osgShadow::ViewDependentShadowTechnique::_viewDataMap
ViewDataMap _viewDataMap
Definition ViewDependentShadowTechnique:225
osgShadow::ViewDependentShadowTechnique::ViewDataMap
std::map< osg::ref_ptr< osg::Identifier >, osg::ref_ptr< ViewData > > ViewDataMap
Definition ViewDependentShadowTechnique:223
osgShadow::ViewDependentShadowTechnique::_viewDataMapMutex
OpenThreads::Mutex _viewDataMapMutex
Definition ViewDependentShadowTechnique:231
osgShadow::ViewDependentShadowTechnique::dirty
virtual void dirty()
osgShadow::ViewDependentShadowTechnique::setViewDependentData
virtual void setViewDependentData(osgUtil::CullVisitor *cv, ViewDependentShadowTechnique::ViewData *data)
osgShadow::ViewDependentShadowTechnique::ViewDependentShadowTechnique
ViewDependentShadowTechnique(const ViewDependentShadowTechnique &vdst, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgShadow::ViewDependentShadowTechnique::traverse
virtual void traverse(osg::NodeVisitor &nv)
osgShadow::ViewDependentShadowTechnique::cleanSceneGraph
virtual void cleanSceneGraph()
osgShadow::ViewDependentShadowTechnique::getViewDependentData
virtual ViewDependentShadowTechnique::ViewData * getViewDependentData(osgUtil::CullVisitor *cv)
osgShadow::ViewDependentShadowTechnique::META_Object
META_Object(osgShadow, ViewDependentShadowTechnique)
osgShadow::ViewDependentShadowTechnique::resizeGLObjectBuffers
virtual void resizeGLObjectBuffers(unsigned int maxSize)
osgShadow::ViewDependentShadowTechnique::releaseGLObjects
virtual void releaseGLObjects(osg::State *=0) const
osgUtil::CullVisitor
Definition CullVisitor:49
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::NodeVisitor
Definition NodeVisitor:82
osg::Referenced
Definition Referenced:44
osg::State
Definition State:80
osg::observer_ptr< osgUtil::CullVisitor >
osg::ref_ptr
Definition ref_ptr:32
osgShadow
Definition ConvexPolyhedron:33
Export
OSGSHADOW_EXPORT
#define OSGSHADOW_EXPORT
Definition osgShadow/Export:39
NULL
#define NULL
Definition osg/Export:55
osgShadow::ViewDependentShadowTechnique::ViewData
Definition ViewDependentShadowTechnique:162
osgShadow::ViewDependentShadowTechnique::ViewData::cull
virtual void cull()
osgShadow::ViewDependentShadowTechnique::ViewData::dirty
virtual void dirty(bool flag)
osgShadow::ViewDependentShadowTechnique::ViewData::resizeGLObjectBuffers
virtual void resizeGLObjectBuffers(unsigned int)
Definition ViewDependentShadowTechnique:209
osgShadow::ViewDependentShadowTechnique::ViewData::_dirty
bool _dirty
Definition ViewDependentShadowTechnique:197
osgShadow::ViewDependentShadowTechnique::ViewData::releaseGLObjects
virtual void releaseGLObjects(osg::State *=0) const
Definition ViewDependentShadowTechnique:214
osgShadow::ViewDependentShadowTechnique::ViewData::ViewData
ViewData()
Definition ViewDependentShadowTechnique:186
osgShadow::ViewDependentShadowTechnique::ViewData::_mutex
OpenThreads::Mutex _mutex
Definition ViewDependentShadowTechnique:192
osgShadow::ViewDependentShadowTechnique::ViewData::className
virtual const char * className() const
Definition ViewDependentShadowTechnique:163
osgShadow::ViewDependentShadowTechnique::ViewData::init
virtual void init(ViewDependentShadowTechnique *st, osgUtil::CullVisitor *cv)
osgShadow::ViewDependentShadowTechnique::ViewData::_cv
osg::observer_ptr< osgUtil::CullVisitor > _cv
Definition ViewDependentShadowTechnique:202
osgShadow::ViewDependentShadowTechnique::ViewData::_st
osg::observer_ptr< ViewDependentShadowTechnique > _st
Definition ViewDependentShadowTechnique:207