[1809] | 1 | /*
|
---|
| 2 | -----------------------------------------------------------------------------
|
---|
| 3 | This source file is part of OGRE
|
---|
| 4 | (Object-oriented Graphics Rendering Engine)
|
---|
| 5 | For the latest info, see http://www.ogre3d.org/
|
---|
| 6 |
|
---|
| 7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
| 8 | Also see acknowledgements in Readme.html
|
---|
| 9 |
|
---|
| 10 | This program is free software; you can redistribute it and/or modify it under
|
---|
| 11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
| 12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
| 13 | version.
|
---|
| 14 |
|
---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
| 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
| 17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
| 18 |
|
---|
| 19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
| 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
| 21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
| 22 | http://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 |
|
---|
| 32 | namespace 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
|
---|