- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

# OgreHardwarePixelBuffer.h

Go to the documentation of this file.

    00001 /*
    00002 -----------------------------------------------------------------------------
    00003 This source file is part of OGRE
    00004     (Object-oriented Graphics Rendering Engine)
    00005 For the latest info, see http://www.ogre3d.org/
    00006
    00007 Copyright (c) 2000-2006 Torus Knot Software Ltd
    00008 Also see acknowledgements in Readme.html
    00009
    00010 This program is free software; you can redistribute it and/or modify it under
    00011 the terms of the GNU Lesser General Public License as published by the Free Software
    00012 Foundation; either version 2 of the License, or (at your option) any later
    00013 version.
    00014
    00015 This program is distributed in the hope that it will be useful, but WITHOUT
    00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    00018
    00019 You should have received a copy of the GNU Lesser General Public License along with
    00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
    00022 http://www.gnu.org/copyleft/lesser.txt.
    00023
    00024 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef __HardwarePixelBuffer__
    00030 #define __HardwarePixelBuffer__
    00031
    00032 // Precompiler options
    00033 #include "OgrePrerequisites.h"
    00034 #include "OgreHardwareBuffer.h"
    00035 #include "OgreSharedPtr.h"
    00036 #include "OgrePixelFormat.h"
    00037 #include "OgreImage.h"
    00038
    00039 namespace Ogre {
    00040
    00047     class _OgreExport HardwarePixelBuffer : public HardwareBuffer
    00048     {
    00049     protected:
    00050         // Extents
    00051         size_t mWidth, mHeight, mDepth;
    00052         // Pitches (offsets between rows and slices)
    00053         size_t mRowPitch, mSlicePitch;
    00054         // Internal format
    00055         PixelFormat mFormat;
    00056         // Currently locked region
    00057         PixelBox mCurrentLock;
    00058
    00060         virtual PixelBox lockImpl(const Image::Box lockBox,  LockOptions options) = 0;
    00061
    00064         virtual void* lockImpl(size_t offset, size_t length, LockOptions options);
    00065
    00067         // virtual void unlockImpl(void) = 0;
    00068
    00072         virtual void _clearSliceRTT(size_t zoffset);
    00073         friend class RenderTexture;
    00074     public:
    00076         HardwarePixelBuffer(size_t mWidth, size_t mHeight, size_t mDepth,
    00077                 PixelFormat mFormat,
    00078                 HardwareBuffer::Usage usage, bool useSystemMemory, bool useShadowBuffer);
    00079         ~HardwarePixelBuffer();
    00080
    00084         using HardwareBuffer::lock;
    00085
    00092         virtual const PixelBox& lock(const Image::Box& lockBox, LockOptions options);
    00094         virtual void* lock(size_t offset, size_t length, LockOptions options);
    00095
    00100         const PixelBox& getCurrentLock();
    00101
    00103         virtual void readData(size_t offset, size_t length, void* pDest);
    00105         virtual void writeData(size_t offset, size_t length, const void* pSource,
    00106                 bool discardWholeBuffer = false);
    00107
    00118         virtual void blit(const HardwarePixelBufferSharedPtr &src, const Image::Box &srcBox, const Image::Box &dstBox);
    00119
    00125         void blit(const HardwarePixelBufferSharedPtr &src);
    00126
    00136         virtual void blitFromMemory(const PixelBox &src, const Image::Box &dstBox) = 0;
    00137
    00143         void blitFromMemory(const PixelBox &src)
    00144         {
    00145             blitFromMemory(src, Box(0,0,0,mWidth,mHeight,mDepth));
    00146         }
    00147
    00155         virtual void blitToMemory(const Image::Box &srcBox, const PixelBox &dst) = 0;
    00156
    00162         void blitToMemory(const PixelBox &dst)
    00163         {
    00164             blitToMemory(Box(0,0,0,mWidth,mHeight,mDepth), dst);
    00165         }
    00166
    00174         virtual RenderTexture *getRenderTarget(size_t slice=0);
    00175
    00177         size_t getWidth() const { return mWidth; }
    00179         size_t getHeight() const { return mHeight; }
    00181         size_t getDepth() const { return mDepth; }
    00183         PixelFormat getFormat() const { return mFormat; }
    00184     };
    00185
    00187     class _OgreExport HardwarePixelBufferSharedPtr : public SharedPtr<HardwarePixelBuffer>
    00188     {
    00189     public:
    00190         HardwarePixelBufferSharedPtr() : SharedPtr<HardwarePixelBuffer>() {}
    00191         explicit HardwarePixelBufferSharedPtr(HardwarePixelBuffer* buf);
    00192
    00193
    00194     };
    00195
    00196 }
    00197 #endif
    00198

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Mon Jun 16 12:48:51 2008