openscenegraph
ShadowedScene
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 OSGSHADOW_SHADOWEDSCENE
15#define OSGSHADOW_SHADOWEDSCENE 1
16
17#include <osg/buffered_value>
18#include <osg/Camera>
19#include <osg/Texture2D>
20#include <osg/TexGenNode>
21
24
25namespace osgShadow {
26
29{
30 public:
31
33
35
37
38 virtual void traverse(osg::NodeVisitor& nv);
39
41 template<class T> void setShadowSettings(const osg::ref_ptr<T>& ss) { setShadowSettings(ss.get()); }
42
43 ShadowSettings* getShadowSettings() { return _shadowSettings.get(); }
44 const ShadowSettings* getShadowSettings() const { return _shadowSettings.get(); }
45
47 template<class T> void setShadowTechnique(const osg::ref_ptr<T>& ss) { setShadowTechnique(ss.get()); }
48
49 ShadowTechnique* getShadowTechnique() { return _shadowTechnique.get(); }
50 const ShadowTechnique* getShadowTechnique() const { return _shadowTechnique.get(); }
51
54
56 void dirty();
57
59 virtual void resizeGLObjectBuffers(unsigned int maxSize);
60
64 virtual void releaseGLObjects(osg::State* = 0) const;
65
66 public:
67
69 void setReceivesShadowTraversalMask(unsigned int mask) { if (_shadowSettings.valid()) _shadowSettings->setReceivesShadowTraversalMask(mask); }
71 unsigned int getReceivesShadowTraversalMask() const { return _shadowSettings.valid() ? _shadowSettings->getReceivesShadowTraversalMask() : 0xffffffff; }
72
74 void setCastsShadowTraversalMask(unsigned int mask) { if (_shadowSettings.valid()) _shadowSettings->setCastsShadowTraversalMask(mask); }
76 unsigned int getCastsShadowTraversalMask() const { return _shadowSettings.valid() ? _shadowSettings->getCastsShadowTraversalMask() : 0xffffffff; }
77
78protected:
79
80 virtual ~ShadowedScene();
81
84
85};
86
87}
88
89#endif
Definition ShadowSettings:25
Definition ShadowTechnique:32
Definition ShadowedScene:29
virtual void releaseGLObjects(osg::State *=0) const
ShadowSettings * getShadowSettings()
Definition ShadowedScene:43
virtual void resizeGLObjectBuffers(unsigned int maxSize)
const ShadowTechnique * getShadowTechnique() const
Definition ShadowedScene:50
unsigned int getReceivesShadowTraversalMask() const
Definition ShadowedScene:71
osg::ref_ptr< ShadowTechnique > _shadowTechnique
Definition ShadowedScene:83
ShadowedScene(ShadowTechnique *st=0)
ShadowedScene(const ShadowedScene &es, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
unsigned int getCastsShadowTraversalMask() const
Definition ShadowedScene:76
void setShadowSettings(const osg::ref_ptr< T > &ss)
Definition ShadowedScene:41
void setShadowTechnique(ShadowTechnique *technique)
virtual void traverse(osg::NodeVisitor &nv)
osg::ref_ptr< ShadowSettings > _shadowSettings
Definition ShadowedScene:82
void setReceivesShadowTraversalMask(unsigned int mask)
Definition ShadowedScene:69
META_Node(osgShadow, ShadowedScene)
void setShadowTechnique(const osg::ref_ptr< T > &ss)
Definition ShadowedScene:47
void setShadowSettings(ShadowSettings *ss)
const ShadowSettings * getShadowSettings() const
Definition ShadowedScene:44
ShadowTechnique * getShadowTechnique()
Definition ShadowedScene:49
void setCastsShadowTraversalMask(unsigned int mask)
Definition ShadowedScene:74
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Definition Group:29
Definition NodeVisitor:82
Definition State:80
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
Definition ConvexPolyhedron:33
#define OSGSHADOW_EXPORT
Definition osgShadow/Export:39