OgreHardwarePixelBuffer.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 __HardwarePixelBuffer__
#define __HardwarePixelBuffer__
// Precompiler options
#include "OgrePrerequisites.h"
#include "OgreHardwareBuffer.h"
#include "OgreSharedPtr.h"
#include "OgrePixelFormat.h"
#include "OgreImage.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
class _OgreExport HardwarePixelBuffer : public HardwareBuffer
{
protected:
uint32 mWidth, mHeight, mDepth;
size_t mRowPitch, mSlicePitch;
PixelFormat mFormat;
PixelBox mCurrentLock;
Image::Box mLockedBox;
virtual PixelBox lockImpl(const Image::Box lockBox, LockOptions options) = 0;
virtual void* lockImpl(size_t offset, size_t length, LockOptions options);
virtual void _clearSliceRTT(size_t zoffset);
friend class RenderTexture;
public:
HardwarePixelBuffer(uint32 mWidth, uint32 mHeight, uint32 mDepth,
PixelFormat mFormat,
HardwareBuffer::Usage usage, bool useSystemMemory, bool useShadowBuffer);
~HardwarePixelBuffer();
using HardwareBuffer::lock;
virtual const PixelBox& lock(const Image::Box& lockBox, LockOptions options);
virtual void* lock(size_t offset, size_t length, LockOptions options);
const PixelBox& getCurrentLock();
virtual void readData(size_t offset, size_t length, void* pDest);
virtual void writeData(size_t offset, size_t length, const void* pSource,
bool discardWholeBuffer = false);
virtual void blit(const HardwarePixelBufferSharedPtr &src, const Image::Box &srcBox, const Image::Box &dstBox);
void blit(const HardwarePixelBufferSharedPtr &src);
virtual void blitFromMemory(const PixelBox &src, const Image::Box &dstBox) = 0;
void blitFromMemory(const PixelBox &src)
{
blitFromMemory(src, Box(0,0,0,mWidth,mHeight,mDepth));
}
virtual void blitToMemory(const Image::Box &srcBox, const PixelBox &dst) = 0;
void blitToMemory(const PixelBox &dst)
{
blitToMemory(Box(0,0,0,mWidth,mHeight,mDepth), dst);
}
virtual RenderTexture *getRenderTarget(size_t slice=0);
uint32 getWidth() const { return mWidth; }
uint32 getHeight() const { return mHeight; }
uint32 getDepth() const { return mDepth; }
PixelFormat getFormat() const { return mFormat; }
};
class _OgreExport HardwarePixelBufferSharedPtr : public SharedPtr<HardwarePixelBuffer>
{
public:
HardwarePixelBufferSharedPtr() : SharedPtr<HardwarePixelBuffer>() {}
explicit HardwarePixelBufferSharedPtr(HardwarePixelBuffer* buf);
};
}
#include "OgreHeaderSuffix.h"
#endif
Ogre::HardwarePixelBuffer::mLockedBox
Image::Box mLockedBox
The current locked box of this surface (entire surface coords)
Definition: OgreHardwarePixelBuffer.h:65
Ogre::HardwareBuffer::lock
virtual void * lock(size_t offset, size_t length, LockOptions options)
Lock the buffer for (potentially) reading / writing.
Definition: OgreHardwareBuffer.h:183
Ogre::HardwarePixelBufferSharedPtr::HardwarePixelBufferSharedPtr
HardwarePixelBufferSharedPtr()
Definition: OgreHardwarePixelBuffer.h:196
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::HardwarePixelBuffer
Specialisation of HardwareBuffer for a pixel buffer.
Definition: OgreHardwarePixelBuffer.h:53
OgreImage.h
Ogre::HardwarePixelBuffer::getDepth
uint32 getDepth() const
Gets the depth of this buffer.
Definition: OgreHardwarePixelBuffer.h:187
OgreSharedPtr.h
OgrePixelFormat.h
Ogre::HardwarePixelBuffer::blitFromMemory
void blitFromMemory(const PixelBox &src)
Convenience function that blits a pixelbox from memory to the entire buffer.
Definition: OgreHardwarePixelBuffer.h:149
Ogre::PixelFormat
PixelFormat
The pixel format used for images, textures, and render surfaces.
Definition: OgrePixelFormat.h:43
Ogre::HardwarePixelBuffer::getHeight
uint32 getHeight() const
Gets the height of this buffer.
Definition: OgreHardwarePixelBuffer.h:185
Ogre::Box
Structure used to define a box in a 3-D integer space.
Definition: OgreCommon.h:659
Ogre::HardwarePixelBuffer::mCurrentLock
PixelBox mCurrentLock
Currently locked region (local coords)
Definition: OgreHardwarePixelBuffer.h:63
Ogre::HardwarePixelBuffer::mSlicePitch
size_t mSlicePitch
Definition: OgreHardwarePixelBuffer.h:59
Ogre::HardwarePixelBuffer::blitToMemory
void blitToMemory(const PixelBox &dst)
Convenience function that blits this entire buffer to a pixelbox.
Definition: OgreHardwarePixelBuffer.h:168
OgrePrerequisites.h
Ogre::HardwarePixelBuffer::getWidth
uint32 getWidth() const
Gets the width of this buffer.
Definition: OgreHardwarePixelBuffer.h:183
Ogre::RenderTexture
This class represents a RenderTarget that renders to a Texture.
Definition: OgreRenderTexture.h:48
Ogre::HardwarePixelBuffer::mWidth
uint32 mWidth
Extents.
Definition: OgreHardwarePixelBuffer.h:57
Ogre::HardwareBuffer::Usage
Usage
Enums describing buffer usage; not mutually exclusive.
Definition: OgreHardwareBuffer.h:79
Ogre::HardwareBuffer
Abstract class defining common features of hardware buffers.
Definition: OgreHardwareBuffer.h:74
Ogre::HardwarePixelBufferSharedPtr
Shared pointer implementation used to share pixel buffers.
Definition: OgreHardwarePixelBuffer.h:193
OgreHeaderSuffix.h
Ogre::HardwareBuffer::LockOptions
LockOptions
Locking options.
Definition: OgreHardwareBuffer.h:121
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre
Definition: OgreAndroidLogListener.h:34
OgreHardwareBuffer.h
Ogre::SharedPtr
Reference-counted shared pointer, used for objects where implicit destruction is required.
Definition: OgrePrerequisites.h:310
OgreHeaderPrefix.h
Ogre::PixelBox
A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.
Definition: OgrePixelFormat.h:304
Ogre::HardwarePixelBuffer::mFormat
PixelFormat mFormat
Internal format.
Definition: OgreHardwarePixelBuffer.h:61
Ogre::HardwarePixelBuffer::getFormat
PixelFormat getFormat() const
Gets the native pixel format of this buffer.
Definition: OgreHardwarePixelBuffer.h:189

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