OgreRenderTexture.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __RenderTexture_H__
#define __RenderTexture_H__
#include "OgrePrerequisites.h"
#include "OgreRenderTarget.h"
#include "OgreHeaderPrefix.h"
namespace Ogre
{
class _OgreExport RenderTexture: public RenderTarget
{
public:
RenderTexture(HardwarePixelBuffer *buffer, uint32 zoffset);
virtual ~RenderTexture();
virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
PixelFormat suggestPixelFormat() const;
protected:
HardwarePixelBuffer *mBuffer;
uint32 mZOffset;
};
class _OgreExport MultiRenderTarget: public RenderTarget
{
public:
MultiRenderTarget(const String &name);
virtual void bindSurface(size_t attachment, RenderTexture *target)
{
for (size_t i = mBoundSurfaces.size(); i <= attachment; ++i)
{
mBoundSurfaces.push_back(0);
}
mBoundSurfaces[attachment] = target;
bindSurfaceImpl(attachment, target);
}
virtual void unbindSurface(size_t attachment)
{
if (attachment < mBoundSurfaces.size())
mBoundSurfaces[attachment] = 0;
unbindSurfaceImpl(attachment);
}
virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
PixelFormat suggestPixelFormat() const { return PF_UNKNOWN; }
typedef vector<RenderTexture*>::type BoundSufaceList;
const BoundSufaceList& getBoundSurfaceList() const { return mBoundSurfaces; }
RenderTexture* getBoundSurface(size_t index)
{
assert (index < mBoundSurfaces.size());
return mBoundSurfaces[index];
}
protected:
BoundSufaceList mBoundSurfaces;
virtual void bindSurfaceImpl(size_t attachment, RenderTexture *target) = 0;
virtual void unbindSurfaceImpl(size_t attachment) = 0;
};
}
#include "OgreHeaderSuffix.h"
#endif
Ogre::RenderTarget
A &#39;canvas&#39; which can receive the results of a rendering operation.
Definition: OgreRenderTarget.h:65
Ogre::MultiRenderTarget::suggestPixelFormat
PixelFormat suggestPixelFormat() const
Irrelevant implementation since cannot copy.
Definition: OgreRenderTexture.h:112
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::HardwarePixelBuffer
Specialisation of HardwareBuffer for a pixel buffer.
Definition: OgreHardwarePixelBuffer.h:53
Ogre::RenderTexture::mBuffer
HardwarePixelBuffer * mBuffer
Definition: OgreRenderTexture.h:58
Ogre::PF_UNKNOWN
Unknown pixel format.
Definition: OgrePixelFormat.h:46
Ogre::MultiRenderTarget::mBoundSurfaces
BoundSufaceList mBoundSurfaces
Definition: OgreRenderTexture.h:127
Ogre::PixelFormat
PixelFormat
The pixel format used for images, textures, and render surfaces.
Definition: OgrePixelFormat.h:43
Ogre::MultiRenderTarget::getBoundSurface
RenderTexture * getBoundSurface(size_t index)
Get a pointer to a bound surface.
Definition: OgreRenderTexture.h:119
OgrePrerequisites.h
Ogre::RenderTarget::FrameBuffer
FrameBuffer
Definition: OgreRenderTarget.h:91
Ogre::RenderTexture
This class represents a RenderTarget that renders to a Texture.
Definition: OgreRenderTexture.h:48
Ogre::MultiRenderTarget::unbindSurface
virtual void unbindSurface(size_t attachment)
Unbind attachment.
Definition: OgreRenderTexture.h:99
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::MultiRenderTarget::getBoundSurfaceList
const BoundSufaceList & getBoundSurfaceList() const
Get a list of the surfaces which have been bound.
Definition: OgreRenderTexture.h:116
OgreHeaderSuffix.h
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
OgreRenderTarget.h
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::vector
Definition: OgrePrerequisites.h:491
Ogre::MultiRenderTarget::bindSurface
virtual void bindSurface(size_t attachment, RenderTexture *target)
Bind a surface to a certain attachment point.
Definition: OgreRenderTexture.h:83
Ogre::MultiRenderTarget::BoundSufaceList
vector< RenderTexture * >::type BoundSufaceList
Definition: OgreRenderTexture.h:114
OgreHeaderPrefix.h
Ogre::PixelBox
A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.
Definition: OgrePixelFormat.h:304
Ogre::MultiRenderTarget
This class represents a render target that renders to multiple RenderTextures at once.
Definition: OgreRenderTexture.h:69
Ogre::RenderTexture::mZOffset
uint32 mZOffset
Definition: OgreRenderTexture.h:59

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.