root/OpenSceneGraph/trunk/include/osgShadow/ShadowedScene @ 13041

Revision 13041, 3.0 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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
22#include <osgShadow/ShadowTechnique>
23#include <osgShadow/ShadowSettings>
24
25namespace osgShadow {
26
27/** ShadowedScene provides a mechansim for decorating a scene that the needs to have shadows cast upon it.*/
28class OSGSHADOW_EXPORT ShadowedScene : public osg::Group
29{
30    public:
31
32        ShadowedScene(ShadowTechnique* st=0);
33
34        ShadowedScene(const ShadowedScene& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
35
36        META_Node(osgShadow, ShadowedScene);
37
38        virtual void traverse(osg::NodeVisitor& nv);
39
40        void setReceivesShadowTraversalMask(unsigned int mask) { _receivesShadowTraversalMask = mask; }
41        unsigned int getReceivesShadowTraversalMask() const { return _receivesShadowTraversalMask; }
42
43        void setCastsShadowTraversalMask(unsigned int mask) { _castsShadowTraversalMask = mask; }
44        unsigned int getCastsShadowTraversalMask() const { return _castsShadowTraversalMask; }
45
46        void setShadowSettings(ShadowSettings* ss);
47        ShadowSettings* getShadowSettings() { return _shadowSettings.get(); }
48        const ShadowSettings* getShadowSettings() const { return _shadowSettings.get(); }
49
50        void setShadowTechnique(ShadowTechnique* technique);
51        ShadowTechnique* getShadowTechnique() { return _shadowTechnique.get(); }
52        const ShadowTechnique* getShadowTechnique() const { return _shadowTechnique.get(); }
53
54        /** Clean scene graph from any shadow technique specific nodes, state and drawables.*/
55        void cleanSceneGraph();
56
57        /** Dirty any cache data structures held in the attached ShadowTechnqiue.*/
58        void dirty();
59
60        /** Resize any per context GLObject buffers to specified size. */
61        virtual void resizeGLObjectBuffers(unsigned int maxSize);
62
63        /** If State is non-zero, this function releases any associated OpenGL objects for
64           * the specified graphics context. Otherwise, releases OpenGL objects
65           * for all graphics contexts. */
66        virtual void releaseGLObjects(osg::State* = 0) const;
67
68protected:
69
70        virtual ~ShadowedScene();
71
72        unsigned int _receivesShadowTraversalMask;
73        unsigned int _castsShadowTraversalMask;
74
75        osg::ref_ptr<ShadowSettings>    _shadowSettings;
76        osg::ref_ptr<ShadowTechnique>   _shadowTechnique;
77
78};
79
80}
81
82#endif
Note: See TracBrowser for help on using the browser.