root/OpenSceneGraph/trunk/include/osgUtil/RenderToTextureStage @ 3526

Revision 1529, 2.1 kB (checked in by robert, 15 years ago)

Added new Copyright/License notice to header and source files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 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 OSGUTIL_RENDERTOTEXTURESTAGE
15#define OSGUTIL_RENDERTOTEXTURESTAGE 1
16
17#include <osg/Texture2D>
18
19#include <osgUtil/RenderStage>
20
21namespace osgUtil {
22
23/**
24 * RenderStage which copies the final image to an attached texture or image.
25 * Generally used as a pre-rendering stage.
26 */
27class OSGUTIL_EXPORT RenderToTextureStage : public RenderStage
28{
29    public:
30   
31
32        RenderToTextureStage();
33       
34
35        virtual osg::Object* cloneType() const { return new RenderToTextureStage(); }
36        virtual osg::Object* clone(const osg::CopyOp&) const { return new RenderToTextureStage(); } // note only implements a clone of type.
37        virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RenderToTextureStage*>(obj)!=0L; }
38        virtual const char* libraryName() const { return "osgUtil"; }
39        virtual const char* className() const { return "RenderToTextureStage"; }
40
41        virtual void reset();
42       
43        void setTexture(osg::Texture2D* texture) { _texture = texture; }
44        osg::Texture2D* getTexture() { return _texture.get(); }
45       
46        void setImage(osg::Image* image) { _image = image; }
47        osg::Image* getImage() { return _image.get(); }
48
49        virtual void draw(osg::State& state,RenderLeaf*& previous);
50
51    public:
52       
53       
54    protected:
55   
56        virtual ~RenderToTextureStage();
57       
58        osg::ref_ptr<osg::Texture2D> _texture;
59        osg::ref_ptr<osg::Image> _image;
60
61};
62
63}
64
65#endif
66
Note: See TracBrowser for help on using the browser.