58 lines
1.6 KiB
Plaintext
58 lines
1.6 KiB
Plaintext
//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
//as published by the Free Software Foundation.
|
|
|
|
#ifndef OSGUTIL_RENDERTOTEXTURESTAGE
|
|
#define OSGUTIL_RENDERTOTEXTURESTAGE 1
|
|
|
|
#include <osg/Texture>
|
|
|
|
#include <osgUtil/RenderStage>
|
|
|
|
namespace osgUtil {
|
|
|
|
/**
|
|
* RenderStage which copies the final image to an attached texture or image.
|
|
* Generally used as a pre-rendering stage.
|
|
*/
|
|
class OSGUTIL_EXPORT RenderToTextureStage : public RenderStage
|
|
{
|
|
public:
|
|
|
|
|
|
RenderToTextureStage();
|
|
|
|
|
|
virtual osg::Object* cloneType() const { return new RenderToTextureStage(); }
|
|
virtual osg::Object* clone(const osg::CopyOp&) const { return new RenderToTextureStage(); } // note only implements a clone of type.
|
|
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RenderToTextureStage*>(obj)!=0L; }
|
|
virtual const char* libraryName() const { return "osgUtil"; }
|
|
virtual const char* className() const { return "RenderToTextureStage"; }
|
|
|
|
virtual void reset();
|
|
|
|
void setTexture(osg::Texture* texture) { _texture = texture; }
|
|
osg::Texture* getTexture() { return _texture.get(); }
|
|
|
|
void setImage(osg::Image* image) { _image = image; }
|
|
osg::Image* getImage() { return _image.get(); }
|
|
|
|
virtual void draw(osg::State& state,RenderLeaf*& previous);
|
|
|
|
public:
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~RenderToTextureStage();
|
|
|
|
osg::ref_ptr<osg::Texture> _texture;
|
|
osg::ref_ptr<osg::Image> _image;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|
|
|