source: GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderTexture.h @ 1812

Revision 1812, 3.0 KB checked in by gumbau, 18 years ago (diff)
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25#ifndef __RenderTexture_H__
26#define __RenderTexture_H__
27
28#include "OgrePrerequisites.h"
29
30#include "OgreRenderTarget.h"
31
32namespace Ogre
33{   
34    /** This class represents a RenderTarget that renders to a Texture. There is no 1 on 1
35        relation between Textures and RenderTextures, as there can be multiple
36        RenderTargets rendering to different mipmaps, faces (for cubemaps) or slices (for 3D textures)
37        of the same Texture.
38    */
39    class _OgreExport RenderTexture: public RenderTarget
40    {
41    public:
42        RenderTexture(HardwarePixelBuffer *buffer, size_t zoffset);
43        virtual ~RenderTexture();
44
45                void writeContentsToFile( const String & filename );
46        protected:
47                HardwarePixelBuffer *mBuffer;
48                size_t mZOffset;
49    };
50
51        /** This class represents a render target that renders to multiple RenderTextures
52                at once. Surfaces can be bound and unbound at will, as long as the following constraints
53                are met:
54                - All bound surfaces have the same size
55                - All bound surfaces have the same internal format
56                - Target 0 is bound
57        */
58        class _OgreExport MultiRenderTarget: public RenderTarget
59        {
60        public:
61                MultiRenderTarget(const String &name);
62
63                /** Bind a surface to a certain attachment point.
64            @param attachment   0 .. mCapabilities->numMultiRenderTargets()-1
65                        @param target           RenderTexture to bind.
66
67                        It does not bind the surface and fails with an exception (ERR_INVALIDPARAMS) if:
68                        - Not all bound surfaces have the same size
69                        - Not all bound surfaces have the same internal format
70                */
71                virtual void bindSurface(size_t attachment, RenderTexture *target)=0;
72
73                /** Unbind attachment.
74                */
75                virtual void unbindSurface(size_t attachment)=0;
76
77                /** Error throwing implementation, it's not possible to write a MultiRenderTarget
78                        to disk.
79                */
80                virtual void writeContentsToFile( const String & filename );
81        };
82}
83
84#endif
Note: See TracBrowser for help on using the repository browser.