OGRE  1.9.0
OgreRenderTexture.h
Go to the documentation of this file.
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-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __RenderTexture_H__
29#define __RenderTexture_H__
30
31#include "OgrePrerequisites.h"
32#include "OgreRenderTarget.h"
33#include "OgreHeaderPrefix.h"
34
35namespace Ogre
36{
49 {
50 public:
52 virtual ~RenderTexture();
53
54 virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
56
57 protected:
60 };
61
70 {
71 public:
73
83 virtual void bindSurface(size_t attachment, RenderTexture *target)
84 {
85 for (size_t i = mBoundSurfaces.size(); i <= attachment; ++i)
86 {
87 mBoundSurfaces.push_back(0);
88 }
89 mBoundSurfaces[attachment] = target;
90
91 bindSurfaceImpl(attachment, target);
92 }
93
94
95
99 virtual void unbindSurface(size_t attachment)
100 {
101 if (attachment < mBoundSurfaces.size())
102 mBoundSurfaces[attachment] = 0;
103 unbindSurfaceImpl(attachment);
104 }
105
109 virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
110
113
116 const BoundSufaceList& getBoundSurfaceList() const { return mBoundSurfaces; }
117
120 {
121 assert (index < mBoundSurfaces.size());
122 return mBoundSurfaces[index];
123 }
124
125
126 protected:
128
130 virtual void bindSurfaceImpl(size_t attachment, RenderTexture *target) = 0;
132 virtual void unbindSurfaceImpl(size_t attachment) = 0;
133
134
135 };
138}
139
140#include "OgreHeaderSuffix.h"
141
142#endif
#define _OgreExport
Specialisation of HardwareBuffer for a pixel buffer.
This class represents a render target that renders to multiple RenderTextures at once.
virtual void unbindSurfaceImpl(size_t attachment)=0
Implementation of unbindSurface, must be provided.
PixelFormat suggestPixelFormat() const
Irrelevant implementation since cannot copy.
const BoundSufaceList & getBoundSurfaceList() const
Get a list of the surfaces which have been bound.
virtual void bindSurface(size_t attachment, RenderTexture *target)
Bind a surface to a certain attachment point.
vector< RenderTexture * >::type BoundSufaceList
RenderTexture * getBoundSurface(size_t index)
Get a pointer to a bound surface.
MultiRenderTarget(const String &name)
virtual void bindSurfaceImpl(size_t attachment, RenderTexture *target)=0
Implementation of bindSurface, must be provided.
virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer)
Error throwing implementation, it's not possible to write a MultiRenderTarget to disk.
virtual void unbindSurface(size_t attachment)
Unbind attachment.
A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.
A 'canvas' which can receive the results of a rendering operation.
This class represents a RenderTarget that renders to a Texture.
virtual ~RenderTexture()
HardwarePixelBuffer * mBuffer
virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer)
Copies the current contents of the render target to a pixelbox.
RenderTexture(HardwarePixelBuffer *buffer, uint32 zoffset)
PixelFormat suggestPixelFormat() const
Suggests a pixel format to use for extracting the data in this target, when calling copyContentsToMem...
PixelFormat
The pixel format used for images, textures, and render surfaces.
@ PF_UNKNOWN
Unknown pixel format.
unsigned int uint32
_StringBase String
std::vector< T, A > type